From f005335743182bda60b7fef1a92d84b18af05882 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 18 Nov 2020 17:54:41 +0000 Subject: [PATCH] Resolve variables in Sheet Properties dialog's sheet path. Fixes https://gitlab.com/kicad/code/kicad/issues/6409 --- eeschema/dialogs/dialog_sheet_properties.cpp | 13 ++++++++++--- eeschema/dialogs/dialog_sheet_properties.h | 5 ++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/eeschema/dialogs/dialog_sheet_properties.cpp b/eeschema/dialogs/dialog_sheet_properties.cpp index a77e11af08..1b7a71669a 100644 --- a/eeschema/dialogs/dialog_sheet_properties.cpp +++ b/eeschema/dialogs/dialog_sheet_properties.cpp @@ -44,7 +44,9 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S DIALOG_SHEET_PROPERTIES_BASE( aParent ), m_frame( aParent ), m_clearAnnotationNewItems( aClearAnnotationNewItems ), - m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits, true ) + m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits, true ), + m_dummySheet( *aSheet ), + m_dummySheetNameField( wxDefaultPosition, SHEETNAME, &m_dummySheet ) { m_sheet = aSheet; m_fields = new FIELDS_GRID_TABLE( this, aParent, m_sheet ); @@ -776,11 +778,16 @@ void DIALOG_SHEET_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event ) wxGridCellEditor* editor = m_grid->GetCellEditor( SHEETNAME, FDC_VALUE ); wxControl* control = editor->GetControl(); wxTextEntry* textControl = dynamic_cast( control ); + wxString sheetName; if( textControl ) - hierarchicalPath += textControl->GetValue(); + sheetName = textControl->GetValue(); else - hierarchicalPath += m_grid->GetCellValue( SHEETNAME, FDC_VALUE ); + sheetName = m_grid->GetCellValue( SHEETNAME, FDC_VALUE ); + + m_dummySheet.SetFields( *m_fields ); + m_dummySheetNameField.SetText( sheetName ); + hierarchicalPath += m_dummySheetNameField.GetShownText(); editor->DecRef(); diff --git a/eeschema/dialogs/dialog_sheet_properties.h b/eeschema/dialogs/dialog_sheet_properties.h index b1873f6fb6..3867cc9aaa 100644 --- a/eeschema/dialogs/dialog_sheet_properties.h +++ b/eeschema/dialogs/dialog_sheet_properties.h @@ -28,7 +28,7 @@ #include #include #include - +#include class SCH_SHEET; class SCH_EDIT_FRAME; @@ -55,6 +55,9 @@ private: FIELDS_GRID_TABLE* m_fields; UNIT_BINDER m_borderWidth; + SCH_SHEET m_dummySheet; + SCH_FIELD m_dummySheetNameField; + bool onSheetFilenameChanged( const wxString& aNewFilename ); bool TransferDataToWindow() override;