From dadaf26ff18a5d9b77afcc64923fa7859cb4f7b7 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Wed, 15 Dec 2021 10:01:46 +0000 Subject: [PATCH] Board Setup: Ensure board editor layers page always gets updated We need to update it even if we move to a different page, as when moving back to the physical stackup page it will reset the layers. Fixes https://gitlab.com/kicad/code/kicad/-/issues/9991 --- pcbnew/board_stackup_manager/panel_board_stackup.cpp | 2 +- pcbnew/dialogs/dialog_board_setup.cpp | 10 ++++++++-- pcbnew/dialogs/dialog_board_setup.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index 8b404508be..89aafaa92a 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -1239,7 +1239,7 @@ void PANEL_SETUP_BOARD_STACKUP::OnLayersOptionsChanged( LSET aNewLayerSet ) { m_enabledLayers = layersList; - synchronizeWithBoard( true ); + synchronizeWithBoard( false ); Layout(); Refresh(); diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index 9a1061e769..03d56d1d0b 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -79,6 +79,8 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) : m_treebook->AddPage( new wxPanel( this ), _( "Board Stackup" ) ); + m_currentPage = -1; + /* * WARNING: Code currently relies on the layers setup coming before the physical stackup panel, * and thus transferring data to the board first. See comment in @@ -138,13 +140,17 @@ void DIALOG_BOARD_SETUP::OnPageChange( wxBookCtrlEvent& event ) { int page = event.GetSelection(); + // Ensure layer page always gets updated even if we aren't moving towards it + if( m_currentPage == m_physicalStackupPage ) + m_layers->SyncCopperLayers( m_physicalStackup->GetCopperLayerCount() ); + if( page == m_physicalStackupPage ) m_physicalStackup->OnLayersOptionsChanged( m_layers->GetUILayerMask() ); - else if( page == m_layerSetupPage ) - m_layers->SyncCopperLayers( m_physicalStackup->GetCopperLayerCount() ); else if( Prj().IsReadOnly() ) KIUI::Disable( m_treebook->GetPage( page ) ); + m_currentPage = page; + #ifdef __WXMAC__ // Work around an OSX bug where the wxGrid children don't get placed correctly until // the first resize event diff --git a/pcbnew/dialogs/dialog_board_setup.h b/pcbnew/dialogs/dialog_board_setup.h index 65eddb2f6b..f77401fdc6 100644 --- a/pcbnew/dialogs/dialog_board_setup.h +++ b/pcbnew/dialogs/dialog_board_setup.h @@ -66,6 +66,7 @@ protected: void OnPageChange( wxBookCtrlEvent& event ); private: + int m_currentPage; // the current page index int m_physicalStackupPage; // the page index of the PANEL_SETUP_BOARD_STACKUP page int m_layerSetupPage; // the page index of the PANEL_SETUP_LAYERS page };