diff --git a/common/eda_item.cpp b/common/eda_item.cpp index 94d8f558bf..4cffc14d81 100644 --- a/common/eda_item.cpp +++ b/common/eda_item.cpp @@ -90,7 +90,7 @@ EDA_ITEM* EDA_ITEM::Clone() const // see base_struct.h // many classes inherit this method, be careful: INSPECT_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { #if 0 && defined(DEBUG) std::cout << GetClass().mb_str() << ' '; diff --git a/common/tool/selection_conditions.cpp b/common/tool/selection_conditions.cpp index dd59402876..e24976525b 100644 --- a/common/tool/selection_conditions.cpp +++ b/common/tool/selection_conditions.cpp @@ -64,13 +64,13 @@ SELECTION_CONDITION SELECTION_CONDITIONS::HasType( KICAD_T aType ) } -SELECTION_CONDITION SELECTION_CONDITIONS::HasTypes( const std::initializer_list& aTypes ) +SELECTION_CONDITION SELECTION_CONDITIONS::HasTypes( std::vector aTypes ) { return std::bind( &SELECTION_CONDITIONS::hasTypesFunc, _1, aTypes ); } -SELECTION_CONDITION SELECTION_CONDITIONS::OnlyTypes( const std::initializer_list& aTypes ) +SELECTION_CONDITION SELECTION_CONDITIONS::OnlyTypes( std::vector aTypes ) { return std::bind( &SELECTION_CONDITIONS::onlyTypesFunc, _1, aTypes ); } @@ -109,8 +109,7 @@ bool SELECTION_CONDITIONS::hasTypeFunc( const SELECTION& aSelection, KICAD_T aTy } -bool SELECTION_CONDITIONS::hasTypesFunc( const SELECTION& aSelection, - const std::initializer_list& aTypes ) +bool SELECTION_CONDITIONS::hasTypesFunc( const SELECTION& aSelection, std::vector aTypes ) { if( aSelection.Empty() ) return false; @@ -125,8 +124,7 @@ bool SELECTION_CONDITIONS::hasTypesFunc( const SELECTION& aSelection, } -bool SELECTION_CONDITIONS::onlyTypesFunc( const SELECTION& aSelection, - const std::initializer_list& aTypes ) +bool SELECTION_CONDITIONS::onlyTypesFunc( const SELECTION& aSelection, std::vector aTypes ) { if( aSelection.Empty() ) return false; diff --git a/eeschema/ee_collectors.cpp b/eeschema/ee_collectors.cpp index c8b706ca5e..4274f0f890 100644 --- a/eeschema/ee_collectors.cpp +++ b/eeschema/ee_collectors.cpp @@ -36,7 +36,7 @@ #include "sch_reference_list.h" -const std::initializer_list EE_COLLECTOR::EditableItems = { +const std::vector EE_COLLECTOR::EditableItems = { SCH_SHAPE_T, SCH_TEXT_T, SCH_TEXTBOX_T, @@ -55,7 +55,7 @@ const std::initializer_list EE_COLLECTOR::EditableItems = { }; -const std::initializer_list EE_COLLECTOR::MovableItems = +const std::vector EE_COLLECTOR::MovableItems = { SCH_MARKER_T, SCH_JUNCTION_T, @@ -78,7 +78,7 @@ const std::initializer_list EE_COLLECTOR::MovableItems = }; -const std::initializer_list EE_COLLECTOR::FieldOwners = { +const std::vector EE_COLLECTOR::FieldOwners = { SCH_SYMBOL_T, SCH_SHEET_T, SCH_LABEL_LOCATE_ANY_T @@ -116,8 +116,7 @@ INSPECT_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData ) } -void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, - const std::initializer_list& aFilterList, +void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const std::vector& aFilterList, const VECTOR2I& aPos, int aUnit, int aConvert ) { Empty(); // empty the collection just in case @@ -137,8 +136,7 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, } -void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, - const std::initializer_list& aFilterList, +void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const std::vector& aFilterList, const VECTOR2I& aPos, int aUnit, int aConvert ) { Empty(); // empty the collection just in case diff --git a/eeschema/ee_collectors.h b/eeschema/ee_collectors.h index 3bbb1c95d7..fc49483edf 100644 --- a/eeschema/ee_collectors.h +++ b/eeschema/ee_collectors.h @@ -39,11 +39,11 @@ class SCH_SYMBOL; class EE_COLLECTOR : public COLLECTOR { public: - static const std::initializer_list EditableItems; - static const std::initializer_list MovableItems; - static const std::initializer_list FieldOwners; + static const std::vector EditableItems; + static const std::vector MovableItems; + static const std::vector FieldOwners; - EE_COLLECTOR( const std::initializer_list& aScanTypes = { SCH_LOCATE_ANY_T } ) : + EE_COLLECTOR( const std::vector& aScanTypes = { SCH_LOCATE_ANY_T } ) : m_Unit( 0 ), m_Convert( 0 ), m_ShowPinElectricalTypes( false ) @@ -71,26 +71,26 @@ public: * Scan a #EDA_ITEM using this class's Inspector method which does the collection. * * @param aScreen The eeschema screen to use for scanning - * @param aFilterList A list of #KICAD_T types that determines what is to be collected and - * the priority order of the resulting collection. + * @param aScanTypes A list of #KICAD_T types that determines what is to be collected and + * the priority order of the resulting collection. * @param aPos are the coordinates to use in hit testing. * @param aUnit is the symbol unit filter (for symbol editor). * @param aConvert is the DeMorgan filter (for symbol editor) */ - void Collect( SCH_SCREEN* aScreen, const std::initializer_list& aFilterList, + void Collect( SCH_SCREEN* aScreen, const std::vector& aScanTypes, const VECTOR2I& aPos, int aUnit = 0, int aConvert = 0 ); /** * Scan an #EDA_ITEM using this class's Inspector method which does the collection. * * @param aItems is a LIB_SYMBOL multivector holding the symbol items. - * @param aFilterList is a list of #KICAD_T types that determines what is to be collected - * and the priority order of the resulting collection. + * @param aScanTypes is a list of #KICAD_T types that determines what is to be collected + * and the priority order of the resulting collection. * @param aPos are the coordinates to use in hit testing. * @param aUnit is the symbol unit filter (for symbol editor). * @param aConvert is the DeMorgan filter (for symbol editor). */ - void Collect( LIB_ITEMS_CONTAINER& aItems, const std::initializer_list& aFilterList, + void Collect( LIB_ITEMS_CONTAINER& aItems, const std::vector& aScanTypes, const VECTOR2I& aPos, int aUnit = 0, int aConvert = 0 ); /** diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 5644d3bed3..88121f92a8 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -1238,7 +1238,7 @@ LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, INSPECT_RESULT LIB_SYMBOL::Visit( INSPECTOR aInspector, void* aTestData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { // The part itself is never inspected, only its children for( LIB_ITEM& item : m_drawings ) diff --git a/eeschema/lib_symbol.h b/eeschema/lib_symbol.h index eb71ff24d3..b9a74bd441 100644 --- a/eeschema/lib_symbol.h +++ b/eeschema/lib_symbol.h @@ -503,7 +503,7 @@ public: const LIB_ITEMS_CONTAINER& GetDrawItems() const { return m_drawings; } INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) override; + const std::vector& aScanTypes ) override; /** * Set the units per symbol count. diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index b1efb11ccd..b6e63bc723 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -69,7 +69,7 @@ public: return wxT( "SCH_FIELD" ); } - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( SCH_ITEM::IsType( aScanTypes ) ) return true; diff --git a/eeschema/sch_item.h b/eeschema/sch_item.h index d59a9999dd..f5239c7de6 100644 --- a/eeschema/sch_item.h +++ b/eeschema/sch_item.h @@ -157,7 +157,7 @@ public: return wxT( "SCH_ITEM" ); } - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( EDA_ITEM::IsType( aScanTypes ) ) return true; diff --git a/eeschema/sch_label.cpp b/eeschema/sch_label.cpp index 4a7cf1df9a..17cd1b7a10 100644 --- a/eeschema/sch_label.cpp +++ b/eeschema/sch_label.cpp @@ -190,7 +190,7 @@ const wxString SCH_LABEL_BASE::GetDefaultFieldName( const wxString& aName, bool } -bool SCH_LABEL_BASE::IsType( const std::initializer_list& aScanTypes ) const +bool SCH_LABEL_BASE::IsType( const std::vector& aScanTypes ) const { if( SCH_TEXT::IsType( aScanTypes ) ) return true; @@ -542,7 +542,7 @@ void SCH_LABEL_BASE::RunOnChildren( const std::function& aFun INSPECT_RESULT SCH_LABEL_BASE::Visit( INSPECTOR aInspector, void* testData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { if( IsType( aScanTypes ) ) { diff --git a/eeschema/sch_label.h b/eeschema/sch_label.h index c4c10cc06e..010f26adda 100644 --- a/eeschema/sch_label.h +++ b/eeschema/sch_label.h @@ -44,7 +44,7 @@ public: // Abstract class virtual wxString GetClass() const override = 0; - bool IsType( const std::initializer_list& aScanTypes ) const override; + bool IsType( const std::vector& aScanTypes ) const override; void SwapData( SCH_ITEM* aItem ) override; @@ -120,7 +120,7 @@ public: void RunOnChildren( const std::function& aFunction ) override; INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& scanTypes ) override; + const std::vector& scanTypes ) override; VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override; diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 2247dee46d..cb18d078bb 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -67,7 +67,7 @@ public: */ wxString GetNetname(const SCH_SHEET_PATH &aSheet); - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( SCH_ITEM::IsType( aScanTypes ) ) return true; diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 56da4c0f86..cb96aa7dc0 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -74,7 +74,7 @@ EESCHEMA_SETTINGS* eeconfig() } -std::initializer_list SCH_PAINTER::g_ScaledSelectionTypes = { +std::vector SCH_PAINTER::g_ScaledSelectionTypes = { SCH_MARKER_T, SCH_JUNCTION_T, SCH_NO_CONNECT_T, diff --git a/eeschema/sch_painter.h b/eeschema/sch_painter.h index 4cfc6b6eab..2408925e6f 100644 --- a/eeschema/sch_painter.h +++ b/eeschema/sch_painter.h @@ -195,7 +195,7 @@ private: void boxText( const wxString& aText, const VECTOR2D& aPosition, const TEXT_ATTRIBUTES& aAttrs ); public: - static std::initializer_list g_ScaledSelectionTypes; + static std::vector g_ScaledSelectionTypes; private: SCH_RENDER_SETTINGS m_schSettings; diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index d41cdf0486..0bbcc5ba16 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -944,7 +944,7 @@ std::vector SCH_SHEET::GetConnectionPoints() const INSPECT_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { for( KICAD_T scanType : aScanTypes ) { diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index b6627581c3..ef7191f339 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -351,7 +351,7 @@ public: std::vector GetConnectionPoints() const override; INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) override; + const std::vector& aScanTypes ) override; void RunOnChildren( const std::function& aFunction ) override; diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 39a8df0ad5..2a9c768433 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -1717,7 +1717,7 @@ wxString SCH_SYMBOL::GetSelectMenuText( EDA_UNITS aUnits ) const INSPECT_RESULT SCH_SYMBOL::Visit( INSPECTOR aInspector, void* aTestData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { for( KICAD_T scanType : aScanTypes ) { diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index d365f31d53..e3bcd8a065 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -639,7 +639,7 @@ public: std::vector GetConnectionPoints() const override; INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) override; + const std::vector& aScanTypes ) override; /** * Return the symbol library item at \a aPosition that is part of this symbol. diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index d35be17454..88bab92a33 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -144,7 +144,7 @@ EE_SELECTION_TOOL::~EE_SELECTION_TOOL() using E_C = EE_CONDITIONS; -static std::initializer_list connectedTypes = +static std::vector connectedTypes = { SCH_SYMBOL_LOCATE_POWER_T, SCH_PIN_T, @@ -777,7 +777,7 @@ EE_SELECTION& EE_SELECTION_TOOL::GetSelection() bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere, - const std::initializer_list& aFilterList ) + const std::vector& aScanTypes ) { int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) ); int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() / 2 ); @@ -791,11 +791,11 @@ bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& a if( !symbol ) return false; - aCollector.Collect( symbol->GetDrawItems(), aFilterList, aWhere, m_unit, m_convert ); + aCollector.Collect( symbol->GetDrawItems(), aScanTypes, aWhere, m_unit, m_convert ); } else { - aCollector.Collect( m_frame->GetScreen(), aFilterList, aWhere, m_unit, m_convert ); + aCollector.Collect( m_frame->GetScreen(), aScanTypes, aWhere, m_unit, m_convert ); if( m_frame->eeconfig()->m_Selection.select_pin_selects_symbol ) { @@ -933,14 +933,14 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& a bool EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, - const std::initializer_list& aFilterList, + const std::vector& aScanTypes, EDA_ITEM** aItem, bool* aSelectionCancelledFlag, bool aCheckLocked, bool aAdd, bool aSubtract, bool aExclusiveOr ) { EE_COLLECTOR collector; - if( !CollectHits( collector, aWhere, aFilterList ) ) + if( !CollectHits( collector, aWhere, aScanTypes ) ) return false; narrowSelection( collector, aWhere, aCheckLocked ); @@ -1142,15 +1142,14 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const } -EE_SELECTION& -EE_SELECTION_TOOL::RequestSelection( const std::initializer_list& aFilterList ) +EE_SELECTION& EE_SELECTION_TOOL::RequestSelection( const std::vector& aScanTypes ) { if( m_selection.Empty() ) { VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true ); ClearSelection(); - SelectPoint( cursorPos, aFilterList ); + SelectPoint( cursorPos, aScanTypes ); m_selection.SetIsHover( true ); m_selection.ClearReferencePoint(); } @@ -1164,7 +1163,7 @@ EE_SELECTION_TOOL::RequestSelection( const std::initializer_list& aFilt EDA_ITEM* item = (EDA_ITEM*) m_selection.GetItem( i ); isMoving |= static_cast( item )->IsMoving(); - if( !item->IsType( aFilterList ) ) + if( !item->IsType( aScanTypes ) ) { unselect( item ); anyUnselected = true; diff --git a/eeschema/tools/ee_selection_tool.h b/eeschema/tools/ee_selection_tool.h index fa6329cf1b..353e3c2010 100644 --- a/eeschema/tools/ee_selection_tool.h +++ b/eeschema/tools/ee_selection_tool.h @@ -81,16 +81,18 @@ public: /** * Return either an existing selection (filtered), or the selection at the current * cursor if the existing selection is empty. + * + * @param aScanTypes an optional type filter indicating the legal KICAD_Ts to be returned. + * @return either the current selection or, if empty, the selection at the cursor. */ - EE_SELECTION& - RequestSelection( const std::initializer_list& aFilterList = { SCH_LOCATE_ANY_T } ); + EE_SELECTION& RequestSelection( const std::vector& aScanTypes = { SCH_LOCATE_ANY_T } ); /** * This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere * before calling the primary SelectPoint method. * * @param aWhere is the location where the item(s) should be collected - * @param aFilterList is a list of items that are acceptable for collection + * @param aScanTypes is a list of items that are acceptable for collection * @param aItem is set to the newly selected item if only one was selected, otherwise is * unchanged. * @param aSelectionCancelledFlag allows the function to inform its caller that a selection @@ -102,7 +104,7 @@ public: * @param aExclusiveOr indicates if found item(s) should be toggle in the selection */ bool SelectPoint( const VECTOR2I& aWhere, - const std::initializer_list& aFilterList = { SCH_LOCATE_ANY_T }, + const std::vector& aScanTypes = { SCH_LOCATE_ANY_T }, EDA_ITEM** aItem = nullptr, bool* aSelectionCancelledFlag = nullptr, bool aCheckLocked = false, bool aAdd = false, bool aSubtract = false, bool aExclusiveOr = false ); @@ -153,11 +155,11 @@ public: * * @param aCollector is the collector object that will store found item(s) * @param aWhere is the place where the item should be selected. - * @param aFilterList is a list of items that are acceptable for collection + * @param aScanTypes is a list of items that are acceptable for collection * @param aCheckLocked indicates if locked items should be excluded. */ bool CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere, - const std::initializer_list& aFilterList = { SCH_LOCATE_ANY_T } ); + const std::vector& aScanTypes = { SCH_LOCATE_ANY_T } ); protected: SELECTION& selection() override { return m_selection; } diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 95030c7b49..54dd55885b 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -325,9 +325,7 @@ bool SCH_EDIT_TOOL::Init() return false; }; - static std::initializer_list allTextTypes = { SCH_LABEL_LOCATE_ANY_T, - SCH_TEXT_T, - SCH_TEXTBOX_T }; + static std::vector allTextTypes = { SCH_LABEL_LOCATE_ANY_T, SCH_TEXT_T, SCH_TEXTBOX_T }; auto toChangeCondition = ( E_C::OnlyTypes( allTextTypes ) ); @@ -523,7 +521,7 @@ bool SCH_EDIT_TOOL::Init() } -const std::initializer_list rotatableItems = { +const std::vector rotatableItems = { SCH_SHAPE_T, SCH_TEXT_T, SCH_TEXTBOX_T, @@ -1080,7 +1078,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) } -static std::initializer_list deletableItems = +static std::vector deletableItems = { SCH_MARKER_T, SCH_JUNCTION_T, diff --git a/eeschema/tools/symbol_editor_edit_tool.cpp b/eeschema/tools/symbol_editor_edit_tool.cpp index a041eaefc0..20e61a7b90 100644 --- a/eeschema/tools/symbol_editor_edit_tool.cpp +++ b/eeschema/tools/symbol_editor_edit_tool.cpp @@ -239,7 +239,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) } -static std::initializer_list nonFields = +static std::vector nonFields = { LIB_SYMBOL_T, LIB_SHAPE_T, diff --git a/gerbview/gbr_layout.cpp b/gerbview/gbr_layout.cpp index 51ff0adb0d..793cbfa752 100644 --- a/gerbview/gbr_layout.cpp +++ b/gerbview/gbr_layout.cpp @@ -76,7 +76,7 @@ EDA_RECT GBR_LAYOUT::ComputeBoundingBox() const INSPECT_RESULT GBR_LAYOUT::Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { #if 0 && defined(DEBUG) std::cout << GetClass().mb_str() << ' '; diff --git a/gerbview/gbr_layout.h b/gerbview/gbr_layout.h index 21cd5280ff..66a0a68931 100644 --- a/gerbview/gbr_layout.h +++ b/gerbview/gbr_layout.h @@ -79,7 +79,7 @@ public: ///< @copydoc EDA_ITEM::Visit() INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) override; + const std::vector& aScanTypes ) override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } diff --git a/gerbview/gerber_collectors.cpp b/gerbview/gerber_collectors.cpp index 5ca08cdad9..4bed9a2054 100644 --- a/gerbview/gerber_collectors.cpp +++ b/gerbview/gerber_collectors.cpp @@ -36,12 +36,12 @@ INSPECT_RESULT GERBER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) } -void GERBER_COLLECTOR::Collect( EDA_ITEM* aItem, const std::initializer_list& aScanList, +void GERBER_COLLECTOR::Collect( EDA_ITEM* aItem, const std::vector& aScanTypes, const VECTOR2I& aRefPos ) { Empty(); // empty the collection, primary criteria list - SetScanTypes( aScanList ); + SetScanTypes( aScanTypes ); // remember where the snapshot was taken from and pass refPos to // the Inspect() function. diff --git a/gerbview/gerber_collectors.h b/gerbview/gerber_collectors.h index 9a77961497..b314c30312 100644 --- a/gerbview/gerber_collectors.h +++ b/gerbview/gerber_collectors.h @@ -60,11 +60,11 @@ public: * Scan an EDA_ITEM using this class's Inspector method, which does the collection. * * @param aItem An EDA_ITEM to scan - * @param aScanList A list of KICAD_Ts that specs what is to be collected and the priority - * order of the resultant collection in "m_list". + * @param aScanTypes A list of KICAD_Ts that specs what is to be collected and the priority + * order of the resultant collection in "m_list". * @param aRefPos A VECTOR2I to use in hit-testing. */ - void Collect( EDA_ITEM* aItem, const std::initializer_list& aScanList, + void Collect( EDA_ITEM* aItem, const std::vector& aScanTypes, const VECTOR2I& aRefPos ); }; diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp index 8d3130417e..b2a2386403 100644 --- a/gerbview/gerber_draw_item.cpp +++ b/gerbview/gerber_draw_item.cpp @@ -985,7 +985,7 @@ double GERBER_DRAW_ITEM::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const INSPECT_RESULT GERBER_DRAW_ITEM::Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { for( KICAD_T scanType : aScanTypes ) { diff --git a/gerbview/gerber_draw_item.h b/gerbview/gerber_draw_item.h index 5bf7a352b5..0ac492c7d5 100644 --- a/gerbview/gerber_draw_item.h +++ b/gerbview/gerber_draw_item.h @@ -219,7 +219,7 @@ public: ///< @copydoc EDA_ITEM::Visit() INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) override; + const std::vector& aScanTypes ) override; ///< @copydoc EDA_ITEM::GetSelectMenuText() virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; diff --git a/gerbview/gerber_file_image.cpp b/gerbview/gerber_file_image.cpp index d700a0ee4a..7faba0e2c1 100644 --- a/gerbview/gerber_file_image.cpp +++ b/gerbview/gerber_file_image.cpp @@ -389,7 +389,7 @@ void GERBER_FILE_IMAGE::RemoveAttribute( X2_ATTRIBUTE& aAttribute ) INSPECT_RESULT GERBER_FILE_IMAGE::Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { for( KICAD_T scanType : aScanTypes ) { diff --git a/gerbview/gerber_file_image.h b/gerbview/gerber_file_image.h index db07706708..e01d4448a4 100644 --- a/gerbview/gerber_file_image.h +++ b/gerbview/gerber_file_image.h @@ -298,7 +298,7 @@ public: ///< @copydoc EDA_ITEM::Visit() INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) override; + const std::vector& aScanTypes ) override; #if defined(DEBUG) diff --git a/include/collector.h b/include/collector.h index 731364e387..6743922518 100644 --- a/include/collector.h +++ b/include/collector.h @@ -209,7 +209,7 @@ public: * * @param aScanTypes A list of KICAD_Ts. */ - void SetScanTypes( const std::initializer_list& aTypes ) { m_scanTypes = aTypes; } + void SetScanTypes( const std::vector& aTypes ) { m_scanTypes = aTypes; } void SetRefPos( const VECTOR2I& aRefPos ) { m_refPos = aRefPos; } @@ -240,14 +240,14 @@ public: bool m_MenuCancelled; // Indicates selection disambiguation menu was canceled protected: - std::vector m_list; // Primary list of most likely items - std::vector m_backupList; // Secondary list with items removed by heuristics + std::vector m_list; // Primary list of most likely items + std::vector m_backupList; // Secondary list with items removed by heuristics - std::initializer_list m_scanTypes; - INSPECTOR_FUNC m_inspector; + std::vector m_scanTypes; + INSPECTOR_FUNC m_inspector; - VECTOR2I m_refPos; // Reference pos used to generate the collection. - EDA_RECT m_refBox; // Selection rect used to generate the collection. + VECTOR2I m_refPos; // Reference pos used to generate the collection. + EDA_RECT m_refBox; // Selection rect used to generate the collection. }; #endif // COLLECTOR_H diff --git a/include/eda_item.h b/include/eda_item.h index bdd220c4e8..75f7926ca3 100644 --- a/include/eda_item.h +++ b/include/eda_item.h @@ -190,7 +190,7 @@ public: * @param aScanTypes List of item types * @return true if the item type is contained in the list aScanTypes */ - virtual bool IsType( const std::initializer_list& aScanTypes ) const + virtual bool IsType( const std::vector& aScanTypes ) const { for( KICAD_T scanType : aScanTypes ) { @@ -303,14 +303,14 @@ public: * else #SCAN_CONTINUE, and determined by the inspector. */ virtual INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ); + const std::vector& aScanTypes ); /** * This changes first parameter to avoid the DList and use the main queue instead. */ template< class T > static INSPECT_RESULT IterateForward( std::deque& aList, INSPECTOR inspector, void* testData, - const std::initializer_list& scanTypes ) + const std::vector& scanTypes ) { for( const auto& it : aList ) { @@ -330,8 +330,7 @@ public: */ template static INSPECT_RESULT IterateForward( std::vector& aList, INSPECTOR inspector, - void* testData, - const std::initializer_list& scanTypes ) + void* testData, const std::vector& scanTypes ) { for( const auto& it : aList ) { diff --git a/include/pcb_group.h b/include/pcb_group.h index 40e2ae65c8..011d585d7c 100644 --- a/include/pcb_group.h +++ b/include/pcb_group.h @@ -162,7 +162,7 @@ public: ///< @copydoc EDA_ITEM::Visit INSPECT_RESULT Visit( INSPECTOR aInspector, void* aTestData, - const std::initializer_list& aScanTypes ) override; + const std::vector& aScanTypes ) override; ///< @copydoc VIEW_ITEM::ViewGetLayers void ViewGetLayers( int aLayers[], int& aCount ) const override; diff --git a/include/tool/selection_conditions.h b/include/tool/selection_conditions.h index 37ebed57b7..89f0cb18eb 100644 --- a/include/tool/selection_conditions.h +++ b/include/tool/selection_conditions.h @@ -114,7 +114,7 @@ public: * @param aTypes is an array containing types that are searched. * @return Functor testing for presence of items of a given types. */ - static SELECTION_CONDITION HasTypes( const std::initializer_list& aTypes ); + static SELECTION_CONDITION HasTypes( std::vector aTypes ); /** * Create a functor that tests if the selected items are *only* of given types. @@ -122,7 +122,7 @@ public: * @param aTypes is an array containing types that are searched. * @return Functor testing if selected items are exclusively of the requested types. */ - static SELECTION_CONDITION OnlyTypes( const std::initializer_list& aTypes ); + static SELECTION_CONDITION OnlyTypes( std::vector aTypes ); /** * Create a functor that tests if the number of selected items is equal to the value given as @@ -156,12 +156,10 @@ private: static bool hasTypeFunc( const SELECTION& aSelection, KICAD_T aType ); ///< Helper function used by HasTypes() - static bool hasTypesFunc( const SELECTION& aSelection, - const std::initializer_list& aTypes ); + static bool hasTypesFunc( const SELECTION& aSelection, std::vector aTypes ); ///< Helper function used by OnlyTypes() - static bool onlyTypesFunc( const SELECTION& aSelection, - const std::initializer_list& aTypes ); + static bool onlyTypesFunc( const SELECTION& aSelection, std::vector aTypes ); ///< Helper function used by Count() static bool countFunc( const SELECTION& aSelection, int aNumber ); diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 5745198c38..3c7401e68b 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -1250,7 +1250,7 @@ void BOARD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector INSPECT_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& scanTypes ) + const std::vector& scanTypes ) { #if 0 && defined(DEBUG) std::cout << GetClass().mb_str() << ' '; diff --git a/pcbnew/board.h b/pcbnew/board.h index f840a6ba40..096a6a3303 100644 --- a/pcbnew/board.h +++ b/pcbnew/board.h @@ -811,7 +811,7 @@ public: * determined by the inspector. */ INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& scanTypes ) override; + const std::vector& scanTypes ) override; /** * Search for a FOOTPRINT within this board with the given reference designator. diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index cf255f6b8d..df172ca075 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -38,7 +38,7 @@ #include // for KiROUND -const std::initializer_list GENERAL_COLLECTOR::AllBoardItems = { +const std::vector GENERAL_COLLECTOR::AllBoardItems = { PCB_MARKER_T, // in m_markers PCB_TEXT_T, // in m_drawings PCB_BITMAP_T, // in m_drawings @@ -62,7 +62,7 @@ const std::initializer_list GENERAL_COLLECTOR::AllBoardItems = { }; -const std::initializer_list GENERAL_COLLECTOR::BoardLevelItems = { +const std::vector GENERAL_COLLECTOR::BoardLevelItems = { PCB_MARKER_T, PCB_BITMAP_T, PCB_TEXT_T, @@ -83,12 +83,12 @@ const std::initializer_list GENERAL_COLLECTOR::BoardLevelItems = { }; -const std::initializer_list GENERAL_COLLECTOR::Footprints = { +const std::vector GENERAL_COLLECTOR::Footprints = { PCB_FOOTPRINT_T }; -const std::initializer_list GENERAL_COLLECTOR::PadsOrTracks = { +const std::vector GENERAL_COLLECTOR::PadsOrTracks = { PCB_PAD_T, PCB_VIA_T, PCB_TRACE_T, @@ -96,7 +96,7 @@ const std::initializer_list GENERAL_COLLECTOR::PadsOrTracks = { }; -const std::initializer_list GENERAL_COLLECTOR::FootprintItems = { +const std::vector GENERAL_COLLECTOR::FootprintItems = { PCB_MARKER_T, PCB_FP_TEXT_T, PCB_FP_TEXTBOX_T, @@ -113,14 +113,14 @@ const std::initializer_list GENERAL_COLLECTOR::FootprintItems = { }; -const std::initializer_list GENERAL_COLLECTOR::Tracks = { +const std::vector GENERAL_COLLECTOR::Tracks = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T }; -const std::initializer_list GENERAL_COLLECTOR::LockableItems = { +const std::vector GENERAL_COLLECTOR::LockableItems = { PCB_FOOTPRINT_T, PCB_GROUP_T, // Can a group be locked? PCB_TRACE_T, @@ -129,13 +129,13 @@ const std::initializer_list GENERAL_COLLECTOR::LockableItems = { }; -const std::initializer_list GENERAL_COLLECTOR::Zones = { +const std::vector GENERAL_COLLECTOR::Zones = { PCB_ZONE_T, PCB_FP_ZONE_T }; -const std::initializer_list GENERAL_COLLECTOR::Dimensions = { +const std::vector GENERAL_COLLECTOR::Dimensions = { PCB_DIM_ALIGNED_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, @@ -149,7 +149,7 @@ const std::initializer_list GENERAL_COLLECTOR::Dimensions = { }; -const std::initializer_list GENERAL_COLLECTOR::DraggableItems = { +const std::vector GENERAL_COLLECTOR::DraggableItems = { PCB_TRACE_T, PCB_VIA_T, PCB_FOOTPRINT_T, @@ -593,8 +593,7 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) } -void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, - const std::initializer_list& aScanTypes, +void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const std::vector& aScanTypes, const VECTOR2I& aRefPos, const COLLECTORS_GUIDE& aGuide ) { Empty(); // empty the collection, primary criteria list @@ -629,7 +628,7 @@ INSPECT_RESULT PCB_TYPE_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) } -void PCB_TYPE_COLLECTOR::Collect( BOARD_ITEM* aBoard, const std::initializer_list& aTypes ) +void PCB_TYPE_COLLECTOR::Collect( BOARD_ITEM* aBoard, const std::vector& aTypes ) { Empty(); aBoard->Visit( m_inspector, nullptr, aTypes ); @@ -647,7 +646,7 @@ INSPECT_RESULT PCB_LAYER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData } -void PCB_LAYER_COLLECTOR::Collect( BOARD_ITEM* aBoard, const std::initializer_list& aTypes ) +void PCB_LAYER_COLLECTOR::Collect( BOARD_ITEM* aBoard, const std::vector& aTypes ) { Empty(); aBoard->Visit( m_inspector, nullptr, aTypes ); diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index 2b16b767b2..b1d6eaeb96 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -52,74 +52,74 @@ class COLLECTORS_GUIDE { public: - virtual ~COLLECTORS_GUIDE() {} + virtual ~COLLECTORS_GUIDE() {} /** * @return true if the given layer is visible, else false. */ - virtual bool IsLayerVisible( PCB_LAYER_ID layer ) const = 0; + virtual bool IsLayerVisible( PCB_LAYER_ID layer ) const = 0; /** * @return the preferred layer for HitTest()ing. */ - virtual PCB_LAYER_ID GetPreferredLayer() const = 0; + virtual PCB_LAYER_ID GetPreferredLayer() const = 0; /** * @return true if should ignore locked items, else false. */ - virtual bool IgnoreLockedItems() const = 0; + virtual bool IgnoreLockedItems() const = 0; /** * Determine if the secondary criteria or 2nd choice items should be included. * * @return true if should include, else false. */ - virtual bool IncludeSecondary() const = 0; + virtual bool IncludeSecondary() const = 0; /** * @return true if footprint texts marked as "no show" should be ignored. */ - virtual bool IgnoreHiddenFPText() const = 0; + virtual bool IgnoreHiddenFPText() const = 0; /** * @return true if should ignore footprint text on back layers */ - virtual bool IgnoreFPTextOnBack() const = 0; + virtual bool IgnoreFPTextOnBack() const = 0; /** * @return true if should ignore footprint text on front layers. */ - virtual bool IgnoreFPTextOnFront() const = 0; + virtual bool IgnoreFPTextOnFront() const = 0; /** * @return true if should ignore FOOTPRINTs on Back Side. */ - virtual bool IgnoreFootprintsOnBack() const = 0; + virtual bool IgnoreFootprintsOnBack() const = 0; /** * @return true if should ignore FOOTPRINTs on Front Side. */ - virtual bool IgnoreFootprintsOnFront() const = 0; + virtual bool IgnoreFootprintsOnFront() const = 0; /** * @return true if should ignore Pads on Back Side. */ - virtual bool IgnorePadsOnBack() const = 0; + virtual bool IgnorePadsOnBack() const = 0; /** * @return true if should ignore PADSs on Front Side. */ - virtual bool IgnorePadsOnFront() const = 0; + virtual bool IgnorePadsOnFront() const = 0; /** * @return true if should ignore through-hole PADSs. */ - virtual bool IgnoreThroughHolePads() const = 0; + virtual bool IgnoreThroughHolePads() const = 0; /** * @return true if should ignore PADSs on Front side and Back side. */ - virtual bool IgnorePads() const + virtual bool IgnorePads() const { return IgnorePadsOnFront() && IgnorePadsOnBack() && IgnoreThroughHolePads(); } @@ -127,39 +127,39 @@ public: /** * @return true if should ignore footprint values. */ - virtual bool IgnoreFPValues() const = 0; + virtual bool IgnoreFPValues() const = 0; /** * @return true if should ignore footprint references. */ - virtual bool IgnoreFPReferences() const = 0; + virtual bool IgnoreFPReferences() const = 0; /** * @return true if should ignore through-hole vias */ - virtual bool IgnoreThroughVias() const = 0; + virtual bool IgnoreThroughVias() const = 0; /** * @return true if should ignore blind/buried vias */ - virtual bool IgnoreBlindBuriedVias() const = 0; + virtual bool IgnoreBlindBuriedVias() const = 0; /** * @return true if should ignore micro vias */ - virtual bool IgnoreMicroVias() const = 0; + virtual bool IgnoreMicroVias() const = 0; /** * @return true if should ignore tracks */ - virtual bool IgnoreTracks() const = 0; + virtual bool IgnoreTracks() const = 0; /** * @return true if should ignore the interiors of zones */ - virtual bool IgnoreZoneFills() const = 0; + virtual bool IgnoreZoneFills() const = 0; - virtual double OnePixelInIU() const = 0; + virtual double OnePixelInIU() const = 0; }; @@ -221,53 +221,53 @@ public: /** * A scan list for all editable board items */ - static const std::initializer_list AllBoardItems; + static const std::vector AllBoardItems; /** * A scan list for zones outlines only */ - static const std::initializer_list Zones; + static const std::vector Zones; /** * A scan list for all primary board items, omitting items which are subordinate to * a FOOTPRINT, such as PAD and FP_TEXT. */ - static const std::initializer_list BoardLevelItems; + static const std::vector BoardLevelItems; /** * A scan list for only FOOTPRINTs */ - static const std::initializer_list Footprints; + static const std::vector Footprints; /** * A scan list for PADs, TRACKs, or VIAs */ - static const std::initializer_list PadsOrTracks; + static const std::vector PadsOrTracks; /** * A scan list for primary footprint items. */ - static const std::initializer_list FootprintItems; + static const std::vector FootprintItems; /** * A scan list for only TRACKs and ARCs */ - static const std::initializer_list Tracks; + static const std::vector Tracks; /** * A scan list for TRACKs, VIAs, FOOTPRINTs */ - static const std::initializer_list LockableItems; + static const std::vector LockableItems; /** * A scan list for dimensions */ - static const std::initializer_list Dimensions; + static const std::vector Dimensions; /** * A scan list for items that can be dragged */ - static const std::initializer_list DraggableItems; + static const std::vector DraggableItems; GENERAL_COLLECTOR() : m_Guide( nullptr ) @@ -313,7 +313,7 @@ public: * @param aRefPos A wxPoint to use in hit-testing. * @param aGuide The COLLECTORS_GUIDE to use in collecting items. */ - void Collect( BOARD_ITEM* aItem, const std::initializer_list& aScanList, + void Collect( BOARD_ITEM* aItem, const std::vector& aScanList, const VECTOR2I& aRefPos, const COLLECTORS_GUIDE& aGuide ); }; @@ -537,7 +537,7 @@ public: * @param aBoard The BOARD_ITEM to scan. * @param aTypes The KICAD_Ts to gather up. */ - void Collect( BOARD_ITEM* aBoard, const std::initializer_list& aTypes ); + void Collect( BOARD_ITEM* aBoard, const std::vector& aTypes ); }; @@ -570,7 +570,7 @@ public: * @param aBoard The BOARD_ITEM to scan. * @param aTypes The KICAD_Ts to gather up. */ - void Collect( BOARD_ITEM* aBoard, const std::initializer_list& aTypes ); + void Collect( BOARD_ITEM* aBoard, const std::vector& aTypes ); private: PCB_LAYER_ID m_layer_id; diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 472aaf1e09..e5529a4d7e 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -1242,7 +1242,7 @@ void FOOTPRINT::Add3DModel( FP_3DMODEL* a3DModel ) // see footprint.h INSPECT_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { #if 0 && defined(DEBUG) std::cout << GetClass().mb_str() << ' '; diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 01df2cf589..12ba920d3e 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -638,7 +638,7 @@ public: void Add3DModel( FP_3DMODEL* a3DModel ); INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) override; + const std::vector& aScanTypes ) override; wxString GetClass() const override { diff --git a/pcbnew/fp_shape.h b/pcbnew/fp_shape.h index f1a7536c5d..17b3a7d1c2 100644 --- a/pcbnew/fp_shape.h +++ b/pcbnew/fp_shape.h @@ -50,7 +50,7 @@ public: return aItem && PCB_FP_SHAPE_T == aItem->Type(); } - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( BOARD_ITEM::IsType( aScanTypes ) ) return true; diff --git a/pcbnew/fp_text.h b/pcbnew/fp_text.h index 7ebfe9539f..d27412d265 100644 --- a/pcbnew/fp_text.h +++ b/pcbnew/fp_text.h @@ -64,7 +64,7 @@ public: return aItem && aItem->Type() == PCB_FP_TEXT_T; } - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( BOARD_ITEM::IsType( aScanTypes ) ) return true; diff --git a/pcbnew/fp_textbox.h b/pcbnew/fp_textbox.h index d190d02664..02051706b0 100644 --- a/pcbnew/fp_textbox.h +++ b/pcbnew/fp_textbox.h @@ -50,7 +50,7 @@ public: return aItem && aItem->Type() == PCB_FP_TEXT_T; } - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( BOARD_ITEM::IsType( aScanTypes ) ) return true; diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index ae74cc7020..e28286b938 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -230,9 +230,6 @@ bool PAD::FlashLayer( LSET aLayers ) const bool PAD::FlashLayer( int aLayer ) const { - static std::initializer_list types - { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, PCB_ZONE_T, PCB_FP_ZONE_T }; - if( aLayer != UNDEFINED_LAYER && !IsOnLayer( static_cast( aLayer ) ) ) return false; @@ -276,7 +273,17 @@ bool PAD::FlashLayer( int aLayer ) const return true; if( const BOARD* board = GetBoard() ) + { + // Must be static to keep from raising its ugly head in performance profiles + static std::initializer_list types = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, + PCB_PAD_T }; + + // Do not check zones. Doing so results in race conditions when the via collides with + // two different zones of different priorities. + // See https://gitlab.com/kicad/code/kicad/-/issues/11299. + return board->GetConnectivity()->IsConnectedOnLayer( this, aLayer, types, true ); + } } return true; diff --git a/pcbnew/pad.h b/pcbnew/pad.h index a2224ce3f8..e3f83a88da 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -82,7 +82,7 @@ public: return aItem && PCB_PAD_T == aItem->Type(); } - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) ) return true; diff --git a/pcbnew/pcb_dimension.h b/pcbnew/pcb_dimension.h index 23bfb849fb..ffa2b6268b 100644 --- a/pcbnew/pcb_dimension.h +++ b/pcbnew/pcb_dimension.h @@ -97,7 +97,7 @@ class PCB_DIMENSION_BASE : public BOARD_ITEM public: PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T ); - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( BOARD_ITEM::IsType( aScanTypes ) ) return true; diff --git a/pcbnew/pcb_group.cpp b/pcbnew/pcb_group.cpp index 2e34a92bb9..32735f8fe9 100644 --- a/pcbnew/pcb_group.cpp +++ b/pcbnew/pcb_group.cpp @@ -234,7 +234,7 @@ const EDA_RECT PCB_GROUP::GetBoundingBox() const INSPECT_RESULT PCB_GROUP::Visit( INSPECTOR aInspector, void* aTestData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { for( KICAD_T scanType : aScanTypes ) { diff --git a/pcbnew/pcb_shape.h b/pcbnew/pcb_shape.h index 71778fd102..e58882ace1 100644 --- a/pcbnew/pcb_shape.h +++ b/pcbnew/pcb_shape.h @@ -57,7 +57,7 @@ public: return wxT( "PCB_SHAPE" ); } - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( BOARD_ITEM::IsType( aScanTypes ) ) return true; diff --git a/pcbnew/pcb_text.h b/pcbnew/pcb_text.h index 3a4d9a6dda..646a046b94 100644 --- a/pcbnew/pcb_text.h +++ b/pcbnew/pcb_text.h @@ -48,7 +48,7 @@ public: return aItem && PCB_TEXT_T == aItem->Type(); } - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( BOARD_ITEM::IsType( aScanTypes ) ) return true; diff --git a/pcbnew/pcb_textbox.h b/pcbnew/pcb_textbox.h index 6c5aaedb14..9a01ee4a75 100644 --- a/pcbnew/pcb_textbox.h +++ b/pcbnew/pcb_textbox.h @@ -48,7 +48,7 @@ public: return aItem && PCB_TEXTBOX_T == aItem->Type(); } - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( BOARD_ITEM::IsType( aScanTypes ) ) return true; diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index 7e44d4ac3a..43eb648ea4 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -370,7 +370,7 @@ void PCB_VIA::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) // see class_track.h INSPECT_RESULT PCB_TRACK::Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) + const std::vector& aScanTypes ) { for( KICAD_T scanType : aScanTypes ) { @@ -579,7 +579,8 @@ bool PCB_VIA::FlashLayer( int aLayer ) const return true; // Must be static to keep from raising its ugly head in performance profiles - static std::initializer_list connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T }; + static std::initializer_list connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, + PCB_PAD_T }; // Do not check zones. Doing so results in race conditions when the via collides with // two different zones of different priorities. diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index 150da7869c..56526347e5 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -174,7 +174,7 @@ public: void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, - const std::initializer_list& aScanTypes ) override; + const std::vector& aScanTypes ) override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; @@ -336,7 +336,7 @@ public: // Do not create a copy constructor. The one generated by the compiler is adequate. - bool IsType( const std::initializer_list& aScanTypes ) const override + bool IsType( const std::vector& aScanTypes ) const override { if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) ) return true; diff --git a/pcbnew/tools/board_inspection_tool.cpp b/pcbnew/tools/board_inspection_tool.cpp index 44137f76cf..7aee5d5ff0 100644 --- a/pcbnew/tools/board_inspection_tool.cpp +++ b/pcbnew/tools/board_inspection_tool.cpp @@ -79,11 +79,11 @@ bool BOARD_INSPECTION_TOOL::Init() auto netSubMenu = std::make_shared(); netSubMenu->SetTool( this ); - static std::initializer_list connectedTypes = { PCB_TRACE_T, - PCB_VIA_T, - PCB_ARC_T, - PCB_PAD_T, - PCB_ZONE_T }; + static std::vector connectedTypes = { PCB_TRACE_T, + PCB_VIA_T, + PCB_ARC_T, + PCB_PAD_T, + PCB_ZONE_T }; CONDITIONAL_MENU& menu = selectionTool->GetToolMenu().GetMenu();