Fix save/load of appearance panel width on show/hide
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8982
This commit is contained in:
parent
781fb0ad0d
commit
c80efb0f98
|
@ -238,6 +238,7 @@ set( COMMON_WIDGET_SRCS
|
|||
widgets/widget_save_restore.cpp
|
||||
widgets/widget_hotkey_list.cpp
|
||||
widgets/wx_aui_art_providers.cpp
|
||||
widgets/wx_aui_utils.cpp
|
||||
widgets/wx_busy_indicator.cpp
|
||||
widgets/wx_ellipsized_static_text.cpp
|
||||
widgets/wx_grid.cpp
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <wx/aui/aui.h>
|
||||
#include <widgets/wx_aui_utils.h>
|
||||
|
||||
|
||||
void SetAuiPaneSize( wxAuiManager& aManager, wxAuiPaneInfo& aPane, int aWidth, int aHeight )
|
||||
{
|
||||
wxSize minSize = aPane.min_size;
|
||||
|
||||
// wxAUI hack: force width by setting MinSize() and then Fixed()
|
||||
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
|
||||
aPane.MinSize( aWidth, aHeight );
|
||||
aPane.Fixed();
|
||||
aManager.Update();
|
||||
|
||||
// now make it resizable again
|
||||
aPane.MinSize( minSize.x, minSize.y );
|
||||
aPane.Resizable();
|
||||
aManager.Update();
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef KICAD_WX_AUI_UTILS_H
|
||||
#define KICAD_WX_AUI_UTILS_H
|
||||
|
||||
class wxAuiMangager;
|
||||
class wxAuiPaneInfo;
|
||||
|
||||
/**
|
||||
* Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180
|
||||
* @param aManager is an AUI manager
|
||||
* @param aPane is a wxAuiPaneInfo containing pane info managed by aManager
|
||||
* @param aWidth is the width to set (-1 for automatic)
|
||||
* @param aHeight is the height to set (-1 for automatic)
|
||||
*/
|
||||
void SetAuiPaneSize( wxAuiManager& aManager, wxAuiPaneInfo& aPane, int aWidth, int aHeight );
|
||||
|
||||
#endif // KICAD_WX_AUI_UTILS_H
|
|
@ -99,6 +99,7 @@
|
|||
#include <widgets/appearance_controls.h>
|
||||
#include <widgets/infobar.h>
|
||||
#include <widgets/panel_selection_filter.h>
|
||||
#include <widgets/wx_aui_utils.h>
|
||||
#include <kiplatform/app.h>
|
||||
|
||||
#include <action_plugin.h>
|
||||
|
@ -292,17 +293,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
if( settings->m_AuiPanels.right_panel_width > 0 )
|
||||
{
|
||||
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
|
||||
|
||||
// wxAUI hack: force width by setting MinSize() and then Fixed()
|
||||
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
|
||||
layersManager.MinSize( settings->m_AuiPanels.right_panel_width, -1 );
|
||||
layersManager.Fixed();
|
||||
m_auimgr.Update();
|
||||
|
||||
// now make it resizable again
|
||||
layersManager.MinSize( 180, -1 );
|
||||
layersManager.Resizable();
|
||||
m_auimgr.Update();
|
||||
SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
|
||||
}
|
||||
|
||||
m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab );
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/pcb_selection_tool.h>
|
||||
#include <widgets/appearance_controls.h>
|
||||
#include <widgets/wx_aui_utils.h>
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include <wx/choice.h>
|
||||
|
@ -751,11 +753,23 @@ void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
|
|||
|
||||
void PCB_EDIT_FRAME::ToggleLayersManager()
|
||||
{
|
||||
PCBNEW_SETTINGS* settings = GetPcbNewSettings();
|
||||
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
|
||||
|
||||
// show auxiliary Vertical layers and visibility manager toolbar
|
||||
m_show_layer_manager_tools = !m_show_layer_manager_tools;
|
||||
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
|
||||
layersManager.Show( m_show_layer_manager_tools );
|
||||
m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
|
||||
|
||||
if( m_show_layer_manager_tools )
|
||||
{
|
||||
SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
settings->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
|
||||
m_auimgr.Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue