Don't recompute the board thickness on UI update
The thickness only needs to be computed when the actual values change, so computing on UI update is a waste of resources and can cause UI lag. Fixes https://gitlab.com/kicad/code/kicad/issues/5049
This commit is contained in:
parent
d64de3808f
commit
5490a85f97
|
@ -114,6 +114,7 @@ PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP( PAGED_DIALOG* aParent, PCB
|
||||||
|
|
||||||
buildLayerStackPanel( true );
|
buildLayerStackPanel( true );
|
||||||
synchronizeWithBoard( true );
|
synchronizeWithBoard( true );
|
||||||
|
computeBoardThickness();
|
||||||
|
|
||||||
m_choiceCopperLayers->Bind( wxEVT_CHOICE,
|
m_choiceCopperLayers->Bind( wxEVT_CHOICE,
|
||||||
[&]( wxCommandEvent& )
|
[&]( wxCommandEvent& )
|
||||||
|
@ -208,6 +209,7 @@ void PANEL_SETUP_BOARD_STACKUP::onAddDielectricLayer( wxCommandEvent& event )
|
||||||
brd_stackup_item->AddDielectricPrms( new_sublayer+1 );
|
brd_stackup_item->AddDielectricPrms( new_sublayer+1 );
|
||||||
|
|
||||||
rebuildLayerStackPanel();
|
rebuildLayerStackPanel();
|
||||||
|
computeBoardThickness();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,6 +260,7 @@ void PANEL_SETUP_BOARD_STACKUP::onRemoveDielectricLayer( wxCommandEvent& event )
|
||||||
brd_stackup_item->RemoveDielectricPrms( sublayer );
|
brd_stackup_item->RemoveDielectricPrms( sublayer );
|
||||||
|
|
||||||
rebuildLayerStackPanel();
|
rebuildLayerStackPanel();
|
||||||
|
computeBoardThickness();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -317,7 +320,7 @@ wxColor PANEL_SETUP_BOARD_STACKUP::GetSelectedColor( int aRow ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PANEL_SETUP_BOARD_STACKUP::onUpdateThicknessValue( wxUpdateUIEvent& event )
|
void PANEL_SETUP_BOARD_STACKUP::computeBoardThickness()
|
||||||
{
|
{
|
||||||
int thickness = 0;
|
int thickness = 0;
|
||||||
|
|
||||||
|
@ -339,7 +342,7 @@ void PANEL_SETUP_BOARD_STACKUP::onUpdateThicknessValue( wxUpdateUIEvent& event )
|
||||||
|
|
||||||
// The text in the event will translate to the value for the text control
|
// The text in the event will translate to the value for the text control
|
||||||
// and is only updated if it changed
|
// and is only updated if it changed
|
||||||
event.SetText( thicknessStr );
|
m_tcCTValue->SetValue( thicknessStr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1109,6 +1112,7 @@ void PANEL_SETUP_BOARD_STACKUP::ImportSettingsFrom( BOARD* aBoard )
|
||||||
m_board = savedBrd;
|
m_board = savedBrd;
|
||||||
|
|
||||||
rebuildLayerStackPanel();
|
rebuildLayerStackPanel();
|
||||||
|
computeBoardThickness();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1271,6 +1275,8 @@ void PANEL_SETUP_BOARD_STACKUP::onThicknessChange( wxCommandEvent& event )
|
||||||
int idx = GetSublayerId( row );
|
int idx = GetSublayerId( row );
|
||||||
|
|
||||||
item->SetThickness( ValueFromString( m_frame->GetUserUnits(), value ), idx );
|
item->SetThickness( ValueFromString( m_frame->GetUserUnits(), value ), idx );
|
||||||
|
|
||||||
|
computeBoardThickness();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,11 @@ private:
|
||||||
*/
|
*/
|
||||||
void updateCopperLayerCount();
|
void updateCopperLayerCount();
|
||||||
|
|
||||||
void onUpdateThicknessValue( wxUpdateUIEvent& event ) override;
|
/**
|
||||||
|
* Recompute the board thickness and update the textbox
|
||||||
|
*/
|
||||||
|
void computeBoardThickness();
|
||||||
|
|
||||||
void onColorSelected( wxCommandEvent& event );
|
void onColorSelected( wxCommandEvent& event );
|
||||||
void onMaterialChange( wxCommandEvent& event );
|
void onMaterialChange( wxCommandEvent& event );
|
||||||
void onThicknessChange( wxCommandEvent& event );
|
void onThicknessChange( wxCommandEvent& event );
|
||||||
|
|
|
@ -154,7 +154,6 @@ PANEL_SETUP_BOARD_STACKUP_BASE::PANEL_SETUP_BOARD_STACKUP_BASE( wxWindow* parent
|
||||||
m_buttonAddDielectricLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onAddDielectricLayer ), NULL, this );
|
m_buttonAddDielectricLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onAddDielectricLayer ), NULL, this );
|
||||||
m_buttonRemoveDielectricLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onRemoveDielectricLayer ), NULL, this );
|
m_buttonRemoveDielectricLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onRemoveDielectricLayer ), NULL, this );
|
||||||
m_buttonRemoveDielectricLayer->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onRemoveDielUI ), NULL, this );
|
m_buttonRemoveDielectricLayer->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onRemoveDielUI ), NULL, this );
|
||||||
m_tcCTValue->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onUpdateThicknessValue ), NULL, this );
|
|
||||||
m_buttonExport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onExportToClipboard ), NULL, this );
|
m_buttonExport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onExportToClipboard ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +163,6 @@ PANEL_SETUP_BOARD_STACKUP_BASE::~PANEL_SETUP_BOARD_STACKUP_BASE()
|
||||||
m_buttonAddDielectricLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onAddDielectricLayer ), NULL, this );
|
m_buttonAddDielectricLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onAddDielectricLayer ), NULL, this );
|
||||||
m_buttonRemoveDielectricLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onRemoveDielectricLayer ), NULL, this );
|
m_buttonRemoveDielectricLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onRemoveDielectricLayer ), NULL, this );
|
||||||
m_buttonRemoveDielectricLayer->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onRemoveDielUI ), NULL, this );
|
m_buttonRemoveDielectricLayer->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onRemoveDielUI ), NULL, this );
|
||||||
m_tcCTValue->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onUpdateThicknessValue ), NULL, this );
|
|
||||||
m_buttonExport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onExportToClipboard ), NULL, this );
|
m_buttonExport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onExportToClipboard ), NULL, this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1193,7 +1193,6 @@
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
<event name="OnUpdateUI">onUpdateThicknessValue</event>
|
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
|
|
|
@ -63,7 +63,6 @@ class PANEL_SETUP_BOARD_STACKUP_BASE : public wxPanel
|
||||||
virtual void onAddDielectricLayer( wxCommandEvent& event ) { event.Skip(); }
|
virtual void onAddDielectricLayer( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void onRemoveDielectricLayer( wxCommandEvent& event ) { event.Skip(); }
|
virtual void onRemoveDielectricLayer( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void onRemoveDielUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
virtual void onRemoveDielUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||||
virtual void onUpdateThicknessValue( wxUpdateUIEvent& event ) { event.Skip(); }
|
|
||||||
virtual void onExportToClipboard( wxCommandEvent& event ) { event.Skip(); }
|
virtual void onExportToClipboard( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue