From 185016b84b6f23f04f95b6ee4db23decdff79b83 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 7 Jun 2022 11:00:13 +0200 Subject: [PATCH] Eeschema, Hierarchy navigator: add tool to Hide/show the panel. Add also a close button to the pane. --- eeschema/eeschema_config.cpp | 2 ++ eeschema/sch_edit_frame.cpp | 7 ++++--- eeschema/sch_edit_frame.h | 8 ++++++++ eeschema/toolbars_sch_editor.cpp | 6 +++++- eeschema/tools/ee_actions.cpp | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 95c6f07e54..911ded445b 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -160,6 +160,8 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) if( eeconfig() ) { eeconfig()->m_System.units = static_cast( 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; } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 0bfc73490b..7e73989954 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -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(); }; diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 563789d6ff..d01455fae8 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -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: diff --git a/eeschema/toolbars_sch_editor.cpp b/eeschema/toolbars_sch_editor.cpp index b102aa016e..1e9f5b69a9 100644 --- a/eeschema/toolbars_sch_editor.cpp +++ b/eeschema/toolbars_sch_editor.cpp @@ -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( 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; diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index b075f40e4d..3c12a8067a 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -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",