Fix usage of AUI SetAuiPaneSize() hack in FOOTPRINT_EDIT_FRAME.

This brings it in line with PCB_EDIT_FRAME, which seems to work
reasonably well.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14297
This commit is contained in:
Jeff Young 2023-07-16 22:28:04 +01:00
parent 6f035de988
commit c3c7f731df
2 changed files with 26 additions and 53 deletions

View File

@ -223,8 +223,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.Caption( _( "Libraries" ) )
.MinSize( 250, -1 ).BestSize( 250, -1 ) );
m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
.Left().Layer( 3 ).Caption( _( "Properties" ) )
.PaneBorder( false ).MinSize( 240, -1 ).BestSize( 300, -1 ) );
.Left().Layer( 3 )
.Caption( _( "Properties" ) ).PaneBorder( false )
.MinSize( 240, -1 ).BestSize( 300, -1 ) );
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
.Left().Layer( 2 ) );
@ -237,7 +238,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Palette().Name( "SelectionFilter" )
.Right().Layer( 3 ).Position( 2 )
.Caption( _( "Selection Filter" ) ).PaneBorder( false )
.MinSize( 160, -1 ).BestSize( m_selectionFilterPanel->GetBestSize() ) );
.MinSize( 180, -1 ).BestSize( 180, -1 ) );
// Center
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
@ -259,45 +260,22 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
FinishAUIInitialization();
// Apply saved visibility stuff at the end
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
// wxAUI hack: force widths by setting MinSize() and then Fixed()
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
if( cfg->m_LibWidth > 0 )
if( FOOTPRINT_EDITOR_SETTINGS* cfg = dynamic_cast<FOOTPRINT_EDITOR_SETTINGS*>( GetSettings() ) )
{
SetAuiPaneSize( m_auimgr, treePane, cfg->m_LibWidth, -1 );
wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
treePane.MinSize( cfg->m_LibWidth, -1 );
treePane.Fixed();
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 );
}
if( cfg->m_AuiPanels.right_panel_width > 0 )
{
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
layersManager.MinSize( cfg->m_LibWidth, -1 );
layersManager.Fixed();
}
// Apply fixed sizes
m_auimgr.Update();
// Now make them resizable again
treePane.Resizable();
m_auimgr.Update();
// Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the sizes
// back to minimum.
treePane.MinSize( 250, -1 );
layersManager.MinSize( 250, -1 );
m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets );
m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset );
m_appearancePanel->SetTabIndex( cfg->m_AuiPanels.appearance_panel_tab );
GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
UpdateTitle();
setupUnits( GetSettings() );

View File

@ -304,25 +304,21 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.MinSize( 180, -1 ).BestSize( 180, -1 ) );
m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
.Left().Layer( 5 ).Caption( _( "Properties" ) )
.PaneBorder( false ).MinSize( 240, -1 ).BestSize( 300, -1 ) );
.Left().Layer( 5 )
.Caption( _( "Properties" ) ).PaneBorder( false )
.MinSize( 240, -1 ).BestSize( 300, -1 ) );
// Center
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
.Center() );
m_auimgr.AddPane( m_searchPane, EDA_PANE()
.Name( SearchPaneName() )
.Bottom()
.Caption( _( "Search" ) )
.PaneBorder( false )
.MinSize( 180, -1 )
.BestSize( 180, -1 )
.FloatingSize( 480, 200 )
.CloseButton( true )
.DestroyOnClose( false ) );
m_auimgr.AddPane( m_searchPane, EDA_PANE().Name( SearchPaneName() )
.Bottom()
.Caption( _( "Search" ) ) .PaneBorder( false )
.MinSize( 180, -1 ).BestSize( 180, -1 )
.FloatingSize( 480, 200 )
.CloseButton( true )
.DestroyOnClose( false ) );
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
@ -358,7 +354,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
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 ) )