From 54682d39ff890c6e8df3c45d04570793180fcfcf Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 16 Aug 2020 14:33:40 -0400 Subject: [PATCH] Remember width of right AUI panel in PcbNew --- pcbnew/pcb_edit_frame.cpp | 12 +++++++++++- pcbnew/pcbnew_settings.cpp | 3 +++ pcbnew/pcbnew_settings.h | 1 + pcbnew/widgets/appearance_controls.cpp | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 4baea14fb9..1e58cc0530 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -267,6 +267,16 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : // The selection filter doesn't need to grow in the vertical direction when docked m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0; + if( PCBNEW_SETTINGS* settings = dynamic_cast( config() ) ) + { + if( settings->m_AuiPanels.right_panel_width > 0 ) + { + wxSize size = m_appearancePanel->GetBestSize(); + size.x = settings->m_AuiPanels.right_panel_width; + m_auimgr.GetPane( "LayersManager" ).BestSize( size ); + } + } + // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before // hidding it. m_auimgr.Update(); @@ -698,6 +708,7 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) cfg->m_PlotLineWidth = Iu2Millimeter( g_DrawDefaultLineThickness ); 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_ShowPageLimits = m_showPageLimits; } } @@ -805,7 +816,6 @@ void PCB_EDIT_FRAME::ShowChangedLanguage() // call my base class PCB_BASE_EDIT_FRAME::ShowChangedLanguage(); - // TODO(JE) APPEARANCE wxAuiPaneInfo& pane_info = m_auimgr.GetPane( m_appearancePanel ); pane_info.Caption( _( "Appearance" ) ); m_auimgr.Update(); diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index be419854a6..438e7d2cb6 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -85,6 +85,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() m_params.emplace_back( new PARAM( "aui.show_microwave_tools", &m_AuiPanels.show_microwave_tools, false ) ); + m_params.emplace_back( + new PARAM( "aui.right_panel_width", &m_AuiPanels.right_panel_width, -1 ) ); + m_params.emplace_back( new PARAM( "footprint_chooser.width", &m_FootprintChooser.width, -1 ) ); diff --git a/pcbnew/pcbnew_settings.h b/pcbnew/pcbnew_settings.h index 825e012644..2ee56440bd 100644 --- a/pcbnew/pcbnew_settings.h +++ b/pcbnew/pcbnew_settings.h @@ -67,6 +67,7 @@ class PCBNEW_SETTINGS : public APP_SETTINGS_BASE public: struct AUI_PANELS { + int right_panel_width; bool show_microwave_tools; bool show_layer_manager; }; diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index 5f979953dc..195c8583f6 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -1417,6 +1417,7 @@ void APPEARANCE_CONTROLS::rebuildNets() NETCLASSPTR defaultClass = board->GetDesignSettings().GetNetClasses().GetDefault(); + m_netclassIdMap[idx] = defaultClass->GetName(); appendNetclass( idx++, defaultClass, true ); for( const wxString& name : names )