From 4491f24d5ec8600c1873831d3b211f19876f7eec Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Fri, 14 Aug 2020 00:14:53 +0100 Subject: [PATCH] Ripout the old SyncToolbars infrastructure reminants The tool framework no longer needs to request updates of the UI state for the controls, wxWidgets will do it for us. --- common/eda_draw_frame.cpp | 3 --- common/tool/tool_manager.cpp | 5 ----- cvpcb/cvpcb_mainframe.cpp | 3 --- eeschema/lib_view_frame.cpp | 2 +- eeschema/libedit/libedit.cpp | 1 - gerbview/gerbview_frame.cpp | 8 -------- include/eda_base_frame.h | 6 ------ kicad/kicad_manager_frame.cpp | 2 -- pcbnew/dialogs/dialog_drc.cpp | 1 - pcbnew/pcb_base_edit_frame.cpp | 3 --- pcbnew/pcb_layer_widget.cpp | 3 --- pcbnew/tools/pcbnew_control.cpp | 3 --- pcbnew/widgets/appearance_controls.cpp | 6 ------ 13 files changed, 1 insertion(+), 45 deletions(-) diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index a67abcf639..b72a72eaf6 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -917,9 +917,6 @@ void EDA_DRAW_FRAME::RecreateToolbars() if( m_auxiliaryToolBar ) // Additional tools under main toolbar ReCreateAuxiliaryToolbar(); - - // Update the checked state of tools - SyncToolbars(); } diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index 81e45a0b2e..6b113949b0 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -1150,10 +1150,5 @@ void TOOL_MANAGER::UpdateUI( const TOOL_EVENT& aEvent ) EDA_BASE_FRAME* frame = dynamic_cast( GetToolHolder() ); if( frame ) - { frame->UpdateStatusBar(); - - if( !aEvent.IsMotion() && !aEvent.IsDrag() ) - frame->SyncToolbars(); - } } diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index 135fc30bc7..8504904f95 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -167,9 +167,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : // Start the main processing loop m_toolManager->InvokeTool( "cvpcb.Control" ); - // Ensure the toolbars are sync'd properly so the filtering options display correct - SyncToolbars(); - SetShutdownBlockReason( _( "Symbol to footprint changes are unsaved" ) ); } diff --git a/eeschema/lib_view_frame.cpp b/eeschema/lib_view_frame.cpp index 5e66086cc1..c505f4edd6 100644 --- a/eeschema/lib_view_frame.cpp +++ b/eeschema/lib_view_frame.cpp @@ -146,7 +146,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame ReCreateHToolbar(); ReCreateVToolbar(); - ReCreateMenuBar(); // Create after toolbars so that SyncToolbars works + ReCreateMenuBar(); m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL | wxNO_BORDER ); diff --git a/eeschema/libedit/libedit.cpp b/eeschema/libedit/libedit.cpp index 7e49340907..75147ee9d7 100644 --- a/eeschema/libedit/libedit.cpp +++ b/eeschema/libedit/libedit.cpp @@ -228,7 +228,6 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_PART* aEntry, const wxString& aL updateTitle(); RebuildSymbolUnitsList(); SetShowDeMorgan( GetCurPart()->HasConversion() ); - SyncToolbars(); // Display the document information based on the entry selected just in // case the entry is an alias. diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 3afdf55eed..065d4833be 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -204,9 +204,6 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ) GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); - // Update the checked state of tools - SyncToolbars(); - // Ensure the window is on top Raise(); } @@ -401,8 +398,6 @@ void GERBVIEW_FRAME::ReFillLayerWidget() m_LayersManager->ReFill(); m_SelLayerBox->Resync(); ReCreateAuxiliaryToolbar(); - // Update the checked state of tools - SyncToolbars(); wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager ); wxSize bestz = m_LayersManager->GetBestSize(); @@ -1131,9 +1126,6 @@ void GERBVIEW_FRAME::ActivateGalCanvas() ReCreateOptToolbar(); ReCreateMenuBar(); - - // Update the checked state of tools - SyncToolbars(); } diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index ad4752185e..7e35ec093c 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -528,12 +528,6 @@ public: */ virtual void UpdateStatusBar() { } - /** - * Update the toolbars (mostly settings/check buttons/checkboxes) with the current - * controller state. - */ - virtual void SyncToolbars() { }; - /** * Redraw the menus and what not in current language. */ diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp index 3809fce121..480b56e585 100644 --- a/kicad/kicad_manager_frame.cpp +++ b/kicad/kicad_manager_frame.cpp @@ -421,8 +421,6 @@ void KICAD_MANAGER_FRAME::LoadProject( const wxFileName& aProjectFileName ) m_leftWin->ReCreateTreePrj(); - SyncToolbars(); - // Rebuild the list of watched paths. // however this is possible only when the main loop event handler is running, // so we use it to run the rebuild function. diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index cc7e427d9f..9faa7767f3 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -450,7 +450,6 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent ) updateDisplayedCounts(); refreshBoardEditor(); m_brdEditor->OnModify(); - m_brdEditor->SyncToolbars(); } } diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index 3d14606732..ae809d73bf 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -139,9 +139,6 @@ void PCB_BASE_EDIT_FRAME::SetGridVisibility( bool aVisible ) // Update the grid checkbox in the layer widget if( m_appearancePanel ) m_appearancePanel->SetObjectVisible( LAYER_GRID, aVisible ); - - // TODO (ISM): Remove this by changing toolbars to use the EVT_UPDATE_UI to get the state - SyncToolbars(); } diff --git a/pcbnew/pcb_layer_widget.cpp b/pcbnew/pcb_layer_widget.cpp index d37fd7b9e7..0940dcd655 100644 --- a/pcbnew/pcb_layer_widget.cpp +++ b/pcbnew/pcb_layer_widget.cpp @@ -697,9 +697,6 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) PCB_DISPLAY_OPTIONS opt = myframe->GetDisplayOptions(); opt.m_ShowGlobalRatsnest = isEnabled; myframe->SetDisplayOptions( opt ); - - // TODO(ISM): Remove once EVT_UPDATE_UI works - myframe->SyncToolbars(); } } else if( aId != LAYER_GRID ) diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index f9f7b5914a..9cbb3f48d8 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -244,9 +244,6 @@ int PCBNEW_CONTROL::HighContrastModeCycle( const TOOL_EVENT& aEvent ) m_frame->SetDisplayOptions( opts ); - // TODO(ISM): remove once EVT_UPDATE_UI works - m_frame->SyncToolbars(); - return 0; } diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index f11538d2b7..072904ae70 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -127,9 +127,6 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo m_frame->SetDisplayOptions( opts ); m_frame->GetCanvas()->SetHighContrastLayer( m_frame->GetActiveLayer() ); m_frame->GetCanvas()->Refresh(); - - // TODO: remove once EVT_UPDATE_UI works - m_frame->SyncToolbars(); }; m_rbHighContrastNormal->Bind( wxEVT_RADIOBUTTON, @@ -937,9 +934,6 @@ void APPEARANCE_CONTROLS::onObjectVisibilityChanged( GAL_LAYER_ID aLayer, bool i PCB_DISPLAY_OPTIONS opt = m_frame->GetDisplayOptions(); opt.m_ShowGlobalRatsnest = isVisible; m_frame->SetDisplayOptions( opt ); - - // TODO(ISM): Remove once EVT_UPDATE_UI works - m_frame->SyncToolbars(); } break;