diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index 53d6931647..d2ec6b15c1 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -114,6 +114,7 @@ PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP( PAGED_DIALOG* aParent, PCB buildLayerStackPanel( true ); synchronizeWithBoard( true ); + computeBoardThickness(); m_choiceCopperLayers->Bind( wxEVT_CHOICE, [&]( wxCommandEvent& ) @@ -208,6 +209,7 @@ void PANEL_SETUP_BOARD_STACKUP::onAddDielectricLayer( wxCommandEvent& event ) brd_stackup_item->AddDielectricPrms( new_sublayer+1 ); rebuildLayerStackPanel(); + computeBoardThickness(); } @@ -258,6 +260,7 @@ void PANEL_SETUP_BOARD_STACKUP::onRemoveDielectricLayer( wxCommandEvent& event ) brd_stackup_item->RemoveDielectricPrms( sublayer ); 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; @@ -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 // 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; rebuildLayerStackPanel(); + computeBoardThickness(); } @@ -1271,6 +1275,8 @@ void PANEL_SETUP_BOARD_STACKUP::onThicknessChange( wxCommandEvent& event ) int idx = GetSublayerId( row ); item->SetThickness( ValueFromString( m_frame->GetUserUnits(), value ), idx ); + + computeBoardThickness(); } diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.h b/pcbnew/board_stackup_manager/panel_board_stackup.h index 24a603d918..5b701f7887 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.h +++ b/pcbnew/board_stackup_manager/panel_board_stackup.h @@ -178,7 +178,11 @@ private: */ void updateCopperLayerCount(); - void onUpdateThicknessValue( wxUpdateUIEvent& event ) override; + /** + * Recompute the board thickness and update the textbox + */ + void computeBoardThickness(); + void onColorSelected( wxCommandEvent& event ); void onMaterialChange( wxCommandEvent& event ); void onThicknessChange( wxCommandEvent& event ); diff --git a/pcbnew/board_stackup_manager/panel_board_stackup_base.cpp b/pcbnew/board_stackup_manager/panel_board_stackup_base.cpp index 9c48cb4668..5bc61b9391 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup_base.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup_base.cpp @@ -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_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_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 ); } @@ -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_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_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 ); } diff --git a/pcbnew/board_stackup_manager/panel_board_stackup_base.fbp b/pcbnew/board_stackup_manager/panel_board_stackup_base.fbp index b7e93ff42a..ac76939f3a 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup_base.fbp +++ b/pcbnew/board_stackup_manager/panel_board_stackup_base.fbp @@ -1193,7 +1193,6 @@ - onUpdateThicknessValue diff --git a/pcbnew/board_stackup_manager/panel_board_stackup_base.h b/pcbnew/board_stackup_manager/panel_board_stackup_base.h index 49334dd7df..dbe82ea9df 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup_base.h +++ b/pcbnew/board_stackup_manager/panel_board_stackup_base.h @@ -63,7 +63,6 @@ class PANEL_SETUP_BOARD_STACKUP_BASE : public wxPanel virtual void onAddDielectricLayer( wxCommandEvent& event ) { event.Skip(); } virtual void onRemoveDielectricLayer( wxCommandEvent& event ) { event.Skip(); } virtual void onRemoveDielUI( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void onUpdateThicknessValue( wxUpdateUIEvent& event ) { event.Skip(); } virtual void onExportToClipboard( wxCommandEvent& event ) { event.Skip(); }