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