mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-13 17:53:11 +02:00
Pcbnew: pickup footprints by points, add a selection filter
This commit is contained in:
parent
c95c15dd4e
commit
eedfb7a573
@ -52,6 +52,7 @@ struct KICOMMON_API PCB_SELECTION_FILTER_OPTIONS
|
||||
bool zones; ///< Copper zones
|
||||
bool keepouts; ///< Keepout zones
|
||||
bool dimensions; ///< Dimension items
|
||||
bool points; ///< Points
|
||||
bool otherItems; ///< Anything not fitting one of the above categories
|
||||
|
||||
PCB_SELECTION_FILTER_OPTIONS()
|
||||
@ -66,6 +67,7 @@ struct KICOMMON_API PCB_SELECTION_FILTER_OPTIONS
|
||||
zones = true;
|
||||
keepouts = true;
|
||||
dimensions = true;
|
||||
points = true;
|
||||
otherItems = true;
|
||||
}
|
||||
|
||||
@ -75,7 +77,7 @@ struct KICOMMON_API PCB_SELECTION_FILTER_OPTIONS
|
||||
bool Any()
|
||||
{
|
||||
return ( footprints || text || tracks || vias || pads || graphics || zones
|
||||
|| keepouts || dimensions || otherItems );
|
||||
|| keepouts || dimensions || points || otherItems );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,7 +86,7 @@ struct KICOMMON_API PCB_SELECTION_FILTER_OPTIONS
|
||||
bool All()
|
||||
{
|
||||
return ( footprints && text && tracks && vias && pads && graphics && zones
|
||||
&& keepouts && dimensions && otherItems );
|
||||
&& keepouts && dimensions && points && otherItems );
|
||||
}
|
||||
|
||||
void SetAll( bool aState )
|
||||
@ -98,6 +100,7 @@ struct KICOMMON_API PCB_SELECTION_FILTER_OPTIONS
|
||||
zones = aState;
|
||||
keepouts = aState;
|
||||
dimensions = aState;
|
||||
points = aState;
|
||||
otherItems = aState;
|
||||
lockedItems = aState;
|
||||
}
|
||||
|
@ -336,6 +336,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
||||
ret["zones"] = m_SelectionFilter.zones;
|
||||
ret["keepouts"] = m_SelectionFilter.keepouts;
|
||||
ret["dimensions"] = m_SelectionFilter.dimensions;
|
||||
ret["points"] = m_SelectionFilter.points;
|
||||
ret["otherItems"] = m_SelectionFilter.otherItems;
|
||||
|
||||
return ret;
|
||||
@ -355,6 +356,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
||||
SetIfPresent( aVal, "zones", m_SelectionFilter.zones );
|
||||
SetIfPresent( aVal, "keepouts", m_SelectionFilter.keepouts );
|
||||
SetIfPresent( aVal, "dimensions", m_SelectionFilter.dimensions );
|
||||
SetIfPresent( aVal, "points", m_SelectionFilter.points );
|
||||
SetIfPresent( aVal, "otherItems", m_SelectionFilter.otherItems );
|
||||
},
|
||||
{
|
||||
@ -368,6 +370,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
||||
{ "zones", true },
|
||||
{ "keepouts", true },
|
||||
{ "dimensions", true },
|
||||
{ "points", true },
|
||||
{ "otherItems", true }
|
||||
} ) );
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <pcb_table.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_group.h>
|
||||
#include <pcb_point.h>
|
||||
#include <pcb_reference_image.h>
|
||||
#include <pcb_track.h>
|
||||
#include <zone.h>
|
||||
@ -1150,8 +1151,8 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
|
||||
const PCB_LAYER_ID activeHighContrastPrimaryLayer = settings->GetPrimaryHighContrastLayer();
|
||||
bool isHighContrast = settings->GetHighContrast();
|
||||
|
||||
auto checkVisibility =
|
||||
[&]( BOARD_ITEM* item )
|
||||
const auto checkVisibility =
|
||||
[&]( const BOARD_ITEM* item )
|
||||
{
|
||||
// New moved items don't yet have view flags so VIEW will call them invisible
|
||||
if( !view->IsVisible( item ) && !item->IsMoving() )
|
||||
@ -1419,6 +1420,18 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
|
||||
} );
|
||||
}
|
||||
|
||||
// Points are also pick-up points
|
||||
for( const PCB_POINT* pt : footprint->Points() )
|
||||
{
|
||||
if( aSelectionFilter && !aSelectionFilter->points )
|
||||
continue;
|
||||
|
||||
if( !checkVisibility( pt ) )
|
||||
continue;
|
||||
|
||||
addAnchor( pt->GetPosition(), ORIGIN | SNAPPABLE, footprint, POINT_TYPE::PT_CENTER );
|
||||
}
|
||||
|
||||
if( aFrom && aSelectionFilter && !aSelectionFilter->footprints )
|
||||
break;
|
||||
|
||||
@ -1561,10 +1574,18 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
|
||||
|
||||
case PCB_MARKER_T:
|
||||
case PCB_TARGET_T:
|
||||
case PCB_POINT_T:
|
||||
addAnchor( aItem->GetPosition(), ORIGIN | CORNER | SNAPPABLE, aItem, POINT_TYPE::PT_CENTER );
|
||||
break;
|
||||
|
||||
case PCB_POINT_T:
|
||||
if( aSelectionFilter && !aSelectionFilter->points )
|
||||
break;
|
||||
|
||||
if( checkVisibility( aItem ) )
|
||||
addAnchor( aItem->GetPosition(), ORIGIN | SNAPPABLE, aItem, POINT_TYPE::PT_CENTER );
|
||||
|
||||
break;
|
||||
|
||||
case PCB_VIA_T:
|
||||
if( aFrom )
|
||||
{
|
||||
|
@ -133,6 +133,7 @@ PCB_SELECTION_TOOL::PCB_SELECTION_TOOL() :
|
||||
m_filter.zones = true;
|
||||
m_filter.keepouts = true;
|
||||
m_filter.dimensions = true;
|
||||
m_filter.points = true;
|
||||
m_filter.otherItems = true;
|
||||
}
|
||||
|
||||
@ -2950,6 +2951,16 @@ bool PCB_SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem, bool aMultiSelect,
|
||||
|
||||
break;
|
||||
|
||||
case PCB_POINT_T:
|
||||
if( !m_filter.points )
|
||||
{
|
||||
if( aRejected )
|
||||
aRejected->points = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if( !m_filter.otherItems )
|
||||
{
|
||||
|
@ -44,6 +44,7 @@ PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER( wxWindow* aParent ) :
|
||||
m_cbZones->SetFont( font );
|
||||
m_cbKeepouts->SetFont( font );
|
||||
m_cbDimensions->SetFont( font );
|
||||
m_cbPoints->SetFont( font );
|
||||
m_cbOtherItems->SetFont( font );
|
||||
m_cbAllItems->SetFont( font );
|
||||
|
||||
@ -65,6 +66,7 @@ PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER( wxWindow* aParent ) :
|
||||
m_cbZones->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
|
||||
m_cbKeepouts->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
|
||||
m_cbDimensions->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
|
||||
m_cbPoints->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
|
||||
m_cbOtherItems->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
|
||||
|
||||
m_frame->Bind( EDA_LANG_CHANGED, &PANEL_SELECTION_FILTER::OnLanguageChanged, this );
|
||||
@ -108,6 +110,7 @@ void PANEL_SELECTION_FILTER::SetCheckboxesFromFilter( PCB_SELECTION_FILTER_OPTIO
|
||||
m_cbZones->SetValue( aOptions.zones );
|
||||
m_cbKeepouts->SetValue( aOptions.keepouts );
|
||||
m_cbDimensions->SetValue( aOptions.dimensions );
|
||||
m_cbPoints->SetValue( aOptions.points );
|
||||
m_cbOtherItems->SetValue( aOptions.otherItems );
|
||||
|
||||
m_cbAllItems->SetValue( aOptions.All() );
|
||||
@ -131,6 +134,7 @@ void PANEL_SELECTION_FILTER::OnFilterChanged( wxCommandEvent& aEvent )
|
||||
m_cbZones->SetValue( newState );
|
||||
m_cbKeepouts->SetValue( newState );
|
||||
m_cbDimensions->SetValue( newState );
|
||||
m_cbPoints->SetValue( newState );
|
||||
m_cbOtherItems->SetValue( newState );
|
||||
}
|
||||
|
||||
@ -154,6 +158,7 @@ bool PANEL_SELECTION_FILTER::setFilterFromCheckboxes( PCB_SELECTION_FILTER_OPTIO
|
||||
aOptions.zones = m_cbZones->GetValue();
|
||||
aOptions.keepouts = m_cbKeepouts->GetValue();
|
||||
aOptions.dimensions = m_cbDimensions->GetValue();
|
||||
aOptions.points = m_cbPoints->GetValue();
|
||||
aOptions.otherItems = m_cbOtherItems->GetValue();
|
||||
|
||||
return aOptions.All();
|
||||
@ -197,6 +202,7 @@ void PANEL_SELECTION_FILTER::onPopupSelection( wxCommandEvent& aEvent )
|
||||
m_cbZones->SetValue( false );
|
||||
m_cbKeepouts->SetValue( false );
|
||||
m_cbDimensions->SetValue( false );
|
||||
m_cbPoints->SetValue( false );
|
||||
m_cbOtherItems->SetValue( false );
|
||||
|
||||
m_onlyCheckbox->SetValue( true );
|
||||
@ -221,6 +227,7 @@ void PANEL_SELECTION_FILTER::OnLanguageChanged( wxCommandEvent& aEvent )
|
||||
m_cbZones->SetLabel( _( "Zones" ) );
|
||||
m_cbKeepouts->SetLabel( _( "Rule Areas" ) );
|
||||
m_cbDimensions->SetLabel( _( "Dimensions" ) );
|
||||
m_cbPoints->SetLabel( _( "Points" ) );
|
||||
m_cbOtherItems->SetLabel( _( "Other items" ) );
|
||||
|
||||
m_cbAllItems->GetParent()->Layout();
|
||||
@ -348,6 +355,9 @@ void PANEL_SELECTION_FILTER::OnFlashEvent( PCB_SELECTION_FILTER_EVENT& aEvent )
|
||||
if( aOptions.dimensions )
|
||||
flashCheckbox( m_cbDimensions );
|
||||
|
||||
if( aOptions.points )
|
||||
flashCheckbox( m_cbPoints );
|
||||
|
||||
if( aOptions.otherItems )
|
||||
flashCheckbox( m_cbOtherItems );
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@ -60,11 +60,15 @@ PANEL_SELECTION_FILTER_BASE::PANEL_SELECTION_FILTER_BASE( wxWindow* parent, wxWi
|
||||
|
||||
m_cbDimensions = new wxCheckBox( this, wxID_ANY, _("Dimensions"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbDimensions->SetValue(true);
|
||||
gbSizer1->Add( m_cbDimensions, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
gbSizer1->Add( m_cbDimensions, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_cbPoints = new wxCheckBox( this, wxID_ANY, _("Points"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbPoints->SetValue(true);
|
||||
gbSizer1->Add( m_cbPoints, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_cbOtherItems = new wxCheckBox( this, wxID_ANY, _("Other items"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbOtherItems->SetValue(true);
|
||||
gbSizer1->Add( m_cbOtherItems, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
gbSizer1->Add( m_cbOtherItems, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
this->SetSizer( gbSizer1 );
|
||||
@ -83,6 +87,7 @@ PANEL_SELECTION_FILTER_BASE::PANEL_SELECTION_FILTER_BASE( wxWindow* parent, wxWi
|
||||
m_cbZones->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
m_cbKeepouts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
m_cbDimensions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
m_cbPoints->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
m_cbOtherItems->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
}
|
||||
|
||||
@ -100,6 +105,7 @@ PANEL_SELECTION_FILTER_BASE::~PANEL_SELECTION_FILTER_BASE()
|
||||
m_cbZones->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
m_cbKeepouts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
m_cbDimensions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
m_cbPoints->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
m_cbOtherItems->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@ -22,7 +22,6 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_SELECTION_FILTER_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -42,6 +41,7 @@ class PANEL_SELECTION_FILTER_BASE : public WX_PANEL
|
||||
wxCheckBox* m_cbZones;
|
||||
wxCheckBox* m_cbKeepouts;
|
||||
wxCheckBox* m_cbDimensions;
|
||||
wxCheckBox* m_cbPoints;
|
||||
wxCheckBox* m_cbOtherItems;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
|
Loading…
x
Reference in New Issue
Block a user