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
This commit is contained in:
Roberto Fernandez Bautista 2021-12-15 10:01:46 +00:00
parent dc71efbcb2
commit dadaf26ff1
3 changed files with 10 additions and 3 deletions

View File

@ -1239,7 +1239,7 @@ void PANEL_SETUP_BOARD_STACKUP::OnLayersOptionsChanged( LSET aNewLayerSet )
{
m_enabledLayers = layersList;
synchronizeWithBoard( true );
synchronizeWithBoard( false );
Layout();
Refresh();

View File

@ -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

View File

@ -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
};