KiCad PCB EDA Suite
EDITOR_CONDITIONS Class Reference

Class that groups generic conditions for editor states. More...

#include <editor_conditions.h>

Inheritance diagram for EDITOR_CONDITIONS:
SELECTION_CONDITIONS PCB_EDITOR_CONDITIONS

Public Member Functions

 EDITOR_CONDITIONS (EDA_BASE_FRAME *aFrame)
 Create an object to define conditions dependent upon a specific frame. More...
 
SELECTION_CONDITION ContentModified ()
 Create a functor that tests if the content of the frame is modified. More...
 
SELECTION_CONDITION UndoAvailable ()
 Create a functor that tests if there are any items in the undo queue. More...
 
SELECTION_CONDITION RedoAvailable ()
 Create a functor that tests if there are any items in the redo queue. More...
 
SELECTION_CONDITION Units (EDA_UNITS aUnit)
 Create a functor that tests if the frame has the specified units. More...
 
SELECTION_CONDITION CurrentTool (const TOOL_ACTION &aTool)
 Create a functor testing if the specified tool is the current active tool in the frame. More...
 
SELECTION_CONDITION NoActiveTool ()
 Create a functor testing if there are no tools active in the frame. More...
 
SELECTION_CONDITION GridVisible ()
 Create a functor testing if the grid is visible in a frame. More...
 
SELECTION_CONDITION PolarCoordinates ()
 Create a functor testing if polar coordinates are current being used. More...
 
SELECTION_CONDITION FullscreenCursor ()
 Create a functor testing if the cursor is full screen in a frame. More...
 
SELECTION_CONDITION ScriptingConsoleVisible ()
 Create a functor testing if the python scripting console window is visible. 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 Protected Member Functions

static bool contentModifiedFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
 < Helper function used by ContentModified(). More...
 
static bool undoFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
 Helper function used by RedoAvailable(). More...
 
static bool redoFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
 Helper function used by Units(). More...
 
static bool unitsFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame, EDA_UNITS aUnits)
 Helper function used by CurrentTool(). More...
 
static bool toolFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame, const TOOL_ACTION &aTool)
 Helper function used by NoActiveTool(). More...
 
static bool noToolFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
 Helper function used by GridVisible(). More...
 
static bool gridFunc (const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
 Helper function used by PolarCoordinates(). More...
 
static bool polarCoordFunc (const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
 Helper function used by FullscreenCursor(). More...
 
static bool cursorFunc (const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
 Helper function used by ScriptingConsoleVisible(). More...
 
static bool consoleVisibleFunc (const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
 The frame to apply the conditions to. More...
 

Protected Attributes

EDA_BASE_FRAMEm_frame
 

Detailed Description

Class that groups generic conditions for editor states.

Definition at line 40 of file editor_conditions.h.

Constructor & Destructor Documentation

◆ EDITOR_CONDITIONS()

EDITOR_CONDITIONS::EDITOR_CONDITIONS ( EDA_BASE_FRAME aFrame)
inline

Create an object to define conditions dependent upon a specific frame.

Parameters
aFrameis the frame to query for the conditions

Definition at line 48 of file editor_conditions.h.

48  :
49  m_frame( aFrame )
50  {}
EDA_BASE_FRAME * m_frame

Member Function Documentation

◆ consoleVisibleFunc()

bool EDITOR_CONDITIONS::consoleVisibleFunc ( const SELECTION aSelection,
EDA_DRAW_FRAME aFrame 
)
staticprotected

The frame to apply the conditions to.

Definition at line 173 of file editor_conditions.cpp.

174 {
175  return aFrame->IsScriptingConsoleVisible();
176 }
bool IsScriptingConsoleVisible()
Gets the current visibility of the scripting console window.

References EDA_DRAW_FRAME::IsScriptingConsoleVisible().

Referenced by ScriptingConsoleVisible().

◆ ContentModified()

SELECTION_CONDITION EDITOR_CONDITIONS::ContentModified ( )

Create a functor that tests if the content of the frame is modified.

Returns
Functor testing for modified content.

Definition at line 38 of file editor_conditions.cpp.

39 {
40  return std::bind( &EDITOR_CONDITIONS::contentModifiedFunc, _1, m_frame );
41 }
static bool contentModifiedFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
< Helper function used by ContentModified().
EDA_BASE_FRAME * m_frame

References contentModifiedFunc().

Referenced by FOOTPRINT_EDIT_FRAME::setupUIConditions(), and CVPCB_MAINFRAME::setupUIConditions().

◆ contentModifiedFunc()

bool EDITOR_CONDITIONS::contentModifiedFunc ( const SELECTION aSelection,
EDA_BASE_FRAME aFrame 
)
staticprotected

< Helper function used by ContentModified().

Helper function used by UndoAvailable().

Definition at line 117 of file editor_conditions.cpp.

118 {
119  return aFrame->IsContentModified();
120 }
virtual bool IsContentModified() const
Get if the contents of the frame have been modified since the last save.

References EDA_BASE_FRAME::IsContentModified().

Referenced by ContentModified().

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

78 {
79  return std::bind( &SELECTION_CONDITIONS::countFunc, _1, aNumber );
80 }
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().

◆ CurrentTool()

SELECTION_CONDITION EDITOR_CONDITIONS::CurrentTool ( const TOOL_ACTION aTool)

Create a functor testing if the specified tool is the current active tool in the frame.

Returns
Functor testing the current tool of a frame.

Definition at line 62 of file editor_conditions.cpp.

63 {
64  return std::bind( &EDITOR_CONDITIONS::toolFunc, _1, m_frame, std::cref( aTool ) );
65 }
EDA_BASE_FRAME * m_frame
static bool toolFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame, const TOOL_ACTION &aTool)
Helper function used by NoActiveTool().

References toolFunc().

Referenced by FOOTPRINT_VIEWER_FRAME::setupUIConditions(), DISPLAY_FOOTPRINTS_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), PL_EDITOR_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), and GERBVIEW_FRAME::setupUIConditions().

◆ cursorFunc()

bool EDITOR_CONDITIONS::cursorFunc ( const SELECTION aSelection,
EDA_DRAW_FRAME aFrame 
)
staticprotected

Helper function used by ScriptingConsoleVisible().

Definition at line 167 of file editor_conditions.cpp.

168 {
169  return aFrame->GetGalDisplayOptions().m_fullscreenCursor;
170 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
bool m_fullscreenCursor
Force cursor display.

References EDA_DRAW_FRAME::GetGalDisplayOptions(), and KIGFX::GAL_DISPLAY_OPTIONS::m_fullscreenCursor.

Referenced by FullscreenCursor().

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

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

References SELECTION::Empty().

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

◆ FullscreenCursor()

SELECTION_CONDITION EDITOR_CONDITIONS::FullscreenCursor ( )

Create a functor testing if the cursor is full screen in a frame.

Note
This requires the frame passed into the constructor be be derived from EDA_DRAW_FRAME.
Returns
Functor testing if the cursor is full screen

Definition at line 96 of file editor_conditions.cpp.

97 {
98  // The fullscreen cursor requires a draw frame
99  EDA_DRAW_FRAME* drwFrame = dynamic_cast<EDA_DRAW_FRAME*>( m_frame );
100 
101  wxASSERT( drwFrame );
102 
103  return std::bind( &EDITOR_CONDITIONS::cursorFunc, _1, drwFrame );
104 }
The base class for create windows for drawing purpose.
static bool cursorFunc(const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
Helper function used by ScriptingConsoleVisible().
EDA_BASE_FRAME * m_frame

References cursorFunc().

Referenced by FOOTPRINT_VIEWER_FRAME::setupUIConditions(), DISPLAY_FOOTPRINTS_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), PL_EDITOR_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), GERBVIEW_FRAME::setupUIConditions(), and PCB_EDIT_FRAME::setupUIConditions().

◆ gridFunc()

bool EDITOR_CONDITIONS::gridFunc ( const SELECTION aSelection,
EDA_DRAW_FRAME aFrame 
)
staticprotected

Helper function used by PolarCoordinates().

Definition at line 155 of file editor_conditions.cpp.

156 {
157  return aFrame->IsGridVisible();
158 }
bool IsGridVisible() const

References EDA_DRAW_FRAME::IsGridVisible().

Referenced by GridVisible().

◆ GridVisible()

SELECTION_CONDITION EDITOR_CONDITIONS::GridVisible ( )

Create a functor testing if the grid is visible in a frame.

Note
This requires the frame passed into the constructor be be derived from EDA_DRAW_FRAME.
Returns
Functor testing if the grid is visible

Definition at line 74 of file editor_conditions.cpp.

75 {
76  // The grid visibility check requires a draw frame
77  EDA_DRAW_FRAME* drwFrame = dynamic_cast<EDA_DRAW_FRAME*>( m_frame );
78 
79  wxASSERT( drwFrame );
80 
81  return std::bind( &EDITOR_CONDITIONS::gridFunc, _1, drwFrame );
82 }
The base class for create windows for drawing purpose.
EDA_BASE_FRAME * m_frame
static bool gridFunc(const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
Helper function used by PolarCoordinates().

References gridFunc().

Referenced by FOOTPRINT_VIEWER_FRAME::setupUIConditions(), DISPLAY_FOOTPRINTS_FRAME::setupUIConditions(), SYMBOL_VIEWER_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), PL_EDITOR_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), GERBVIEW_FRAME::setupUIConditions(), 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 59 of file selection_conditions.cpp.

60 {
61  return std::bind( &SELECTION_CONDITIONS::hasTypeFunc, _1, aType );
62 }
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 47 of file selection_conditions.cpp.

48 {
49  return ( !aSelection.Front() || aSelection.Front()->GetEditFlags() == 0 );
50 }
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:158
EDA_ITEM * Front() const
Definition: selection.h:144

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(), SCH_EDIT_FRAME::setupUIConditions(), PL_EDITOR_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 53 of file selection_conditions.cpp.

54 {
55  return ( aSelection.Front() && aSelection.Front()->GetEditFlags() == 0 );
56 }
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:158
EDA_ITEM * Front() const
Definition: selection.h:144

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

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

References SELECTION_CONDITIONS::lessThanFunc().

Referenced by EE_SELECTION_TOOL::Init().

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

84 {
85  return std::bind( &SELECTION_CONDITIONS::moreThanFunc, _1, aNumber );
86 }
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().

◆ NoActiveTool()

SELECTION_CONDITION EDITOR_CONDITIONS::NoActiveTool ( )

Create a functor testing if there are no tools active in the frame.

Returns
Functor testing the frame has no tools running.

Definition at line 68 of file editor_conditions.cpp.

69 {
70  return std::bind( &EDITOR_CONDITIONS::noToolFunc, _1, m_frame );
71 }
EDA_BASE_FRAME * m_frame
static bool noToolFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
Helper function used by GridVisible().

References noToolFunc().

Referenced by 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 35 of file selection_conditions.cpp.

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

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

◆ noToolFunc()

bool EDITOR_CONDITIONS::noToolFunc ( const SELECTION aSelection,
EDA_BASE_FRAME aFrame 
)
staticprotected

Helper function used by GridVisible().

Definition at line 149 of file editor_conditions.cpp.

150 {
151  return aFrame->ToolStackIsEmpty();
152 }
bool ToolStackIsEmpty()
Definition: tools_holder.h:116

References TOOLS_HOLDER::ToolStackIsEmpty().

Referenced by NoActiveTool().

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

66 {
67  return std::bind( &SELECTION_CONDITIONS::onlyTypeFunc, _1, aType );
68 }
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 71 of file selection_conditions.cpp.

72 {
73  return std::bind( &SELECTION_CONDITIONS::onlyTypesFunc, _1, aTypes );
74 }
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().

◆ polarCoordFunc()

bool EDITOR_CONDITIONS::polarCoordFunc ( const SELECTION aSelection,
EDA_DRAW_FRAME aFrame 
)
staticprotected

Helper function used by FullscreenCursor().

Definition at line 161 of file editor_conditions.cpp.

162 {
163  return aFrame->GetShowPolarCoords();
164 }
bool GetShowPolarCoords() const
For those frames that support polar coordinates.

References EDA_DRAW_FRAME::GetShowPolarCoords().

Referenced by PolarCoordinates().

◆ PolarCoordinates()

SELECTION_CONDITION EDITOR_CONDITIONS::PolarCoordinates ( )

Create a functor testing if polar coordinates are current being used.

Note
This requires the frame passed into the constructor be be derived from EDA_DRAW_FRAME.
Returns
Functor testing if the grid is visible

Definition at line 85 of file editor_conditions.cpp.

86 {
87  // The polar coordinates require a draw frame
88  EDA_DRAW_FRAME* drwFrame = dynamic_cast<EDA_DRAW_FRAME*>( m_frame );
89 
90  wxASSERT( drwFrame );
91 
92  return std::bind( &EDITOR_CONDITIONS::polarCoordFunc, _1, drwFrame );
93 }
The base class for create windows for drawing purpose.
static bool polarCoordFunc(const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
Helper function used by FullscreenCursor().
EDA_BASE_FRAME * m_frame

References polarCoordFunc().

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

◆ RedoAvailable()

SELECTION_CONDITION EDITOR_CONDITIONS::RedoAvailable ( )

Create a functor that tests if there are any items in the redo queue.

Returns
Functor testing if the redo queue has items.

Definition at line 50 of file editor_conditions.cpp.

51 {
52  return std::bind( &EDITOR_CONDITIONS::redoFunc, _1, m_frame );
53 }
EDA_BASE_FRAME * m_frame
static bool redoFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
Helper function used by Units().

References redoFunc().

Referenced by SCH_EDIT_FRAME::setupUIConditions(), PL_EDITOR_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), CVPCB_MAINFRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), and PCB_EDIT_FRAME::setupUIConditions().

◆ redoFunc()

bool EDITOR_CONDITIONS::redoFunc ( const SELECTION aSelection,
EDA_BASE_FRAME aFrame 
)
staticprotected

Helper function used by Units().

Definition at line 129 of file editor_conditions.cpp.

130 {
131  return aFrame->GetRedoCommandCount() > 0;
132 }
virtual int GetRedoCommandCount() const

References EDA_BASE_FRAME::GetRedoCommandCount().

Referenced by RedoAvailable().

◆ ScriptingConsoleVisible()

SELECTION_CONDITION EDITOR_CONDITIONS::ScriptingConsoleVisible ( )

Create a functor testing if the python scripting console window is visible.

Note
This requires the frame passed into the constructor be be derived from EDA_DRAW_FRAME.
Returns
Functor testing if the python scripting console window is visible

Definition at line 107 of file editor_conditions.cpp.

108 {
109  EDA_DRAW_FRAME* drwFrame = dynamic_cast<EDA_DRAW_FRAME*>( m_frame );
110 
111  wxASSERT( drwFrame );
112 
113  return std::bind( &EDITOR_CONDITIONS::consoleVisibleFunc, _1, drwFrame );
114 }
The base class for create windows for drawing purpose.
static bool consoleVisibleFunc(const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
The frame to apply the conditions to.
EDA_BASE_FRAME * m_frame

References consoleVisibleFunc().

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

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

◆ toolFunc()

bool EDITOR_CONDITIONS::toolFunc ( const SELECTION aSelection,
EDA_BASE_FRAME aFrame,
const TOOL_ACTION aTool 
)
staticprotected

Helper function used by NoActiveTool().

Definition at line 142 of file editor_conditions.cpp.

144 {
145  return aFrame->IsCurrentTool( aTool );
146 }
bool IsCurrentTool(const TOOL_ACTION &aAction) const

References TOOLS_HOLDER::IsCurrentTool().

Referenced by CurrentTool().

◆ UndoAvailable()

SELECTION_CONDITION EDITOR_CONDITIONS::UndoAvailable ( )

Create a functor that tests if there are any items in the undo queue.

Returns
Functor testing if the undo queue has items.

Definition at line 44 of file editor_conditions.cpp.

45 {
46  return std::bind( &EDITOR_CONDITIONS::undoFunc, _1, m_frame );
47 }
EDA_BASE_FRAME * m_frame
static bool undoFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
Helper function used by RedoAvailable().

References undoFunc().

Referenced by SCH_EDIT_FRAME::setupUIConditions(), PL_EDITOR_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), CVPCB_MAINFRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), and PCB_EDIT_FRAME::setupUIConditions().

◆ undoFunc()

bool EDITOR_CONDITIONS::undoFunc ( const SELECTION aSelection,
EDA_BASE_FRAME aFrame 
)
staticprotected

Helper function used by RedoAvailable().

Definition at line 123 of file editor_conditions.cpp.

124 {
125  return aFrame->GetUndoCommandCount() > 0;
126 }
virtual int GetUndoCommandCount() const

References EDA_BASE_FRAME::GetUndoCommandCount().

Referenced by UndoAvailable().

◆ Units()

SELECTION_CONDITION EDITOR_CONDITIONS::Units ( EDA_UNITS  aUnit)

Create a functor that tests if the frame has the specified units.

Returns
Functor testing the units of a frame.

Definition at line 56 of file editor_conditions.cpp.

57 {
58  return std::bind( &EDITOR_CONDITIONS::unitsFunc, _1, m_frame, aUnit );
59 }
static bool unitsFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame, EDA_UNITS aUnits)
Helper function used by CurrentTool().
EDA_BASE_FRAME * m_frame

References unitsFunc().

Referenced by FOOTPRINT_VIEWER_FRAME::setupUIConditions(), DISPLAY_FOOTPRINTS_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), PL_EDITOR_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), GERBVIEW_FRAME::setupUIConditions(), and PCB_EDIT_FRAME::setupUIConditions().

◆ unitsFunc()

bool EDITOR_CONDITIONS::unitsFunc ( const SELECTION aSelection,
EDA_BASE_FRAME aFrame,
EDA_UNITS  aUnits 
)
staticprotected

Helper function used by CurrentTool().

Definition at line 135 of file editor_conditions.cpp.

137 {
138  return aFrame->GetUserUnits() == aUnits;
139 }
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References EDA_BASE_FRAME::GetUserUnits().

Referenced by Units().

Member Data Documentation

◆ m_frame

EDA_BASE_FRAME* EDITOR_CONDITIONS::m_frame
protected

Definition at line 163 of file editor_conditions.h.


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