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.
*
* 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 <dialog_filter_selection.h>
#include <pcb_edit_frame.h>
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 );
}

View File

@ -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

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/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -9,71 +9,45 @@
///////////////////////////////////////////////////////////////////////////
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 );
bSizerMain->Add( gSizer1, 1, wxEXPAND|wxALL, 10 );
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 );
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 );
@ -92,34 +66,30 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow
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 );
}

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/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_BLOCK_OPTIONS_BASE_H__
#define __DIALOG_BLOCK_OPTIONS_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -20,7 +19,6 @@
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -28,9 +26,9 @@
///////////////////////////////////////////////////////////////////////////////
/// 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:
@ -43,9 +41,7 @@ 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;
@ -58,9 +54,8 @@ class DIALOG_BLOCK_OPTIONS_BASE : public DIALOG_SHIM
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__

View File

@ -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<const MODULE&>( 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<BOARD>();
const BOARD& board = *getModel<BOARD>();
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();

View File

@ -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 )
;
{
}
}