eeschema: Fix Search pane not remembering docking sizes and positions

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14120 for eeschema
Fixes that Show Search Panel Checkbox can get out of sync when restarting
eeschema while the search pane is active
This commit is contained in:
CraftedNightmare 2023-05-19 22:51:57 +02:00 committed by Mark Roszko
parent d94e9b31b1
commit aa667bea0f
6 changed files with 41 additions and 5 deletions

View File

@ -224,9 +224,12 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
cfg->m_FindReplaceExtra.search_selected_only = searchData->searchSelectedOnly;
}
m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
m_show_search = searchPaneInfo.IsShown();
cfg->m_AuiPanels.show_search = m_show_search;
cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
}
}

View File

@ -199,6 +199,12 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "aui.search_panel_height",
&m_AuiPanels.search_panel_height, -1 ) );
m_params.emplace_back( new PARAM<int>( "aui.search_panel_width",
&m_AuiPanels.search_panel_width, -1 ) );
m_params.emplace_back( new PARAM<int>( "aui.search_panel_dock_direction",
&m_AuiPanels.search_panel_dock_direction, 0 ) );
m_params.emplace_back( new PARAM<bool>( "aui.show_search",
&m_AuiPanels.show_search, false ) );

View File

@ -84,6 +84,8 @@ public:
int hierarchy_panel_float_width; // width of hierarchy tree panel when floating
int hierarchy_panel_float_height; // height of hierarchy tree panel when floating
int search_panel_height; // height of the search panel
int search_panel_width; // width of the search panel
int search_panel_dock_direction; // docking direction of the search panel
bool schematic_hierarchy_float; // show hierarchy tree panel as floating
bool show_schematic_hierarchy; // show hierarchy tree pane
bool show_search; // show the search panel

View File

@ -261,12 +261,24 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
if( cfg->m_AuiPanels.schematic_hierarchy_float )
hierarchy_pane.Float();
if( cfg->m_AuiPanels.search_panel_height > 0 )
if( cfg->m_AuiPanels.search_panel_height > 0
&& ( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
|| cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
{
wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
searchPane.Direction( cfg->m_AuiPanels.search_panel_dock_direction );
SetAuiPaneSize( m_auimgr, searchPane, -1, cfg->m_AuiPanels.search_panel_height );
}
else if( cfg->m_AuiPanels.search_panel_width > 0
&& ( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
|| cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
{
wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
searchPane.Direction( cfg->m_AuiPanels.search_panel_dock_direction );
SetAuiPaneSize( m_auimgr, searchPane, cfg->m_AuiPanels.search_panel_width, -1 );
}
if( cfg->m_AuiPanels.float_net_nav_panel )
netNavigatorPane.Float();
@ -655,7 +667,6 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( EE_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
mgr->SetConditions( ACTIONS::toggleBoundingBoxes, CHECK( cond.BoundingBoxes() ) );
#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
CURRENT_TOOL( ACTIONS::deleteTool );

View File

@ -239,13 +239,27 @@ void SCH_EDIT_FRAME::ToggleSearch()
searchPaneInfo.Show( m_show_search );
if( m_show_search )
{
searchPaneInfo.Direction( cfg->m_AuiPanels.search_panel_dock_direction );
if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
|| cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM )
{
SetAuiPaneSize( m_auimgr, searchPaneInfo, -1, cfg->m_AuiPanels.search_panel_height );
}
else if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
|| cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT )
{
SetAuiPaneSize( m_auimgr, searchPaneInfo, cfg->m_AuiPanels.search_panel_width, -1 );
}
m_searchPane->FocusSearch();
}
else
{
cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
m_auimgr.Update();
}
}

View File

@ -107,7 +107,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
&m_AuiPanels.search_panel_width, -1 ) );
m_params.emplace_back( new PARAM<int>( "aui.search_panel_dock_direction",
&m_AuiPanels.search_panel_dock_direction, -1 ) );
&m_AuiPanels.search_panel_dock_direction, 0 ) );
m_params.emplace_back( new PARAM<int>( "aui.appearance_panel_tab",
&m_AuiPanels.appearance_panel_tab, 0, 0, 2 ) );