Do not expand the entire schematic hierarchy navigator tree by default.
The new behavior is to only expand to the first child of the root sheet level. On very complex hierarchies, this makes the navigator far more useful. Do not update schematic hierarchy navigator on every edit. Now only sheet changes will trigger a rebuild of the tree. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16371
This commit is contained in:
parent
32cc486d89
commit
193e7f894d
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2018 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2021-2024 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
|
||||
|
@ -96,6 +96,22 @@ bool PICKED_ITEMS_LIST::ContainsItem( const EDA_ITEM* aItem ) const
|
|||
}
|
||||
|
||||
|
||||
bool PICKED_ITEMS_LIST::ContainsItemType( KICAD_T aItemType ) const
|
||||
{
|
||||
for( const ITEM_PICKER& picker : m_ItemsList )
|
||||
{
|
||||
const EDA_ITEM* item = picker.GetItem();
|
||||
|
||||
wxCHECK2( item, continue );
|
||||
|
||||
if( item->Type() == aItemType )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int PICKED_ITEMS_LIST::FindItem( const EDA_ITEM* aItem ) const
|
||||
{
|
||||
for( size_t i = 0; i < m_ItemsList.size(); i++ )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2024 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
|
||||
|
@ -950,7 +950,6 @@ void SCH_EDIT_FRAME::OnModify()
|
|||
RecalculateConnections( NO_CLEANUP );
|
||||
|
||||
GetCanvas()->Refresh();
|
||||
UpdateHierarchyNavigator();
|
||||
|
||||
if( !GetTitle().StartsWith( wxS( "*" ) ) )
|
||||
updateTitle();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2024 KiCad Developers, see change_log.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
|
||||
|
@ -392,10 +392,17 @@ void SCH_EDIT_FRAME::RollbackSchematicFromUndo()
|
|||
{
|
||||
delete aItem;
|
||||
} );
|
||||
|
||||
// Only rebuild the hierarchy navigator if there are sheet changes.
|
||||
bool hasSheets = undo->ContainsItemType( SCH_SHEET_T );
|
||||
|
||||
delete undo;
|
||||
|
||||
SetSheetNumberAndCount();
|
||||
UpdateHierarchyNavigator();
|
||||
if( hasSheets )
|
||||
{
|
||||
SetSheetNumberAndCount();
|
||||
UpdateHierarchyNavigator();
|
||||
}
|
||||
|
||||
TestDanglingEnds();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 CERN
|
||||
* Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2019-2024 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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 CERN
|
||||
* Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2019-2024 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
|
||||
|
@ -1218,9 +1218,10 @@ static std::vector<KICAD_T> deletableItems =
|
|||
|
||||
int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
auto items = m_selectionTool->RequestSelection( deletableItems ).GetItems();
|
||||
bool appendToUndo = false;
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
auto items = m_selectionTool->RequestSelection( deletableItems ).GetItems();
|
||||
bool appendToUndo = false;
|
||||
bool rebuildHierarchyNavigator = false;
|
||||
std::vector<VECTOR2I> pts;
|
||||
|
||||
if( items.empty() )
|
||||
|
@ -1285,7 +1286,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
m_frame->RemoveFromScreen( sch_item, m_frame->GetScreen() );
|
||||
|
||||
if( sch_item->Type() == SCH_SHEET_T )
|
||||
m_frame->UpdateHierarchyNavigator();
|
||||
rebuildHierarchyNavigator = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1300,8 +1301,10 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
m_frame->DeleteJunction( junction, appendToUndo );
|
||||
}
|
||||
|
||||
m_frame->TestDanglingEnds();
|
||||
if( rebuildHierarchyNavigator )
|
||||
m_frame->UpdateHierarchyNavigator();
|
||||
|
||||
m_frame->TestDanglingEnds();
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 CERN
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2024 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
|
||||
|
@ -1231,7 +1231,10 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
|
||||
|
||||
// Get the old list
|
||||
PICKED_ITEMS_LIST* List = m_frame->PopCommandFromUndoList();
|
||||
PICKED_ITEMS_LIST* list = m_frame->PopCommandFromUndoList();
|
||||
|
||||
wxCHECK( m_frame && list, 0 );
|
||||
|
||||
size_t num_undos = m_frame->m_undoList.m_CommandsList.size();
|
||||
|
||||
// The cleanup routines normally run after an operation and so attempt to append their
|
||||
|
@ -1240,9 +1243,15 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
|
|||
PICKED_ITEMS_LIST* dummy = new PICKED_ITEMS_LIST();
|
||||
m_frame->PushCommandToUndoList( dummy );
|
||||
|
||||
m_frame->PutDataInPreviousState( List );
|
||||
m_frame->PutDataInPreviousState( list );
|
||||
|
||||
// Only rebuild the hierarchy navigator if there are sheet changes.
|
||||
if( list->ContainsItemType( SCH_SHEET_T ) )
|
||||
{
|
||||
m_frame->SetSheetNumberAndCount();
|
||||
m_frame->UpdateHierarchyNavigator();
|
||||
}
|
||||
|
||||
m_frame->SetSheetNumberAndCount();
|
||||
m_frame->TestDanglingEnds();
|
||||
m_frame->OnPageSettingsChange();
|
||||
|
||||
|
@ -1252,8 +1261,8 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
|
|||
delete m_frame->PopCommandFromUndoList();
|
||||
|
||||
// Now push the old command to the RedoList
|
||||
List->ReversePickersListOrder();
|
||||
m_frame->PushCommandToRedoList( List );
|
||||
list->ReversePickersListOrder();
|
||||
m_frame->PushCommandToRedoList( list );
|
||||
|
||||
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->RebuildSelection();
|
||||
|
||||
|
@ -1267,6 +1276,8 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
wxCHECK( m_frame, 0 );
|
||||
|
||||
if( m_frame->GetRedoCommandCount() == 0 )
|
||||
return 0;
|
||||
|
||||
|
@ -1276,6 +1287,8 @@ int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
|
|||
/* Get the old list */
|
||||
PICKED_ITEMS_LIST* list = m_frame->PopCommandFromRedoList();
|
||||
|
||||
wxCHECK( list, 0 );
|
||||
|
||||
/* Redo the command: */
|
||||
m_frame->PutDataInPreviousState( list );
|
||||
|
||||
|
@ -1283,7 +1296,13 @@ int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
|
|||
list->ReversePickersListOrder();
|
||||
m_frame->PushCommandToUndoList( list );
|
||||
|
||||
m_frame->SetSheetNumberAndCount();
|
||||
// Only rebuild the hierarchy navigator if there are sheet changes.
|
||||
if( list->ContainsItemType( SCH_SHEET_T ) )
|
||||
{
|
||||
m_frame->SetSheetNumberAndCount();
|
||||
m_frame->UpdateHierarchyNavigator();
|
||||
}
|
||||
|
||||
m_frame->TestDanglingEnds();
|
||||
|
||||
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->RebuildSelection();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2024 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
|
||||
|
@ -231,7 +231,8 @@ void HIERARCHY_PANE::UpdateHierarchyTree()
|
|||
buildHierarchyTree( &m_list, root );
|
||||
UpdateHierarchySelection();
|
||||
|
||||
m_tree->ExpandAll();
|
||||
if( m_tree->ItemHasChildren( root ) )
|
||||
m_tree->Expand( root );
|
||||
|
||||
if( eventsWereBound )
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2009 jean-pierre.charras@gipsa-lab.inpg.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2009-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2009-2024 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
|
||||
|
@ -156,6 +156,14 @@ public:
|
|||
*/
|
||||
bool ContainsItem( const EDA_ITEM* aItem ) const;
|
||||
|
||||
/**
|
||||
* Check the undo/redo list for any #EDA_ITEM of type \a aItemType.
|
||||
*
|
||||
* @param aItemType is an #EDA_ITEM type from the list of #KICAD_T types.
|
||||
* @return true if an item of \a aItemType is found in the pick list.
|
||||
*/
|
||||
bool ContainsItemType( KICAD_T aItemType ) const;
|
||||
|
||||
/**
|
||||
* @return Index of the searched item. If the item is not stored in the list, negative value
|
||||
* is returned.
|
||||
|
|
Loading…
Reference in New Issue