diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp b/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp index 21cca12aa6..72fbbefade 100644 --- a/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp @@ -71,12 +71,7 @@ public: private: void initDialog(); - // event handlers - void OnOKClick( wxCommandEvent& event ) override; - void OnCancelClick( wxCommandEvent& event ) override - { - EndModal( wxID_CANCEL ); - } + bool TransferDataFromWindow() override; }; bool DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_refSelection = false; @@ -110,7 +105,7 @@ void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::initDialog() } -void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::OnOKClick( wxCommandEvent& event ) +bool DIALOG_GLOBAL_MODULES_FIELDS_EDITION::TransferDataFromWindow() { m_refSelection = m_ReferenceOpt->GetValue(); m_valueSelection = m_ValueOpt->GetValue(); @@ -122,14 +117,14 @@ void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::OnOKClick( wxCommandEvent& event ) m_brdSettings->m_ModuleTextWidth = ValueFromTextCtrl( *m_ThicknessValue ); // clip m_ModuleTextWidth to the 1/4 of min size, to keep it always readable - int minsize = std::min( m_brdSettings->m_ModuleTextSize.x, + int max_thickness = std::min( m_brdSettings->m_ModuleTextSize.x, m_brdSettings->m_ModuleTextSize.y ) / 4; - if( m_brdSettings->m_ModuleTextWidth > minsize ) - m_brdSettings->m_ModuleTextWidth = minsize; + if( m_brdSettings->m_ModuleTextWidth > max_thickness ) + m_brdSettings->m_ModuleTextWidth = max_thickness; m_parent->ResetModuleTextSizes( m_filterString, m_refSelection, m_valueSelection, m_othersSelection ); - EndModal( wxID_OK ); + return true; } @@ -146,11 +141,12 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, int modTextWidth = GetDesignSettings().m_ModuleTextWidth; const wxSize& modTextSize = GetDesignSettings().m_ModuleTextSize; + bool modified = false; - // Prepare undo list + // Change fields of footprints with fpid matching the filter for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() ) { - if( ! aFilter.IsEmpty() ) + if( !aFilter.IsEmpty() ) { if( ! WildCompareString( aFilter, FROM_UTF8( module->GetFPID().Format().c_str() ), false ) ) @@ -168,6 +164,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, commit.Modify( item ); item->SetThickness( modTextWidth ); item->SetTextSize( modTextSize ); + modified = true; } } @@ -181,6 +178,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, commit.Modify( item ); item->SetThickness( modTextWidth ); item->SetTextSize( modTextSize ); + modified = true; } } @@ -199,11 +197,16 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, commit.Modify( item ); item->SetThickness( modTextWidth ); item->SetTextSize( modTextSize ); + modified = true; } } } } } - commit.Push( wxT( "Reset module text size" ) ); + if( modified ) + { + commit.Push( "Reset module text size" ); + GetCanvas()->Refresh(); + } } diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp index ea999d3236..80af310b52 100644 --- a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 1 2016) +// C++ code generated with wxFormBuilder (version May 6 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -37,7 +37,7 @@ DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::DIALOG_GLOBAL_MODULES_FIELDS_EDITION_ bLeftSizer->Add( sbSizer1, 1, wxBOTTOM|wxEXPAND|wxRIGHT, 5 ); - m_staticTextFilter = new wxStaticText( this, wxID_ANY, _("Footprint Filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextFilter = new wxStaticText( this, wxID_ANY, _("Footprint Name (FPID) Filter:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextFilter->Wrap( -1 ); m_staticTextFilter->SetToolTip( _("A string to filter footprints to edit.\nIf not void, footprint names should match this filter.\nA filter can be something like SM* (case insensitive)") ); @@ -124,14 +124,12 @@ DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::DIALOG_GLOBAL_MODULES_FIELDS_EDITION_ bMainSizer->Fit( this ); // Connect Events - m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnCancelClick ), NULL, this ); m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnOKClick ), NULL, this ); } DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::~DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE() { // Disconnect Events - m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnCancelClick ), NULL, this ); m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnOKClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp index ee0727cac7..da7313eced 100644 --- a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp @@ -121,6 +121,7 @@ sbSizer1 wxVERTICAL + 1 none @@ -421,7 +422,7 @@ 0 0 wxID_ANY - Footprint Filter: + Footprint Name (FPID) Filter: 0 @@ -584,6 +585,7 @@ sbSizerSettings wxVERTICAL + 1 none @@ -1479,11 +1481,11 @@ m_sdbSizerButtons protected - OnCancelClick + - OnOKClick + diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h index 230f2504ff..1f015fde69 100644 --- a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 1 2016) +// C++ code generated with wxFormBuilder (version May 6 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -59,7 +59,6 @@ class DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE : public DIALOG_SHIM wxButton* m_sdbSizerButtonsCancel; // Virtual event handlers, overide them in your derived class - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }