Apply wxWidgets hack to get saved component tree widths restored.

Fixes https://gitlab.com/kicad/code/kicad/issues/6036
This commit is contained in:
Jeff Young 2020-10-26 15:34:59 +00:00
parent 41c6de45e4
commit d7ee5fe97f
2 changed files with 40 additions and 4 deletions

View File

@ -154,8 +154,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(2) m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(2)
.Caption( _( "Libraries" ) ).MinSize( 250, -1 ) .Caption( _( "Libraries" ) ).MinSize( 250, -1 ).BestSize( 250, -1 ) );
.BestSize( m_settings->m_LibWidth, -1 ).Resizable() );
m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) ); m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) );
m_auimgr.AddPane( m_infoBar, m_auimgr.AddPane( m_infoBar,
EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) ); EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
@ -170,6 +169,25 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.GetPane( "InfoBar" ).Hide(); m_auimgr.GetPane( "InfoBar" ).Hide();
m_auimgr.Update(); m_auimgr.Update();
if( m_settings->m_LibWidth > 0 )
{
wxAuiPaneInfo& treePane = m_auimgr.GetPane( "ComponentTree" );
// wxAUI hack: force width by setting MinSize() and then Fixed()
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
treePane.MinSize( m_settings->m_LibWidth, -1 );
treePane.Fixed();
m_auimgr.Update();
// now make it resizable again
treePane.Resizable();
m_auimgr.Update();
// Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
// back to minimum.
treePane.MinSize( 250, -1 );
}
Raise(); Raise();
Show( true ); Show( true );

View File

@ -213,8 +213,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
// Vertical items; layers 1 - 3 // Vertical items; layers 1 - 3
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer( 3 ) ); m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer( 3 ) );
m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(2) m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(2)
.Caption( _( "Libraries" ) ).MinSize( 250, 400 ) .Caption( _( "Libraries" ) ).MinSize( 250, 400 ).Resizable() );
.BestSize( m_defaultLibWidth, -1 ) );
m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) ); m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) );
@ -246,6 +245,25 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_auimgr.GetPane( "InfoBar" ).Hide(); m_auimgr.GetPane( "InfoBar" ).Hide();
m_auimgr.Update(); m_auimgr.Update();
if( m_settings->m_LibWidth > 0 )
{
wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
// wxAUI hack: force width by setting MinSize() and then Fixed()
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
treePane.MinSize( m_settings->m_LibWidth, -1 );
treePane.Fixed();
m_auimgr.Update();
// now make it resizable again
treePane.Resizable();
m_auimgr.Update();
// Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
// back to minimum.
treePane.MinSize( 250, -1 );
}
// Apply saved visibility stuff at the end // Apply saved visibility stuff at the end
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings(); FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets ); m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets );