KiCad PCB EDA Suite
EDA_3D_CONDITIONS Class Reference

#include <3d_conditions.h>

Inheritance diagram for EDA_3D_CONDITIONS:
SELECTION_CONDITIONS

Public Member Functions

 EDA_3D_CONDITIONS (BOARD_ADAPTER *aAdapter)
 Define conditions for a 3D viewer frame. More...
 
SELECTION_CONDITION MaterialMode (MATERIAL_MODE aMaterial)
 Creates a functor that tests if a specific material mode is active. More...
 
SELECTION_CONDITION Flag (DISPLAY3D_FLG aFlag)
 Creates a functor that tests if the board adapter has a flag set currently. More...
 
SELECTION_CONDITION GridSize (GRID3D_TYPE aGridSize)
 Creates a functor that tests the current grid size. More...
 

Static Public Member Functions

static bool ShowAlways (const SELECTION &aSelection)
 The default condition function (always returns true). More...
 
static bool ShowNever (const SELECTION &aSelection)
 Always returns false. More...
 
static bool NotEmpty (const SELECTION &aSelection)
 Test if there are any items selected. More...
 
static bool Empty (const SELECTION &aSelection)
 Test if there are no items selected. More...
 
static bool Idle (const SELECTION &aSelection)
 Test if there no items selected or being edited. More...
 
static bool IdleSelection (const SELECTION &aSelection)
 Test if all selected items are not being edited. More...
 
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. More...
 
static SELECTION_CONDITION OnlyType (KICAD_T aType)
 Create a functor that tests if the selected items are only of given type. More...
 
static SELECTION_CONDITION OnlyTypes (const KICAD_T aTypes[])
 Create a functor that tests if the selected items are only of given types. More...
 
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. More...
 
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. More...
 
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. More...
 

Static Private Member Functions

static bool materialModeFunction (const SELECTION &aSelection, BOARD_ADAPTER *aAdapter, MATERIAL_MODE aMaterial)
 < Helper function used by MaterialMode() More...
 
static bool flagFunction (const SELECTION &aSelection, BOARD_ADAPTER *aAdapter, DISPLAY3D_FLG aFlag)
 Helper function used by GridDize() More...
 
static bool gridSizeFunction (const SELECTION &aSelection, BOARD_ADAPTER *aAdapter, GRID3D_TYPE aGridSize)
 The board adapter to read the 3D viewer state from. More...
 

Private Attributes

BOARD_ADAPTERm_adapter
 

Detailed Description

Definition at line 35 of file 3d_conditions.h.

Constructor & Destructor Documentation

◆ EDA_3D_CONDITIONS()

EDA_3D_CONDITIONS::EDA_3D_CONDITIONS ( BOARD_ADAPTER aAdapter)
inline

Define conditions for a 3D viewer frame.

Parameters
aAdapteris the board adapter to query for information.

Definition at line 43 of file 3d_conditions.h.

43  :
44  m_adapter( aAdapter )
45  {}
BOARD_ADAPTER * m_adapter
Definition: 3d_conditions.h:88

Member Function Documentation

◆ 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 76 of file selection_conditions.cpp.

77 {
78  return std::bind( &SELECTION_CONDITIONS::countFunc, _1, aNumber );
79 }
static bool countFunc(const SELECTION &aSelection, int aNumber)
Helper function used by MoreThan()

References SELECTION_CONDITIONS::countFunc().

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

◆ Empty()

bool SELECTION_CONDITIONS::Empty ( const SELECTION aSelection)
staticinherited

Test if there are no items selected.

Parameters
aSelectionis the selection to be tested.
Returns
True if there are no items selected.

Definition at line 40 of file selection_conditions.cpp.

41 {
42  return aSelection.Empty();
43 }
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122

References SELECTION::Empty().

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

◆ Flag()

SELECTION_CONDITION EDA_3D_CONDITIONS::Flag ( DISPLAY3D_FLG  aFlag)

Creates a functor that tests if the board adapter has a flag set currently.

Parameters
aAdapteris the board adapter the setting is in
aFlagis the flag to test for.
Returns
Functor testing if the flag is set.

Definition at line 39 of file 3d_conditions.cpp.

40 {
41  return std::bind( &EDA_3D_CONDITIONS::flagFunction, _1, m_adapter, aFlag );
42 }
static bool flagFunction(const SELECTION &aSelection, BOARD_ADAPTER *aAdapter, DISPLAY3D_FLG aFlag)
Helper function used by GridDize()
BOARD_ADAPTER * m_adapter
Definition: 3d_conditions.h:88

References flagFunction().

◆ flagFunction()

bool EDA_3D_CONDITIONS::flagFunction ( const SELECTION aSelection,
BOARD_ADAPTER aAdapter,
DISPLAY3D_FLG  aFlag 
)
staticprivate

Helper function used by GridDize()

Definition at line 59 of file 3d_conditions.cpp.

62 {
63  return aAdapter->GetFlag( aFlag );
64 }
bool GetFlag(DISPLAY3D_FLG aFlag) const
Get a configuration status of a flag.

References BOARD_ADAPTER::GetFlag().

Referenced by Flag().

◆ GridSize()

SELECTION_CONDITION EDA_3D_CONDITIONS::GridSize ( GRID3D_TYPE  aGridSize)

Creates a functor that tests the current grid size.

Parameters
aAdapteris the board adapter the setting is in
aGridSizeis the grid size to test for.
Returns
Functor testing if the flag is set.

Definition at line 45 of file 3d_conditions.cpp.

46 {
47  return std::bind( &EDA_3D_CONDITIONS::gridSizeFunction, _1, m_adapter, aGridSize );
48 }
BOARD_ADAPTER * m_adapter
Definition: 3d_conditions.h:88
static bool gridSizeFunction(const SELECTION &aSelection, BOARD_ADAPTER *aAdapter, GRID3D_TYPE aGridSize)
The board adapter to read the 3D viewer state from.

References gridSizeFunction().

◆ gridSizeFunction()

bool EDA_3D_CONDITIONS::gridSizeFunction ( const SELECTION aSelection,
BOARD_ADAPTER aAdapter,
GRID3D_TYPE  aGridSize 
)
staticprivate

The board adapter to read the 3D viewer state from.

Definition at line 67 of file 3d_conditions.cpp.

70 {
71  return aAdapter->GetGridType() == aGridSize;
72 }
GRID3D_TYPE GetGridType() const noexcept
Get the current grid.

References BOARD_ADAPTER::GetGridType().

Referenced by GridSize().

◆ 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 58 of file selection_conditions.cpp.

59 {
60  return std::bind( &SELECTION_CONDITIONS::hasTypeFunc, _1, aType );
61 }
static bool hasTypeFunc(const SELECTION &aSelection, KICAD_T aType)
< Helper function used by HasType()

References SELECTION_CONDITIONS::hasTypeFunc().

Referenced by PAD_TOOL::Init().

◆ Idle()

bool SELECTION_CONDITIONS::Idle ( const SELECTION aSelection)
staticinherited

Test if there no items selected or being edited.

Parameters
aSelectionis the selection to be tested.
Returns
True if there are no items being edited or no items selected.

Definition at line 46 of file selection_conditions.cpp.

47 {
48  return ( !aSelection.Front() || aSelection.Front()->GetEditFlags() == 0 );
49 }
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:208
EDA_ITEM * Front() const
Definition: selection.h:203

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

Referenced by SYMBOL_EDITOR_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), EE_INSPECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PL_EDITOR_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), and PCB_EDIT_FRAME::setupUIConditions().

◆ IdleSelection()

bool SELECTION_CONDITIONS::IdleSelection ( const SELECTION aSelection)
staticinherited

Test if all selected items are not being edited.

Parameters
aSelectionis the selection to be tested.
Returns
True if no selected items are being edited.

Definition at line 52 of file selection_conditions.cpp.

53 {
54  return ( aSelection.Front() && aSelection.Front()->GetEditFlags() == 0 );
55 }
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:208
EDA_ITEM * Front() const
Definition: selection.h:203

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

Referenced by SYMBOL_EDITOR_EDIT_TOOL::Init(), SYMBOL_EDITOR_MOVE_TOOL::Init(), and SCH_EDIT_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 88 of file selection_conditions.cpp.

89 {
90  return std::bind( &SELECTION_CONDITIONS::lessThanFunc, _1, aNumber );
91 }
static bool lessThanFunc(const SELECTION &aSelection, int aNumber)
Helper function used by operator||.

References SELECTION_CONDITIONS::lessThanFunc().

Referenced by EE_SELECTION_TOOL::Init().

◆ MaterialMode()

SELECTION_CONDITION EDA_3D_CONDITIONS::MaterialMode ( MATERIAL_MODE  aMaterial)

Creates a functor that tests if a specific material mode is active.

Parameters
aAdapteris the board adapter the setting is in
aMaterialis the material mode to test for.
Returns
Functor testing if a material mode is active.

Definition at line 33 of file 3d_conditions.cpp.

34 {
35  return std::bind( &EDA_3D_CONDITIONS::materialModeFunction, _1, m_adapter, aMaterial );
36 }
static bool materialModeFunction(const SELECTION &aSelection, BOARD_ADAPTER *aAdapter, MATERIAL_MODE aMaterial)
< Helper function used by MaterialMode()
BOARD_ADAPTER * m_adapter
Definition: 3d_conditions.h:88

References materialModeFunction().

◆ materialModeFunction()

bool EDA_3D_CONDITIONS::materialModeFunction ( const SELECTION aSelection,
BOARD_ADAPTER aAdapter,
MATERIAL_MODE  aMaterial 
)
staticprivate

< Helper function used by MaterialMode()

Helper function used by Flag()

Definition at line 51 of file 3d_conditions.cpp.

54 {
55  return aAdapter->GetMaterialMode() == aMaterial;
56 }
MATERIAL_MODE GetMaterialMode() const noexcept

References BOARD_ADAPTER::GetMaterialMode().

Referenced by MaterialMode().

◆ 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 82 of file selection_conditions.cpp.

83 {
84  return std::bind( &SELECTION_CONDITIONS::moreThanFunc, _1, aNumber );
85 }
static bool moreThanFunc(const SELECTION &aSelection, int aNumber)
Helper function used by LessThan()

References SELECTION_CONDITIONS::moreThanFunc().

Referenced by SCH_EDIT_TOOL::Init(), CONVERT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), and PCB_EDIT_FRAME::setupUIConditions().

◆ NotEmpty()

bool SELECTION_CONDITIONS::NotEmpty ( const SELECTION aSelection)
staticinherited

Test 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:122

References SELECTION::Empty().

Referenced by SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GROUP_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), PCB_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), and PL_EDITOR_FRAME::setupUIConditions().

◆ OnlyType()

SELECTION_CONDITION SELECTION_CONDITIONS::OnlyType ( KICAD_T  aType)
staticinherited

Create 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 64 of file selection_conditions.cpp.

65 {
66  return std::bind( &SELECTION_CONDITIONS::onlyTypeFunc, _1, aType );
67 }
static bool onlyTypeFunc(const SELECTION &aSelection, KICAD_T aType)
Helper function used by OnlyTypes()

References SELECTION_CONDITIONS::onlyTypeFunc().

Referenced by SYMBOL_EDITOR_PIN_TOOL::Init(), SCH_EDIT_TOOL::Init(), EE_INSPECTION_TOOL::Init(), PAD_TOOL::Init(), CONVERT_TOOL::Init(), SCH_MOVE_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), EE_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), and PCB_EDIT_FRAME::setupUIConditions().

◆ OnlyTypes()

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

Create 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 70 of file selection_conditions.cpp.

71 {
72  return std::bind( &SELECTION_CONDITIONS::onlyTypesFunc, _1, aTypes );
73 }
static bool onlyTypesFunc(const SELECTION &aSelection, const KICAD_T aTypes[])
Helper function used by Count()

References SELECTION_CONDITIONS::onlyTypesFunc().

Referenced by SCH_EDIT_TOOL::Init(), CONVERT_TOOL::Init(), EE_SELECTION_TOOL::Init(), BOARD_INSPECTION_TOOL::Init(), EDIT_TOOL::Init(), EDIT_TOOL::Properties(), PCB_EDIT_FRAME::setupUIConditions(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), BOARD_EDITOR_CONTROL::ViaSizeDec(), and BOARD_EDITOR_CONTROL::ViaSizeInc().

◆ ShowAlways()

◆ ShowNever()

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

Always returns false.

Parameters
aSelectionis the selection to be tested.
Returns
Always false.

Definition at line 88 of file selection_conditions.h.

89  {
90  return false;
91  }

Referenced by ACTION_CONDITIONS::ACTION_CONDITIONS(), and PL_EDITOR_FRAME::setupUIConditions().

Member Data Documentation

◆ m_adapter

BOARD_ADAPTER* EDA_3D_CONDITIONS::m_adapter
private

Definition at line 88 of file 3d_conditions.h.


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