Check added fields only if all fields were checked before.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16408
(cherry picked from commit 7e72a53876
)
This commit is contained in:
parent
b597a4559f
commit
d7b2c81db5
|
@ -350,14 +350,26 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the listbox widget
|
// Update the listbox widget
|
||||||
|
wxArrayInt checkedItems;
|
||||||
|
wxArrayString checkedNames;
|
||||||
|
|
||||||
|
m_fieldsBox->GetCheckedItems( checkedItems );
|
||||||
|
|
||||||
|
for( int i : checkedItems )
|
||||||
|
checkedNames.push_back( m_fieldsBox->GetString( i ) );
|
||||||
|
|
||||||
|
bool allChecked = checkedItems.size() == m_fieldsBox->GetCount();
|
||||||
|
|
||||||
for( unsigned i = m_fieldsBox->GetCount() - 1; i >= MANDATORY_FIELDS; --i )
|
for( unsigned i = m_fieldsBox->GetCount() - 1; i >= MANDATORY_FIELDS; --i )
|
||||||
m_fieldsBox->Delete( i );
|
m_fieldsBox->Delete( i );
|
||||||
|
|
||||||
for( const wxString& fieldName : fieldNames )
|
for( const wxString& fieldName : fieldNames )
|
||||||
|
{
|
||||||
m_fieldsBox->Append( fieldName );
|
m_fieldsBox->Append( fieldName );
|
||||||
|
|
||||||
for( unsigned i = MANDATORY_FIELDS; i < m_fieldsBox->GetCount(); ++i )
|
if( allChecked || alg::contains( checkedNames, fieldName ) )
|
||||||
m_fieldsBox->Check( i, true );
|
m_fieldsBox->Check( m_fieldsBox->GetCount() - 1, true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue