diff --git a/common/dialogs/dialog_design_block_properties.cpp b/common/dialogs/dialog_design_block_properties.cpp index 75248362a6..f62a2e1f1e 100644 --- a/common/dialogs/dialog_design_block_properties.cpp +++ b/common/dialogs/dialog_design_block_properties.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -209,7 +210,7 @@ void DIALOG_DESIGN_BLOCK_PROPERTIES::OnMoveFieldDown( wxCommandEvent& event ) bool DIALOG_DESIGN_BLOCK_PROPERTIES::TransferDataToGrid() { - WINDOW_FREEZER raiiFreezer( m_fieldsGrid ); + wxWindowUpdateLocker updateLock( m_fieldsGrid ); m_fieldsGrid->ClearRows(); m_fieldsGrid->AppendRows( m_fields.size() ); diff --git a/common/dialogs/panel_embedded_files.cpp b/common/dialogs/panel_embedded_files.cpp index 0396c64933..05e855178b 100644 --- a/common/dialogs/panel_embedded_files.cpp +++ b/common/dialogs/panel_embedded_files.cpp @@ -25,19 +25,18 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include #include #include +#include /* ---------- GRID_TRICKS for embedded files grid ---------- */ @@ -214,7 +213,7 @@ bool PANEL_EMBEDDED_FILES::TransferDataFromWindow() void PANEL_EMBEDDED_FILES::onFontEmbedClick( wxCommandEvent& event ) { - WINDOW_FREEZER raiiFreezer( this ); + wxWindowUpdateLocker updateLock( this ); int row_pos = m_files_grid->GetGridCursorRow(); int col_pos = m_files_grid->GetGridCursorCol(); diff --git a/common/dialogs/panel_setup_netclasses.cpp b/common/dialogs/panel_setup_netclasses.cpp index 7fd4d8b628..4c71f7966a 100644 --- a/common/dialogs/panel_setup_netclasses.cpp +++ b/common/dialogs/panel_setup_netclasses.cpp @@ -25,7 +25,7 @@ #include #include - +#include #include #include #include @@ -118,7 +118,7 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( wxWindow* aParentWindow, EDA_DRA m_membershipPane->SetBorders( true, false, false, false ); // Prevent Size events from firing before we are ready - WINDOW_FREEZER raiiFreezer( this ); + wxWindowUpdateLocker updateLock( this ); m_netclassGrid->BeginBatch(); m_netclassGrid->SetUseNativeColLabels(); diff --git a/common/widgets/search_pane_tab.cpp b/common/widgets/search_pane_tab.cpp index 9fb87239f4..d57bf01b25 100644 --- a/common/widgets/search_pane_tab.cpp +++ b/common/widgets/search_pane_tab.cpp @@ -19,12 +19,11 @@ #include #include -#include #include #include #include +#include #include -#include SEARCH_PANE_LISTVIEW::SEARCH_PANE_LISTVIEW( SEARCH_HANDLER* handler, wxWindow* parent, wxWindowID winid, const wxPoint& pos, @@ -204,7 +203,7 @@ std::vector SEARCH_PANE_LISTVIEW::Sort() void SEARCH_PANE_LISTVIEW::RefreshColumnNames() { - WINDOW_FREEZER raiiFreezer( this ); + wxWindowUpdateLocker updateLock( this ); DeleteAllColumns(); diff --git a/common/widgets/widget_hotkey_list.cpp b/common/widgets/widget_hotkey_list.cpp index c07be6794f..7870780d76 100644 --- a/common/widgets/widget_hotkey_list.cpp +++ b/common/widgets/widget_hotkey_list.cpp @@ -39,6 +39,7 @@ #include #include #include +#include /** * Menu IDs for the hotkey context menu @@ -585,7 +586,7 @@ void WIDGET_HOTKEY_LIST::ApplyFilterString( const wxString& aFilterStr ) void WIDGET_HOTKEY_LIST::ResetAllHotkeys( bool aResetToDefault ) { - WINDOW_FREEZER raiiFreezer( this ); + wxWindowUpdateLocker updateLock( this ); // Reset all the hotkeys, not just the ones shown // Should not need to check conflicts, as the state we're about @@ -631,7 +632,7 @@ void WIDGET_HOTKEY_LIST::updateColumnWidths() void WIDGET_HOTKEY_LIST::updateShownItems( const wxString& aFilterStr ) { - WINDOW_FREEZER raiiFreezer( this ); + wxWindowUpdateLocker updateLock( this ); DeleteAllItems(); diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index d650b29860..867d1710de 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -41,11 +40,8 @@ #include #include #include -#include #include #include -#include -#include #include #include @@ -53,6 +49,7 @@ #include #include #include +#include wxDEFINE_EVENT( EDA_EVT_CLOSE_ERC_DIALOG, wxCommandEvent ); @@ -1014,7 +1011,7 @@ void DIALOG_ERC::deleteAllMarkers( bool aIncludeExclusions ) // Clear current selection list to avoid selection of deleted items // Freeze to avoid repainting the dialog, which can cause a RePaint() // of the screen as well - WINDOW_FREEZER raiiFreezer( this ); + wxWindowUpdateLocker updateLock( this ); m_parent->GetToolManager()->RunAction( ACTIONS::selectionClear ); diff --git a/eeschema/net_navigator.cpp b/eeschema/net_navigator.cpp index 91635e9e9f..34f9f8a541 100644 --- a/eeschema/net_navigator.cpp +++ b/eeschema/net_navigator.cpp @@ -21,8 +21,8 @@ */ #include +#include #include -#include #include #include #include @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -306,8 +305,8 @@ void SCH_EDIT_FRAME::RefreshNetNavigator( const NET_NAVIGATOR_ITEM_DATA* aSelect bool singleSheetSchematic = m_schematic->Hierarchy().size() == 1; size_t nodeCnt = 0; - WINDOW_FREEZER raiiFreezer( m_netNavigator ); - PROF_TIMER timer; + wxWindowUpdateLocker updateLock( m_netNavigator ); + PROF_TIMER timer; if( m_highlightedConn.IsEmpty() ) { diff --git a/eeschema/widgets/hierarchy_pane.cpp b/eeschema/widgets/hierarchy_pane.cpp index f50df8be71..b594c26ec8 100644 --- a/eeschema/widgets/hierarchy_pane.cpp +++ b/eeschema/widgets/hierarchy_pane.cpp @@ -24,22 +24,16 @@ */ #include -#include #include -#include -#include #include -#include #include #include - #include #include -#include - #include #include #include +#include /** * Store an SCH_SHEET_PATH of each sheet in hierarchy. @@ -211,7 +205,7 @@ void HIERARCHY_PANE::UpdateHierarchySelection() void HIERARCHY_PANE::UpdateHierarchyTree( bool aClear ) { - WINDOW_FREEZER raiiFreezer( this ); + wxWindowUpdateLocker updateLock( this ); bool eventsWereBound = m_events_bound; diff --git a/kicad/project_tree_pane.cpp b/kicad/project_tree_pane.cpp index 38b093ea85..7a82245a34 100644 --- a/kicad/project_tree_pane.cpp +++ b/kicad/project_tree_pane.cpp @@ -24,7 +24,6 @@ */ #include -#include #include #include @@ -33,6 +32,7 @@ #include #include #include +#include #include #include @@ -61,10 +61,6 @@ #include #include #include -#include -#include -#include -#include #include #include #include @@ -80,8 +76,6 @@ #include "kicad_manager_frame.h" #include "project_tree_pane.h" -#include - #include #include @@ -666,10 +660,8 @@ void PROJECT_TREE_PANE::ReCreateTreePrj() if( !m_TreeProject ) m_TreeProject = new PROJECT_TREE( this ); - - WINDOW_FREEZER raiiFreezer( m_TreeProject ); - - m_TreeProject->DeleteAllItems(); + else + m_TreeProject->DeleteAllItems(); if( !pro_dir ) // This is empty from PROJECT_TREE_PANE constructor return; @@ -1616,8 +1608,6 @@ void PROJECT_TREE_PANE::EmptyTreePrj() // Make sure we don't try to inspect the tree after we've deleted its items. shutdownFileWatcher(); - m_TreeProject->Freeze(); - m_TreeProject->DeleteAllItems(); // Remove the git repository when the project is unloaded diff --git a/libs/core/include/core/raii.h b/libs/core/include/core/raii.h index 14d8067f1d..d4aaedd848 100644 --- a/libs/core/include/core/raii.h +++ b/libs/core/include/core/raii.h @@ -82,26 +82,6 @@ protected: }; -// Temporarily freeze a window, and then un-freeze on destruction -class WINDOW_FREEZER -{ -public: - WINDOW_FREEZER( wxWindow* aWindow ) - { - m_window = aWindow; - m_window->Freeze(); - } - - ~WINDOW_FREEZER() - { - m_window->Thaw(); - } - -protected: - wxWindow* m_window; -}; - - /// Temporarily disable a window, and then re-enable on destruction. class WINDOW_DISABLER { diff --git a/pagelayout_editor/tools/pl_editor_control.cpp b/pagelayout_editor/tools/pl_editor_control.cpp index f980b1a69e..52bcc4c8c3 100644 --- a/pagelayout_editor/tools/pl_editor_control.cpp +++ b/pagelayout_editor/tools/pl_editor_control.cpp @@ -31,13 +31,14 @@ #include #include -#include "pl_editor_frame.h" -#include "pl_editor_id.h" -#include "properties_frame.h" -#include "tools/pl_actions.h" -#include "tools/pl_editor_control.h" -#include "tools/pl_selection_tool.h" +#include +#include +#include +#include +#include +#include #include +#include bool PL_EDITOR_CONTROL::Init() @@ -149,7 +150,7 @@ int PL_EDITOR_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent ) PL_SELECTION& selection = selTool->GetSelection(); // The Properties frame will be updated. Avoid flicker during update: - WINDOW_FREEZER raiiFreezer( m_frame->GetPropertiesFrame() ); + wxWindowUpdateLocker updateLock( m_frame->GetPropertiesFrame() ); if( selection.GetSize() == 1 ) { diff --git a/pcbnew/dialogs/panel_setup_time_domain_parameters.cpp b/pcbnew/dialogs/panel_setup_time_domain_parameters.cpp index 08476a9649..27c00a02a7 100644 --- a/pcbnew/dialogs/panel_setup_time_domain_parameters.cpp +++ b/pcbnew/dialogs/panel_setup_time_domain_parameters.cpp @@ -32,6 +32,7 @@ #include #include #include +#include PANEL_SETUP_TIME_DOMAIN_PARAMETERS::PANEL_SETUP_TIME_DOMAIN_PARAMETERS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame, BOARD* aBoard, @@ -504,7 +505,7 @@ void PANEL_SETUP_TIME_DOMAIN_PARAMETERS::OnDelayProfileGridCellChanging( wxGridE if( !oldName.IsEmpty() ) { - WINDOW_FREEZER raiiFreezer( m_viaPropagationGrid ); + wxWindowUpdateLocker updateLocker( m_viaPropagationGrid ); updateViaProfileNamesEditor( oldName, newName ); diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index cb9146fc8e..4299636741 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -35,14 +35,11 @@ #include #include #include -#include -#include "footprint_wizard_frame.h" #include #include #include #include -#include -#include +#include #include #include #include @@ -50,12 +47,13 @@ #include #include #include -#include "tools/pcb_selection_tool.h" -#include "tools/pcb_control.h" -#include "tools/pcb_actions.h" -#include "tools/footprint_wizard_tools.h" +#include +#include +#include +#include #include #include +#include "footprint_wizard_frame.h" BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, PCB_BASE_EDIT_FRAME ) @@ -380,7 +378,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() if( footprintWizard == nullptr ) return; - WINDOW_FREEZER raiiFreezer( m_parameterGrid ); + wxWindowUpdateLocker updateLock( m_parameterGrid ); m_parameterGrid->ClearGrid(); m_parameterGridPage = m_pageList->GetSelection(); diff --git a/pcbnew/pcb_layer_box_selector.cpp b/pcbnew/pcb_layer_box_selector.cpp index f1bccff02b..3632695b98 100644 --- a/pcbnew/pcb_layer_box_selector.cpp +++ b/pcbnew/pcb_layer_box_selector.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include PCB_LAYER_BOX_SELECTOR::PCB_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxString& value, @@ -56,7 +56,7 @@ void PCB_LAYER_BOX_SELECTOR::SetBoardFrame( PCB_BASE_FRAME* aFrame ) // Reload the Layers void PCB_LAYER_BOX_SELECTOR::Resync() { - WINDOW_FREEZER raiiFreezer( this ); + wxWindowUpdateLocker updateLock( this ); Clear(); diff --git a/pcbnew/widgets/pcb_net_inspector_panel.cpp b/pcbnew/widgets/pcb_net_inspector_panel.cpp index 6f3c78c61e..51e500269e 100644 --- a/pcbnew/widgets/pcb_net_inspector_panel.cpp +++ b/pcbnew/widgets/pcb_net_inspector_panel.cpp @@ -895,7 +895,7 @@ void PCB_NET_INSPECTOR_PANEL::updateNets( const std::vector& aNet netsToUpdate.emplace_back( net ); } - WINDOW_FREEZER raiiFreezer( m_netsList ); + wxWindowUpdateLocker updateLocker( m_netsList ); std::vector> newListItems = calculateNets( aNets, true ); diff --git a/pcbnew/zone_manager/dialog_zone_manager.cpp b/pcbnew/zone_manager/dialog_zone_manager.cpp index 40d4c7e7e0..e97bf5cd26 100644 --- a/pcbnew/zone_manager/dialog_zone_manager.cpp +++ b/pcbnew/zone_manager/dialog_zone_manager.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -213,7 +214,7 @@ void DIALOG_ZONE_MANAGER::onDialogResize( wxSizeEvent& event ) void DIALOG_ZONE_MANAGER::OnZoneSelectionChanged( ZONE* zone ) { - WINDOW_FREEZER raiiFreezer( this ); + wxWindowUpdateLocker updateLock( this ); for( ZONE_SELECTION_CHANGE_NOTIFIER* i : std::list{ m_panelZoneProperties, m_zoneViewer } )