Eeschema, Hierarchy navigator: add tool to Hide/show the panel.

Add also a close button to the pane.
This commit is contained in:
jean-pierre charras 2022-06-07 11:00:13 +02:00
parent bf71cada4e
commit 185016b84b
5 changed files with 20 additions and 5 deletions

View File

@ -160,6 +160,8 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
if( eeconfig() )
{
eeconfig()->m_System.units = static_cast<int>( m_userUnits );
wxAuiPaneInfo& hierarchy = m_auimgr.GetPane( SchematicHierarchyPaneName() );
m_showHierarchy = hierarchy.IsShown();
eeconfig()->m_AuiPanels.show_schematic_hierarchy = m_showHierarchy;
eeconfig()->m_AuiPanels.left_panel_width = m_hierarchy->GetSize().x;
}

View File

@ -267,9 +267,10 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.Top().Layer( 6 ) );
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
.Left().Layer( 4 ) );
m_auimgr.AddPane( m_hierarchy, EDA_PANE().Palette().Name( "SchematicHierarchy" )
m_auimgr.AddPane( m_hierarchy, EDA_PANE().Palette().Name( SchematicHierarchyPaneName() )
.Caption( _("Schematic Hierarchy") )
.Left().Layer( 3 )
.CloseButton( true )
.MinSize(120, -1)
.BestSize(200, -1));
m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" )
@ -288,7 +289,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
initScreenZoom();
wxAuiPaneInfo& hierarchy = m_auimgr.GetPane( "SchematicHierarchy" );
wxAuiPaneInfo& hierarchy = m_auimgr.GetPane( SchematicHierarchyPaneName() );
hierarchy.Show( m_showHierarchy );
if( eeconfig() && ( eeconfig()->m_AuiPanels.left_panel_width > 0 ) )
@ -418,7 +419,7 @@ void SCH_EDIT_FRAME::setupUIConditions()
auto hierarchyNavigatorCond =
[ this ] ( const SELECTION& aSel )
{
return m_auimgr.GetPane( "SchematicHierarchy" ).IsShown();
return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
};

View File

@ -833,6 +833,14 @@ public:
*/
void ToggleSchematicHierarchy();
/**
* @return the name of the wxAuiPaneInfo managing the Hierarchy Navigator panel
*/
static const wxString SchematicHierarchyPaneName()
{
return wxT( "SchematicHierarchy" );
}
DECLARE_EVENT_TABLE()
protected:

View File

@ -209,6 +209,9 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( EE_ACTIONS::toggleAnnotateAuto, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( EE_ACTIONS::showHierarchy, ACTION_TOOLBAR::TOGGLE );
if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
m_optionsToolBar->Add( ACTIONS::toggleBoundingBoxes, ACTION_TOOLBAR::TOGGLE );
@ -224,7 +227,8 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
void SCH_EDIT_FRAME::ToggleSchematicHierarchy()
{
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxAuiPaneInfo& hierarchy = m_auimgr.GetPane( "SchematicHierarchy" );
wxAuiPaneInfo& hierarchy = m_auimgr.GetPane( SchematicHierarchyPaneName() );
m_showHierarchy = hierarchy.IsShown();
// show auxiliary Vertical layers and visibility manager toolbar
m_showHierarchy = !m_showHierarchy;

View File

@ -771,7 +771,7 @@ TOOL_ACTION EE_ACTIONS::navigateNext( "eeschema.NavigateTool.next",
TOOL_ACTION EE_ACTIONS::showHierarchy( "eeschema.EditorTool.showHierarchy",
AS_GLOBAL,
MD_CTRL + 'H', "",
_( "Hierarchy Navigator" ), _( "Show schematic sheet hierarchy" ),
_( "Hierarchy Navigator" ), _( "Show or hide the schematic sheet hierarchy navigator" ),
BITMAPS::hierarchy_nav );
TOOL_ACTION EE_ACTIONS::hypertextCommand( "eeschema.NavigateTool.hypertextCommand",