diff --git a/pcbnew/dialog_layers_setup.cpp b/pcbnew/dialog_layers_setup.cpp index 3e53e57731..38905d2309 100644 --- a/pcbnew/dialog_layers_setup.cpp +++ b/pcbnew/dialog_layers_setup.cpp @@ -1001,6 +1001,11 @@ void DialogLayerSetup::OnOKClick( wxCommandEvent& event ) m_Pcb->m_BoardSettings->SetCopperLayerCount( NumberOfCopperLayers ); m_Pcb->SetEnabledLayers( m_LayersMask ); + /* Reset the layers visibility flag + * Because it could creates SERIOUS mistakes for the user, + * if some layers are not visible after activating them ... + */ + m_Pcb->SetVisibleLayers( m_LayersMask ); for( int i = 0; i < NB_COPPER_LAYERS; i++ ) { diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 27a93a3ff1..9bc3a89e7f 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -259,6 +259,12 @@ this file again.")); /* Rebuild the new pad list (for drc and ratsnet control ...) */ GetBoard()->m_Status_Pcb = 0; + /* Reset the layers visibility flag when loading a new config + * Because it could creates SERIOUS mistakes for the user, + * if some layers are not visible after loading a board... + */ + GetBoard()->SetVisibleLayers( GetBoard()->GetEnabledLayers() ); + // Display the loaded board: DrawPanel->Refresh( true); wxSafeYield(); // Needed if we want to see the board now. diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index e80f51a69d..07e3854372 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -177,7 +177,6 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose ) bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName ) { wxFileName fn = projectFileName; - int ii; if( fn.GetExt() != ProjectFileExtension ) fn.SetExt( ProjectFileExtension ); @@ -197,8 +196,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName ) * Because it could creates SERIOUS mistakes for the user, * if some items are not visible after loading a board... */ - for( ii = 0; ii < LAYER_COUNT; ii++ ) - g_DesignSettings.SetLayerVisibility( ii, true ); + g_DesignSettings.SetVisibleLayers( FULL_LAYERS ); DisplayOpt.Show_Modules_Cmp = true; DisplayOpt.Show_Modules_Cu = true;