Symbol Fields Table: fix issues with selecting row of starting selection
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/15684
This commit is contained in:
parent
dd0743d766
commit
6425c5cc1a
|
@ -457,6 +457,8 @@ bool DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow()
|
||||||
EE_SELECTION& selection = selectionTool->GetSelection();
|
EE_SELECTION& selection = selectionTool->GetSelection();
|
||||||
SCH_SYMBOL* symbol = nullptr;
|
SCH_SYMBOL* symbol = nullptr;
|
||||||
|
|
||||||
|
UpdateScope();
|
||||||
|
|
||||||
if( selection.GetSize() == 1 )
|
if( selection.GetSize() == 1 )
|
||||||
{
|
{
|
||||||
EDA_ITEM* item = selection.Front();
|
EDA_ITEM* item = selection.Front();
|
||||||
|
@ -485,14 +487,33 @@ bool DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow()
|
||||||
|
|
||||||
if( found )
|
if( found )
|
||||||
{
|
{
|
||||||
m_grid->GoToCell( row, 1 );
|
// Find the value column and the reference column if they're shown
|
||||||
|
int valueCol = -1;
|
||||||
|
int refCol = -1;
|
||||||
|
int anyCol = -1;
|
||||||
|
|
||||||
|
for( int col = 0; col < m_dataModel->GetNumberCols(); col++ )
|
||||||
|
{
|
||||||
|
if( m_dataModel->ColIsValue( col ) )
|
||||||
|
valueCol = col;
|
||||||
|
else if( m_dataModel->ColIsReference( col ) )
|
||||||
|
refCol = col;
|
||||||
|
else if( anyCol == -1 && m_dataModel->GetShowColumn( col ) )
|
||||||
|
anyCol = col;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( valueCol != -1 && m_dataModel->GetShowColumn( valueCol ) )
|
||||||
|
m_grid->GoToCell( row, valueCol );
|
||||||
|
else if( refCol != -1 && m_dataModel->GetShowColumn( refCol ) )
|
||||||
|
m_grid->GoToCell( row, refCol );
|
||||||
|
else if( anyCol != -1 )
|
||||||
|
m_grid->GoToCell( row, anyCol );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateScope();
|
|
||||||
|
|
||||||
// We don't want table range selection events to happen until we've loaded the data or we
|
// We don't want table range selection events to happen until we've loaded the data or we
|
||||||
// we'll clear our selection as the grid is built before the code above can get the
|
// we'll clear our selection as the grid is built before the code above can get the
|
||||||
// user's current selection.
|
// user's current selection.
|
||||||
|
|
|
@ -234,6 +234,12 @@ bool FIELDS_EDITOR_GRID_DATA_MODEL::ColIsReference( int aCol )
|
||||||
return m_cols[aCol].m_fieldName == TEMPLATE_FIELDNAME::GetDefaultFieldName( REFERENCE_FIELD );
|
return m_cols[aCol].m_fieldName == TEMPLATE_FIELDNAME::GetDefaultFieldName( REFERENCE_FIELD );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FIELDS_EDITOR_GRID_DATA_MODEL::ColIsValue( int aCol )
|
||||||
|
{
|
||||||
|
wxCHECK( aCol >= 0 && aCol < (int) m_cols.size(), false );
|
||||||
|
return m_cols[aCol].m_fieldName == TEMPLATE_FIELDNAME::GetDefaultFieldName( VALUE_FIELD );
|
||||||
|
}
|
||||||
|
|
||||||
bool FIELDS_EDITOR_GRID_DATA_MODEL::ColIsQuantity( int aCol )
|
bool FIELDS_EDITOR_GRID_DATA_MODEL::ColIsQuantity( int aCol )
|
||||||
{
|
{
|
||||||
wxCHECK( aCol >= 0 && aCol < (int) m_cols.size(), false );
|
wxCHECK( aCol >= 0 && aCol < (int) m_cols.size(), false );
|
||||||
|
|
|
@ -132,6 +132,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ColIsReference( int aCol );
|
bool ColIsReference( int aCol );
|
||||||
|
bool ColIsValue( int aCol );
|
||||||
bool ColIsQuantity( int aCol );
|
bool ColIsQuantity( int aCol );
|
||||||
bool ColIsItemNumber( int aCol );
|
bool ColIsItemNumber( int aCol );
|
||||||
bool ColIsAttribute( int aCol );
|
bool ColIsAttribute( int aCol );
|
||||||
|
|
Loading…
Reference in New Issue