KiCad PCB EDA Suite
PL_CONDITIONS Class Reference

#include <pl_selection_tool.h>

Inheritance diagram for PL_CONDITIONS:
SELECTION_CONDITIONS

Static Public Member Functions

static bool ShowAlways (const SELECTION &aSelection)
 Function ShowAlways The default condition function (always returns true). More...
 
static bool NotEmpty (const SELECTION &aSelection)
 Function NotEmpty Tests if there are any items selected. More...
 
static SELECTION_CONDITION HasType (KICAD_T aType)
 Function HasType Creates a functor that tests if among the selected items there is at least one of a given type. More...
 
static SELECTION_CONDITION OnlyType (KICAD_T aType)
 Function OnlyType Creates a functor that tests if the selected items are only of given type. More...
 
static SELECTION_CONDITION OnlyTypes (const KICAD_T aTypes[])
 Function OnlyTypes Creates a functor that tests if the selected items are only of given types. More...
 
static SELECTION_CONDITION Count (int aNumber)
 Function Count Creates a functor that tests if the number of selected items is equal to the value given as parameter. More...
 
static SELECTION_CONDITION MoreThan (int aNumber)
 Function MoreThan Creates a functor that tests if the number of selected items is greater than the value given as parameter. More...
 
static SELECTION_CONDITION LessThan (int aNumber)
 Function LessThan Creates a functor that tests if the number of selected items is smaller than the value given as parameter. More...
 

Static Public Attributes

static SELECTION_CONDITION Idle
 

Detailed Description

Definition at line 42 of file pl_selection_tool.h.

Member Function Documentation

◆ Count()

SELECTION_CONDITION SELECTION_CONDITIONS::Count ( int  aNumber)
staticinherited

Function Count Creates 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 58 of file selection_conditions.cpp.

59 {
60  return std::bind( &SELECTION_CONDITIONS::countFunc, _1, aNumber );
61 }
static bool countFunc(const SELECTION &aSelection, int aNumber)
Helper function used by Count()

References SELECTION_CONDITIONS::countFunc().

Referenced by LIB_EDIT_TOOL::Init(), LIB_PIN_TOOL::Init(), SCH_EDIT_TOOL::Init(), EE_INSPECTION_TOOL::Init(), PAD_TOOL::Init(), EE_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), and ZONE_CONTEXT_MENU::update().

◆ HasType()

SELECTION_CONDITION SELECTION_CONDITIONS::HasType ( KICAD_T  aType)
staticinherited

Function HasType Creates 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 40 of file selection_conditions.cpp.

41 {
42  return std::bind( &SELECTION_CONDITIONS::hasTypeFunc, _1, aType );
43 }
static bool hasTypeFunc(const SELECTION &aSelection, KICAD_T aType)
Helper function used by HasType()

References SELECTION_CONDITIONS::hasTypeFunc().

Referenced by PAD_TOOL::Init().

◆ LessThan()

SELECTION_CONDITION SELECTION_CONDITIONS::LessThan ( int  aNumber)
staticinherited

Function LessThan Creates 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 70 of file selection_conditions.cpp.

71 {
72  return std::bind( &SELECTION_CONDITIONS::lessThanFunc, _1, aNumber );
73 }
static bool lessThanFunc(const SELECTION &aSelection, int aNumber)
Helper function used by LessThan()

References SELECTION_CONDITIONS::lessThanFunc().

◆ MoreThan()

SELECTION_CONDITION SELECTION_CONDITIONS::MoreThan ( int  aNumber)
staticinherited

Function MoreThan Creates 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 64 of file selection_conditions.cpp.

65 {
66  return std::bind( &SELECTION_CONDITIONS::moreThanFunc, _1, aNumber );
67 }
static bool moreThanFunc(const SELECTION &aSelection, int aNumber)
Helper function used by MoreThan()

References SELECTION_CONDITIONS::moreThanFunc().

Referenced by SCH_EDIT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PL_EDITOR_FRAME::ReCreateMenuBar(), and ZONE_CONTEXT_MENU::update().

◆ NotEmpty()

bool SELECTION_CONDITIONS::NotEmpty ( const SELECTION aSelection)
staticinherited

Function NotEmpty Tests if there are any items selected.

Parameters
aSelectionis the selection to be tested.
Returns
True if there is at least one item selected.

Definition at line 34 of file selection_conditions.cpp.

35 {
36  return !aSelection.Empty();
37 }
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119

References SELECTION::Empty().

Referenced by LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), and PCB_EDIT_FRAME::ReCreateMenuBar().

◆ OnlyType()

SELECTION_CONDITION SELECTION_CONDITIONS::OnlyType ( KICAD_T  aType)
staticinherited

Function OnlyType Creates a functor that tests if the selected items are only of given type.

Parameters
aTypeis the type that is searched.
Returns
Functor testing if selected items are exclusively of one type.

Definition at line 46 of file selection_conditions.cpp.

47 {
48  return std::bind( &SELECTION_CONDITIONS::onlyTypeFunc, _1, aType );
49 }
static bool onlyTypeFunc(const SELECTION &aSelection, KICAD_T aType)
Helper function used by OnlyType()

References SELECTION_CONDITIONS::onlyTypeFunc().

Referenced by LIB_PIN_TOOL::Init(), SCH_EDIT_TOOL::Init(), EE_INSPECTION_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EDIT_TOOL::Init(), and ZONE_CONTEXT_MENU::update().

◆ OnlyTypes()

SELECTION_CONDITION SELECTION_CONDITIONS::OnlyTypes ( const KICAD_T  aTypes[])
staticinherited

Function OnlyTypes Creates a functor that tests if the selected items are only of given types.

Parameters
aTypesis an array containing types that are searched. It has to be ended with KICAD_T::EOT as end marker.
Returns
Functor testing if selected items are exclusively of the requested types.

Definition at line 52 of file selection_conditions.cpp.

53 {
54  return std::bind( &SELECTION_CONDITIONS::onlyTypesFunc, _1, aTypes );
55 }
static bool onlyTypesFunc(const SELECTION &aSelection, const KICAD_T aTypes[])
Helper function used by OnlyTypes()

References SELECTION_CONDITIONS::onlyTypesFunc().

Referenced by SCH_EDIT_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), EE_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), EDIT_TOOL::Properties(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PCB_EDITOR_CONTROL::ViaSizeDec(), and PCB_EDITOR_CONTROL::ViaSizeInc().

◆ ShowAlways()

Member Data Documentation

◆ Idle

SELECTION_CONDITION PL_CONDITIONS::Idle
static
Initial value:
= [] (const SELECTION& aSelection )
{
return ( !aSelection.Front() || aSelection.Front()->GetEditFlags() == 0 );
}

Definition at line 45 of file pl_selection_tool.h.

Referenced by PL_SELECTION_TOOL::Init().


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