KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PCB_SELECTION_CONDITIONS Class Reference

#include <pcb_selection_conditions.h>

Inheritance diagram for PCB_SELECTION_CONDITIONS:
SELECTION_CONDITIONS

Static Public Member Functions

static SELECTION_CONDITION SameNet (bool aAllowUnconnected=false)
 Create a functor that tests if selection contains items belonging to the same net or are unconnected if aAllowUnconnected == true.
 
static SELECTION_CONDITION SameLayer ()
 Creates a functor that tests if selection contains items that belong exclusively to the same layer.
 
static bool HasLockedItems (const SELECTION &aSelection)
 Test if any selected items are locked.
 
static bool HasUnlockedItems (const SELECTION &aSelection)
 Test if any selected items are unlocked.
 
static bool ShowAlways (const SELECTION &aSelection)
 The default condition function (always returns true).
 
static bool ShowNever (const SELECTION &aSelection)
 Always returns false.
 
static bool NotEmpty (const SELECTION &aSelection)
 Test if there are any items selected.
 
static bool Empty (const SELECTION &aSelection)
 Test if there are no items selected.
 
static bool Idle (const SELECTION &aSelection)
 Test if there no items selected or being edited.
 
static bool IdleSelection (const SELECTION &aSelection)
 Test if all selected items are not being edited.
 
static SELECTION_CONDITION HasType (KICAD_T aType)
 Create a functor that tests if among the selected items there is at least one of a given type.
 
static SELECTION_CONDITION HasTypes (std::vector< KICAD_T > aTypes)
 Create a functor that tests if among the selected items there is at least one of a given types.
 
static SELECTION_CONDITION OnlyTypes (std::vector< KICAD_T > aTypes)
 Create a functor that tests if the selected items are only of given types.
 
static SELECTION_CONDITION Count (int aNumber)
 Create a functor that tests if the number of selected items is equal to the value given as parameter.
 
static SELECTION_CONDITION MoreThan (int aNumber)
 Create a functor that tests if the number of selected items is greater than the value given as parameter.
 
static SELECTION_CONDITION LessThan (int aNumber)
 Create a functor that tests if the number of selected items is smaller than the value given as parameter.
 

Static Private Member Functions

static bool sameNetFunc (const SELECTION &aSelection, bool aAllowUnconnected)
 < Helper function used by SameNet()
 
static bool sameLayerFunc (const SELECTION &aSelection)
 
static bool hasTypeFunc (const SELECTION &aSelection, KICAD_T aType)
 < Helper function used by HasType()
 
static bool hasTypesFunc (const SELECTION &aSelection, std::vector< KICAD_T > aTypes)
 Helper function used by OnlyTypes()
 
static bool onlyTypesFunc (const SELECTION &aSelection, std::vector< KICAD_T > aTypes)
 Helper function used by Count()
 
static bool countFunc (const SELECTION &aSelection, int aNumber)
 Helper function used by MoreThan()
 
static bool moreThanFunc (const SELECTION &aSelection, int aNumber)
 Helper function used by LessThan()
 
static bool lessThanFunc (const SELECTION &aSelection, int aNumber)
 Helper function used by operator||.
 
static bool orFunc (const SELECTION_CONDITION &aConditionA, const SELECTION_CONDITION &aConditionB, const SELECTION &aSelection)
 Helper function used by operator&&.
 
static bool andFunc (const SELECTION_CONDITION &aConditionA, const SELECTION_CONDITION &aConditionB, const SELECTION &aSelection)
 Helper function used by operator!
 
static bool notFunc (const SELECTION_CONDITION &aCondition, const SELECTION &aSelection)
 Helper function used by operator||.
 
static bool orBoolFunc (const SELECTION_CONDITION &aConditionA, SELECTION_BOOL &aConditionB, const SELECTION &aSelection)
 Helper function used by operator&&.
 
static bool andBoolFunc (const SELECTION_CONDITION &aConditionA, SELECTION_BOOL &aConditionB, const SELECTION &aSelection)
 

Detailed Description

Definition at line 35 of file pcb_selection_conditions.h.

Member Function Documentation

◆ andBoolFunc()

static bool SELECTION_CONDITIONS::andBoolFunc ( const SELECTION_CONDITION aConditionA,
SELECTION_BOOL aConditionB,
const SELECTION aSelection 
)
inlinestaticprivateinherited

Definition at line 202 of file selection_conditions.h.

◆ andFunc()

static bool SELECTION_CONDITIONS::andFunc ( const SELECTION_CONDITION aConditionA,
const SELECTION_CONDITION aConditionB,
const SELECTION aSelection 
)
inlinestaticprivateinherited

Helper function used by operator!

Definition at line 182 of file selection_conditions.h.

◆ Count()

SELECTION_CONDITION SELECTION_CONDITIONS::Count ( int  aNumber)
staticinherited

Create a functor that tests if the number of selected items is equal to the value given as parameter.

Parameters
aNumberis the number of expected items.
Returns
Functor testing if the number of selected items is equal aNumber.

Definition at line 79 of file selection_conditions.cpp.

References SELECTION_CONDITIONS::countFunc().

Referenced by EE_SELECTION_TOOL::Init(), SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), SYMBOL_EDITOR_PIN_TOOL::Init(), CONVERT_TOOL::Init(), EDIT_TOOL::Init(), PAD_TOOL::Init(), PCB_SELECTION_TOOL::Init(), makeShapeModificationMenu(), and PCB_EDIT_FRAME::setupUIConditions().

◆ countFunc()

bool SELECTION_CONDITIONS::countFunc ( const SELECTION aSelection,
int  aNumber 
)
staticprivateinherited

Helper function used by MoreThan()

Definition at line 142 of file selection_conditions.cpp.

References SELECTION::Size().

Referenced by SELECTION_CONDITIONS::Count().

◆ Empty()

bool SELECTION_CONDITIONS::Empty ( const SELECTION aSelection)
staticinherited

Test if there are no items selected.

Definition at line 41 of file selection_conditions.cpp.

References SELECTION::Empty().

Referenced by EE_SELECTION_TOOL::Init(), and PL_SELECTION_TOOL::Init().

◆ HasLockedItems()

bool PCB_SELECTION_CONDITIONS::HasLockedItems ( const SELECTION aSelection)
static

Test if any selected items are locked.

Definition at line 46 of file pcb_selection_conditions.cpp.

References BOARD_ITEM::IsLocked(), and SELECTION::Items().

Referenced by LOCK_CONTEXT_MENU::LOCK_CONTEXT_MENU(), and PCB_EDIT_FRAME::setupUIConditions().

◆ HasType()

SELECTION_CONDITION SELECTION_CONDITIONS::HasType ( KICAD_T  aType)
staticinherited

Create a functor that tests if among the selected items there is at least one of a given type.

Parameters
aTypeis the type that is searched.
Returns
Functor testing for presence of items of a given type.

Definition at line 61 of file selection_conditions.cpp.

References SELECTION_CONDITIONS::hasTypeFunc().

Referenced by SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), PAD_TOOL::Init(), PCB_SELECTION_TOOL::Init(), and FOOTPRINT_EDIT_FRAME::setupUIConditions().

◆ hasTypeFunc()

bool SELECTION_CONDITIONS::hasTypeFunc ( const SELECTION aSelection,
KICAD_T  aType 
)
staticprivateinherited

< Helper function used by HasType()

Helper function used by HasTypes()

Definition at line 97 of file selection_conditions.cpp.

References SELECTION::Empty().

Referenced by SELECTION_CONDITIONS::HasType().

◆ HasTypes()

SELECTION_CONDITION SELECTION_CONDITIONS::HasTypes ( std::vector< KICAD_T aTypes)
staticinherited

Create a functor that tests if among the selected items there is at least one of a given types.

Parameters
aTypesis an array containing types that are searched.
Returns
Functor testing for presence of items of a given types.

Definition at line 67 of file selection_conditions.cpp.

References SELECTION_CONDITIONS::hasTypesFunc().

Referenced by EE_SELECTION_TOOL::Init(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), makeShapeModificationMenu(), and PCB_EDIT_FRAME::setupUIConditions().

◆ hasTypesFunc()

bool SELECTION_CONDITIONS::hasTypesFunc ( const SELECTION aSelection,
std::vector< KICAD_T aTypes 
)
staticprivateinherited

Helper function used by OnlyTypes()

Definition at line 112 of file selection_conditions.cpp.

References SELECTION::Empty().

Referenced by SELECTION_CONDITIONS::HasTypes().

◆ HasUnlockedItems()

bool PCB_SELECTION_CONDITIONS::HasUnlockedItems ( const SELECTION aSelection)
static

Test if any selected items are unlocked.

Definition at line 58 of file pcb_selection_conditions.cpp.

References BOARD_ITEM::IsLocked(), and SELECTION::Items().

Referenced by LOCK_CONTEXT_MENU::LOCK_CONTEXT_MENU(), and PCB_EDIT_FRAME::setupUIConditions().

◆ Idle()

◆ IdleSelection()

bool SELECTION_CONDITIONS::IdleSelection ( const SELECTION aSelection)
staticinherited

Test if all selected items are not being edited.

Definition at line 55 of file selection_conditions.cpp.

References SELECTION::Front(), and EDA_ITEM::GetEditFlags().

Referenced by SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), and SYMBOL_EDITOR_MOVE_TOOL::Init().

◆ LessThan()

SELECTION_CONDITION SELECTION_CONDITIONS::LessThan ( int  aNumber)
staticinherited

Create a functor that tests if the number of selected items is smaller than the value given as parameter.

Parameters
aNumberis the number used for comparison.
Returns
Functor testing if the number of selected items is smaller than aNumber.

Definition at line 91 of file selection_conditions.cpp.

References SELECTION_CONDITIONS::lessThanFunc().

Referenced by EE_SELECTION_TOOL::Init().

◆ lessThanFunc()

bool SELECTION_CONDITIONS::lessThanFunc ( const SELECTION aSelection,
int  aNumber 
)
staticprivateinherited

Helper function used by operator||.

Definition at line 154 of file selection_conditions.cpp.

References SELECTION::Size().

Referenced by SELECTION_CONDITIONS::LessThan().

◆ MoreThan()

SELECTION_CONDITION SELECTION_CONDITIONS::MoreThan ( int  aNumber)
staticinherited

Create a functor that tests if the number of selected items is greater than the value given as parameter.

Parameters
aNumberis the number used for comparison.
Returns
Functor testing if the number of selected items is greater than aNumber.

Definition at line 85 of file selection_conditions.cpp.

References SELECTION_CONDITIONS::moreThanFunc().

Referenced by EDIT_TABLE_TOOL_BASE< T_TABLE, T_TABLECELL, T_COMMIT >::addMenus(), EE_SELECTION_TOOL::Init(), SCH_EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), CONVERT_TOOL::Init(), EDIT_TOOL::Init(), PCB_SELECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), makeShapeModificationMenu(), and PCB_EDIT_FRAME::setupUIConditions().

◆ moreThanFunc()

bool SELECTION_CONDITIONS::moreThanFunc ( const SELECTION aSelection,
int  aNumber 
)
staticprivateinherited

Helper function used by LessThan()

Definition at line 148 of file selection_conditions.cpp.

References SELECTION::Size().

Referenced by SELECTION_CONDITIONS::MoreThan().

◆ NotEmpty()

◆ notFunc()

static bool SELECTION_CONDITIONS::notFunc ( const SELECTION_CONDITION aCondition,
const SELECTION aSelection 
)
inlinestaticprivateinherited

Helper function used by operator||.

Definition at line 189 of file selection_conditions.h.

◆ OnlyTypes()

◆ onlyTypesFunc()

bool SELECTION_CONDITIONS::onlyTypesFunc ( const SELECTION aSelection,
std::vector< KICAD_T aTypes 
)
staticprivateinherited

Helper function used by Count()

Definition at line 127 of file selection_conditions.cpp.

References SELECTION::Empty().

Referenced by SELECTION_CONDITIONS::OnlyTypes().

◆ orBoolFunc()

static bool SELECTION_CONDITIONS::orBoolFunc ( const SELECTION_CONDITION aConditionA,
SELECTION_BOOL aConditionB,
const SELECTION aSelection 
)
inlinestaticprivateinherited

Helper function used by operator&&.

Definition at line 195 of file selection_conditions.h.

◆ orFunc()

static bool SELECTION_CONDITIONS::orFunc ( const SELECTION_CONDITION aConditionA,
const SELECTION_CONDITION aConditionB,
const SELECTION aSelection 
)
inlinestaticprivateinherited

Helper function used by operator&&.

Definition at line 175 of file selection_conditions.h.

◆ SameLayer()

SELECTION_CONDITION PCB_SELECTION_CONDITIONS::SameLayer ( )
static

Creates a functor that tests if selection contains items that belong exclusively to the same layer.

In case of items belonging to multiple layers, it is enough to have a single common layer with other items.

Returns
Functor testing if selected items share at least one common layer.

Definition at line 40 of file pcb_selection_conditions.cpp.

References sameLayerFunc().

Referenced by CONVERT_TOOL::Init().

◆ sameLayerFunc()

bool PCB_SELECTION_CONDITIONS::sameLayerFunc ( const SELECTION aSelection)
staticprivate

Definition at line 115 of file pcb_selection_conditions.cpp.

References SELECTION::Empty(), BOARD_ITEM::GetLayerSet(), and BASE_SET::set().

Referenced by SameLayer().

◆ SameNet()

SELECTION_CONDITION PCB_SELECTION_CONDITIONS::SameNet ( bool  aAllowUnconnected = false)
static

Create a functor that tests if selection contains items belonging to the same net or are unconnected if aAllowUnconnected == true.

Parameters
aAllowUnconnecteddetermines if unconnected items (with no net code assigned) should be treated as connected to the same net.
Returns
Functor testing if selected items are belonging to the same net.

Definition at line 34 of file pcb_selection_conditions.cpp.

References sameNetFunc().

◆ sameNetFunc()

bool PCB_SELECTION_CONDITIONS::sameNetFunc ( const SELECTION aSelection,
bool  aAllowUnconnected 
)
staticprivate

< Helper function used by SameNet()

Helper function used by SameLayer()

Definition at line 70 of file pcb_selection_conditions.cpp.

References SELECTION::Empty(), BOARD_CONNECTED_ITEM::GetNetCode(), and NETINFO_LIST::UNCONNECTED.

Referenced by SameNet().

◆ ShowAlways()

◆ ShowNever()

static bool SELECTION_CONDITIONS::ShowNever ( const SELECTION aSelection)
inlinestaticinherited

The documentation for this class was generated from the following files: