Properties: save and restore splitter position

This commit is contained in:
Jon Evans 2022-12-07 21:38:33 -05:00
parent 5251ea6f27
commit 33d76f63b0
5 changed files with 22 additions and 0 deletions

View File

@ -325,3 +325,10 @@ void PROPERTIES_PANEL::RecalculateSplitterPos()
else
m_grid->SetSplitterPosition( m_splitter_key_proportion * m_grid->GetSize().x );
}
void PROPERTIES_PANEL::SetSplitterProportion( float aProportion )
{
m_splitter_key_proportion = aProportion;
RecalculateSplitterPos();
}

View File

@ -62,6 +62,9 @@ public:
void RecalculateSplitterPos();
void SetSplitterProportion( float aProportion );
float SplitterProportion() const { return m_splitter_key_proportion; }
protected:
virtual void update( const SELECTION& aSelection );
virtual wxPGProperty* createPGProperty( const PROPERTY_BASE* aProperty ) const = 0;

View File

@ -246,8 +246,13 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateOptToolbar();
if( ADVANCED_CFG::GetCfg().m_ShowPropertiesPanel )
{
m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
float proportion = GetPcbNewSettings()->m_AuiPanels.properties_splitter_proportion;
m_propertiesPanel->SetSplitterProportion( proportion );
}
m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas() );
@ -1240,6 +1245,9 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{
cfg->m_AuiPanels.show_properties = m_show_properties;
cfg->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x;
cfg->m_AuiPanels.properties_splitter_proportion =
m_propertiesPanel->SplitterProportion();
}
// ensure m_show_search is up to date (the pane can be closed)

View File

@ -97,6 +97,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<int>( "aui.properties_panel_width",
&m_AuiPanels.properties_panel_width, -1 ) );
m_params.emplace_back( new PARAM<float>( "aui.properties_splitter_proportion",
&m_AuiPanels.properties_splitter_proportion, 0.5f ) );
m_params.emplace_back( new PARAM<int>( "aui.search_panel_height",
&m_AuiPanels.search_panel_height, -1 ) );

View File

@ -137,6 +137,7 @@ public:
bool appearance_expand_net_display;
int right_panel_width;
int properties_panel_width;
float properties_splitter_proportion;
int search_panel_height;
bool show_layer_manager;
bool show_properties;