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

#include <sch_selection_tool.h>

Inheritance diagram for SCH_CONDITIONS:
SELECTION_CONDITIONS

Static Public Member Functions

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 Public Attributes

static SELECTION_CONDITION SingleSymbol
 
static SELECTION_CONDITION SingleSymbolOrPower
 
static SELECTION_CONDITION SingleMultiBodyStyleSymbol
 
static SELECTION_CONDITION SingleMultiUnitSymbol
 
static SELECTION_CONDITION SingleMultiFunctionPin
 
static SELECTION_CONDITION SingleNonExcludedMarker
 
static SELECTION_CONDITION MultipleSymbolsOrPower
 
static SELECTION_CONDITION AllPins
 
static SELECTION_CONDITION AllPinsOrSheetPins
 

Static Private Member Functions

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 HasTypes().
 
static bool onlyTypesFunc (const SELECTION &aSelection, std::vector< KICAD_T > aTypes)
 Helper function used by OnlyTypes().
 
static bool countFunc (const SELECTION &aSelection, int aNumber)
 Helper function used by Count().
 
static bool moreThanFunc (const SELECTION &aSelection, int aNumber)
 Helper function used by MoreThan().
 
static bool lessThanFunc (const SELECTION &aSelection, int aNumber)
 Helper function used by LessThan().
 
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)
 Helper function used by operator &&.
 

Detailed Description

Definition at line 55 of file sch_selection_tool.h.

Member Function Documentation

◆ andBoolFunc()

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

Helper function used by operator &&.

Definition at line 202 of file selection_conditions.h.

Referenced by operator&&.

◆ 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.

Referenced by operator&&.

◆ 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 countFunc().

Referenced by CONVERT_TOOL::Init(), EDIT_TOOL::Init(), PAD_TOOL::Init(), PCB_POINT_EDITOR::Init(), PCB_SELECTION_TOOL::Init(), SCH_POINT_EDITOR::Init(), SCH_SELECTION_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), SYMBOL_EDITOR_PIN_TOOL::Init(), makeShapeModificationMenu(), and PCB_EDIT_FRAME::setupUIConditions().

◆ countFunc()

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

Helper function used by Count().

Definition at line 142 of file selection_conditions.cpp.

References SELECTION::Size().

Referenced by 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 PL_SELECTION_TOOL::Init(), and SCH_SELECTION_TOOL::Init().

◆ 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 hasTypeFunc().

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

◆ hasTypeFunc()

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

Helper function used by HasType().

Definition at line 97 of file selection_conditions.cpp.

References SELECTION::Empty().

Referenced by 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 hasTypesFunc().

Referenced by EDIT_TOOL::Init(), SCH_SELECTION_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 HasTypes().

Definition at line 112 of file selection_conditions.cpp.

References SELECTION::Empty().

Referenced by HasTypes().

◆ 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 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 lessThanFunc().

Referenced by SCH_SELECTION_TOOL::Init().

◆ lessThanFunc()

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

Helper function used by LessThan().

Definition at line 154 of file selection_conditions.cpp.

References SELECTION::Size().

Referenced by 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 moreThanFunc().

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

◆ moreThanFunc()

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

Helper function used by MoreThan().

Definition at line 148 of file selection_conditions.cpp.

References SELECTION::Size().

Referenced by 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.

Referenced by operator!.

◆ OnlyTypes()

◆ onlyTypesFunc()

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

Helper function used by OnlyTypes().

Definition at line 127 of file selection_conditions.cpp.

References SELECTION::Empty().

Referenced by 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.

Referenced by operator||.

◆ 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.

Referenced by operator||.

◆ ShowAlways()

◆ ShowNever()

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

Member Data Documentation

◆ AllPins

SELECTION_CONDITION SCH_CONDITIONS::AllPins
static
Initial value:
= []( const SELECTION& aSel )
{
return aSel.GetSize() >= 1 && aSel.OnlyContains( { SCH_PIN_T } );
}
@ SCH_PIN_T
Definition typeinfo.h:155

Definition at line 143 of file sch_selection_tool.h.

◆ AllPinsOrSheetPins

SELECTION_CONDITION SCH_CONDITIONS::AllPinsOrSheetPins
static
Initial value:
= []( const SELECTION& aSel )
{
return aSel.GetSize() >= 1 && aSel.OnlyContains( { SCH_PIN_T, SCH_SHEET_PIN_T } );
}
@ SCH_SHEET_PIN_T
Definition typeinfo.h:176

Definition at line 149 of file sch_selection_tool.h.

◆ MultipleSymbolsOrPower

SELECTION_CONDITION SCH_CONDITIONS::MultipleSymbolsOrPower
static
Initial value:
= []( const SELECTION& aSel )
{
return aSel.GetSize() > 1 && aSel.OnlyContains( { SCH_SYMBOL_T } );
}
@ SCH_SYMBOL_T
Definition typeinfo.h:174

Definition at line 137 of file sch_selection_tool.h.

◆ SingleMultiBodyStyleSymbol

SELECTION_CONDITION SCH_CONDITIONS::SingleMultiBodyStyleSymbol
static
Initial value:
= []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
if( symbol )
return symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->IsMultiBodyStyle();
}
return false;
}
bool IsMultiBodyStyle() const override
Definition lib_symbol.h:594
Schematic symbol object.
Definition sch_symbol.h:75
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:183

Definition at line 86 of file sch_selection_tool.h.

◆ SingleMultiFunctionPin

SELECTION_CONDITION SCH_CONDITIONS::SingleMultiFunctionPin
static
Initial value:
= []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
SCH_PIN* pin = dynamic_cast<SCH_PIN*>( aSel.Front() );
if( pin && pin->GetLibPin() )
return !pin->GetLibPin()->GetAlternates().empty();
}
return false;
}

Definition at line 114 of file sch_selection_tool.h.

◆ SingleMultiUnitSymbol

SELECTION_CONDITION SCH_CONDITIONS::SingleMultiUnitSymbol
static
Initial value:
= []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
if( symbol )
return symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->GetUnitCount() >= 2;
}
return false;
}
int GetUnitCount() const override

Definition at line 100 of file sch_selection_tool.h.

◆ SingleNonExcludedMarker

SELECTION_CONDITION SCH_CONDITIONS::SingleNonExcludedMarker
static
Initial value:
= []( const SELECTION& aSel )
{
if( aSel.CountType( SCH_MARKER_T ) != 1 )
return false;
return !static_cast<SCH_MARKER*>( aSel.Front() )->IsExcluded();
}
bool IsExcluded() const
Definition marker_base.h:93
@ SCH_MARKER_T
Definition typeinfo.h:160

Definition at line 128 of file sch_selection_tool.h.

Referenced by SCH_INSPECTION_TOOL::Init().

◆ SingleSymbol

SELECTION_CONDITION SCH_CONDITIONS::SingleSymbol
static
Initial value:
= []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
if( symbol )
return !symbol->GetLibSymbolRef() || !symbol->GetLibSymbolRef()->IsPower();
}
return false;
}
bool IsPower() const override

Definition at line 66 of file sch_selection_tool.h.

Referenced by SCH_INSPECTION_TOOL::Init().

◆ SingleSymbolOrPower

SELECTION_CONDITION SCH_CONDITIONS::SingleSymbolOrPower
static
Initial value:
= []( const SELECTION& aSel )
{
return aSel.GetSize() == 1 && aSel.Front()->Type() == SCH_SYMBOL_T;
}

Definition at line 80 of file sch_selection_tool.h.


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