Make sure appearance panel builds after project has been loaded

OnBoardChanged must run after LoadProjectSettings.
Move the local overrides to PCB_EDIT_FRAME::onBoardLoaded
so that they are run after the panel is initialized.
This commit is contained in:
Jon Evans 2020-08-24 19:38:34 -04:00
parent e9b8cac320
commit 67a5ed15c7
3 changed files with 12 additions and 6 deletions

View File

@ -643,11 +643,12 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
GetBoard()->BuildConnectivity(); GetBoard()->BuildConnectivity();
Compile_Ratsnest( true ); Compile_Ratsnest( true );
onBoardLoaded();
// Load project settings after setting up board; some of them depend on the nets list // Load project settings after setting up board; some of them depend on the nets list
LoadProjectSettings(); LoadProjectSettings();
// Syncs the UI (appearance panel, etc) with the loaded board and project
onBoardLoaded();
// Refresh the 3D view, if any // Refresh the 3D view, if any
EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame(); EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();

View File

@ -49,6 +49,7 @@
#include <pcb_draw_panel_gal.h> #include <pcb_draw_panel_gal.h>
#include <functional> #include <functional>
#include <project/project_file.h> #include <project/project_file.h>
#include <project/project_local_settings.h>
#include <project/net_settings.h> #include <project/net_settings.h>
#include <settings/common_settings.h> #include <settings/common_settings.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
@ -1021,6 +1022,14 @@ void PCB_EDIT_FRAME::onBoardLoaded()
m_appearancePanel->OnBoardChanged(); m_appearancePanel->OnBoardChanged();
// Apply saved display state to the appearance panel after it has been set up
PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
m_appearancePanel->ApplyLayerPreset( localSettings.m_ActiveLayerPreset );
if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
SetActiveLayer( localSettings.m_ActiveLayer );
// Update the tracks / vias available sizes list: // Update the tracks / vias available sizes list:
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();

View File

@ -125,7 +125,6 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
} }
m_appearancePanel->SetUserLayerPresets( project.m_LayerPresets ); m_appearancePanel->SetUserLayerPresets( project.m_LayerPresets );
m_appearancePanel->ApplyLayerPreset( localSettings.m_ActiveLayerPreset );
SELECTION_FILTER_OPTIONS& filterOpts = GetToolManager()->GetTool<SELECTION_TOOL>()->GetFilter(); SELECTION_FILTER_OPTIONS& filterOpts = GetToolManager()->GetTool<SELECTION_TOOL>()->GetFilter();
@ -141,9 +140,6 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
opts.m_ZoneOpacity = localSettings.m_ZoneOpacity; opts.m_ZoneOpacity = localSettings.m_ZoneOpacity;
SetDisplayOptions( opts ); SetDisplayOptions( opts );
if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
SetActiveLayer( localSettings.m_ActiveLayer );
wxFileName fn( GetCurrentFileName() ); wxFileName fn( GetCurrentFileName() );
fn.MakeRelativeTo( Prj().GetProjectPath() ); fn.MakeRelativeTo( Prj().GetProjectPath() );
LoadWindowState( fn.GetFullPath() ); LoadWindowState( fn.GetFullPath() );