GUI improvements to hierarchy navigator.
(1) and (3) from the linked issue. Fixes https://gitlab.com/kicad/code/kicad/issues/11762
This commit is contained in:
parent
d0d354872b
commit
6c9d8f1ae7
|
@ -151,7 +151,9 @@ void HIERARCHY_NAVIG_PANEL::UpdateHierarchySelection()
|
||||||
m_events_bound = false;
|
m_events_bound = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::function<void( const wxTreeItemId& )> selectSheet =
|
bool sheetSelected = false;
|
||||||
|
|
||||||
|
std::function<void( const wxTreeItemId& )> recursiveDescent =
|
||||||
[&]( const wxTreeItemId& id )
|
[&]( const wxTreeItemId& id )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( id.IsOk(), wxT( "Invalid tree item" ) );
|
wxCHECK_RET( id.IsOk(), wxT( "Invalid tree item" ) );
|
||||||
|
@ -159,9 +161,20 @@ void HIERARCHY_NAVIG_PANEL::UpdateHierarchySelection()
|
||||||
TREE_ITEM_DATA* itemData = static_cast<TREE_ITEM_DATA*>( m_tree->GetItemData( id ) );
|
TREE_ITEM_DATA* itemData = static_cast<TREE_ITEM_DATA*>( m_tree->GetItemData( id ) );
|
||||||
|
|
||||||
if( itemData->m_SheetPath == m_frame->GetCurrentSheet() )
|
if( itemData->m_SheetPath == m_frame->GetCurrentSheet() )
|
||||||
|
{
|
||||||
|
m_tree->EnsureVisible( id );
|
||||||
|
m_tree->SetItemBold( id, true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_tree->SetItemBold( id, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( itemData->m_SheetPath.Last()->IsSelected() )
|
||||||
{
|
{
|
||||||
m_tree->EnsureVisible( id );
|
m_tree->EnsureVisible( id );
|
||||||
m_tree->SelectItem( id );
|
m_tree->SelectItem( id );
|
||||||
|
sheetSelected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTreeItemIdValue cookie;
|
wxTreeItemIdValue cookie;
|
||||||
|
@ -169,12 +182,15 @@ void HIERARCHY_NAVIG_PANEL::UpdateHierarchySelection()
|
||||||
|
|
||||||
while( child.IsOk() )
|
while( child.IsOk() )
|
||||||
{
|
{
|
||||||
selectSheet( child );
|
recursiveDescent( child );
|
||||||
child = m_tree->GetNextChild( id, cookie );
|
child = m_tree->GetNextChild( id, cookie );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
selectSheet( m_tree->GetRootItem() );
|
recursiveDescent( m_tree->GetRootItem() );
|
||||||
|
|
||||||
|
if( !sheetSelected && m_tree->GetSelection() )
|
||||||
|
m_tree->SelectItem( m_tree->GetSelection(), false );
|
||||||
|
|
||||||
if( eventsWereBound )
|
if( eventsWereBound )
|
||||||
{
|
{
|
||||||
|
@ -210,7 +226,6 @@ void HIERARCHY_NAVIG_PANEL::UpdateHierarchyTree()
|
||||||
m_tree->DeleteAllItems();
|
m_tree->DeleteAllItems();
|
||||||
|
|
||||||
wxTreeItemId root = m_tree->AddRoot( getRootString(), 0, 1 );
|
wxTreeItemId root = m_tree->AddRoot( getRootString(), 0, 1 );
|
||||||
m_tree->SetItemBold( root, true );
|
|
||||||
m_tree->SetItemData( root, new TREE_ITEM_DATA( m_list ) );
|
m_tree->SetItemData( root, new TREE_ITEM_DATA( m_list ) );
|
||||||
|
|
||||||
buildHierarchyTree( &m_list, root );
|
buildHierarchyTree( &m_list, root );
|
||||||
|
|
|
@ -1029,6 +1029,12 @@ void SCH_EDIT_FRAME::UpdateHierarchyNavigator()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_EDIT_FRAME::UpdateHierarchySelection()
|
||||||
|
{
|
||||||
|
m_hierarchy->UpdateHierarchySelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
|
void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
|
||||||
{
|
{
|
||||||
wxString findString;
|
wxString findString;
|
||||||
|
|
|
@ -209,6 +209,12 @@ public:
|
||||||
*/
|
*/
|
||||||
void UpdateHierarchyNavigator();
|
void UpdateHierarchyNavigator();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy
|
||||||
|
* pane).
|
||||||
|
*/
|
||||||
|
void UpdateHierarchySelection();
|
||||||
|
|
||||||
void ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime );
|
void ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime );
|
||||||
void ClearFindReplaceStatus();
|
void ClearFindReplaceStatus();
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,10 @@ int EE_INSPECTION_TOOL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
if( SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
||||||
|
{
|
||||||
editFrame->UpdateNetHighlightStatus();
|
editFrame->UpdateNetHighlightStatus();
|
||||||
|
editFrame->UpdateHierarchySelection();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue