Attempt to fix std::initializer_list lifetime issue.

This commit is contained in:
Jeff Young 2022-08-21 20:54:07 +01:00
parent 88c9177ff6
commit 4f0136db3b
52 changed files with 164 additions and 165 deletions

View File

@ -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<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
#if 0 && defined(DEBUG)
std::cout << GetClass().mb_str() << ' ';

View File

@ -64,13 +64,13 @@ SELECTION_CONDITION SELECTION_CONDITIONS::HasType( KICAD_T aType )
}
SELECTION_CONDITION SELECTION_CONDITIONS::HasTypes( const std::initializer_list<KICAD_T>& aTypes )
SELECTION_CONDITION SELECTION_CONDITIONS::HasTypes( std::vector<KICAD_T> aTypes )
{
return std::bind( &SELECTION_CONDITIONS::hasTypesFunc, _1, aTypes );
}
SELECTION_CONDITION SELECTION_CONDITIONS::OnlyTypes( const std::initializer_list<KICAD_T>& aTypes )
SELECTION_CONDITION SELECTION_CONDITIONS::OnlyTypes( std::vector<KICAD_T> 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<KICAD_T>& aTypes )
bool SELECTION_CONDITIONS::hasTypesFunc( const SELECTION& aSelection, std::vector<KICAD_T> 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<KICAD_T>& aTypes )
bool SELECTION_CONDITIONS::onlyTypesFunc( const SELECTION& aSelection, std::vector<KICAD_T> aTypes )
{
if( aSelection.Empty() )
return false;

View File

@ -36,7 +36,7 @@
#include "sch_reference_list.h"
const std::initializer_list<KICAD_T> EE_COLLECTOR::EditableItems = {
const std::vector<KICAD_T> EE_COLLECTOR::EditableItems = {
SCH_SHAPE_T,
SCH_TEXT_T,
SCH_TEXTBOX_T,
@ -55,7 +55,7 @@ const std::initializer_list<KICAD_T> EE_COLLECTOR::EditableItems = {
};
const std::initializer_list<KICAD_T> EE_COLLECTOR::MovableItems =
const std::vector<KICAD_T> EE_COLLECTOR::MovableItems =
{
SCH_MARKER_T,
SCH_JUNCTION_T,
@ -78,7 +78,7 @@ const std::initializer_list<KICAD_T> EE_COLLECTOR::MovableItems =
};
const std::initializer_list<KICAD_T> EE_COLLECTOR::FieldOwners = {
const std::vector<KICAD_T> 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<KICAD_T>& aFilterList,
void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const std::vector<KICAD_T>& 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<KICAD_T>& aFilterList,
void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const std::vector<KICAD_T>& aFilterList,
const VECTOR2I& aPos, int aUnit, int aConvert )
{
Empty(); // empty the collection just in case

View File

@ -39,11 +39,11 @@ class SCH_SYMBOL;
class EE_COLLECTOR : public COLLECTOR
{
public:
static const std::initializer_list<KICAD_T> EditableItems;
static const std::initializer_list<KICAD_T> MovableItems;
static const std::initializer_list<KICAD_T> FieldOwners;
static const std::vector<KICAD_T> EditableItems;
static const std::vector<KICAD_T> MovableItems;
static const std::vector<KICAD_T> FieldOwners;
EE_COLLECTOR( const std::initializer_list<KICAD_T>& aScanTypes = { SCH_LOCATE_ANY_T } ) :
EE_COLLECTOR( const std::vector<KICAD_T>& 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<KICAD_T>& aFilterList,
void Collect( SCH_SCREEN* aScreen, const std::vector<KICAD_T>& 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<KICAD_T>& aFilterList,
void Collect( LIB_ITEMS_CONTAINER& aItems, const std::vector<KICAD_T>& aScanTypes,
const VECTOR2I& aPos, int aUnit = 0, int aConvert = 0 );
/**

View File

@ -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<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
// The part itself is never inspected, only its children
for( LIB_ITEM& item : m_drawings )

View File

@ -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<KICAD_T>& aScanTypes ) override;
const std::vector<KICAD_T>& aScanTypes ) override;
/**
* Set the units per symbol count.

View File

@ -69,7 +69,7 @@ public:
return wxT( "SCH_FIELD" );
}
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( SCH_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -157,7 +157,7 @@ public:
return wxT( "SCH_ITEM" );
}
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( EDA_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -190,7 +190,7 @@ const wxString SCH_LABEL_BASE::GetDefaultFieldName( const wxString& aName, bool
}
bool SCH_LABEL_BASE::IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const
bool SCH_LABEL_BASE::IsType( const std::vector<KICAD_T>& aScanTypes ) const
{
if( SCH_TEXT::IsType( aScanTypes ) )
return true;
@ -542,7 +542,7 @@ void SCH_LABEL_BASE::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFun
INSPECT_RESULT SCH_LABEL_BASE::Visit( INSPECTOR aInspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
if( IsType( aScanTypes ) )
{

View File

@ -44,7 +44,7 @@ public:
// Abstract class
virtual wxString GetClass() const override = 0;
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override;
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override;
void SwapData( SCH_ITEM* aItem ) override;
@ -120,7 +120,7 @@ public:
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& scanTypes ) override;
const std::vector<KICAD_T>& scanTypes ) override;
VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;

View File

@ -67,7 +67,7 @@ public:
*/
wxString GetNetname(const SCH_SHEET_PATH &aSheet);
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( SCH_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -74,7 +74,7 @@ EESCHEMA_SETTINGS* eeconfig()
}
std::initializer_list<KICAD_T> SCH_PAINTER::g_ScaledSelectionTypes = {
std::vector<KICAD_T> SCH_PAINTER::g_ScaledSelectionTypes = {
SCH_MARKER_T,
SCH_JUNCTION_T,
SCH_NO_CONNECT_T,

View File

@ -195,7 +195,7 @@ private:
void boxText( const wxString& aText, const VECTOR2D& aPosition, const TEXT_ATTRIBUTES& aAttrs );
public:
static std::initializer_list<KICAD_T> g_ScaledSelectionTypes;
static std::vector<KICAD_T> g_ScaledSelectionTypes;
private:
SCH_RENDER_SETTINGS m_schSettings;

View File

@ -944,7 +944,7 @@ std::vector<VECTOR2I> SCH_SHEET::GetConnectionPoints() const
INSPECT_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
for( KICAD_T scanType : aScanTypes )
{

View File

@ -351,7 +351,7 @@ public:
std::vector<VECTOR2I> GetConnectionPoints() const override;
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes ) override;
const std::vector<KICAD_T>& aScanTypes ) override;
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;

View File

@ -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<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
for( KICAD_T scanType : aScanTypes )
{

View File

@ -639,7 +639,7 @@ public:
std::vector<VECTOR2I> GetConnectionPoints() const override;
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes ) override;
const std::vector<KICAD_T>& aScanTypes ) override;
/**
* Return the symbol library item at \a aPosition that is part of this symbol.

View File

@ -144,7 +144,7 @@ EE_SELECTION_TOOL::~EE_SELECTION_TOOL()
using E_C = EE_CONDITIONS;
static std::initializer_list<KICAD_T> connectedTypes =
static std::vector<KICAD_T> 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<KICAD_T>& aFilterList )
const std::vector<KICAD_T>& 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<KICAD_T>& aFilterList,
const std::vector<KICAD_T>& 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<KICAD_T>& aFilterList )
EE_SELECTION& EE_SELECTION_TOOL::RequestSelection( const std::vector<KICAD_T>& 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<KICAD_T>& aFilt
EDA_ITEM* item = (EDA_ITEM*) m_selection.GetItem( i );
isMoving |= static_cast<SCH_ITEM*>( item )->IsMoving();
if( !item->IsType( aFilterList ) )
if( !item->IsType( aScanTypes ) )
{
unselect( item );
anyUnselected = true;

View File

@ -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<KICAD_T>& aFilterList = { SCH_LOCATE_ANY_T } );
EE_SELECTION& RequestSelection( const std::vector<KICAD_T>& 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<KICAD_T>& aFilterList = { SCH_LOCATE_ANY_T },
const std::vector<KICAD_T>& 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<KICAD_T>& aFilterList = { SCH_LOCATE_ANY_T } );
const std::vector<KICAD_T>& aScanTypes = { SCH_LOCATE_ANY_T } );
protected:
SELECTION& selection() override { return m_selection; }

View File

@ -325,9 +325,7 @@ bool SCH_EDIT_TOOL::Init()
return false;
};
static std::initializer_list<KICAD_T> allTextTypes = { SCH_LABEL_LOCATE_ANY_T,
SCH_TEXT_T,
SCH_TEXTBOX_T };
static std::vector<KICAD_T> 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<KICAD_T> rotatableItems = {
const std::vector<KICAD_T> 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<KICAD_T> deletableItems =
static std::vector<KICAD_T> deletableItems =
{
SCH_MARKER_T,
SCH_JUNCTION_T,

View File

@ -239,7 +239,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
}
static std::initializer_list<KICAD_T> nonFields =
static std::vector<KICAD_T> nonFields =
{
LIB_SYMBOL_T,
LIB_SHAPE_T,

View File

@ -76,7 +76,7 @@ EDA_RECT GBR_LAYOUT::ComputeBoundingBox() const
INSPECT_RESULT GBR_LAYOUT::Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
#if 0 && defined(DEBUG)
std::cout << GetClass().mb_str() << ' ';

View File

@ -79,7 +79,7 @@ public:
///< @copydoc EDA_ITEM::Visit()
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes ) override;
const std::vector<KICAD_T>& aScanTypes ) override;
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }

View File

@ -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<KICAD_T>& aScanList,
void GERBER_COLLECTOR::Collect( EDA_ITEM* aItem, const std::vector<KICAD_T>& 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.

View File

@ -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<KICAD_T>& aScanList,
void Collect( EDA_ITEM* aItem, const std::vector<KICAD_T>& aScanTypes,
const VECTOR2I& aRefPos );
};

View File

@ -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<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
for( KICAD_T scanType : aScanTypes )
{

View File

@ -219,7 +219,7 @@ public:
///< @copydoc EDA_ITEM::Visit()
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes ) override;
const std::vector<KICAD_T>& aScanTypes ) override;
///< @copydoc EDA_ITEM::GetSelectMenuText()
virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;

View File

@ -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<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
for( KICAD_T scanType : aScanTypes )
{

View File

@ -298,7 +298,7 @@ public:
///< @copydoc EDA_ITEM::Visit()
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes ) override;
const std::vector<KICAD_T>& aScanTypes ) override;
#if defined(DEBUG)

View File

@ -209,7 +209,7 @@ public:
*
* @param aScanTypes A list of KICAD_Ts.
*/
void SetScanTypes( const std::initializer_list<KICAD_T>& aTypes ) { m_scanTypes = aTypes; }
void SetScanTypes( const std::vector<KICAD_T>& 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<EDA_ITEM*> m_list; // Primary list of most likely items
std::vector<EDA_ITEM*> m_backupList; // Secondary list with items removed by heuristics
std::vector<EDA_ITEM*> m_list; // Primary list of most likely items
std::vector<EDA_ITEM*> m_backupList; // Secondary list with items removed by heuristics
std::initializer_list<KICAD_T> m_scanTypes;
INSPECTOR_FUNC m_inspector;
std::vector<KICAD_T> 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

View File

@ -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<KICAD_T>& aScanTypes ) const
virtual bool IsType( const std::vector<KICAD_T>& 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<KICAD_T>& aScanTypes );
const std::vector<KICAD_T>& aScanTypes );
/**
* This changes first parameter to avoid the DList and use the main queue instead.
*/
template< class T >
static INSPECT_RESULT IterateForward( std::deque<T>& aList, INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& scanTypes )
const std::vector<KICAD_T>& scanTypes )
{
for( const auto& it : aList )
{
@ -330,8 +330,7 @@ public:
*/
template <class T>
static INSPECT_RESULT IterateForward( std::vector<T>& aList, INSPECTOR inspector,
void* testData,
const std::initializer_list<KICAD_T>& scanTypes )
void* testData, const std::vector<KICAD_T>& scanTypes )
{
for( const auto& it : aList )
{

View File

@ -162,7 +162,7 @@ public:
///< @copydoc EDA_ITEM::Visit
INSPECT_RESULT Visit( INSPECTOR aInspector, void* aTestData,
const std::initializer_list<KICAD_T>& aScanTypes ) override;
const std::vector<KICAD_T>& aScanTypes ) override;
///< @copydoc VIEW_ITEM::ViewGetLayers
void ViewGetLayers( int aLayers[], int& aCount ) const override;

View File

@ -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<KICAD_T>& aTypes );
static SELECTION_CONDITION HasTypes( std::vector<KICAD_T> 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<KICAD_T>& aTypes );
static SELECTION_CONDITION OnlyTypes( std::vector<KICAD_T> 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<KICAD_T>& aTypes );
static bool hasTypesFunc( const SELECTION& aSelection, std::vector<KICAD_T> aTypes );
///< Helper function used by OnlyTypes()
static bool onlyTypesFunc( const SELECTION& aSelection,
const std::initializer_list<KICAD_T>& aTypes );
static bool onlyTypesFunc( const SELECTION& aSelection, std::vector<KICAD_T> aTypes );
///< Helper function used by Count()
static bool countFunc( const SELECTION& aSelection, int aNumber );

View File

@ -1250,7 +1250,7 @@ void BOARD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>
INSPECT_RESULT BOARD::Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& scanTypes )
const std::vector<KICAD_T>& scanTypes )
{
#if 0 && defined(DEBUG)
std::cout << GetClass().mb_str() << ' ';

View File

@ -811,7 +811,7 @@ public:
* determined by the inspector.
*/
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& scanTypes ) override;
const std::vector<KICAD_T>& scanTypes ) override;
/**
* Search for a FOOTPRINT within this board with the given reference designator.

View File

@ -38,7 +38,7 @@
#include <math/util.h> // for KiROUND
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::AllBoardItems = {
const std::vector<KICAD_T> 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<KICAD_T> GENERAL_COLLECTOR::AllBoardItems = {
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::BoardLevelItems = {
const std::vector<KICAD_T> GENERAL_COLLECTOR::BoardLevelItems = {
PCB_MARKER_T,
PCB_BITMAP_T,
PCB_TEXT_T,
@ -83,12 +83,12 @@ const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::BoardLevelItems = {
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::Footprints = {
const std::vector<KICAD_T> GENERAL_COLLECTOR::Footprints = {
PCB_FOOTPRINT_T
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::PadsOrTracks = {
const std::vector<KICAD_T> GENERAL_COLLECTOR::PadsOrTracks = {
PCB_PAD_T,
PCB_VIA_T,
PCB_TRACE_T,
@ -96,7 +96,7 @@ const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::PadsOrTracks = {
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::FootprintItems = {
const std::vector<KICAD_T> GENERAL_COLLECTOR::FootprintItems = {
PCB_MARKER_T,
PCB_FP_TEXT_T,
PCB_FP_TEXTBOX_T,
@ -113,14 +113,14 @@ const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::FootprintItems = {
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::Tracks = {
const std::vector<KICAD_T> GENERAL_COLLECTOR::Tracks = {
PCB_TRACE_T,
PCB_ARC_T,
PCB_VIA_T
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::LockableItems = {
const std::vector<KICAD_T> 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<KICAD_T> GENERAL_COLLECTOR::LockableItems = {
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::Zones = {
const std::vector<KICAD_T> GENERAL_COLLECTOR::Zones = {
PCB_ZONE_T,
PCB_FP_ZONE_T
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::Dimensions = {
const std::vector<KICAD_T> GENERAL_COLLECTOR::Dimensions = {
PCB_DIM_ALIGNED_T,
PCB_DIM_LEADER_T,
PCB_DIM_ORTHOGONAL_T,
@ -149,7 +149,7 @@ const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::Dimensions = {
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::DraggableItems = {
const std::vector<KICAD_T> 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<KICAD_T>& aScanTypes,
void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const std::vector<KICAD_T>& 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<KICAD_T>& aTypes )
void PCB_TYPE_COLLECTOR::Collect( BOARD_ITEM* aBoard, const std::vector<KICAD_T>& 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<KICAD_T>& aTypes )
void PCB_LAYER_COLLECTOR::Collect( BOARD_ITEM* aBoard, const std::vector<KICAD_T>& aTypes )
{
Empty();
aBoard->Visit( m_inspector, nullptr, aTypes );

View File

@ -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<KICAD_T> AllBoardItems;
static const std::vector<KICAD_T> AllBoardItems;
/**
* A scan list for zones outlines only
*/
static const std::initializer_list<KICAD_T> Zones;
static const std::vector<KICAD_T> 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<KICAD_T> BoardLevelItems;
static const std::vector<KICAD_T> BoardLevelItems;
/**
* A scan list for only FOOTPRINTs
*/
static const std::initializer_list<KICAD_T> Footprints;
static const std::vector<KICAD_T> Footprints;
/**
* A scan list for PADs, TRACKs, or VIAs
*/
static const std::initializer_list<KICAD_T> PadsOrTracks;
static const std::vector<KICAD_T> PadsOrTracks;
/**
* A scan list for primary footprint items.
*/
static const std::initializer_list<KICAD_T> FootprintItems;
static const std::vector<KICAD_T> FootprintItems;
/**
* A scan list for only TRACKs and ARCs
*/
static const std::initializer_list<KICAD_T> Tracks;
static const std::vector<KICAD_T> Tracks;
/**
* A scan list for TRACKs, VIAs, FOOTPRINTs
*/
static const std::initializer_list<KICAD_T> LockableItems;
static const std::vector<KICAD_T> LockableItems;
/**
* A scan list for dimensions
*/
static const std::initializer_list<KICAD_T> Dimensions;
static const std::vector<KICAD_T> Dimensions;
/**
* A scan list for items that can be dragged
*/
static const std::initializer_list<KICAD_T> DraggableItems;
static const std::vector<KICAD_T> 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<KICAD_T>& aScanList,
void Collect( BOARD_ITEM* aItem, const std::vector<KICAD_T>& 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<KICAD_T>& aTypes );
void Collect( BOARD_ITEM* aBoard, const std::vector<KICAD_T>& 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<KICAD_T>& aTypes );
void Collect( BOARD_ITEM* aBoard, const std::vector<KICAD_T>& aTypes );
private:
PCB_LAYER_ID m_layer_id;

View File

@ -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<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
#if 0 && defined(DEBUG)
std::cout << GetClass().mb_str() << ' ';

View File

@ -638,7 +638,7 @@ public:
void Add3DModel( FP_3DMODEL* a3DModel );
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes ) override;
const std::vector<KICAD_T>& aScanTypes ) override;
wxString GetClass() const override
{

View File

@ -50,7 +50,7 @@ public:
return aItem && PCB_FP_SHAPE_T == aItem->Type();
}
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -64,7 +64,7 @@ public:
return aItem && aItem->Type() == PCB_FP_TEXT_T;
}
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -50,7 +50,7 @@ public:
return aItem && aItem->Type() == PCB_FP_TEXT_T;
}
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -230,9 +230,6 @@ bool PAD::FlashLayer( LSET aLayers ) const
bool PAD::FlashLayer( int aLayer ) const
{
static std::initializer_list<KICAD_T> 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<PCB_LAYER_ID>( 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<KICAD_T> 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;

View File

@ -82,7 +82,7 @@ public:
return aItem && PCB_PAD_T == aItem->Type();
}
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -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<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -234,7 +234,7 @@ const EDA_RECT PCB_GROUP::GetBoundingBox() const
INSPECT_RESULT PCB_GROUP::Visit( INSPECTOR aInspector, void* aTestData,
const std::initializer_list<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& aScanTypes )
{
for( KICAD_T scanType : aScanTypes )
{

View File

@ -57,7 +57,7 @@ public:
return wxT( "PCB_SHAPE" );
}
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -48,7 +48,7 @@ public:
return aItem && PCB_TEXT_T == aItem->Type();
}
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -48,7 +48,7 @@ public:
return aItem && PCB_TEXTBOX_T == aItem->Type();
}
bool IsType( const std::initializer_list<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -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<KICAD_T>& aScanTypes )
const std::vector<KICAD_T>& 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<KICAD_T> connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T };
static std::initializer_list<KICAD_T> 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.

View File

@ -174,7 +174,7 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::initializer_list<KICAD_T>& aScanTypes ) override;
const std::vector<KICAD_T>& 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<KICAD_T>& aScanTypes ) const override
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
return true;

View File

@ -79,11 +79,11 @@ bool BOARD_INSPECTION_TOOL::Init()
auto netSubMenu = std::make_shared<NET_CONTEXT_MENU>();
netSubMenu->SetTool( this );
static std::initializer_list<KICAD_T> connectedTypes = { PCB_TRACE_T,
PCB_VIA_T,
PCB_ARC_T,
PCB_PAD_T,
PCB_ZONE_T };
static std::vector<KICAD_T> connectedTypes = { PCB_TRACE_T,
PCB_VIA_T,
PCB_ARC_T,
PCB_PAD_T,
PCB_ZONE_T };
CONDITIONAL_MENU& menu = selectionTool->GetToolMenu().GetMenu();