diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp index 0fa9fee04a..1ef1b45a23 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -55,6 +55,8 @@ static bool g_filterByReference; static wxString g_referenceFilter; static bool g_filterBySymbol; static wxString g_symbolFilter; +static bool g_filterByType; +static bool g_typeFilterIsPower; static bool g_filterByNet; static wxString g_netFilter; @@ -130,6 +132,8 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS() g_referenceFilter = m_referenceFilter->GetValue(); g_filterBySymbol = m_symbolFilterOpt->GetValue(); g_symbolFilter = m_symbolFilter->GetValue(); + g_filterByType = m_typeFilterOpt->GetValue(); + g_typeFilterIsPower = m_typeFilter->GetSelection() == 1; g_filterByNet = m_netFilterOpt->GetValue(); g_netFilter = m_netFilter->GetValue(); } @@ -160,6 +164,8 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow() m_referenceFilterOpt->SetValue( g_filterByReference ); m_symbolFilter->ChangeValue( g_symbolFilter ); m_symbolFilterOpt->SetValue( g_filterBySymbol ); + m_typeFilter->SetSelection( g_typeFilterIsPower ? 1 : 0 ); + m_typeFilterOpt->SetValue( g_filterByType ); if( g_filterByNet && !g_netFilter.IsEmpty() ) { @@ -319,6 +325,17 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe } } + if( m_typeFilterOpt->GetValue() ) + { + if( aItem->Type() == SCH_COMPONENT_T ) + { + bool isPower = static_cast( aItem )->GetPartRef()->IsPower(); + + if( isPower != ( m_typeFilter->GetSelection() == 1 ) ) + return; + } + } + static KICAD_T wireTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LABEL_LOCATE_WIRE_T, EOT }; static KICAD_T busTypes[] = { SCH_LINE_LOCATE_BUS_T, SCH_LABEL_LOCATE_BUS_T, EOT }; static KICAD_T schTextAndGraphics[] = { SCH_TEXT_T, SCH_LINE_LOCATE_GRAPHIC_LINE_T, EOT }; diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.cpp b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.cpp index 1f46a35930..241bda8697 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.cpp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.cpp @@ -100,11 +100,20 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_ fgSizer2->Add( m_referenceFilter, 0, wxEXPAND|wxLEFT, 5 ); m_symbolFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by parent symbol library id:"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer2->Add( m_symbolFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + fgSizer2->Add( m_symbolFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_symbolFilter = new wxTextCtrl( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer2->Add( m_symbolFilter, 0, wxEXPAND|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + m_typeFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by parent symbol type:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer2->Add( m_typeFilterOpt, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_typeFilterChoices[] = { _("Non-power symbols"), _("Power symbols") }; + int m_typeFilterNChoices = sizeof( m_typeFilterChoices ) / sizeof( wxString ); + m_typeFilter = new wxChoice( sbFilters->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_typeFilterNChoices, m_typeFilterChoices, 0 ); + m_typeFilter->SetSelection( 0 ); + fgSizer2->Add( m_typeFilter, 0, wxRIGHT|wxLEFT|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer2->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.fbp b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.fbp index 739dead29c..7002d71c62 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.fbp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.fbp @@ -1188,7 +1188,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 1 @@ -1315,6 +1315,134 @@ OnSymbolFilterText + + 5 + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Filter items by parent symbol type: + + 0 + + + 0 + + 1 + m_typeFilterOpt + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxRIGHT|wxLEFT|wxEXPAND|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Non-power symbols" "Power symbols" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_typeFilter + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxEXPAND|wxTOP|wxBOTTOM diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.h b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.h index 2caaa72991..a42b43b20e 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.h +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.h @@ -21,8 +21,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -57,6 +57,8 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM wxTextCtrl* m_referenceFilter; wxCheckBox* m_symbolFilterOpt; wxTextCtrl* m_symbolFilter; + wxCheckBox* m_typeFilterOpt; + wxChoice* m_typeFilter; wxCheckBox* m_netFilterOpt; wxTextCtrl* m_netFilter; wxPanel* m_specifiedValues;