pcbnew: synchronize zone visibility view menu entries with the toolbar buttons
This commit is contained in:
parent
aeae32b1a2
commit
af7064ef89
|
@ -430,7 +430,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
|
|||
aEvent.Skip();
|
||||
#endif
|
||||
|
||||
updateUI();
|
||||
updateUI( aEvent );
|
||||
}
|
||||
|
||||
|
||||
|
@ -443,11 +443,11 @@ void TOOL_DISPATCHER::DispatchWxCommand( wxCommandEvent& aEvent )
|
|||
else
|
||||
aEvent.Skip();
|
||||
|
||||
updateUI();
|
||||
updateUI( aEvent );
|
||||
}
|
||||
|
||||
|
||||
void TOOL_DISPATCHER::updateUI()
|
||||
void TOOL_DISPATCHER::updateUI( wxEvent& aEvent )
|
||||
{
|
||||
// TODO I don't feel it is the right place for updating UI,
|
||||
// but at the moment I cannot think of a better one..
|
||||
|
@ -456,6 +456,6 @@ void TOOL_DISPATCHER::updateUI()
|
|||
if( frame )
|
||||
{
|
||||
frame->UpdateStatusBar();
|
||||
//frame->UpdateMsgPanel();
|
||||
frame->SyncMenusAndToolbars( aEvent );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -897,11 +897,18 @@ public:
|
|||
virtual void* GetDisplayOptions() { return NULL; }
|
||||
|
||||
/**
|
||||
* Function GetGalDisplayOptions
|
||||
* Returns a reference to the gal rendering options used by GAL for rendering.
|
||||
*/
|
||||
* Function GetGalDisplayOptions
|
||||
* Returns a reference to the gal rendering options used by GAL for rendering.
|
||||
*/
|
||||
KIGFX::GAL_DISPLAY_OPTIONS& GetGalDisplayOptions() { return *m_galDisplayOptions; }
|
||||
|
||||
/**
|
||||
* Function SyncMenusAndToolbars
|
||||
* Updates the toolbars and menus (mostly settings/check buttons/checkboxes)
|
||||
* with the current controller state
|
||||
*/
|
||||
virtual void SyncMenusAndToolbars( wxEvent& aEvent ) {};
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -115,8 +115,8 @@ private:
|
|||
return mods;
|
||||
}
|
||||
|
||||
///> Redraws the status bar and message panel.
|
||||
void updateUI();
|
||||
///> Redraws the status bar and message panel, synchronizes menus and toolbars.
|
||||
void updateUI( wxEvent& aEvent );
|
||||
|
||||
///> Stores all the informations regarding a mouse button state.
|
||||
struct BUTTON_STATE;
|
||||
|
|
|
@ -308,8 +308,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
PCB_EDIT_FRAME::OnUpdateSelectViaSize )
|
||||
EVT_UPDATE_UI_RANGE( ID_PCB_HIGHLIGHT_BUTT, ID_PCB_MEASUREMENT_TOOL,
|
||||
PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
|
||||
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
|
||||
PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle )
|
||||
EVT_UPDATE_UI_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
|
||||
PCB_EDIT_FRAME::OnUpdateMuWaveToolbar )
|
||||
|
||||
|
|
|
@ -1730,6 +1730,8 @@ public:
|
|||
int GetIconScale() override;
|
||||
void SetIconScale( int aScale ) override;
|
||||
|
||||
void SyncMenusAndToolbars( wxEvent& aEvent ) override;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -119,13 +119,7 @@ void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent )
|
|||
|
||||
void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
int selected = aEvent.GetId() - ID_TB_OPTIONS_SHOW_ZONES;
|
||||
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
|
||||
|
||||
if( aEvent.IsChecked() && ( displ_opts->m_DisplayZonesMode == selected ) )
|
||||
return;
|
||||
|
||||
aEvent.Check( displ_opts->m_DisplayZonesMode == selected );
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,3 +225,32 @@ void PCB_EDIT_FRAME::OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent )
|
|||
{
|
||||
//Nothing to do.
|
||||
}
|
||||
|
||||
void PCB_EDIT_FRAME::SyncMenusAndToolbars( wxEvent& aEvent )
|
||||
{
|
||||
auto displOpts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
|
||||
auto menuBar = GetMenuBar();
|
||||
|
||||
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES, false );
|
||||
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, false );
|
||||
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, false );
|
||||
|
||||
|
||||
switch( displOpts->m_DisplayZonesMode )
|
||||
{
|
||||
case 0:
|
||||
menuBar->FindItem( ID_TB_OPTIONS_SHOW_ZONES )->Check( true );
|
||||
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES, true );
|
||||
break;
|
||||
|
||||
case 1:
|
||||
menuBar->FindItem( ID_TB_OPTIONS_SHOW_ZONES_DISABLE )->Check( true );
|
||||
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, true );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
menuBar->FindItem( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY )->Check( true );
|
||||
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue