3D viewer: fix check state of some menuitems not correctly updated.

Fixes: lp:1837950
https://bugs.launchpad.net/kicad/+bug/1837950
This commit is contained in:
jean-pierre charras 2019-07-31 09:19:44 +02:00
parent 6c401ecce7
commit d4e9ddc14c
2 changed files with 37 additions and 0 deletions

View File

@ -128,6 +128,11 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END, EDA_3D_VIEWER::On3DGridSelection )
EVT_UPDATE_UI( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER::OnUpdateUIEngine )
EVT_UPDATE_UI_RANGE( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL,
ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE,
EDA_3D_VIEWER::OnUpdateUIMaterial )
EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow )
END_EVENT_TABLE()
@ -1114,6 +1119,35 @@ bool EDA_3D_VIEWER::Set3DSolderPasteColorFromUser()
}
void EDA_3D_VIEWER::OnUpdateUIEngine( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_settings.RenderEngineGet() != RENDER_ENGINE_OPENGL_LEGACY );
}
void EDA_3D_VIEWER::OnUpdateUIMaterial( wxUpdateUIEvent& aEvent )
{
// Set the state of toggle menus according to the current display options
switch( aEvent.GetId() )
{
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL:
aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_NORMAL );
break;
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY:
aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_DIFFUSE_ONLY );
break;
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE:
aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_CAD_MODE );
break;
default:
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::OnUpdateUIMaterial()" );
}
}
void EDA_3D_VIEWER::loadCommonSettings()
{
wxCHECK_RET( m_canvas, "Cannot load settings to null canvas" );

View File

@ -172,6 +172,9 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
void Install3DViewOptionDialog( wxCommandEvent &event );
void OnUpdateUIEngine( wxUpdateUIEvent& aEvent );
void OnUpdateUIMaterial( wxUpdateUIEvent& aEvent );
void CreateMenuBar();
/**