field editor: Find components when reference field is clicked
This makes it significantly easier to find a particular component when using the field editor, as I often do for part selection. Fixes: lp:1772169 * https://bugs.launchpad.net/kicad/+bug/1772169
This commit is contained in:
parent
850aac5ec5
commit
3f783d2318
|
@ -177,6 +177,11 @@ public:
|
|||
return GetValue( m_rows[ aRow ], aCol );
|
||||
}
|
||||
|
||||
std::vector<SCH_REFERENCE> GetRowReferences( int aRow )
|
||||
{
|
||||
wxCHECK( aRow < m_rows.size(), std::vector<SCH_REFERENCE>() );
|
||||
return m_rows[ aRow ].m_Refs;
|
||||
}
|
||||
|
||||
wxString GetValue( DATA_MODEL_ROW& group, int aCol )
|
||||
{
|
||||
|
@ -820,9 +825,21 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnRegroupComponents( wxCommandEvent& event )
|
|||
void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick( wxGridEvent& event )
|
||||
{
|
||||
if( event.GetCol() == REFERENCE )
|
||||
m_dataModel->ExpandCollapseRow( event.GetRow());
|
||||
{
|
||||
m_dataModel->ExpandCollapseRow( event.GetRow() );
|
||||
std::vector<SCH_REFERENCE> refs = m_dataModel->GetRowReferences( event.GetRow() );
|
||||
|
||||
// Focus eeschema view on the component selected in the dialog
|
||||
if( refs.size() == 1 )
|
||||
{
|
||||
m_parent->FindComponentAndItem( refs[0].GetRef() + refs[0].GetRefNumber(),
|
||||
true, FIND_COMPONENT_ONLY, wxEmptyString, false );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue