KiCad PCB EDA Suite
EE_CONDITIONS Class Reference

#include <ee_selection_tool.h>

Inheritance diagram for EE_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 Empty
 
static SELECTION_CONDITION Idle
 
static SELECTION_CONDITION IdleSelection
 
static SELECTION_CONDITION SingleSymbol
 
static SELECTION_CONDITION SingleDeMorganSymbol
 
static SELECTION_CONDITION SingleMultiUnitSymbol
 

Detailed Description

Definition at line 44 of file ee_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 PAD_CONTEXT_MENU::getEnablements(), 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_CONTEXT_MENU::getEnablements(), and 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_WIRE_BUS_TOOL::Init(), 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(), EE_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), and SELECTION_TOOL::Init().

◆ 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 PAD_CONTEXT_MENU::getEnablements(), LIB_PIN_TOOL::Init(), SCH_EDIT_TOOL::Init(), EE_INSPECTION_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), EE_SELECTION_TOOL::Init(), SCH_WIRE_BUS_TOOL::Init(), EDIT_TOOL::Init(), SELECT_MENU::update(), 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(), and SELECT_MENU::update().

◆ ShowAlways()

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

Function ShowAlways The default condition function (always returns true).

Parameters
aSelectionis the selection to be tested.
Returns
Always true;

Definition at line 58 of file selection_conditions.h.

59  {
60  return true;
61  }

Referenced by TOOL_MENU::AddStandardSubMenus(), GERBVIEW_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), SCH_WIRE_BUS_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_TOOL_BASE::Init(), LIB_VIEW_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), and PCB_EDIT_FRAME::ReCreateMenuBar().

Member Data Documentation

◆ Empty

SELECTION_CONDITION EE_CONDITIONS::Empty
static
Initial value:
= [] (const SELECTION& aSelection )
{
return aSelection.Empty();
}

Definition at line 47 of file ee_selection_tool.h.

Referenced by EE_SELECTION_TOOL::Init().

◆ Idle

SELECTION_CONDITION EE_CONDITIONS::Idle
static

◆ IdleSelection

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

Definition at line 49 of file ee_selection_tool.h.

Referenced by LIB_EDIT_TOOL::Init(), LIB_MOVE_TOOL::Init(), and SCH_EDIT_TOOL::Init().

◆ SingleDeMorganSymbol

SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol
static
Initial value:
= [] ( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
SCH_COMPONENT* comp = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
if( comp )
{
auto partRef = comp->GetPartRef().lock();
return partRef && partRef->HasConversion();
}
}
return false;
}

Definition at line 52 of file ee_selection_tool.h.

Referenced by SCH_EDIT_TOOL::Init().

◆ SingleMultiUnitSymbol

SELECTION_CONDITION EE_CONDITIONS::SingleMultiUnitSymbol
static
Initial value:
= [] ( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
SCH_COMPONENT* comp = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
if( comp )
{
auto partRef = comp->GetPartRef().lock();
return partRef && partRef->GetUnitCount() >= 2;
}
}
return false;
}

Definition at line 53 of file ee_selection_tool.h.

Referenced by SCH_EDIT_TOOL::Init().

◆ SingleSymbol

SELECTION_CONDITION EE_CONDITIONS::SingleSymbol
static
Initial value:
= [] (const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
SCH_COMPONENT* comp = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
if( comp )
{
auto partRef = comp->GetPartRef().lock();
return !partRef || !partRef->IsPower();
}
}
return false;
}

Definition at line 51 of file ee_selection_tool.h.

Referenced by SCH_EDIT_TOOL::Init(), and EE_INSPECTION_TOOL::Init().


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