diff --git a/common/widgets/wx_html_report_panel_base.cpp b/common/widgets/wx_html_report_panel_base.cpp index 257843db0f..a5d041e148 100644 --- a/common/widgets/wx_html_report_panel_base.cpp +++ b/common/widgets/wx_html_report_panel_base.cpp @@ -39,6 +39,7 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow bSizerBottom->Add( 30, 0, 0, wxEXPAND, 5 ); m_checkBoxShowErrors = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("Errors"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowErrors->SetValue(true); bSizerBottom->Add( m_checkBoxShowErrors, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); m_errorsBadge = new NUMBER_BADGE( m_box->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); @@ -50,6 +51,7 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow bSizerBottom->Add( 25, 0, 0, wxEXPAND, 5 ); m_checkBoxShowWarnings = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("Warnings"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowWarnings->SetValue(true); bSizerBottom->Add( m_checkBoxShowWarnings, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); m_warningsBadge = new NUMBER_BADGE( m_box->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); @@ -61,12 +63,14 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow bSizerBottom->Add( 25, 0, 0, wxEXPAND, 5 ); m_checkBoxShowActions = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("Actions"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowActions->SetValue(true); bSizerBottom->Add( m_checkBoxShowActions, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); bSizerBottom->Add( 30, 0, 0, wxEXPAND, 5 ); m_checkBoxShowInfos = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("Infos"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowInfos->SetValue(true); bSizerBottom->Add( m_checkBoxShowInfos, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); diff --git a/common/widgets/wx_html_report_panel_base.fbp b/common/widgets/wx_html_report_panel_base.fbp index 34ebe82d1b..78596b2c90 100644 --- a/common/widgets/wx_html_report_panel_base.fbp +++ b/common/widgets/wx_html_report_panel_base.fbp @@ -304,7 +304,7 @@ 1 0 - 0 + 1 1 1 @@ -443,7 +443,7 @@ 1 0 - 0 + 1 1 1 @@ -582,7 +582,7 @@ 1 0 - 0 + 1 1 1 @@ -658,7 +658,7 @@ 1 0 - 0 + 1 1 1 diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index 54a612d0a3..499c9e39ae 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -45,34 +45,56 @@ public: DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& message ); ~DIALOG_ANNOTATE(); + bool TransferDataToWindow() override; + private: /// Initialize member variables. - void InitValues(); void OnOptionChanged( wxCommandEvent& event ) override; void OnClearAnnotationClick( wxCommandEvent& event ) override; void OnCloseClick( wxCommandEvent& event ) override; void OnClose( wxCloseEvent& event ) override; void OnAnnotateClick( wxCommandEvent& event ) override; - // User functions: - bool GetResetItems(); + ANNOTATE_SCOPE_T GetScope() + { + if( m_rbScope_Schematic->GetValue() ) + return ANNOTATE_ALL; + else if( m_rbScope_Sheet->GetValue() ) + return ANNOTATE_CURRENT_SHEET; + else + return ANNOTATE_SELECTION; + } - ANNOTATE_SCOPE_T GetScope(); + ANNOTATE_ORDER_T GetSortOrder() + { + if( m_rbSortBy_Y_Position->GetValue() ) + return SORT_BY_Y_POSITION; + else + return SORT_BY_X_POSITION; + } - bool GetRecursive(); + ANNOTATE_ALGO_T GetAnnotateAlgo() + { + if( m_rbSheetX100->GetValue() ) + return SHEET_NUMBER_X_100; + else if( m_rbSheetX1000->GetValue() ) + return SHEET_NUMBER_X_1000; + else + return INCREMENTAL_BY_REF; + } - ANNOTATE_ORDER_T GetSortOrder(); - - ANNOTATE_ALGO_T GetAnnotateAlgo(); - - int GetStartNumber(); + int GetStartNumber() + { + return (int) EDA_UNIT_UTILS::UI::ValueFromString( m_textNumberAfter->GetValue() ); + } +private: SCH_EDIT_FRAME* m_Parent; }; -DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& message ) - : DIALOG_ANNOTATE_BASE( parent ) +DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& message ) : + DIALOG_ANNOTATE_BASE( parent ) { SetName( DLG_WINDOW_NAME ); m_Parent = parent; @@ -92,7 +114,11 @@ DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& messag SetupStandardButtons( { { wxID_OK, _( "Annotate" ) }, { wxID_CANCEL, _( "Close" ) } } ); - InitValues(); + annotate_down_right_bitmap->SetBitmap( KiBitmapBundle( BITMAPS::annotate_down_right ) ); + annotate_right_down_bitmap->SetBitmap( KiBitmapBundle( BITMAPS::annotate_right_down ) ); + + m_MessageWindow->MsgPanelSetMinSize( wxSize( -1, 160 ) ); + Layout(); // When all widgets have the size fixed, call FinishDialogSettings @@ -102,7 +128,7 @@ DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& messag DIALOG_ANNOTATE::~DIALOG_ANNOTATE() { - auto cfg = static_cast( Kiface().KifaceSettings() ); + EESCHEMA_SETTINGS* cfg = static_cast( Kiface().KifaceSettings() ); cfg->m_AnnotatePanel.sort_order = GetSortOrder(); cfg->m_AnnotatePanel.method = GetAnnotateAlgo(); @@ -111,16 +137,15 @@ DIALOG_ANNOTATE::~DIALOG_ANNOTATE() if( m_rbScope_Schematic->IsEnabled() ) { cfg->m_AnnotatePanel.scope = GetScope(); - cfg->m_AnnotatePanel.recursive = GetRecursive(); + cfg->m_AnnotatePanel.recursive = m_checkRecursive->GetValue(); } cfg->m_AnnotatePanel.messages_filter = m_MessageWindow->GetVisibleSeverities(); // Get the "start annotation after" value from dialog and update project settings if changed int startNum = GetStartNumber(); - SCH_EDIT_FRAME* schFrame = dynamic_cast( m_parentFrame ); - if( schFrame ) + if( SCH_EDIT_FRAME* schFrame = dynamic_cast( m_parentFrame ) ) { SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings(); @@ -137,10 +162,9 @@ DIALOG_ANNOTATE::~DIALOG_ANNOTATE() } -void DIALOG_ANNOTATE::InitValues() +bool DIALOG_ANNOTATE::TransferDataToWindow() { EESCHEMA_SETTINGS* cfg = static_cast( Kiface().KifaceSettings() ); - int option; if( m_rbScope_Schematic->IsEnabled() ) { @@ -155,21 +179,16 @@ void DIALOG_ANNOTATE::InitValues() m_checkRecursive->SetValue( cfg->m_AnnotatePanel.recursive ); } - m_rbOptions->SetSelection( cfg->m_AnnotatePanel.options ); - option = cfg->m_AnnotatePanel.sort_order; - - switch( option ) + switch( cfg->m_AnnotatePanel.sort_order ) { default: case SORT_BY_X_POSITION: m_rbSortBy_X_Position->SetValue( true ); break; case SORT_BY_Y_POSITION: m_rbSortBy_Y_Position->SetValue( true ); break; } - option = cfg->m_AnnotatePanel.method; - - switch( option ) + switch( cfg->m_AnnotatePanel.method ) { default: case INCREMENTAL_BY_REF: m_rbFirstFree->SetValue( true ); break; @@ -180,9 +199,7 @@ void DIALOG_ANNOTATE::InitValues() int annotateStartNum = 0; // Default "start after" value for annotation // See if we can get a "start after" value from the project settings - SCH_EDIT_FRAME* schFrame = dynamic_cast( m_parentFrame ); - - if( schFrame ) + if( SCH_EDIT_FRAME* schFrame = dynamic_cast( m_parentFrame ) ) { SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings(); annotateStartNum = projSettings.m_AnnotateStartNum; @@ -190,10 +207,7 @@ void DIALOG_ANNOTATE::InitValues() m_textNumberAfter->SetValue( wxString::Format( wxT( "%d" ), annotateStartNum ) ); - annotate_down_right_bitmap->SetBitmap( KiBitmapBundle( BITMAPS::annotate_down_right ) ); - annotate_right_down_bitmap->SetBitmap( KiBitmapBundle( BITMAPS::annotate_right_down ) ); - - m_MessageWindow->MsgPanelSetMinSize( wxSize( -1, 160 ) ); + return true; } @@ -218,8 +232,8 @@ void DIALOG_ANNOTATE::OnAnnotateClick( wxCommandEvent& event ) REPORTER& reporter = m_MessageWindow->Reporter(); m_MessageWindow->SetLazyUpdate( true ); // Don't update after each message - m_Parent->AnnotateSymbols( &commit, GetScope(), GetSortOrder(), GetAnnotateAlgo(), - GetRecursive(), GetStartNumber(), GetResetItems(), true, reporter ); + m_Parent->AnnotateSymbols( &commit, GetScope(), GetSortOrder(), GetAnnotateAlgo(), m_checkRecursive->GetValue(), + GetStartNumber(), m_rbOptions->GetSelection() >= 1, true, reporter ); commit.Push( _( "Annotate" ) ); @@ -230,7 +244,7 @@ void DIALOG_ANNOTATE::OnAnnotateClick( wxCommandEvent& event ) void DIALOG_ANNOTATE::OnClearAnnotationClick( wxCommandEvent& event ) { m_MessageWindow->Clear(); - m_Parent->DeleteAnnotation( GetScope(), GetRecursive(), m_MessageWindow->Reporter() ); + m_Parent->DeleteAnnotation( GetScope(), m_checkRecursive->GetValue(), m_MessageWindow->Reporter() ); m_MessageWindow->Flush( true ); // Now update to show all messages } @@ -243,59 +257,9 @@ void DIALOG_ANNOTATE::OnOptionChanged( wxCommandEvent& event ) } -bool DIALOG_ANNOTATE::GetResetItems() -{ - return m_rbOptions->GetSelection() >= 1; -} - - -ANNOTATE_SCOPE_T DIALOG_ANNOTATE::GetScope() -{ - if( m_rbScope_Schematic->GetValue() ) - return ANNOTATE_ALL; - else if( m_rbScope_Sheet->GetValue() ) - return ANNOTATE_CURRENT_SHEET; - else - return ANNOTATE_SELECTION; -} - - -bool DIALOG_ANNOTATE::GetRecursive() -{ - return m_checkRecursive->GetValue(); -} - - -ANNOTATE_ORDER_T DIALOG_ANNOTATE::GetSortOrder() -{ - if( m_rbSortBy_Y_Position->GetValue() ) - return SORT_BY_Y_POSITION; - else - return SORT_BY_X_POSITION; -} - - -ANNOTATE_ALGO_T DIALOG_ANNOTATE::GetAnnotateAlgo() -{ - if( m_rbSheetX100->GetValue() ) - return SHEET_NUMBER_X_100; - else if( m_rbSheetX1000->GetValue() ) - return SHEET_NUMBER_X_1000; - else - return INCREMENTAL_BY_REF; -} - - -int DIALOG_ANNOTATE::GetStartNumber() -{ - return EDA_UNIT_UTILS::UI::ValueFromString( m_textNumberAfter->GetValue() ); -} - - void SCH_EDIT_FRAME::OnAnnotate() { - DIALOG_ANNOTATE* dlg = - static_cast( wxWindow::FindWindowByName( DLG_WINDOW_NAME ) ); + DIALOG_ANNOTATE* dlg = static_cast( wxWindow::FindWindowByName( DLG_WINDOW_NAME ) ); if( !dlg ) { diff --git a/eeschema/dialogs/dialog_annotate_base.cpp b/eeschema/dialogs/dialog_annotate_base.cpp index cf7812d45b..55c2544aaf 100644 --- a/eeschema/dialogs/dialog_annotate_base.cpp +++ b/eeschema/dialogs/dialog_annotate_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -40,6 +40,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scope") ), wxVERTICAL ); m_rbScope_Schematic = new wxRadioButton( sbSizer3->GetStaticBox(), wxID_ANY, _("Entire schematic"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_rbScope_Schematic->SetValue( true ); sbSizer3->Add( m_rbScope_Schematic, 0, wxLEFT|wxRIGHT, 5 ); m_rbScope_Sheet = new wxRadioButton( sbSizer3->GetStaticBox(), wxID_ANY, _("Current sheet only"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -49,6 +50,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con sbSizer3->Add( m_rbScope_Selection, 0, wxLEFT|wxRIGHT|wxBOTTOM, 5 ); m_checkRecursive = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Recurse into subsheets"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkRecursive->SetValue(true); sbSizer3->Add( m_checkRecursive, 0, wxALL, 5 ); @@ -61,6 +63,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con bSizerXpos = new wxBoxSizer( wxHORIZONTAL ); m_rbSortBy_X_Position = new wxRadioButton( sbSizer1->GetStaticBox(), ID_SORT_BY_X_POSITION, _("Sort symbols by &X position"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_rbSortBy_X_Position->SetValue( true ); bSizerXpos->Add( m_rbSortBy_X_Position, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); annotate_down_right_bitmap = new wxStaticBitmap( sbSizer1->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); @@ -99,6 +102,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); m_rbFirstFree = new wxRadioButton( sbSizer2->GetStaticBox(), wxID_FIRST_FREE, _("Use first free number after:"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_rbFirstFree->SetValue( true ); gbSizer1->Add( m_rbFirstFree, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 2 ); m_textNumberAfter = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 60,-1 ), 0 ); diff --git a/eeschema/dialogs/dialog_annotate_base.fbp b/eeschema/dialogs/dialog_annotate_base.fbp index fa626f1240..27d60ae120 100644 --- a/eeschema/dialogs/dialog_annotate_base.fbp +++ b/eeschema/dialogs/dialog_annotate_base.fbp @@ -1,34 +1,36 @@ - + - C++ - 1 - source_name - 0 - 0 + + 1 + connect + none + + + 0 + 0 res UTF-8 - connect dialog_annotate_base 1000 - none - - 1 + 1 + UI dialog_annotate_base - . - + 0 + source_name + 1 + 0 + source_name + + + 1 1 - 1 - 1 - 1 - UI - 0 - 0 0 + 0 0 wxAUI_MGR_DEFAULT @@ -72,10 +74,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -170,10 +172,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -220,7 +222,7 @@ wxFILTER_NONE wxDefaultValidator - 0 + 1 @@ -235,10 +237,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -300,10 +302,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -365,16 +367,16 @@ 1 1 1 - + 0 - - + 0 + 0 1 0 - 0 + 1 1 1 @@ -453,10 +455,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -503,7 +505,7 @@ wxFILTER_NONE wxDefaultValidator - 0 + 1 @@ -519,10 +521,10 @@ 1 1 1 - + 0 - - + 0 + 0 Load From Resource; @@ -589,10 +591,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -655,10 +657,10 @@ 1 1 1 - + 0 - - + 0 + 0 Load From Resource; @@ -718,10 +720,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -816,10 +818,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -866,7 +868,7 @@ wxFILTER_NONE wxDefaultValidator - 0 + 1 @@ -885,10 +887,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -912,7 +914,7 @@ 0 - + 0 0 @@ -954,10 +956,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1023,10 +1025,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1095,10 +1097,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1164,10 +1166,10 @@ 1 1 1 - + 0 - - + 0 + 0 0 diff --git a/eeschema/dialogs/dialog_annotate_base.h b/eeschema/dialogs/dialog_annotate_base.h index 1544f85f4f..17dee6eda8 100644 --- a/eeschema/dialogs/dialog_annotate_base.h +++ b/eeschema/dialogs/dialog_annotate_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! diff --git a/eeschema/dialogs/dialog_change_symbols.cpp b/eeschema/dialogs/dialog_change_symbols.cpp index f66a86076a..40110af16a 100644 --- a/eeschema/dialogs/dialog_change_symbols.cpp +++ b/eeschema/dialogs/dialog_change_symbols.cpp @@ -40,24 +40,12 @@ bool g_selectRefDes = false; bool g_selectValue = false; - // { change, update } -bool g_removeExtraFields[2] = { false, false }; -bool g_resetEmptyFields[2] = { false, false }; -bool g_resetFieldText[2] = { true, true }; -bool g_resetFieldVisibilities[2] = { true, false }; -bool g_resetFieldEffects[2] = { true, false }; -bool g_resetFieldPositions[2] = { true, false }; -bool g_resetAttributes[2] = { true, false }; -bool g_resetPinVisibilities[2] = { true, false }; -bool g_resetCustomPower[2] = { false, false }; -bool g_resetAlternatePins[2] = { true, false }; -DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBOL* aSymbol, - MODE aMode ) : - DIALOG_CHANGE_SYMBOLS_BASE( aParent ), - m_symbol( aSymbol), - m_mode( aMode ) +DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBOL* aSymbol, MODE aMode ) : + DIALOG_CHANGE_SYMBOLS_BASE( aParent ), + m_symbol( aSymbol), + m_mode( aMode ) { wxASSERT( aParent ); @@ -70,73 +58,11 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO m_matchAll->SetLabel( _( "Change all symbols in schematic" ) ); SetTitle( _( "Change Symbols" ) ); m_matchSizer->FindItem( m_matchAll )->Show( false ); - } - if( m_symbol ) - { - SCH_SHEET_PATH* currentSheet = &aParent->Schematic().CurrentSheet(); - - if( m_mode == MODE::CHANGE ) - m_matchBySelection->SetLabel( _( "Change selected symbol(s)" ) ); - - m_newId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) ); - m_specifiedReference->ChangeValue( m_symbol->GetRef( currentSheet ) ); - m_specifiedValue->ChangeValue( UnescapeString( m_symbol->GetField( FIELD_T::VALUE )->GetText() ) ); - m_specifiedId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) ); - } - else - { - m_matchSizer->FindItem( m_matchBySelection )->Show( false ); - } - - m_matchIdBrowserButton->SetBitmap( KiBitmapBundle( BITMAPS::small_library ) ); - m_newIdBrowserButton->SetBitmap( KiBitmapBundle( BITMAPS::small_library ) ); - - if( m_mode == MODE::CHANGE ) - { m_matchByReference->SetLabel( _( "Change symbols matching reference designator:" ) ); m_matchByValue->SetLabel( _( "Change symbols matching value:" ) ); m_matchById->SetLabel( _( "Change symbols matching library identifier:" ) ); - } - m_matchSizer->SetEmptyCellSize( wxSize( 0, 0 ) ); - m_matchSizer->Layout(); - - for( FIELD_T fieldId : MANDATORY_FIELDS ) - { - int listIdx = m_fieldsBox->GetCount(); - - m_fieldsBox->Append( GetDefaultFieldName( fieldId, DO_TRANSLATE ) ); - - if( fieldId == FIELD_T::REFERENCE ) - m_fieldsBox->Check( listIdx, g_selectRefDes ); - else if( fieldId == FIELD_T::VALUE ) - m_fieldsBox->Check( listIdx, g_selectValue ); - else - m_fieldsBox->Check( listIdx, true ); - - m_mandatoryFieldListIndexes[fieldId] = listIdx; - } - - m_messagePanel->SetLazyUpdate( true ); - m_messagePanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) ); - - if( aSymbol && aSymbol->IsSelected() ) - { - m_matchBySelection->SetValue( true ); - } - else - { - if( aMode == MODE::UPDATE ) - m_matchAll->SetValue( true ); - else - m_matchByReference->SetValue( true ); - } - - updateFieldsList(); - - if( m_mode == MODE::CHANGE ) - { m_updateFieldsSizer->GetStaticBox()->SetLabel( _( "Update Fields" ) ); m_removeExtraBox->SetLabel( _( "Remove fields if not in new symbol" ) ); m_resetEmptyFields->SetLabel( _( "Reset fields if empty in new symbol" ) ); @@ -148,18 +74,53 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO m_resetPinTextVisibility->SetLabel( _( "Update pin name/number visibilities" ) ); m_resetAlternatePin->SetLabel( _( "Reset alternate pin functions" ) ); m_resetCustomPower->SetLabel( _( "Reset custom power symbols" ) ); + + if( m_symbol ) + m_matchBySelection->SetLabel( _( "Change selected symbol(s)" ) ); } - m_removeExtraBox->SetValue( g_removeExtraFields[ (int) m_mode ] ); - m_resetEmptyFields->SetValue( g_resetEmptyFields[ (int) m_mode ] ); - m_resetFieldText->SetValue( g_resetFieldText[ (int) m_mode ] ); - m_resetFieldVisibilities->SetValue( g_resetFieldVisibilities[ (int) m_mode ] ); - m_resetFieldEffects->SetValue( g_resetFieldEffects[ (int) m_mode ] ); - m_resetFieldPositions->SetValue( g_resetFieldPositions[ (int) m_mode ] ); - m_resetAttributes->SetValue( g_resetAttributes[ (int) m_mode ] ); - m_resetPinTextVisibility->SetValue( g_resetPinVisibilities[ (int) m_mode ] ); - m_resetCustomPower->SetValue( g_resetCustomPower[ (int) m_mode ] ); - m_resetAlternatePin->SetValue( g_resetAlternatePins[ (int) m_mode ] ); + if( !m_symbol ) + m_matchSizer->FindItem( m_matchBySelection )->Show( false ); + + m_matchIdBrowserButton->SetBitmap( KiBitmapBundle( BITMAPS::small_library ) ); + m_newIdBrowserButton->SetBitmap( KiBitmapBundle( BITMAPS::small_library ) ); + + m_matchSizer->SetEmptyCellSize( wxSize( 0, 0 ) ); + m_matchSizer->Layout(); + + for( FIELD_T fieldId : MANDATORY_FIELDS ) + { + int listIdx = (int) m_fieldsBox->GetCount(); + + m_fieldsBox->Append( GetDefaultFieldName( fieldId, DO_TRANSLATE ) ); + + // List boxes aren't currently handled in DIALOG_SHIM's control-state-save/restore + if( fieldId == FIELD_T::REFERENCE ) + m_fieldsBox->Check( listIdx, g_selectRefDes ); + else if( fieldId == FIELD_T::VALUE ) + m_fieldsBox->Check( listIdx, g_selectValue ); + else + m_fieldsBox->Check( listIdx, true ); + + m_mandatoryFieldListIndexes[fieldId] = listIdx; + } + + updateFieldsList(); + + // initialize controls based on m_mode in case there is no saved state yet + m_removeExtraBox->SetValue( m_mode == MODE::CHANGE ? false : false ); + m_resetEmptyFields->SetValue( m_mode == MODE::CHANGE ? false : false ); + m_resetFieldText->SetValue( m_mode == MODE::CHANGE ? true : true ); + m_resetFieldVisibilities->SetValue( m_mode == MODE::CHANGE ? true : false ); + m_resetFieldEffects->SetValue( m_mode == MODE::CHANGE ? true : false ); + m_resetFieldPositions->SetValue( m_mode == MODE::CHANGE ? true : false ); + m_resetAttributes->SetValue( m_mode == MODE::CHANGE ? true : false ); + m_resetPinTextVisibility->SetValue( m_mode == MODE::CHANGE ? true : false ); + m_resetCustomPower->SetValue( m_mode == MODE::CHANGE ? false : false ); + m_resetAlternatePin->SetValue( m_mode == MODE::CHANGE ? true : false ); + + m_messagePanel->SetLazyUpdate( true ); + m_messagePanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) ); // DIALOG_SHIM needs a unique hash_key because classname is not sufficient // because the update and change versions of this dialog have different controls. @@ -175,6 +136,28 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO } +bool DIALOG_CHANGE_SYMBOLS::TransferDataToWindow() +{ + if( m_symbol ) + { + SCH_SHEET_PATH* currentSheet = &m_symbol->Schematic()->CurrentSheet(); + + m_specifiedReference->ChangeValue( m_symbol->GetRef( currentSheet ) ); + m_specifiedValue->ChangeValue( UnescapeString( m_symbol->GetField( FIELD_T::VALUE )->GetText() ) ); + m_specifiedId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) ); + } + + if( m_symbol && m_symbol->IsSelected() ) + m_matchBySelection->SetValue( true ); + else if( m_mode == MODE::UPDATE ) + m_matchAll->SetValue( true ); + else + m_matchByReference->SetValue( true ); + + return true; +} + + void DIALOG_CHANGE_SYMBOLS::onMatchByAll( wxCommandEvent& aEvent ) { updateFieldsList(); @@ -231,19 +214,9 @@ void DIALOG_CHANGE_SYMBOLS::onNewLibIDKillFocus( wxFocusEvent& event ) DIALOG_CHANGE_SYMBOLS::~DIALOG_CHANGE_SYMBOLS() { + // List boxes aren't currently handled in DIALOG_SHIM's control-state-save/restore g_selectRefDes = m_fieldsBox->IsChecked( m_mandatoryFieldListIndexes[FIELD_T::REFERENCE] ); g_selectValue = m_fieldsBox->IsChecked( m_mandatoryFieldListIndexes[FIELD_T::VALUE] ); - - g_removeExtraFields[ (int) m_mode ] = m_removeExtraBox->GetValue(); - g_resetEmptyFields[ (int) m_mode ] = m_resetEmptyFields->GetValue(); - g_resetFieldText[ (int) m_mode ] = m_resetFieldText->GetValue(); - g_resetFieldVisibilities[ (int) m_mode ] = m_resetFieldVisibilities->GetValue(); - g_resetFieldEffects[ (int) m_mode ] = m_resetFieldEffects->GetValue(); - g_resetFieldPositions[ (int) m_mode ] = m_resetFieldPositions->GetValue(); - g_resetAttributes[ (int) m_mode ] = m_resetAttributes->GetValue(); - g_resetPinVisibilities[ (int) m_mode ] = m_resetPinTextVisibility->GetValue(); - g_resetCustomPower[ (int) m_mode ] = m_resetCustomPower->GetValue(); - g_resetAlternatePins[ (int) m_mode ] = m_resetAlternatePin->GetValue(); } @@ -577,8 +550,7 @@ int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCH_COMMIT* aCommit ) if( symbols.size() > 0 ) matchesProcessed += processSymbols( aCommit, symbols ); else - m_messagePanel->Report( _( "*** No symbols matching criteria found ***" ), - RPT_SEVERITY_ERROR ); + m_messagePanel->Report( _( "*** No symbols matching criteria found ***" ), RPT_SEVERITY_ERROR ); frame->GetCurrentSheet().UpdateAllScreenReferences(); @@ -586,8 +558,7 @@ int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCH_COMMIT* aCommit ) } -int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit, - const std::map& aSymbols ) { wxCHECK( !aSymbols.empty(), 0 ); @@ -828,9 +799,12 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit, // name which causes library symbol comparison errors. Clear the alternate pin // name in this case even if the reset option is not checked. Also clear the // alternate pin name if it no longer exists in the alternate pin map. - if( m_resetAlternatePin->IsChecked() || ( pin->GetAlt() == pin->GetBaseName() ) + if( m_resetAlternatePin->IsChecked() + || ( pin->GetAlt() == pin->GetBaseName() ) || ( pin->GetAlternates().count( pin->GetAlt() ) == 0 ) ) + { pin->SetAlt( wxEmptyString ); + } } } } @@ -847,15 +821,13 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit, } -wxString DIALOG_CHANGE_SYMBOLS::getSymbolReferences( SCH_SYMBOL& aSymbol, - const LIB_ID& aNewId, +wxString DIALOG_CHANGE_SYMBOLS::getSymbolReferences( SCH_SYMBOL& aSymbol, const LIB_ID& aNewId, const wxString* aOldLibLinkName ) { - wxString msg; - wxString references; + wxString msg; + wxString references; const LIB_ID& oldId = aSymbol.GetLibId(); - - wxString oldLibLinkName; // For report + wxString oldLibLinkName; // For report if( aOldLibLinkName ) oldLibLinkName = *aOldLibLinkName; diff --git a/eeschema/dialogs/dialog_change_symbols.h b/eeschema/dialogs/dialog_change_symbols.h index f5ace2973b..e07ba313f4 100644 --- a/eeschema/dialogs/dialog_change_symbols.h +++ b/eeschema/dialogs/dialog_change_symbols.h @@ -20,8 +20,7 @@ * with this program. If not, see . */ -#ifndef _DIALOG_CHANGE_SYMBOLS_H_ -#define _DIALOG_CHANGE_SYMBOLS_H_ +#pragma once #include @@ -51,10 +50,11 @@ class DIALOG_CHANGE_SYMBOLS : public DIALOG_CHANGE_SYMBOLS_BASE public: enum class MODE { CHANGE = 0, UPDATE }; - DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBOL* aSymbol, - MODE aMode = MODE::UPDATE ); + DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBOL* aSymbol, MODE aMode = MODE::UPDATE ); ~DIALOG_CHANGE_SYMBOLS() override; + bool TransferDataToWindow() override; + protected: void launchMatchIdSymbolBrowser( wxCommandEvent& aEvent ) override; void launchNewIdSymbolBrowser( wxCommandEvent& aEvent ) override; @@ -92,13 +92,11 @@ protected: void selectAll( bool aSelect ); void checkAll( bool aCheck ); -private: void updateFieldsList(); bool isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInstance ); int processMatchingSymbols( SCH_COMMIT* aCommit ); - int processSymbols( SCH_COMMIT* aCommit, - const std::map& aSymbols ); + int processSymbols( SCH_COMMIT* aCommit, const std::map& aSymbols ); wxString getSymbolReferences( SCH_SYMBOL& aSymbol, const LIB_ID& aNewId, const wxString* aOldLibLinkName = nullptr ); @@ -112,5 +110,3 @@ private: /// Index in the list control for each mandatory FIELD_T type std::map m_mandatoryFieldListIndexes; }; - -#endif // _DIALOG_CHANGE_SYMBOLS_H_ diff --git a/eeschema/dialogs/dialog_eeschema_page_settings.cpp b/eeschema/dialogs/dialog_eeschema_page_settings.cpp index 9310b2104d..34edf885d2 100644 --- a/eeschema/dialogs/dialog_eeschema_page_settings.cpp +++ b/eeschema/dialogs/dialog_eeschema_page_settings.cpp @@ -18,7 +18,6 @@ */ #include "dialog_eeschema_page_settings.h" - #include #include #include @@ -26,6 +25,7 @@ #include #include + DIALOG_EESCHEMA_PAGE_SETTINGS::DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent, EMBEDDED_FILES* aEmbeddedFiles, VECTOR2I aMaxUserSizeMils ) : @@ -84,8 +84,6 @@ DIALOG_EESCHEMA_PAGE_SETTINGS::~DIALOG_EESCHEMA_PAGE_SETTINGS() void DIALOG_EESCHEMA_PAGE_SETTINGS::onTransferDataToWindow() { - wxString msg; - m_TextSheetCount->Show( true ); m_TextSheetNumber->Show( true ); m_PaperExport->Show( true ); @@ -104,44 +102,26 @@ void DIALOG_EESCHEMA_PAGE_SETTINGS::onTransferDataToWindow() m_Comment9Export->Show( true ); // Init display value for schematic sub-sheet number - wxString format = m_TextSheetCount->GetLabel(); - msg.Printf( format, m_screen->GetPageCount() ); - m_TextSheetCount->SetLabel( msg ); - - format = m_TextSheetNumber->GetLabel(); - msg.Printf( format, m_screen->GetVirtualPageNumber() ); - m_TextSheetNumber->SetLabel( msg ); + m_TextSheetCount->SetLabel( wxString::Format( m_TextSheetCount->GetLabel(), m_screen->GetPageCount() ) ); + m_TextSheetNumber->SetLabel( wxString::Format( m_TextSheetNumber->GetLabel(), m_screen->GetVirtualPageNumber() ) ); EESCHEMA_SETTINGS* cfg = dynamic_cast( Kiface().KifaceSettings() ); wxCHECK( cfg, /* void */ ); m_PaperExport->SetValue( cfg->m_PageSettings.export_paper ); - m_RevisionExport->SetValue( - m_TextRevision->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_revision ); - m_DateExport->SetValue( m_TextDate->GetValue().IsEmpty() ? false - : cfg->m_PageSettings.export_date ); - m_TitleExport->SetValue( m_TextTitle->GetValue().IsEmpty() ? false - : cfg->m_PageSettings.export_title ); - m_CompanyExport->SetValue( - m_TextCompany->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_company ); - m_Comment1Export->SetValue( - m_TextComment1->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment1 ); - m_Comment2Export->SetValue( - m_TextComment2->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment2 ); - m_Comment3Export->SetValue( - m_TextComment3->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment3 ); - m_Comment4Export->SetValue( - m_TextComment4->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment4 ); - m_Comment5Export->SetValue( - m_TextComment5->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment5 ); - m_Comment6Export->SetValue( - m_TextComment6->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment6 ); - m_Comment7Export->SetValue( - m_TextComment7->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment7 ); - m_Comment8Export->SetValue( - m_TextComment8->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment8 ); - m_Comment9Export->SetValue( - m_TextComment9->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment9 ); + m_RevisionExport->SetValue( m_TextRevision->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_revision ); + m_DateExport->SetValue( m_TextDate->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_date ); + m_TitleExport->SetValue( m_TextTitle->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_title ); + m_CompanyExport->SetValue( m_TextCompany->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_company ); + m_Comment1Export->SetValue( m_TextComment1->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment1 ); + m_Comment2Export->SetValue( m_TextComment2->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment2 ); + m_Comment3Export->SetValue( m_TextComment3->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment3 ); + m_Comment4Export->SetValue( m_TextComment4->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment4 ); + m_Comment5Export->SetValue( m_TextComment5->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment5 ); + m_Comment6Export->SetValue( m_TextComment6->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment6 ); + m_Comment7Export->SetValue( m_TextComment7->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment7 ); + m_Comment8Export->SetValue( m_TextComment8->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment8 ); + m_Comment9Export->SetValue( m_TextComment9->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment9 ); } diff --git a/eeschema/dialogs/dialog_eeschema_page_settings.h b/eeschema/dialogs/dialog_eeschema_page_settings.h index 868dad6864..a417ff9281 100644 --- a/eeschema/dialogs/dialog_eeschema_page_settings.h +++ b/eeschema/dialogs/dialog_eeschema_page_settings.h @@ -17,8 +17,7 @@ * with this program. If not, see . */ -#ifndef DIALOG_EESCHEMA_PAGE_SETTINGS_H -#define DIALOG_EESCHEMA_PAGE_SETTINGS_H +#pragma once #include @@ -36,5 +35,3 @@ private: void onTransferDataToWindow() override; bool onSavePageSettings() override; }; - -#endif // DIALOG_PCBNEW_PAGE_SETTINGS diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index e900c4663a..e6c6f75067 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -49,24 +48,13 @@ #define ID_MATCH_FP_VAL 4203 #define ID_MATCH_FP_ID 4204 - int g_matchModeForUpdate = ID_MATCH_FP_ALL; int g_matchModeForUpdateSelected = ID_MATCH_FP_SELECTED; int g_matchModeForExchange = ID_MATCH_FP_REF; int g_matchModeForExchangeSelected = ID_MATCH_FP_SELECTED; - // { update, change } -bool g_removeExtraTextItems[2] = { false, false }; -bool g_resetTextItemLayers[2] = { false, true }; -bool g_resetTextItemEffects[2] = { false, true }; -bool g_resetTextItemContent[2] = { false, true }; -bool g_resetFabricationAttrs[2] = { false, true }; -bool g_resetClearanceOverrides[2] = { true, true }; -bool g_reset3DModels[2] = { true, true }; - -DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, - FOOTPRINT* aFootprint, +DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, FOOTPRINT* aFootprint, bool updateMode, bool selectedMode ) : DIALOG_EXCHANGE_FOOTPRINTS_BASE( aParent ), m_commit( aParent ), @@ -98,63 +86,35 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, #endif if( m_updateMode ) - { m_changeSizer->Show( false ); - } else - { m_upperSizer->FindItem( m_matchAll )->Show( false ); - m_newIDBrowseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_library ) ); - } - if( m_currentFootprint ) - m_newID->AppendText( From_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) ); - else + if( !m_currentFootprint ) m_upperSizer->FindItem( m_matchSelected )->Show( false ); - // Use ChangeValue() instead of SetValue() so we don't generate events. - if( m_currentFootprint ) - m_specifiedRef->ChangeValue( m_currentFootprint->GetReference() ); - - if( m_currentFootprint ) - m_specifiedValue->ChangeValue( m_currentFootprint->GetValue() ); - - if( m_currentFootprint ) - m_specifiedID->ChangeValue( From_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) ); - + m_newIDBrowseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_library ) ); m_specifiedIDBrowseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_library ) ); m_upperSizer->SetEmptyCellSize( wxSize( 0, 0 ) ); // The upper sizer has its content modified: re-layout it: m_upperSizer->Layout(); + // initialize controls based on update mode in case there is no saved state yet + m_removeExtraBox->SetValue( m_updateMode ? false : false ); + m_resetTextItemLayers->SetValue( m_updateMode ? false : true ); + m_resetTextItemEffects->SetValue( m_updateMode ? false : true ); + m_resetTextItemContent->SetValue( m_updateMode ? false : true ); + m_resetFabricationAttrs->SetValue( m_updateMode ? false : true ); + m_resetClearanceOverrides->SetValue( m_updateMode ? true : true ); + m_reset3DModels->SetValue( m_updateMode ? true : true ); + // initialize match-mode if( m_updateMode ) m_matchMode = selectedMode ? &g_matchModeForUpdateSelected : &g_matchModeForUpdate; else m_matchMode = selectedMode ? &g_matchModeForExchangeSelected : &g_matchModeForExchange; - wxCommandEvent event; - event.SetEventObject( this ); - - switch( *m_matchMode ) - { - case ID_MATCH_FP_ALL: OnMatchAllClicked( event ); break; - case ID_MATCH_FP_SELECTED: OnMatchSelectedClicked( event ); break; - case ID_MATCH_FP_REF: OnMatchRefClicked( event ); break; - case ID_MATCH_FP_VAL: OnMatchValueClicked( event ); break; - case ID_MATCH_FP_ID: OnMatchIDClicked( event ); break; - default: break; - } - - m_removeExtraBox->SetValue( g_removeExtraTextItems[ m_updateMode ? 0 : 1 ] ); - m_resetTextItemLayers->SetValue( g_resetTextItemLayers[ m_updateMode ? 0 : 1 ] ); - m_resetTextItemEffects->SetValue( g_resetTextItemEffects[ m_updateMode ? 0 : 1 ] ); - m_resetTextItemContent->SetValue( g_resetTextItemContent[ m_updateMode ? 0 : 1 ] ); - m_resetFabricationAttrs->SetValue( g_resetFabricationAttrs[ m_updateMode ? 0 : 1 ] ); - m_resetClearanceOverrides->SetValue( g_resetClearanceOverrides[ m_updateMode ? 0 : 1 ] ); - m_reset3DModels->SetValue( g_reset3DModels[ m_updateMode ? 0 : 1 ] ); - m_MessageWindow->SetLazyUpdate( true ); m_MessageWindow->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) ); @@ -172,15 +132,32 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, } -DIALOG_EXCHANGE_FOOTPRINTS::~DIALOG_EXCHANGE_FOOTPRINTS() +bool DIALOG_EXCHANGE_FOOTPRINTS::TransferDataToWindow() { - g_removeExtraTextItems[ m_updateMode ? 0 : 1 ] = m_removeExtraBox->GetValue(); - g_resetTextItemLayers[ m_updateMode ? 0 : 1 ] = m_resetTextItemLayers->GetValue(); - g_resetTextItemEffects[ m_updateMode ? 0 : 1 ] = m_resetTextItemEffects->GetValue(); - g_resetTextItemContent[ m_updateMode ? 0 : 1 ] = m_resetTextItemContent->GetValue(); - g_resetFabricationAttrs[ m_updateMode ? 0 : 1 ] = m_resetFabricationAttrs->GetValue(); - g_resetClearanceOverrides[ m_updateMode ? 0 : 1 ] = m_resetClearanceOverrides->GetValue(); - g_reset3DModels[ m_updateMode ? 0 : 1 ] = m_reset3DModels->GetValue(); + if( m_currentFootprint ) + { + m_newID->AppendText( From_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) ); + + // Use ChangeValue() instead of SetValue() so we don't generate events. + m_specifiedRef->ChangeValue( m_currentFootprint->GetReference() ); + m_specifiedValue->ChangeValue( m_currentFootprint->GetValue() ); + m_specifiedID->ChangeValue( From_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) ); + } + + wxCommandEvent event; + event.SetEventObject( this ); + + switch( *m_matchMode ) + { + case ID_MATCH_FP_ALL: OnMatchAllClicked( event ); break; + case ID_MATCH_FP_SELECTED: OnMatchSelectedClicked( event ); break; + case ID_MATCH_FP_REF: OnMatchRefClicked( event ); break; + case ID_MATCH_FP_VAL: OnMatchValueClicked( event ); break; + case ID_MATCH_FP_ID: OnMatchIDClicked( event ); break; + default: break; + } + + return true; } diff --git a/pcbnew/dialogs/dialog_exchange_footprints.h b/pcbnew/dialogs/dialog_exchange_footprints.h index 0c392e7fb7..4418004b07 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.h +++ b/pcbnew/dialogs/dialog_exchange_footprints.h @@ -38,7 +38,9 @@ class DIALOG_EXCHANGE_FOOTPRINTS : public DIALOG_EXCHANGE_FOOTPRINTS_BASE public: DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, FOOTPRINT* aFootprint, bool updateMode, bool selectedMode ); - ~DIALOG_EXCHANGE_FOOTPRINTS() override; + ~DIALOG_EXCHANGE_FOOTPRINTS() = default; + + bool TransferDataToWindow() override; private: void updateMatchModeRadioButtons( wxUpdateUIEvent& aEvent ) override;