Clean a bunch of legacy code out of the Filter Selection dialog.

This commit is contained in:
Jeff Young 2020-01-12 20:52:19 +00:00
parent 127c66285b
commit 8d0f31f6f4
7 changed files with 698 additions and 1239 deletions

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <dialog_filter_selection.h> #include <dialog_filter_selection.h>
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, OPTIONS& aOptions ) :
OPTIONS& aOptions, bool aShowLegacyOptions, DIALOG_FILTER_SELECTION_BASE( aParent ),
const wxString& aTitle ) :
DIALOG_BLOCK_OPTIONS_BASE( aParent, -1, aTitle ),
m_options( aOptions ) m_options( aOptions )
{ {
if( !aShowLegacyOptions )
{
m_DrawBlockItems->Hide();
m_checkBoxIncludeInvisible->Hide();
m_staticline1->Hide();
}
m_Include_Modules->SetValue( m_options.includeModules ); m_Include_Modules->SetValue( m_options.includeModules );
m_IncludeLockedModules->SetValue( m_options.includeLockedModules ); 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_Draw_Items->SetValue( m_options.includeItemsOnTechLayers );
m_Include_Edges_Items->SetValue( m_options.includeBoardOutlineLayer ); m_Include_Edges_Items->SetValue( m_options.includeBoardOutlineLayer );
m_Include_PcbTextes->SetValue( m_options.includePcbTexts ); m_Include_PcbTextes->SetValue( m_options.includePcbTexts );
m_DrawBlockItems->SetValue( m_options.drawItems );
m_checkBoxIncludeInvisible->SetValue( m_options.includeItemsOnInvisibleLayers );
m_sdbSizer1OK->SetDefault(); m_sdbSizer1OK->SetDefault();
SetFocus(); SetFocus();
@ -75,16 +62,14 @@ void DIALOG_FILTER_SELECTION::checkBoxClicked( wxCommandEvent& aEvent )
void DIALOG_FILTER_SELECTION::ExecuteCommand( wxCommandEvent& event ) void DIALOG_FILTER_SELECTION::ExecuteCommand( wxCommandEvent& event )
{ {
m_options.includeModules = m_Include_Modules->GetValue(); m_options.includeModules = m_Include_Modules->GetValue();
m_options.includeLockedModules = m_IncludeLockedModules->GetValue(); m_options.includeLockedModules = m_IncludeLockedModules->GetValue();
m_options.includeTracks = m_Include_Tracks->GetValue(); m_options.includeTracks = m_Include_Tracks->GetValue();
m_options.includeVias = m_Include_Vias->GetValue(); m_options.includeVias = m_Include_Vias->GetValue();
m_options.includeZones = m_Include_Zones->GetValue(); m_options.includeZones = m_Include_Zones->GetValue();
m_options.includeItemsOnTechLayers = m_Include_Draw_Items->GetValue(); m_options.includeItemsOnTechLayers = m_Include_Draw_Items->GetValue();
m_options.includeBoardOutlineLayer = m_Include_Edges_Items->GetValue(); m_options.includeBoardOutlineLayer = m_Include_Edges_Items->GetValue();
m_options.includePcbTexts = m_Include_PcbTextes->GetValue(); m_options.includePcbTexts = m_Include_PcbTextes->GetValue();
m_options.drawItems = m_DrawBlockItems->GetValue();
m_options.includeItemsOnInvisibleLayers = m_checkBoxIncludeInvisible->GetValue();
EndModal( wxID_OK ); EndModal( wxID_OK );
} }

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -28,31 +28,26 @@
class PCB_BASE_FRAME; class PCB_BASE_FRAME;
class DIALOG_FILTER_SELECTION : public DIALOG_BLOCK_OPTIONS_BASE class DIALOG_FILTER_SELECTION : public DIALOG_FILTER_SELECTION_BASE
{ {
public: public:
/** /**
* Struct that will be set with the result of the user choices * Struct that will be set with the result of the user choices in the dialog
* in the dialog
*/ */
struct OPTIONS struct OPTIONS
{ {
bool includeModules = true; bool includeModules = true;
bool includeLockedModules = true; bool includeLockedModules = true;
bool includeTracks = true; bool includeTracks = true;
bool includeVias = true; bool includeVias = true;
bool includeZones = true; bool includeZones = true;
bool includeItemsOnTechLayers = true; bool includeItemsOnTechLayers = true;
bool includeBoardOutlineLayer = true; bool includeBoardOutlineLayer = true;
bool includePcbTexts = true; bool includePcbTexts = true;
bool drawItems = true;
bool includeItemsOnInvisibleLayers = false;
}; };
DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, OPTIONS& aOptions, DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, OPTIONS& aOptions );
bool aShowLegacyOptions,
const wxString& aTitle );
~DIALOG_FILTER_SELECTION() ~DIALOG_FILTER_SELECTION()
{ {
@ -72,4 +67,4 @@ private:
OPTIONS& m_options; OPTIONS& m_options;
}; };
#endif // DIALOG_EXCHANGE_MODULES_H_ #endif // DIALOG_FILTER_SELECTION_H

View File

@ -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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // 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 ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain; wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL ); 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; wxGridSizer* gSizer1;
gSizer1 = new wxGridSizer( 4, 2, 3, 3 ); 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); gSizer1->Add( m_Include_Zones, 0, 0, 5 );
fgSizer1->Add( gSizer1, 1, wxALL|wxEXPAND, 5 ); bSizerMain->Add( gSizer1, 1, wxEXPAND|wxALL, 10 );
m_staticline1 = new wxStaticLine( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticLine = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizer1->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); bSizerMain->Add( m_staticLine, 0, wxEXPAND|wxRIGHT|wxLEFT, 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 );
m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize(); m_sdbSizer1->Realize();
bSizerMain->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); bSizerMain->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
this->Layout(); this->Layout();
bSizerMain->Fit( this ); bSizerMain->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
m_Include_Modules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), 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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_Include_Zones->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this );
m_checkBoxIncludeInvisible->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::OnCancel ), NULL, this );
m_DrawBlockItems->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::ExecuteCommand ), 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 );
} }
DIALOG_BLOCK_OPTIONS_BASE::~DIALOG_BLOCK_OPTIONS_BASE() DIALOG_FILTER_SELECTION_BASE::~DIALOG_FILTER_SELECTION_BASE()
{ {
// Disconnect Events // Disconnect Events
m_Include_Modules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), 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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_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_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_Include_Zones->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::checkBoxClicked ), NULL, this );
m_checkBoxIncludeInvisible->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::OnCancel ), NULL, this );
m_DrawBlockItems->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FILTER_SELECTION_BASE::ExecuteCommand ), 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 );
} }

File diff suppressed because it is too large Load Diff

View File

@ -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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_BLOCK_OPTIONS_BASE_H__ #pragma once
#define __DIALOG_BLOCK_OPTIONS_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
@ -20,7 +19,6 @@
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/statbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -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: private:
protected: protected:
wxCheckBox* m_Include_Modules; wxCheckBox* m_Include_Modules;
wxCheckBox* m_Include_PcbTextes; wxCheckBox* m_Include_PcbTextes;
@ -43,24 +41,21 @@ class DIALOG_BLOCK_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_Include_Edges_Items; wxCheckBox* m_Include_Edges_Items;
wxCheckBox* m_Include_Vias; wxCheckBox* m_Include_Vias;
wxCheckBox* m_Include_Zones; wxCheckBox* m_Include_Zones;
wxStaticLine* m_staticline1; wxStaticLine* m_staticLine;
wxCheckBox* m_checkBoxIncludeInvisible;
wxCheckBox* m_DrawBlockItems;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void checkBoxClicked( wxCommandEvent& event ) { event.Skip(); } virtual void checkBoxClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
virtual void ExecuteCommand( wxCommandEvent& event ) { event.Skip(); } virtual void ExecuteCommand( wxCommandEvent& event ) { event.Skip(); }
public: 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_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_BLOCK_OPTIONS_BASE(); ~DIALOG_FILTER_SELECTION_BASE();
}; };
#endif //__DIALOG_BLOCK_OPTIONS_BASE_H__

View File

@ -1174,24 +1174,14 @@ int SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
* *
* Determine if an item is included by the filter specified * Determine if an item is included by the filter specified
* *
* @return true if the parameter indicate the items should be selected * @return true if aItem should be selected by this filter (i..e not filtered out)
* by this filter (i..e not filtered out)
*/ */
static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard,
const BOARD& aBoard, const DIALOG_FILTER_SELECTION::OPTIONS& aFilterOptions )
const DIALOG_FILTER_SELECTION::OPTIONS& aBlockOpts )
{ {
bool include = true; bool include = true;
const PCB_LAYER_ID layer = aItem.GetLayer(); 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 the item needs to be checked against the options
if( include ) if( include )
{ {
@ -1201,9 +1191,9 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
{ {
const auto& module = static_cast<const MODULE&>( aItem ); const auto& module = static_cast<const MODULE&>( aItem );
include = aBlockOpts.includeModules; include = aFilterOptions.includeModules;
if( include && !aBlockOpts.includeLockedModules ) if( include && !aFilterOptions.includeLockedModules )
{ {
include = !module.IsLocked(); include = !module.IsLocked();
} }
@ -1212,17 +1202,17 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
} }
case PCB_TRACE_T: case PCB_TRACE_T:
{ {
include = aBlockOpts.includeTracks; include = aFilterOptions.includeTracks;
break; break;
} }
case PCB_VIA_T: case PCB_VIA_T:
{ {
include = aBlockOpts.includeVias; include = aFilterOptions.includeVias;
break; break;
} }
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
{ {
include = aBlockOpts.includeZones; include = aFilterOptions.includeZones;
break; break;
} }
case PCB_LINE_T: case PCB_LINE_T:
@ -1230,14 +1220,14 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
{ {
if( layer == Edge_Cuts ) if( layer == Edge_Cuts )
include = aBlockOpts.includeBoardOutlineLayer; include = aFilterOptions.includeBoardOutlineLayer;
else else
include = aBlockOpts.includeItemsOnTechLayers; include = aFilterOptions.includeItemsOnTechLayers;
break; break;
} }
case PCB_TEXT_T: case PCB_TEXT_T:
{ {
include = aBlockOpts.includePcbTexts; include = aFilterOptions.includePcbTexts;
break; break;
} }
default: default:
@ -1254,9 +1244,9 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent ) int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
{ {
const BOARD& board = *getModel<BOARD>(); const BOARD& board = *getModel<BOARD>();
DIALOG_FILTER_SELECTION::OPTIONS& opts = m_priv->m_filterOpts; 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(); const int cmd = dlg.ShowModal();

View File

@ -205,12 +205,11 @@ MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
} }
DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, DIALOG_FILTER_SELECTION_BASE::DIALOG_FILTER_SELECTION_BASE( wxWindow* parent, wxWindowID id,
wxWindowID id, const wxString& title,
const wxString& title, const wxPoint& pos, const wxSize& size,
const wxPoint& pos, long style ) :
const wxSize& size, DIALOG_SHIM( parent, id, title, pos, size, style )
long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
// these members are initialized only to avoid warnings about non initialized vars // these members are initialized only to avoid warnings about non initialized vars
m_Include_Modules = nullptr; m_Include_Modules = nullptr;
@ -221,29 +220,26 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent,
m_Include_Vias = nullptr; m_Include_Vias = nullptr;
m_Include_Edges_Items = nullptr; m_Include_Edges_Items = nullptr;
m_Include_Zones = nullptr; m_Include_Zones = nullptr;
m_DrawBlockItems = nullptr;
m_staticline1 = nullptr;
m_checkBoxIncludeInvisible = nullptr;
m_sdbSizer1 = nullptr; m_sdbSizer1 = nullptr;
m_staticLine = nullptr;
m_sdbSizer1OK = nullptr; m_sdbSizer1OK = nullptr;
m_sdbSizer1Cancel = 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, DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, OPTIONS& aOptions ) :
OPTIONS& aOptions, bool aShowLegacyOptions, DIALOG_FILTER_SELECTION_BASE( aParent ),
const wxString& aTitle ) : m_options( aOptions )
DIALOG_BLOCK_OPTIONS_BASE( aParent, -1, aTitle ),
m_options( aOptions )
{ {
// silence another compiler warning about m_options not being used // silence another compiler warning about m_options not being used
if( m_options.includeModules ) if( m_options.includeModules )
; {
}
} }