From daa0d391dea947bd9942f002cf6f2f76672b4082 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 17 May 2016 20:02:49 +0200 Subject: [PATCH] Enhancement in eeschema: Footprint field immediately updated after footprint picking (from footprint viewer) in the eeschema LIB_PART or component text field properties editors --- .../dialog_edit_component_in_schematic.cpp | 15 +++++++++++---- .../dialog_edit_libentry_fields_in_lib.cpp | 14 ++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index bea245a2d4..bf8c4dcdba 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -106,7 +106,12 @@ private: void copyPanelToOptions(); - void setRowItem( int aFieldNdx, const SCH_FIELD& aField ); + void setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue ); + + void setRowItem( int aFieldNdx, const SCH_FIELD& aField ) + { + setRowItem( aFieldNdx, aField.GetName( false ), aField.GetText() ); + } // event handlers void OnCloseDialog( wxCloseEvent& event ); @@ -540,6 +545,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler( wxCommandEvent& even { // DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); ) fieldValueTextCtrl->SetValue( fpid ); + + setRowItem( fieldNdx, m_FieldsBuf[fieldNdx].GetName( false ), fpid ); } frame->Destroy(); @@ -765,7 +772,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent } -void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const SCH_FIELD& aField ) +void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue ) { wxASSERT( aFieldNdx >= 0 ); @@ -779,8 +786,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const SCH_FI fieldListCtrl->SetItem( ndx, 1, wxEmptyString ); } - fieldListCtrl->SetItem( aFieldNdx, 0, aField.GetName( false ) ); - fieldListCtrl->SetItem( aFieldNdx, 1, aField.GetText() ); + fieldListCtrl->SetItem( aFieldNdx, 0, aName ); + fieldListCtrl->SetItem( aFieldNdx, 1, aValue ); // recompute the column widths here, after setting texts fieldListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE ); diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index bb8c768788..dfe5c5706a 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -113,7 +113,12 @@ private: * bad data into a field, and this value can be used to deny a row change. */ bool copyPanelToSelectedField(); - void setRowItem( int aFieldNdx, const LIB_FIELD& aField ); + + void setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue ); + void setRowItem( int aFieldNdx, const LIB_FIELD& aField ) + { + setRowItem( aFieldNdx, aField.GetName(), aField.GetText() ); + } /** * Function updateDisplay @@ -408,6 +413,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler( wxCommandEvent& even if( frame->ShowModal( &fpid, this ) ) { fieldValueTextCtrl->SetValue( fpid ); + setRowItem( fieldNdx, m_FieldsBuf[fieldNdx].GetName( false ), fpid ); } frame->Destroy(); @@ -576,7 +582,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() } -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LIB_FIELD& aField ) +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue ) { wxASSERT( aFieldNdx >= 0 ); @@ -590,8 +596,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LIB_FI fieldListCtrl->SetItem( ndx, COLUMN_TEXT, wxEmptyString ); } - fieldListCtrl->SetItem( aFieldNdx, COLUMN_FIELD_NAME, aField.GetName() ); - fieldListCtrl->SetItem( aFieldNdx, COLUMN_TEXT, aField.GetText() ); + fieldListCtrl->SetItem( aFieldNdx, COLUMN_FIELD_NAME, aName ); + fieldListCtrl->SetItem( aFieldNdx, COLUMN_TEXT, aValue ); // recompute the column widths here, after setting texts fieldListCtrl->SetColumnWidth( COLUMN_FIELD_NAME, wxLIST_AUTOSIZE );