From 1b7358f93a7f3f5a7a459dc88610401261031bb5 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 11 Oct 2021 11:46:02 -0700 Subject: [PATCH] Import layer settings before swapping boards The rebuildLayerStackPanel() reads from the current board to setup the panel. We maintain the board swap until after the setup is completed Fixes https://gitlab.com/kicad/code/kicad/issues/9370 --- .../panel_board_stackup.cpp | 6 +++--- pcbnew/dialogs/dialog_board_setup.cpp | 18 ++++++------------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index b3da68e565..024d75015e 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -1215,11 +1215,11 @@ void PANEL_SETUP_BOARD_STACKUP::ImportSettingsFrom( BOARD* aBoard ) m_enabledLayers = m_panelLayers->GetUILayerMask() & BOARD_STACKUP::StackupAllowedBrdLayers(); synchronizeWithBoard( true ); - m_brdSettings = savedSettings; - m_board = savedBrd; - rebuildLayerStackPanel(); computeBoardThickness(); + + m_brdSettings = savedSettings; + m_board = savedBrd; } diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index ae4b867978..9a1061e769 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -238,8 +238,14 @@ void DIALOG_BOARD_SETUP::OnAuxiliaryAction( wxCommandEvent& event ) { otherBoard->SetProject( otherPrj ); + // If layers options are imported, import also the stackup + // layers options and stackup are linked, so they cannot be imported + // separately, and stackup can be imported only after layers options if( importDlg.m_LayersOpt->GetValue() ) + { m_layers->ImportSettingsFrom( otherBoard ); + m_physicalStackup->ImportSettingsFrom( otherBoard ); + } if( importDlg.m_TextAndGraphicsOpt->GetValue() ) m_textAndGraphics->ImportSettingsFrom( otherBoard ); @@ -256,18 +262,6 @@ void DIALOG_BOARD_SETUP::OnAuxiliaryAction( wxCommandEvent& event ) if( importDlg.m_MaskAndPasteOpt->GetValue() ) m_maskAndPaste->ImportSettingsFrom( otherBoard ); - // If layers options are imported, import also the stackup - // layers options and stackup are linked, so they cannot be imported - // separately, and stackup can be imported only after layers options - // - // Note also currently only the list of enabled layers can be imported, because - // we import settings from a .pro project file, not the settings inside - // a board, and info only living in the board is not imported. - // TODO: Add import of physical settings now that we are actually loading the board here - - if( importDlg.m_LayersOpt->GetValue() ) - m_physicalStackup->ImportSettingsFrom( otherBoard ); - if( importDlg.m_SeveritiesOpt->GetValue() ) m_severities->ImportSettingsFrom( otherBoard->GetDesignSettings().m_DRCSeverities );