7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Apply EEschema fixes to PCBNew and Footprint Editor.

(Symbol Editor doesn't have the issue of the properties
being overwritten.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20066
This commit is contained in:
Jeff Young 2025-02-26 12:58:05 +00:00
parent f510cce2da
commit 797de67c6c
3 changed files with 57 additions and 46 deletions

View File

@ -218,7 +218,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
CreateInfoBar();
// Fetch COPY of config as a lot of these initializations are going to overwrite our data.
// Fetch a COPY of the config as a lot of these initializations are going to overwrite our
// data.
EESCHEMA_SETTINGS::AUI_PANELS aui_cfg = eeconfig()->m_AuiPanels;
EESCHEMA_SETTINGS::APPEARANCE appearance_cfg = eeconfig()->m_Appearance;

View File

@ -206,6 +206,17 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetActiveLayer( F_SilkS );
// Fetch a COPY of the config as a lot of these initializations are going to overwrite our
// data.
int libWidth = 0;
FOOTPRINT_EDITOR_SETTINGS::AUI_PANELS aui_cfg;
if( FOOTPRINT_EDITOR_SETTINGS* cfg = dynamic_cast<FOOTPRINT_EDITOR_SETTINGS*>( GetSettings() ) )
{
libWidth = cfg->m_LibWidth;
aui_cfg = cfg->m_AuiPanels;
}
m_auimgr.SetManagedWindow( this );
unsigned int auiFlags = wxAUI_MGR_DEFAULT;
@ -264,20 +275,21 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
FinishAUIInitialization();
// Apply saved visibility stuff at the end
wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
if( libWidth > 0 )
SetAuiPaneSize( m_auimgr, treePane, libWidth, -1 );
if( aui_cfg.right_panel_width > 0 )
SetAuiPaneSize( m_auimgr, layersManager, aui_cfg.right_panel_width, -1 );
m_appearancePanel->SetTabIndex( aui_cfg.appearance_panel_tab );
if( FOOTPRINT_EDITOR_SETTINGS* cfg = dynamic_cast<FOOTPRINT_EDITOR_SETTINGS*>( GetSettings() ) )
{
wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
if( cfg->m_LibWidth > 0 )
SetAuiPaneSize( m_auimgr, treePane, cfg->m_LibWidth, -1 );
if( cfg->m_AuiPanels.right_panel_width > 0 )
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets );
m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset );
m_appearancePanel->SetTabIndex( cfg->m_AuiPanels.appearance_panel_tab );
}
// restore the last footprint from the project, if any, after the library has been init'ed

View File

@ -283,10 +283,12 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
&PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
#endif
m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
// Fetch a COPY of the config as a lot of these initializations are going to overwrite our
// data.
PCBNEW_SETTINGS::AUI_PANELS aui_cfg = GetPcbNewSettings()->m_AuiPanels;
float proportion = GetPcbNewSettings()->m_AuiPanels.properties_splitter;
m_propertiesPanel->SetSplitterProportion( proportion );
m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
m_propertiesPanel->SetSplitterProportion( aui_cfg.properties_splitter );
m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
@ -380,41 +382,37 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
FinishAUIInitialization();
if( PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( config() ) )
if( aui_cfg.right_panel_width > 0 )
{
if( settings->m_AuiPanels.right_panel_width > 0 )
{
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( wxS( "LayersManager" ) );
SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
}
if( settings->m_AuiPanels.properties_panel_width > 0 && m_propertiesPanel )
{
wxAuiPaneInfo& propertiesPanel = m_auimgr.GetPane( PropertiesPaneName() );
SetAuiPaneSize( m_auimgr, propertiesPanel,
settings->m_AuiPanels.properties_panel_width, -1 );
}
if( settings->m_AuiPanels.search_panel_height > 0
&& ( settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
|| settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
{
wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
searchPane.Direction( settings->m_AuiPanels.search_panel_dock_direction );
SetAuiPaneSize( m_auimgr, searchPane, -1, settings->m_AuiPanels.search_panel_height );
}
else if( settings->m_AuiPanels.search_panel_width > 0
&& ( settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
|| settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
{
wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
searchPane.Direction( settings->m_AuiPanels.search_panel_dock_direction );
SetAuiPaneSize( m_auimgr, searchPane, settings->m_AuiPanels.search_panel_width, -1 );
}
m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab );
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( wxS( "LayersManager" ) );
SetAuiPaneSize( m_auimgr, layersManager, aui_cfg.right_panel_width, -1 );
}
if( aui_cfg.properties_panel_width > 0 && m_propertiesPanel )
{
wxAuiPaneInfo& propertiesPanel = m_auimgr.GetPane( PropertiesPaneName() );
SetAuiPaneSize( m_auimgr, propertiesPanel, aui_cfg.properties_panel_width, -1 );
}
if( aui_cfg.search_panel_height > 0
&& ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
|| aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
{
wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
searchPane.Direction( aui_cfg.search_panel_dock_direction );
SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
}
else if( aui_cfg.search_panel_width > 0
&& ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
|| aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
{
wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
searchPane.Direction( aui_cfg.search_panel_dock_direction );
SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
}
m_appearancePanel->SetTabIndex( aui_cfg.appearance_panel_tab );
{
m_layerPairSettings = std::make_unique<LAYER_PAIR_SETTINGS>();