From 8d0f31f6f4585618167d74e66c7e8fd3cea60a24 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 12 Jan 2020 20:52:19 +0000 Subject: [PATCH] Clean a bunch of legacy code out of the Filter Selection dialog. --- pcbnew/dialogs/dialog_filter_selection.cpp | 35 +- pcbnew/dialogs/dialog_filter_selection.h | 29 +- .../dialogs/dialog_filter_selection_base.cpp | 138 +- .../dialogs/dialog_filter_selection_base.fbp | 1640 ++++++----------- pcbnew/dialogs/dialog_filter_selection_base.h | 31 +- pcbnew/tools/selection_tool.cpp | 36 +- qa/qa_utils/mocks.cpp | 28 +- 7 files changed, 698 insertions(+), 1239 deletions(-) diff --git a/pcbnew/dialogs/dialog_filter_selection.cpp b/pcbnew/dialogs/dialog_filter_selection.cpp index 8bc4a133e1..001e96dbdb 100644 --- a/pcbnew/dialogs/dialog_filter_selection.cpp +++ b/pcbnew/dialogs/dialog_filter_selection.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,25 +21,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - #include - #include -DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, - OPTIONS& aOptions, bool aShowLegacyOptions, - const wxString& aTitle ) : - DIALOG_BLOCK_OPTIONS_BASE( aParent, -1, aTitle ), +DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, OPTIONS& aOptions ) : + DIALOG_FILTER_SELECTION_BASE( aParent ), m_options( aOptions ) { - if( !aShowLegacyOptions ) - { - m_DrawBlockItems->Hide(); - m_checkBoxIncludeInvisible->Hide(); - m_staticline1->Hide(); - } - m_Include_Modules->SetValue( m_options.includeModules ); m_IncludeLockedModules->SetValue( m_options.includeLockedModules ); @@ -54,8 +43,6 @@ DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, m_Include_Draw_Items->SetValue( m_options.includeItemsOnTechLayers ); m_Include_Edges_Items->SetValue( m_options.includeBoardOutlineLayer ); m_Include_PcbTextes->SetValue( m_options.includePcbTexts ); - m_DrawBlockItems->SetValue( m_options.drawItems ); - m_checkBoxIncludeInvisible->SetValue( m_options.includeItemsOnInvisibleLayers ); m_sdbSizer1OK->SetDefault(); SetFocus(); @@ -75,16 +62,14 @@ void DIALOG_FILTER_SELECTION::checkBoxClicked( wxCommandEvent& aEvent ) void DIALOG_FILTER_SELECTION::ExecuteCommand( wxCommandEvent& event ) { - m_options.includeModules = m_Include_Modules->GetValue(); - m_options.includeLockedModules = m_IncludeLockedModules->GetValue(); - m_options.includeTracks = m_Include_Tracks->GetValue(); - m_options.includeVias = m_Include_Vias->GetValue(); - m_options.includeZones = m_Include_Zones->GetValue(); - m_options.includeItemsOnTechLayers = m_Include_Draw_Items->GetValue(); + m_options.includeModules = m_Include_Modules->GetValue(); + m_options.includeLockedModules = m_IncludeLockedModules->GetValue(); + m_options.includeTracks = m_Include_Tracks->GetValue(); + m_options.includeVias = m_Include_Vias->GetValue(); + m_options.includeZones = m_Include_Zones->GetValue(); + m_options.includeItemsOnTechLayers = m_Include_Draw_Items->GetValue(); m_options.includeBoardOutlineLayer = m_Include_Edges_Items->GetValue(); - m_options.includePcbTexts = m_Include_PcbTextes->GetValue(); - m_options.drawItems = m_DrawBlockItems->GetValue(); - m_options.includeItemsOnInvisibleLayers = m_checkBoxIncludeInvisible->GetValue(); + m_options.includePcbTexts = m_Include_PcbTextes->GetValue(); EndModal( wxID_OK ); } diff --git a/pcbnew/dialogs/dialog_filter_selection.h b/pcbnew/dialogs/dialog_filter_selection.h index f64dbd5007..2cf00bcc82 100644 --- a/pcbnew/dialogs/dialog_filter_selection.h +++ b/pcbnew/dialogs/dialog_filter_selection.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,31 +28,26 @@ class PCB_BASE_FRAME; -class DIALOG_FILTER_SELECTION : public DIALOG_BLOCK_OPTIONS_BASE +class DIALOG_FILTER_SELECTION : public DIALOG_FILTER_SELECTION_BASE { public: /** - * Struct that will be set with the result of the user choices - * in the dialog + * Struct that will be set with the result of the user choices in the dialog */ struct OPTIONS { - bool includeModules = true; - bool includeLockedModules = true; - bool includeTracks = true; - bool includeVias = true; - bool includeZones = true; - bool includeItemsOnTechLayers = true; + bool includeModules = true; + bool includeLockedModules = true; + bool includeTracks = true; + bool includeVias = true; + bool includeZones = true; + bool includeItemsOnTechLayers = true; bool includeBoardOutlineLayer = true; - bool includePcbTexts = true; - bool drawItems = true; - bool includeItemsOnInvisibleLayers = false; + bool includePcbTexts = true; }; - DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, OPTIONS& aOptions, - bool aShowLegacyOptions, - const wxString& aTitle ); + DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, OPTIONS& aOptions ); ~DIALOG_FILTER_SELECTION() { @@ -72,4 +67,4 @@ private: OPTIONS& m_options; }; -#endif // DIALOG_EXCHANGE_MODULES_H_ +#endif // DIALOG_FILTER_SELECTION_H diff --git a/pcbnew/dialogs/dialog_filter_selection_base.cpp b/pcbnew/dialogs/dialog_filter_selection_base.cpp index 4dd2c30393..08d6edfc09 100644 --- a/pcbnew/dialogs/dialog_filter_selection_base.cpp +++ b/pcbnew/dialogs/dialog_filter_selection_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -9,117 +9,87 @@ /////////////////////////////////////////////////////////////////////////// -DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +DIALOG_FILTER_SELECTION_BASE::DIALOG_FILTER_SELECTION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - + wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer1; - sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); - - wxFlexGridSizer* fgSizer1; - fgSizer1 = new wxFlexGridSizer( 3, 1, 0, 0 ); - fgSizer1->SetFlexibleDirection( wxBOTH ); - fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + wxGridSizer* gSizer1; gSizer1 = new wxGridSizer( 4, 2, 3, 3 ); - - m_Include_Modules = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include &footprints"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Include_Modules = new wxCheckBox( this, wxID_ANY, _("Include &footprints"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_Include_Modules, 0, 0, 5 ); - - m_Include_PcbTextes = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include t&ext items"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Include_PcbTextes = new wxCheckBox( this, wxID_ANY, _("Include t&ext items"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_Include_PcbTextes, 0, 0, 5 ); - - m_IncludeLockedModules = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include &locked footprints"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_IncludeLockedModules = new wxCheckBox( this, wxID_ANY, _("Include &locked footprints"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_IncludeLockedModules, 0, 0, 5 ); - - m_Include_Draw_Items = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include &drawings"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Include_Draw_Items = new wxCheckBox( this, wxID_ANY, _("Include &drawings"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_Include_Draw_Items, 0, 0, 5 ); - - m_Include_Tracks = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include &tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Include_Tracks = new wxCheckBox( this, wxID_ANY, _("Include &tracks"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_Include_Tracks, 0, 0, 5 ); - - m_Include_Edges_Items = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include &board outline layer"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Include_Edges_Items = new wxCheckBox( this, wxID_ANY, _("Include &board outline layer"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_Include_Edges_Items, 0, 0, 5 ); - - m_Include_Vias = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include &vias"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Include_Vias = new wxCheckBox( this, wxID_ANY, _("Include &vias"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_Include_Vias, 0, 0, 5 ); - - m_Include_Zones = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include &zones"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Include_Zones = new wxCheckBox( this, wxID_ANY, _("Include &zones"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_Include_Zones, 0, 0, 5 ); - - - fgSizer1->Add( gSizer1, 1, wxALL|wxEXPAND, 5 ); - - m_staticline1 = new wxStaticLine( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - fgSizer1->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); - - wxGridSizer* gSizer2; - gSizer2 = new wxGridSizer( 1, 2, 3, 3 ); - - m_checkBoxIncludeInvisible = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include &items on invisible layers"), wxDefaultPosition, wxDefaultSize, 0 ); - gSizer2->Add( m_checkBoxIncludeInvisible, 0, 0, 5 ); - - m_DrawBlockItems = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Draw &selected items while moving"), wxDefaultPosition, wxDefaultSize, 0 ); - gSizer2->Add( m_DrawBlockItems, 0, 0, 5 ); - - - fgSizer1->Add( gSizer2, 1, wxALL|wxEXPAND, 5 ); - - - sbSizer1->Add( fgSizer1, 1, wxEXPAND, 5 ); - - - bSizerMain->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 ); - + + + bSizerMain->Add( gSizer1, 1, wxEXPAND|wxALL, 10 ); + + m_staticLine = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticLine, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK ); m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - + bSizerMain->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); - - + + this->SetSizer( bSizerMain ); this->Layout(); bSizerMain->Fit( this ); - + this->Centre( wxBOTH ); - + // Connect Events - m_Include_Modules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_PcbTextes->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_IncludeLockedModules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Draw_Items->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Tracks->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Edges_Items->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Vias->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Zones->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_checkBoxIncludeInvisible->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_DrawBlockItems->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::OnCancel ), NULL, this ); - m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::ExecuteCommand ), NULL, this ); + m_Include_Modules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_PcbTextes->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_IncludeLockedModules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Draw_Items->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Tracks->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Edges_Items->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Vias->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Zones->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::OnCancel ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::ExecuteCommand ), NULL, this ); } -DIALOG_BLOCK_OPTIONS_BASE::~DIALOG_BLOCK_OPTIONS_BASE() +DIALOG_FILTER_SELECTION_BASE::~DIALOG_FILTER_SELECTION_BASE() { // Disconnect Events - m_Include_Modules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_PcbTextes->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_IncludeLockedModules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Draw_Items->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Tracks->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Edges_Items->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Vias->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_Include_Zones->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_checkBoxIncludeInvisible->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_DrawBlockItems->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); - m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::OnCancel ), NULL, this ); - m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::ExecuteCommand ), NULL, this ); - + m_Include_Modules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_PcbTextes->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_IncludeLockedModules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Draw_Items->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Tracks->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Edges_Items->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Vias->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_Include_Zones->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this ); + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::OnCancel ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::ExecuteCommand ), NULL, this ); + } diff --git a/pcbnew/dialogs/dialog_filter_selection_base.fbp b/pcbnew/dialogs/dialog_filter_selection_base.fbp index 5d2e4a0d92..9f7703caf4 100644 --- a/pcbnew/dialogs/dialog_filter_selection_base.fbp +++ b/pcbnew/dialogs/dialog_filter_selection_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -48,1072 +48,606 @@ -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h - + Filter Selection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizerMain wxVERTICAL none - 5 - wxALL|wxEXPAND + 10 + wxEXPAND|wxALL 1 - - wxID_ANY - Options: + + 2 + 3 - sbSizer1 - wxVERTICAL - 1 + gSizer1 none - - + 4 + 3 + 5 - wxEXPAND - 1 - - 1 - wxBOTH - - - 0 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Include &footprints + + 0 + + + 0 - fgSizer1 - wxFLEX_GROWMODE_SPECIFIED - none - 3 - 0 - - 5 - wxALL|wxEXPAND - 1 - - 2 - 3 - - gSizer1 - none - 4 - 3 - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include &footprints - - 0 - - - 0 - - 1 - m_Include_Modules - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include t&ext items - - 0 - - - 0 - - 1 - m_Include_PcbTextes - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include &locked footprints - - 0 - - - 0 - - 1 - m_IncludeLockedModules - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include &drawings - - 0 - - - 0 - - 1 - m_Include_Draw_Items - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include &tracks - - 0 - - - 0 - - 1 - m_Include_Tracks - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include &board outline layer - - 0 - - - 0 - - 1 - m_Include_Edges_Items - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include &vias - - 0 - - - 0 - - 1 - m_Include_Vias - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include &zones - - 0 - - - 0 - - 1 - m_Include_Zones - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline1 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - 2 - 3 - - gSizer2 - none - 1 - 3 - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include &items on invisible layers - - 0 - - - 0 - - 1 - m_checkBoxIncludeInvisible - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Draw &selected items while moving - - 0 - - - 0 - - 1 - m_DrawBlockItems - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - checkBoxClicked - - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + m_Include_Modules + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + checkBoxClicked + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Include t&ext items + + 0 + + + 0 + + 1 + m_Include_PcbTextes + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + checkBoxClicked + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Include &locked footprints + + 0 + + + 0 + + 1 + m_IncludeLockedModules + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + checkBoxClicked + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Include &drawings + + 0 + + + 0 + + 1 + m_Include_Draw_Items + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + checkBoxClicked + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Include &tracks + + 0 + + + 0 + + 1 + m_Include_Tracks + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + checkBoxClicked + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Include &board outline layer + + 0 + + + 0 + + 1 + m_Include_Edges_Items + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + checkBoxClicked + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Include &vias + + 0 + + + 0 + + 1 + m_Include_Vias + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + checkBoxClicked + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Include &zones + + 0 + + + 0 + + 1 + m_Include_Zones + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + checkBoxClicked + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticLine + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + @@ -1132,14 +666,8 @@ m_sdbSizer1 protected - OnCancel - - - ExecuteCommand - - diff --git a/pcbnew/dialogs/dialog_filter_selection_base.h b/pcbnew/dialogs/dialog_filter_selection_base.h index 7bb91e3dc8..0db2774d5a 100644 --- a/pcbnew/dialogs/dialog_filter_selection_base.h +++ b/pcbnew/dialogs/dialog_filter_selection_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __DIALOG_BLOCK_OPTIONS_BASE_H__ -#define __DIALOG_BLOCK_OPTIONS_BASE_H__ +#pragma once #include #include @@ -20,7 +19,6 @@ #include #include #include -#include #include #include @@ -28,12 +26,12 @@ /////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_BLOCK_OPTIONS_BASE +/// Class DIALOG_FILTER_SELECTION_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_BLOCK_OPTIONS_BASE : public DIALOG_SHIM +class DIALOG_FILTER_SELECTION_BASE : public DIALOG_SHIM { private: - + protected: wxCheckBox* m_Include_Modules; wxCheckBox* m_Include_PcbTextes; @@ -43,24 +41,21 @@ class DIALOG_BLOCK_OPTIONS_BASE : public DIALOG_SHIM wxCheckBox* m_Include_Edges_Items; wxCheckBox* m_Include_Vias; wxCheckBox* m_Include_Zones; - wxStaticLine* m_staticline1; - wxCheckBox* m_checkBoxIncludeInvisible; - wxCheckBox* m_DrawBlockItems; + wxStaticLine* m_staticLine; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; - + // Virtual event handlers, overide them in your derived class virtual void checkBoxClicked( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } virtual void ExecuteCommand( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_BLOCK_OPTIONS_BASE(); - + + DIALOG_FILTER_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Filter Selection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FILTER_SELECTION_BASE(); + }; -#endif //__DIALOG_BLOCK_OPTIONS_BASE_H__ diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 9a5e451108..6688461664 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -1174,24 +1174,14 @@ int SELECTION_TOOL::find( const TOOL_EVENT& aEvent ) * * Determine if an item is included by the filter specified * - * @return true if the parameter indicate the items should be selected - * by this filter (i..e not filtered out) + * @return true if aItem should be selected by this filter (i..e not filtered out) */ -static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, - const BOARD& aBoard, - const DIALOG_FILTER_SELECTION::OPTIONS& aBlockOpts ) +static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard, + const DIALOG_FILTER_SELECTION::OPTIONS& aFilterOptions ) { bool include = true; const PCB_LAYER_ID layer = aItem.GetLayer(); - // can skip without even checking item type - // fixme: selecting items on invisible layers does not work in GAL - if( !aBlockOpts.includeItemsOnInvisibleLayers - && !aBoard.IsLayerVisible( layer ) ) - { - include = false; - } - // if the item needs to be checked against the options if( include ) { @@ -1201,9 +1191,9 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, { const auto& module = static_cast( aItem ); - include = aBlockOpts.includeModules; + include = aFilterOptions.includeModules; - if( include && !aBlockOpts.includeLockedModules ) + if( include && !aFilterOptions.includeLockedModules ) { include = !module.IsLocked(); } @@ -1212,17 +1202,17 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, } case PCB_TRACE_T: { - include = aBlockOpts.includeTracks; + include = aFilterOptions.includeTracks; break; } case PCB_VIA_T: { - include = aBlockOpts.includeVias; + include = aFilterOptions.includeVias; break; } case PCB_ZONE_AREA_T: { - include = aBlockOpts.includeZones; + include = aFilterOptions.includeZones; break; } case PCB_LINE_T: @@ -1230,14 +1220,14 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, case PCB_DIMENSION_T: { if( layer == Edge_Cuts ) - include = aBlockOpts.includeBoardOutlineLayer; + include = aFilterOptions.includeBoardOutlineLayer; else - include = aBlockOpts.includeItemsOnTechLayers; + include = aFilterOptions.includeItemsOnTechLayers; break; } case PCB_TEXT_T: { - include = aBlockOpts.includePcbTexts; + include = aFilterOptions.includePcbTexts; break; } default: @@ -1254,9 +1244,9 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent ) { - const BOARD& board = *getModel(); + const BOARD& board = *getModel(); DIALOG_FILTER_SELECTION::OPTIONS& opts = m_priv->m_filterOpts; - DIALOG_FILTER_SELECTION dlg( m_frame, opts, false, _( "Filter selection" ) ); + DIALOG_FILTER_SELECTION dlg( m_frame, opts ); const int cmd = dlg.ShowModal(); diff --git a/qa/qa_utils/mocks.cpp b/qa/qa_utils/mocks.cpp index f71f49b3de..676265b4c8 100644 --- a/qa/qa_utils/mocks.cpp +++ b/qa/qa_utils/mocks.cpp @@ -205,12 +205,11 @@ MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference() } -DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +DIALOG_FILTER_SELECTION_BASE::DIALOG_FILTER_SELECTION_BASE( wxWindow* parent, wxWindowID id, + const wxString& title, + const wxPoint& pos, const wxSize& size, + long style ) : + DIALOG_SHIM( parent, id, title, pos, size, style ) { // these members are initialized only to avoid warnings about non initialized vars m_Include_Modules = nullptr; @@ -221,29 +220,26 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, m_Include_Vias = nullptr; m_Include_Edges_Items = nullptr; m_Include_Zones = nullptr; - m_DrawBlockItems = nullptr; - m_staticline1 = nullptr; - m_checkBoxIncludeInvisible = nullptr; m_sdbSizer1 = nullptr; + m_staticLine = nullptr; m_sdbSizer1OK = nullptr; m_sdbSizer1Cancel = nullptr; } -DIALOG_BLOCK_OPTIONS_BASE::~DIALOG_BLOCK_OPTIONS_BASE() +DIALOG_FILTER_SELECTION_BASE::~DIALOG_FILTER_SELECTION_BASE() { } -DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, - OPTIONS& aOptions, bool aShowLegacyOptions, - const wxString& aTitle ) : - DIALOG_BLOCK_OPTIONS_BASE( aParent, -1, aTitle ), - m_options( aOptions ) +DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, OPTIONS& aOptions ) : + DIALOG_FILTER_SELECTION_BASE( aParent ), + m_options( aOptions ) { // silence another compiler warning about m_options not being used if( m_options.includeModules ) - ; + { + } }