Remember the last active tab on the appearance panel

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5216
This commit is contained in:
Jon Evans 2020-08-17 22:06:31 -04:00
parent ab7c96f672
commit 96f4e8f6f8
5 changed files with 29 additions and 0 deletions

View File

@ -280,7 +280,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
wxSize size = m_appearancePanel->GetBestSize();
size.x = settings->m_AuiPanels.right_panel_width;
m_auimgr.GetPane( "LayersManager" ).BestSize( size );
m_appearancePanel->SetSize( size );
}
m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab );
}
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
@ -944,6 +947,7 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
cfg->m_AuiPanels.show_microwave_tools = m_show_microwave_tools;
cfg->m_AuiPanels.show_layer_manager = m_show_layer_manager_tools;
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
cfg->m_AuiPanels.appearance_panel_tab = m_appearancePanel->GetTabIndex();
cfg->m_ShowPageLimits = m_showPageLimits;
}
}

View File

@ -88,6 +88,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back(
new PARAM<int>( "aui.right_panel_width", &m_AuiPanels.right_panel_width, -1 ) );
m_params.emplace_back( new PARAM<int>(
"aui.appearance_panel_tab", &m_AuiPanels.appearance_panel_tab, 0, 0, 2 ) );
m_params.emplace_back( new PARAM<int>( "footprint_chooser.width",
&m_FootprintChooser.width, -1 ) );

View File

@ -67,6 +67,7 @@ class PCBNEW_SETTINGS : public APP_SETTINGS_BASE
public:
struct AUI_PANELS
{
int appearance_panel_tab;
int right_panel_width;
bool show_microwave_tools;
bool show_layer_manager;

View File

@ -836,6 +836,21 @@ void APPEARANCE_CONTROLS::OnLayerContextMenu( wxCommandEvent& aEvent )
}
int APPEARANCE_CONTROLS::GetTabIndex() const
{
return m_notebook->GetSelection();
}
void APPEARANCE_CONTROLS::SetTabIndex( int aTab )
{
size_t max = m_notebook->GetPageCount();
if( aTab >= 0 && static_cast<size_t>( aTab ) < max )
m_notebook->SetSelection( aTab );
}
void APPEARANCE_CONTROLS::syncColorsAndVisibility()
{
BOARD* board = m_frame->GetBoard();

View File

@ -143,6 +143,12 @@ public:
void OnLayerContextMenu( wxCommandEvent& aEvent );
///> Returns the index of the current tab (0-2)
int GetTabIndex() const;
///> Sets the current notebook tab
void SetTabIndex( int aTab );
protected:
void OnLayerDisplayPaneChanged( wxCollapsiblePaneEvent& event ) override;