Responsive: Avoid excessive repaints when toggling a netclass' rastnest visibility.
Toggling netclasses visibility toggles the member nets' visibility one by one. Defer redrawing until all toggling is done. Fixes https://gitlab.com/kicad/code/kicad/issues/17115
This commit is contained in:
parent
77576e1a80
commit
4e8e14ae3a
|
@ -144,10 +144,10 @@ int BOARD_INSPECTION_TOOL::ShowBoardStatistics( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
std::unique_ptr<DRC_ENGINE> BOARD_INSPECTION_TOOL::makeDRCEngine( bool* aCompileError,
|
||||
std::unique_ptr<DRC_ENGINE> BOARD_INSPECTION_TOOL::makeDRCEngine( bool* aCompileError,
|
||||
bool* aCourtyardError )
|
||||
{
|
||||
auto engine = std::make_unique<DRC_ENGINE>( m_frame->GetBoard(),
|
||||
auto engine = std::make_unique<DRC_ENGINE>( m_frame->GetBoard(),
|
||||
&m_frame->GetBoard()->GetDesignSettings() );
|
||||
|
||||
try
|
||||
|
@ -2115,10 +2115,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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include <wx/statline.h>
|
||||
#include <wx/textdlg.h>
|
||||
#include <wx/bmpbuttn.h> // needed on wxMSW for OnSetFocus()
|
||||
#include <core/profile.h>
|
||||
|
||||
|
||||
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() ) );
|
||||
|
@ -1083,6 +1085,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 )
|
||||
|
@ -3096,6 +3101,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 )
|
||||
|
@ -3119,6 +3126,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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3411,3 +3421,9 @@ void APPEARANCE_CONTROLS::RefreshCollapsiblePanes()
|
|||
{
|
||||
m_paneLayerDisplayOptions->Refresh();
|
||||
}
|
||||
|
||||
|
||||
bool APPEARANCE_CONTROLS::IsTogglingNetclassRatsnestVisibility()
|
||||
{
|
||||
return m_togglingNetclassRatsnestVisibility;
|
||||
}
|
||||
|
|
|
@ -280,6 +280,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
|
||||
|
|
Loading…
Reference in New Issue