Remember pane widths in CvPcb.

Fixes https://gitlab.com/kicad/code/kicad/issues/5708
This commit is contained in:
Jeff Young 2020-10-09 21:29:19 +01:00
parent 2574a8d71e
commit 0c75a09bde
3 changed files with 47 additions and 0 deletions

View File

@ -162,6 +162,45 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.Update();
m_initialized = true;
if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
{
if( cfg->m_LibrariesWidth > 0 )
{
wxAuiPaneInfo& librariesPane = m_auimgr.GetPane( "Libraries" );
// wxAUI hack: force width by setting MinSize() and then Fixed()
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
librariesPane.MinSize( cfg->m_LibrariesWidth, -1 );
librariesPane.BestSize( cfg->m_LibrariesWidth, -1 );
librariesPane.MaxSize( cfg->m_LibrariesWidth, -1 );
librariesPane.Fixed();
m_auimgr.Update();
// now make it resizable again
librariesPane.MinSize( 20, -1 );
librariesPane.Resizable();
m_auimgr.Update();
}
if( cfg->m_FootprintsWidth > 0 )
{
wxAuiPaneInfo& footprintsPane = m_auimgr.GetPane( "Footprints" );
// wxAUI hack: force width by setting MinSize() and then Fixed()
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
footprintsPane.MinSize( cfg->m_FootprintsWidth, -1 );
footprintsPane.BestSize( cfg->m_FootprintsWidth, -1 );
footprintsPane.MaxSize( cfg->m_FootprintsWidth, -1 );
footprintsPane.Fixed();
m_auimgr.Update();
// now make it resizable again
footprintsPane.MinSize( 20, -1 );
footprintsPane.Resizable();
m_auimgr.Update();
}
}
// Connect Events
setupEventHandlers();
@ -420,6 +459,9 @@ void CVPCB_MAINFRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
auto cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
cfg->m_FilterFootprint = m_filteringOptions;
cfg->m_LibrariesWidth = m_libListBox->GetSize().x;
cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
}

View File

@ -43,6 +43,9 @@ CVPCB_SETTINGS::CVPCB_SETTINGS()
// Init settings:
m_params.emplace_back( new PARAM<int>( "filter_footprint", &m_FilterFootprint, 0 ) );
m_params.emplace_back( new PARAM<int>( "libraries_pane_width", &m_LibrariesWidth, 0 ) );
m_params.emplace_back( new PARAM<int>( "footprints_pane_width", &m_FootprintsWidth, 0 ) );
addParamsForWindow( &m_FootprintViewer, "footprint_viewer" );
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.pad_fill",

View File

@ -48,6 +48,8 @@ public:
double m_FootprintViewerZoom;
int m_FilterFootprint;
int m_LibrariesWidth;
int m_FootprintsWidth;
protected: