DIALOG_SYMBOL_FIELDS_TABLE: minor enhancements and fix a minor issue

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19145
This commit is contained in:
jean-pierre charras 2025-06-26 18:23:01 +02:00
parent ed8605b9c1
commit c44a477823
4 changed files with 18 additions and 10 deletions

View File

@ -824,7 +824,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRenameField( wxCommandEvent& event )
{
if( m_mandatoryFieldListIndexes[id] == row )
{
wxBell();
DisplayError( this, wxString::Format( _( "The first %d fields are mandatory and names cannot be changed." ),
(int) m_mandatoryFieldListIndexes.size() ) );
return;
}
}
@ -834,7 +835,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRenameField( wxCommandEvent& event )
int col = m_dataModel->GetFieldNameCol( fieldName );
wxCHECK_RET( col != -1, wxS( "Existing field name missing from data model" ) );
wxTextEntryDialog dlg( this, _( "New field name:" ), _( "Rename Field" ) );
wxTextEntryDialog dlg( this, _( "New field name:" ), _( "Rename Field" ), fieldName );
if( dlg.ShowModal() != wxID_OK )
return;
@ -1068,7 +1069,10 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnColLabelChange( wxDataViewEvent& aEvent )
int col = m_dataModel->GetFieldNameCol( fieldName );
if( col != -1 )
{
m_dataModel->SetColLabelValue( col, label );
m_grid->SetColLabelValue( col, label );
}
syncBomPresetSelection();

View File

@ -40,15 +40,21 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
bFieldsButtons = new wxBoxSizer( wxHORIZONTAL );
m_addFieldButton = new STD_BITMAP_BUTTON( m_leftPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_addFieldButton->SetToolTip( _("Add a new field") );
bFieldsButtons->Add( m_addFieldButton, 0, wxBOTTOM|wxLEFT, 5 );
m_renameFieldButton = new STD_BITMAP_BUTTON( m_leftPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_renameFieldButton->SetToolTip( _("Rename selected field") );
bFieldsButtons->Add( m_renameFieldButton, 0, wxBOTTOM|wxLEFT, 5 );
bFieldsButtons->Add( 15, 0, 0, wxEXPAND, 5 );
m_removeFieldButton = new STD_BITMAP_BUTTON( m_leftPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_removeFieldButton->SetToolTip( _("Remove selected field") );
bFieldsButtons->Add( m_removeFieldButton, 0, wxBOTTOM|wxLEFT, 5 );
@ -107,7 +113,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
m_staticline32 = new wxStaticLine( m_rightPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
bControls->Add( m_staticline32, 0, wxEXPAND | wxALL, 3 );
m_groupSymbolsBox = new wxCheckBox( m_rightPanel, OPT_GROUP_COMPONENTS, _("Group symbols"), wxDefaultPosition, wxDefaultSize, 0 );
m_groupSymbolsBox = new wxCheckBox( m_rightPanel, wxID_ANY, _("Group symbols"), wxDefaultPosition, wxDefaultSize, 0 );
m_groupSymbolsBox->SetValue(true);
m_groupSymbolsBox->SetToolTip( _("Group symbols together based on common properties") );

View File

@ -383,7 +383,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">MyButton</property>
<property name="label">Add Field...</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
@ -408,7 +408,7 @@
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="tooltip">Add a new field</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
@ -483,7 +483,7 @@
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="tooltip">Rename selected field</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
@ -568,7 +568,7 @@
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="tooltip">Remove selected field</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
@ -1199,7 +1199,7 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">OPT_GROUP_COMPONENTS</property>
<property name="id">wxID_ANY</property>
<property name="label">Group symbols</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>

View File

@ -42,8 +42,6 @@ class WX_GRID;
///////////////////////////////////////////////////////////////////////////
#define OPT_GROUP_COMPONENTS 1000
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SYMBOL_FIELDS_TABLE_BASE
///////////////////////////////////////////////////////////////////////////////