diff --git a/pcbnew/tools/board_inspection_tool.cpp b/pcbnew/tools/board_inspection_tool.cpp index b1c49403bc..73a839adcb 100644 --- a/pcbnew/tools/board_inspection_tool.cpp +++ b/pcbnew/tools/board_inspection_tool.cpp @@ -144,10 +144,10 @@ int BOARD_INSPECTION_TOOL::ShowBoardStatistics( const TOOL_EVENT& aEvent ) } -std::unique_ptr BOARD_INSPECTION_TOOL::makeDRCEngine( bool* aCompileError, +std::unique_ptr BOARD_INSPECTION_TOOL::makeDRCEngine( bool* aCompileError, bool* aCourtyardError ) { - auto engine = std::make_unique( m_frame->GetBoard(), + auto engine = std::make_unique( m_frame->GetBoard(), &m_frame->GetBoard()->GetDesignSettings() ); try @@ -2046,10 +2046,13 @@ void BOARD_INSPECTION_TOOL::doHideRatsnestNet( int aNetCode, bool aHide ) else rs->GetHiddenNets().erase( aNetCode ); - m_frame->GetCanvas()->RedrawRatsnest(); - m_frame->GetCanvas()->Refresh(); + if( !m_frame->GetAppearancePanel()->IsTogglingNetclassRatsnestVisibility() ) + { + m_frame->GetCanvas()->RedrawRatsnest(); + m_frame->GetCanvas()->Refresh(); - m_frame->GetAppearancePanel()->OnNetVisibilityChanged( aNetCode, !aHide ); + m_frame->GetAppearancePanel()->OnNetVisibilityChanged( aNetCode, !aHide ); + } } diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index b4f61d506a..e8cbd218fd 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -58,6 +58,7 @@ #include #include #include // needed on wxMSW for OnSetFocus() +#include NET_GRID_TABLE::NET_GRID_TABLE( PCB_BASE_FRAME* aFrame, wxColor aBackgroundColor ) : @@ -405,7 +406,8 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo m_isFpEditor( aFpEditorMode ), m_currentPreset( nullptr ), m_lastSelectedUserPreset( nullptr ), - m_layerContextMenu( nullptr ) + m_layerContextMenu( nullptr ), + m_togglingNetclassRatsnestVisibility( false ) { // Correct the min size from wxformbuilder not using fromdip SetMinSize( FromDIP( GetMinSize() ) ); @@ -1077,6 +1079,9 @@ void APPEARANCE_CONTROLS::OnBoardNetSettingsChanged( BOARD& aBoard ) void APPEARANCE_CONTROLS::OnNetVisibilityChanged( int aNetCode, bool aVisibility ) { + if( m_togglingNetclassRatsnestVisibility ) + return; + int row = m_netsTable->GetRowByNetcode( aNetCode ); if( row >= 0 ) @@ -3073,6 +3078,8 @@ void APPEARANCE_CONTROLS::onNetclassVisibilityChanged( wxCommandEvent& aEvent ) void APPEARANCE_CONTROLS::showNetclass( const wxString& aClassName, bool aShow ) { + m_togglingNetclassRatsnestVisibility = true; + for( NETINFO_ITEM* net : m_frame->GetBoard()->GetNetInfo() ) { if( net->GetNetClass()->GetName() == aClassName ) @@ -3096,6 +3103,9 @@ void APPEARANCE_CONTROLS::showNetclass( const wxString& aClassName, bool aShow ) localSettings.m_HiddenNetclasses.erase( aClassName ); m_netsGrid->ForceRefresh(); + m_frame->GetCanvas()->RedrawRatsnest(); + m_frame->GetCanvas()->Refresh(); + m_togglingNetclassRatsnestVisibility = false; } @@ -3344,3 +3354,9 @@ void APPEARANCE_CONTROLS::RefreshCollapsiblePanes() { m_paneLayerDisplayOptions->Refresh(); } + + +bool APPEARANCE_CONTROLS::IsTogglingNetclassRatsnestVisibility() +{ + return m_togglingNetclassRatsnestVisibility; +} diff --git a/pcbnew/widgets/appearance_controls.h b/pcbnew/widgets/appearance_controls.h index adfc53ec1f..28bfc353f0 100644 --- a/pcbnew/widgets/appearance_controls.h +++ b/pcbnew/widgets/appearance_controls.h @@ -282,6 +282,9 @@ public: bool IsLayerOptionsExpanded(); bool IsNetOptionsExpanded(); + bool IsTogglingNetclassRatsnestVisibility(); + bool IsTogglingNetRatsnestVisibility(); + protected: void OnNotebookPageChanged( wxNotebookEvent& event ) override; void OnSetFocus( wxFocusEvent& aEvent ) override; @@ -486,6 +489,8 @@ private: ID_SHOW_ALL_NON_COPPER, ID_LAST_VALUE }; + + bool m_togglingNetclassRatsnestVisibility; }; #endif