Decouple vias from tracks in selection filter

This commit is contained in:
Andrzej Wolski 2018-03-17 14:51:16 +01:00 committed by Jon Evans
parent ea3f8743fd
commit ff3f229871
8 changed files with 975 additions and 825 deletions

View File

@ -334,19 +334,19 @@ void PCB_EDIT_FRAME::Block_SelectItems()
}
// Add tracks and vias
if( blockOpts.includeTracks )
for( auto PtStruct : m_Pcb->Tracks() )
{
for( TRACK* track = m_Pcb->m_Track; track != NULL; track = track->Next() )
if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && !blockOpts.includeItemsOnInvisibleLayers )
continue;
if( !( blockOpts.includeTracks && PtStruct->Type() == PCB_TRACE_T ) &&
!( blockOpts.includeVias && PtStruct->Type() == PCB_VIA_T) )
continue;
if( PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
{
if( track->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
{
if( blockOpts.includeItemsOnInvisibleLayers
|| m_Pcb->IsLayerVisible( track->GetLayer() ) )
{
picker.SetItem( track );
itemsList->PushItem( picker );
}
}
picker.SetItem ( PtStruct );
itemsList->PushItem( picker );
}
}

View File

@ -49,6 +49,7 @@ DIALOG_BLOCK_OPTIONS::DIALOG_BLOCK_OPTIONS( PCB_BASE_FRAME* aParent,
m_IncludeLockedModules->Disable();
m_Include_Tracks->SetValue( m_options.includeTracks );
m_Include_Vias->SetValue( m_options.includeVias );
m_Include_Zones->SetValue( m_options.includeZones );
m_Include_Draw_Items->SetValue( m_options.includeItemsOnTechLayers );
m_Include_Edges_Items->SetValue( m_options.includeBoardOutlineLayer );
@ -77,6 +78,7 @@ void DIALOG_BLOCK_OPTIONS::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.includeBoardOutlineLayer = m_Include_Edges_Items->GetValue();

View File

@ -41,6 +41,7 @@ public:
bool includeModules = true;
bool includeLockedModules = true;
bool includeTracks = true;
bool includeVias = true;
bool includeZones = true;
bool includeItemsOnTechLayers = true;
bool includeBoardOutlineLayer = true;

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version May 6 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_block_options_base.h"
@ -19,6 +19,11 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow
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 );
@ -40,20 +45,32 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow
m_Include_Edges_Items = new wxCheckBox( sbSizer1->GetStaticBox(), 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 );
gSizer1->Add( m_Include_Vias, 0, 0, 5 );
m_Include_Zones = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Include &zones"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( m_Include_Zones, 0, 0, 5 );
m_DrawBlockItems = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Draw &selected items while moving"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( m_DrawBlockItems, 0, 0, 5 );
sbSizer1->Add( gSizer1, 1, wxALL|wxEXPAND, 5 );
fgSizer1->Add( gSizer1, 1, wxALL|wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sbSizer1->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
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 );
sbSizer1->Add( m_checkBoxIncludeInvisible, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
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 );
@ -81,9 +98,10 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow
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_DrawBlockItems->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 );
}
@ -97,9 +115,10 @@ DIALOG_BLOCK_OPTIONS_BASE::~DIALOG_BLOCK_OPTIONS_BASE()
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_DrawBlockItems->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 );

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version May 6 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_BLOCK_OPTIONS_BASE_H__
@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/checkbox.h>
@ -41,10 +43,11 @@ class DIALOG_BLOCK_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_Include_Draw_Items;
wxCheckBox* m_Include_Tracks;
wxCheckBox* m_Include_Edges_Items;
wxCheckBox* m_Include_Vias;
wxCheckBox* m_Include_Zones;
wxCheckBox* m_DrawBlockItems;
wxStaticLine* m_staticline1;
wxCheckBox* m_checkBoxIncludeInvisible;
wxCheckBox* m_DrawBlockItems;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;

View File

@ -1267,11 +1267,15 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
break;
}
case PCB_TRACE_T:
case PCB_VIA_T:
{
include = aBlockOpts.includeTracks;
break;
}
case PCB_VIA_T:
{
include = aBlockOpts.includeVias;
break;
}
case PCB_ZONE_AREA_T:
{
include = aBlockOpts.includeZones;

View File

@ -295,6 +295,7 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent,
m_IncludeLockedModules = nullptr;
m_Include_Draw_Items = nullptr;
m_Include_Tracks = nullptr;
m_Include_Vias = nullptr;
m_Include_Edges_Items = nullptr;
m_Include_Zones = nullptr;
m_DrawBlockItems = nullptr;