diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp index 148976b23e..be68d80490 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -60,6 +60,7 @@ enum }; +static wxString g_textAndGraphicsReferenceFilter; static wxString g_textAndGraphicsFootprintFilter; @@ -83,6 +84,10 @@ protected: { m_layerFilterOpt->SetValue( true ); } + void OnReferenceFilterText( wxCommandEvent& event ) override + { + m_referenceFilterOpt->SetValue( true ); + } void OnFootprintFilterText( wxCommandEvent& event ) override { m_footprintFilterOpt->SetValue( true ); @@ -127,6 +132,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS() { + g_textAndGraphicsReferenceFilter = m_referenceFilter->GetValue(); g_textAndGraphicsFootprintFilter = m_footprintFilter->GetValue(); } @@ -134,6 +140,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS() bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow() { // SetValue() generates events, ChangeValue() does not + m_referenceFilter->ChangeValue( g_textAndGraphicsReferenceFilter ); m_footprintFilter->ChangeValue( g_textAndGraphicsFootprintFilter ); m_lineWidth.SetValue( INDETERMINATE ); @@ -280,13 +287,24 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOA return; } + if( m_referenceFilterOpt->GetValue() && !m_referenceFilter->GetValue().IsEmpty() ) + { + MODULE* module = dynamic_cast( aItem->GetParent() ); + + if( module ) + { + if( !WildCompareString( m_referenceFilter->GetValue(), module->GetReference(), false ) ) + return; + } + } + if( m_footprintFilterOpt->GetValue() && !m_footprintFilter->GetValue().IsEmpty() ) { MODULE* module = dynamic_cast( aItem->GetParent() ); if( module ) { - if( !WildCompareString( m_footprintFilter->GetValue(), module->GetReference(), false ) ) + if( !WildCompareString( m_footprintFilter->GetValue(), module->GetFPID().Format(), false ) ) return; } } diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.cpp index 4c97847263..a7a62c2029 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.cpp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.cpp @@ -71,13 +71,22 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_ fgSizer2->Add( m_layerFilter, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT, 5 ); - fgSizer2->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 100 ); + fgSizer2->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 60 ); - m_footprintFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by parent footprint:"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer2->Add( m_footprintFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_referenceFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by parent footprint reference:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer2->Add( m_referenceFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_referenceFilter = new wxTextCtrl( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer2->Add( m_referenceFilter, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxLEFT, 5 ); + + + fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_footprintFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by parent footprint identifier:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer2->Add( m_footprintFilterOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_footprintFilter = new wxTextCtrl( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer2->Add( m_footprintFilter, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxLEFT, 5 ); + fgSizer2->Add( m_footprintFilter, 0, wxEXPAND|wxBOTTOM|wxLEFT, 5 ); fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -271,6 +280,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_ // Connect Events this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnUpdateUI ) ); m_layerFilter->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnLayerFilterSelect ), NULL, this ); + m_referenceFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnReferenceFilterText ), NULL, this ); m_footprintFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnFootprintFilterText ), NULL, this ); m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnSizeNetclassGrid ), NULL, this ); } @@ -280,6 +290,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS // Disconnect Events this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnUpdateUI ) ); m_layerFilter->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnLayerFilterSelect ), NULL, this ); + m_referenceFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnReferenceFilterText ), NULL, this ); m_footprintFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnFootprintFilterText ), NULL, this ); m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnSizeNetclassGrid ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.fbp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.fbp index 65f385e91b..172b965420 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.fbp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.fbp @@ -873,7 +873,7 @@ - 100 + 60 wxEXPAND|wxRIGHT|wxLEFT 0 @@ -915,7 +915,196 @@ 0 0 wxID_ANY - Filter items by parent footprint: + Filter items by parent footprint reference: + + 0 + + + 0 + + 1 + m_referenceFilterOpt + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_referenceFilter + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnReferenceFilterText + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Filter items by parent footprint identifier: 0 @@ -970,11 +1159,11 @@ - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxLEFT + wxEXPAND|wxBOTTOM|wxLEFT 0 - + 1 1 1 diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.h b/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.h index 2a3ceb0f01..8b107691e2 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.h +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics_base.h @@ -52,6 +52,8 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM wxCheckBox* m_footprintGraphics; wxCheckBox* m_layerFilterOpt; PCB_LAYER_BOX_SELECTOR* m_layerFilter; + wxCheckBox* m_referenceFilterOpt; + wxTextCtrl* m_referenceFilter; wxCheckBox* m_footprintFilterOpt; wxTextCtrl* m_footprintFilter; wxRadioButton* m_setToSpecifiedValues; @@ -82,6 +84,7 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnLayerFilterSelect( wxCommandEvent& event ) { event.Skip(); } + virtual void OnReferenceFilterText( wxCommandEvent& event ) { event.Skip(); } virtual void OnFootprintFilterText( wxCommandEvent& event ) { event.Skip(); } virtual void OnSizeNetclassGrid( wxSizeEvent& event ) { event.Skip(); }