eeschema: focus eeschema on symbol when its row is selected in the symbol fields table

This commit is contained in:
vinsfortunato 2023-01-30 15:40:48 +01:00 committed by Wayne Stambaugh
parent d592e49d06
commit 3d52115ae7
1 changed files with 18 additions and 23 deletions

View File

@ -1316,34 +1316,29 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnTableRangeSelected( wxGridRangeSelectEvent& e
if( selectedCells.GetCount() == 1 )
{
int row = selectedCells[0].GetRow();
int col = selectedCells[0].GetCol();
int flag = m_dataModel->GetRowFlags( row );
std::vector<SCH_REFERENCE> refs = m_dataModel->GetRowReferences( row );
if( col == REFERENCE_FIELD )
// Focus Eeschema view on the symbol selected in the dialog
// TODO: Highlight or select more than one unit
if( ( flag == GROUP_SINGLETON || flag == CHILD_ITEM ) && refs.size() >= 1 )
{
int flag = m_dataModel->GetRowFlags( row );
std::vector<SCH_REFERENCE> refs = m_dataModel->GetRowReferences( row );
SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool<SCH_EDITOR_CONTROL>();
// Focus Eeschema view on the symbol selected in the dialog
// TODO: Highlight or select more than one unit
if( ( flag == GROUP_SINGLETON || flag == CHILD_ITEM ) && refs.size() >= 1 )
{
SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool<SCH_EDITOR_CONTROL>();
std::sort( refs.begin(), refs.end(),
[]( const SCH_REFERENCE& a, const SCH_REFERENCE& b )
{
return a.GetUnit() < b.GetUnit();
} );
std::sort( refs.begin(), refs.end(),
[]( const SCH_REFERENCE& a, const SCH_REFERENCE& b )
{
return a.GetUnit() < b.GetUnit();
} );
// search and highlight the symbol found by its full path.
// It allows select of not yet annotated or duplicaded symbols
wxString symbol_path = refs[0].GetFullPath();
// wxString reference = refs[0].GetRef() + refs[0].GetRefNumber(); // Not used
editor->FindSymbolAndItem( &symbol_path, nullptr, true, HIGHLIGHT_SYMBOL, wxEmptyString );
}
return;
// search and highlight the symbol found by its full path.
// It allows select of not yet annotated or duplicaded symbols
wxString symbol_path = refs[0].GetFullPath();
// wxString reference = refs[0].GetRef() + refs[0].GetRefNumber(); // Not used
editor->FindSymbolAndItem( &symbol_path, nullptr, true, HIGHLIGHT_SYMBOL, wxEmptyString );
}
return;
}
event.Skip();