Do not update tree to selected sheet in schematic hierarchy navigator.

This was causing unwanted tree expansions when descending a sheet hierarchy
in editor.

Also fixed an issue with the tree highlighting when changing sheets in the
schematic editor.
This commit is contained in:
Wayne Stambaugh 2024-01-06 12:25:16 -05:00
parent bbdefa05eb
commit 50cad558cf
1 changed files with 9 additions and 13 deletions

View File

@ -151,8 +151,6 @@ void HIERARCHY_PANE::UpdateHierarchySelection()
m_events_bound = false; m_events_bound = false;
} }
bool sheetSelected = false;
std::function<void( const wxTreeItemId& )> recursiveDescent = std::function<void( const wxTreeItemId& )> recursiveDescent =
[&]( const wxTreeItemId& id ) [&]( const wxTreeItemId& id )
{ {
@ -162,21 +160,22 @@ void HIERARCHY_PANE::UpdateHierarchySelection()
if( itemData->m_SheetPath == m_frame->GetCurrentSheet() ) if( itemData->m_SheetPath == m_frame->GetCurrentSheet() )
{ {
m_tree->EnsureVisible( id ); wxTreeItemId parent = m_tree->GetItemParent( id );
if( parent.IsOk() && !m_tree->IsExpanded( parent ) )
m_tree->Expand( parent );
if( !m_tree->IsVisible( id ) )
m_tree->EnsureVisible( id );
m_tree->SetItemBold( id, true ); m_tree->SetItemBold( id, true );
m_tree->SetFocusedItem( id );
} }
else else
{ {
m_tree->SetItemBold( id, false ); m_tree->SetItemBold( id, false );
} }
if( itemData->m_SheetPath.Last()->IsSelected() )
{
m_tree->EnsureVisible( id );
m_tree->SelectItem( id );
sheetSelected = true;
}
wxTreeItemIdValue cookie; wxTreeItemIdValue cookie;
wxTreeItemId child = m_tree->GetFirstChild( id, cookie ); wxTreeItemId child = m_tree->GetFirstChild( id, cookie );
@ -189,9 +188,6 @@ void HIERARCHY_PANE::UpdateHierarchySelection()
recursiveDescent( m_tree->GetRootItem() ); recursiveDescent( m_tree->GetRootItem() );
if( !sheetSelected && m_tree->GetSelection() )
m_tree->SelectItem( m_tree->GetSelection(), false );
if( eventsWereBound ) if( eventsWereBound )
{ {
// Enable selection events // Enable selection events