From c44a477823702f2319c303f46ef6708e5e22f71b Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 26 Jun 2025 18:23:01 +0200 Subject: [PATCH] DIALOG_SYMBOL_FIELDS_TABLE: minor enhancements and fix a minor issue Fixes https://gitlab.com/kicad/code/kicad/-/issues/19145 --- eeschema/dialogs/dialog_symbol_fields_table.cpp | 8 ++++++-- eeschema/dialogs/dialog_symbol_fields_table_base.cpp | 8 +++++++- eeschema/dialogs/dialog_symbol_fields_table_base.fbp | 10 +++++----- eeschema/dialogs/dialog_symbol_fields_table_base.h | 2 -- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index e04bfbaf7b..306f8c171b 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -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(); diff --git a/eeschema/dialogs/dialog_symbol_fields_table_base.cpp b/eeschema/dialogs/dialog_symbol_fields_table_base.cpp index 18d4d6b8bf..b5000b25a5 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table_base.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table_base.cpp @@ -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") ); diff --git a/eeschema/dialogs/dialog_symbol_fields_table_base.fbp b/eeschema/dialogs/dialog_symbol_fields_table_base.fbp index ef774e0d64..cf83bae5b3 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table_base.fbp +++ b/eeschema/dialogs/dialog_symbol_fields_table_base.fbp @@ -383,7 +383,7 @@ 0 0 wxID_ANY - MyButton + Add Field... 0 @@ -408,7 +408,7 @@ STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare 0 - + Add a new field wxFILTER_NONE wxDefaultValidator @@ -483,7 +483,7 @@ STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare 0 - + Rename selected field wxFILTER_NONE wxDefaultValidator @@ -568,7 +568,7 @@ STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare 0 - + Remove selected field wxFILTER_NONE wxDefaultValidator @@ -1199,7 +1199,7 @@ 0 0 - OPT_GROUP_COMPONENTS + wxID_ANY Group symbols 0 diff --git a/eeschema/dialogs/dialog_symbol_fields_table_base.h b/eeschema/dialogs/dialog_symbol_fields_table_base.h index 66fd9ce769..1a4795d263 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table_base.h +++ b/eeschema/dialogs/dialog_symbol_fields_table_base.h @@ -42,8 +42,6 @@ class WX_GRID; /////////////////////////////////////////////////////////////////////////// -#define OPT_GROUP_COMPONENTS 1000 - /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_SYMBOL_FIELDS_TABLE_BASE ///////////////////////////////////////////////////////////////////////////////