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 ()
 Creates a functor that tests if the content of the frame is modified. More...
 
SELECTION_CONDITION UndoAvailable ()
 Creates a functor that tests if there are any items in the undo queue. More...
 
SELECTION_CONDITION RedoAvailable ()
 Creates a functor that tests if there are any items in the redo queue. More...
 
SELECTION_CONDITION Units (EDA_UNITS aUnit)
 Creates a functor that tests if the frame has the specified units. More...
 
SELECTION_CONDITION CurrentTool (const TOOL_ACTION &aTool)
 Creates a functor testing if the specified tool is the current active tool in the frame. More...
 
SELECTION_CONDITION NoActiveTool ()
 Creates a functor testing if there are no tools active in the frame. More...
 
SELECTION_CONDITION GridVisible ()
 Creates a functor testing if the grid is visible in a frame. More...
 
SELECTION_CONDITION PolarCoordinates ()
 Creates a functor testing if polar coordinates are current being used. More...
 
SELECTION_CONDITION FullscreenCursor ()
 Creates a functor testing if the cursor is full screen in a frame. More...
 
SELECTION_CONDITION CanvasType (EDA_DRAW_PANEL_GAL::GAL_TYPE aType)
 Creates a functor testing if the specified canvas is active in the frame. 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)
 Tests if there are any items selected. More...
 
static bool Empty (const SELECTION &aSelection)
 Tests if there are no items selected. More...
 
static bool Idle (const SELECTION &aSelection)
 Tests if there no items selected or being edited. More...
 
static bool IdleSelection (const SELECTION &aSelection)
 Tests if all selected items are not being edited. More...
 
static SELECTION_CONDITION HasType (KICAD_T aType)
 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)
 Creates a functor that tests if the selected items are only of given type. More...
 
static SELECTION_CONDITION OnlyTypes (const KICAD_T aTypes[])
 Creates a functor that tests if the selected items are only of given types. More...
 
static SELECTION_CONDITION Count (int aNumber)
 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)
 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)
 Creates 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 UndoAvailable()

More...
 
static bool redoFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
 

Helper function used by RedoAvailable()

More...
 
static bool unitsFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame, EDA_UNITS aUnits)
 

Helper function used by Units()

More...
 
static bool toolFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame, const TOOL_ACTION &aTool)
 

Helper function used by CurrentTool()

More...
 
static bool noToolFunc (const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
 

Helper function used by NoActiveTool()

More...
 
static bool gridFunc (const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
 

Helper function used by GridVisible()

More...
 
static bool polarCoordFunc (const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
 

Helper function used by PolarCoordinates()

More...
 
static bool cursorFunc (const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
 

Helper function used by FullscreenCursor()

More...
 
static bool canvasTypeFunc (const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame, EDA_DRAW_PANEL_GAL::GAL_TYPE aType)
 

Helper function used by CanvasType()

More...
 

Protected Attributes

EDA_BASE_FRAMEm_frame
 

The frame to apply the conditions to

More...
 

Detailed Description

Class that groups generic conditions for editor states.

Definition at line 39 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 47 of file editor_conditions.h.

47  :
48  m_frame( aFrame )
49  {}
EDA_BASE_FRAME * m_frame
The frame to apply the conditions to

Member Function Documentation

◆ CanvasType()

SELECTION_CONDITION EDITOR_CONDITIONS::CanvasType ( EDA_DRAW_PANEL_GAL::GAL_TYPE  aType)

Creates a functor testing if the specified canvas is active in the frame.

Note
this requires the frame passed into the constructor be be derived from EDA_DRAW_FRAME.
Returns
Functor testing the canvas type of the frame

Definition at line 107 of file editor_conditions.cpp.

108 {
109  // The canvas type requires a draw frame
110  EDA_DRAW_FRAME* drwFrame = dynamic_cast<EDA_DRAW_FRAME*>( m_frame );
111 
112  wxASSERT( drwFrame );
113 
114  return std::bind( &EDITOR_CONDITIONS::canvasTypeFunc, _1, drwFrame, aType );
115 }
static bool canvasTypeFunc(const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame, EDA_DRAW_PANEL_GAL::GAL_TYPE aType)
Helper function used by CanvasType()
The base class for create windows for drawing purpose.
EDA_BASE_FRAME * m_frame
The frame to apply the conditions to

References canvasTypeFunc().

Referenced by PCB_EDIT_FRAME::setupUIConditions(), GERBVIEW_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), LIB_EDIT_FRAME::setupUIConditions(), and FOOTPRINT_EDIT_FRAME::setupUIConditions().

◆ canvasTypeFunc()

bool EDITOR_CONDITIONS::canvasTypeFunc ( const SELECTION aSelection,
EDA_DRAW_FRAME aFrame,
EDA_DRAW_PANEL_GAL::GAL_TYPE  aType 
)
staticprotected

Helper function used by CanvasType()

Definition at line 174 of file editor_conditions.cpp.

176 {
177  return aFrame->GetCanvas()->GetBackend() == aType;
178 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.

References EDA_DRAW_PANEL_GAL::GetBackend(), and EDA_DRAW_FRAME::GetCanvas().

Referenced by CanvasType().

◆ ContentModified()

SELECTION_CONDITION EDITOR_CONDITIONS::ContentModified ( )

Creates 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
The frame to apply the conditions to

References contentModifiedFunc().

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

◆ contentModifiedFunc()

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

Helper function used by ContentModified()

Definition at line 118 of file editor_conditions.cpp.

119 {
120  return aFrame->IsContentModified();
121 }
virtual bool IsContentModified()
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

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

References SELECTION_CONDITIONS::countFunc().

Referenced by LIB_EDIT_TOOL::Init(), LIB_PIN_TOOL::Init(), SCH_EDIT_TOOL::Init(), EE_INSPECTION_TOOL::Init(), CONVERT_TOOL::Init(), PAD_TOOL::Init(), EE_SELECTION_TOOL::Init(), PCB_INSPECTION_TOOL::Init(), EDIT_TOOL::Init(), and PCB_EDIT_FRAME::setupUIConditions().

◆ CurrentTool()

SELECTION_CONDITION EDITOR_CONDITIONS::CurrentTool ( const TOOL_ACTION aTool)

Creates 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
The frame to apply the conditions to
static bool toolFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame, const TOOL_ACTION &aTool)
Helper function used by CurrentTool()

References toolFunc().

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

◆ cursorFunc()

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

Helper function used by FullscreenCursor()

Definition at line 168 of file editor_conditions.cpp.

169 {
170  return aFrame->GetGalDisplayOptions().m_fullscreenCursor;
171 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
bool m_fullscreenCursor
Fullscreen crosshair or small cross

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

Referenced by FullscreenCursor().

◆ Empty()

bool SELECTION_CONDITIONS::Empty ( const SELECTION aSelection)
staticinherited

Tests 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:121

References SELECTION::Empty().

Referenced by EE_SELECTION_TOOL::Init().

◆ FullscreenCursor()

SELECTION_CONDITION EDITOR_CONDITIONS::FullscreenCursor ( )

Creates 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 FullscreenCursor()
EDA_BASE_FRAME * m_frame
The frame to apply the conditions to

References cursorFunc().

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

◆ gridFunc()

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

Helper function used by GridVisible()

Definition at line 156 of file editor_conditions.cpp.

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

References EDA_DRAW_FRAME::IsGridVisible().

Referenced by GridVisible().

◆ GridVisible()

SELECTION_CONDITION EDITOR_CONDITIONS::GridVisible ( )

Creates 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
The frame to apply the conditions to
static bool gridFunc(const SELECTION &aSelection, EDA_DRAW_FRAME *aFrame)
Helper function used by GridVisible()

References gridFunc().

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

◆ HasType()

SELECTION_CONDITION SELECTION_CONDITIONS::HasType ( KICAD_T  aType)
staticinherited

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 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 BOARD::GroupLegalOps(), and PAD_TOOL::Init().

◆ Idle()

bool SELECTION_CONDITIONS::Idle ( const SELECTION aSelection)
staticinherited

Tests 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:226
EDA_ITEM * Front() const
Definition: selection.h:184

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

Referenced by LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), EE_INSPECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), LIB_EDIT_FRAME::LoadOneSymbol(), PL_EDITOR_FRAME::setupUIConditions(), PCB_EDIT_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), LIB_EDIT_FRAME::setupUIConditions(), and FOOTPRINT_EDIT_FRAME::setupUIConditions().

◆ IdleSelection()

bool SELECTION_CONDITIONS::IdleSelection ( const SELECTION aSelection)
staticinherited

Tests 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:226
EDA_ITEM * Front() const
Definition: selection.h:184

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

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

◆ LessThan()

SELECTION_CONDITION SELECTION_CONDITIONS::LessThan ( int  aNumber)
staticinherited

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

References SELECTION_CONDITIONS::lessThanFunc().

◆ MoreThan()

SELECTION_CONDITION SELECTION_CONDITIONS::MoreThan ( int  aNumber)
staticinherited

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

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(), and PCB_EDIT_FRAME::setupUIConditions().

◆ NoActiveTool()

SELECTION_CONDITION EDITOR_CONDITIONS::NoActiveTool ( )

Creates 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
The frame to apply the conditions to
static bool noToolFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
Helper function used by NoActiveTool()

References noToolFunc().

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

◆ NotEmpty()

bool SELECTION_CONDITIONS::NotEmpty ( const SELECTION aSelection)
staticinherited

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:121

References SELECTION::Empty().

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

◆ noToolFunc()

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

Helper function used by NoActiveTool()

Definition at line 150 of file editor_conditions.cpp.

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

References TOOLS_HOLDER::ToolStackIsEmpty().

Referenced by NoActiveTool().

◆ OnlyType()

SELECTION_CONDITION SELECTION_CONDITIONS::OnlyType ( KICAD_T  aType)
staticinherited

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

References SELECTION_CONDITIONS::onlyTypeFunc().

Referenced by BOARD::GroupLegalOps(), LIB_PIN_TOOL::Init(), SCH_EDIT_TOOL::Init(), EE_INSPECTION_TOOL::Init(), CONVERT_TOOL::Init(), PAD_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EDIT_TOOL::Init(), and PCB_EDIT_FRAME::setupUIConditions().

◆ OnlyTypes()

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

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

References SELECTION_CONDITIONS::onlyTypesFunc().

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

◆ polarCoordFunc()

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

Helper function used by PolarCoordinates()

Definition at line 162 of file editor_conditions.cpp.

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

References EDA_DRAW_FRAME::GetShowPolarCoords().

Referenced by PolarCoordinates().

◆ PolarCoordinates()

SELECTION_CONDITION EDITOR_CONDITIONS::PolarCoordinates ( )

Creates 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 PolarCoordinates()
EDA_BASE_FRAME * m_frame
The frame to apply the conditions to

References polarCoordFunc().

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

◆ RedoAvailable()

SELECTION_CONDITION EDITOR_CONDITIONS::RedoAvailable ( )

Creates 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
The frame to apply the conditions to
static bool redoFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
Helper function used by RedoAvailable()

References redoFunc().

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

◆ redoFunc()

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

Helper function used by RedoAvailable()

Definition at line 130 of file editor_conditions.cpp.

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

References EDA_BASE_FRAME::GetRedoCommandCount().

Referenced by RedoAvailable().

◆ ShowAlways()

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

◆ 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 86 of file selection_conditions.h.

87  {
88  return false;
89  }

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

Definition at line 143 of file editor_conditions.cpp.

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

References TOOLS_HOLDER::IsCurrentTool().

Referenced by CurrentTool().

◆ UndoAvailable()

SELECTION_CONDITION EDITOR_CONDITIONS::UndoAvailable ( )

Creates 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
The frame to apply the conditions to
static bool undoFunc(const SELECTION &aSelection, EDA_BASE_FRAME *aFrame)
Helper function used by UndoAvailable()

References undoFunc().

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

◆ undoFunc()

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

Helper function used by UndoAvailable()

Definition at line 124 of file editor_conditions.cpp.

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

References EDA_BASE_FRAME::GetUndoCommandCount().

Referenced by UndoAvailable().

◆ Units()

SELECTION_CONDITION EDITOR_CONDITIONS::Units ( EDA_UNITS  aUnit)

Creates 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 Units()
EDA_BASE_FRAME * m_frame
The frame to apply the conditions to

References unitsFunc().

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

◆ unitsFunc()

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

Helper function used by Units()

Definition at line 136 of file editor_conditions.cpp.

138 {
139  return aFrame->GetUserUnits() == aUnits;
140 }
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

The frame to apply the conditions to

Definition at line 162 of file editor_conditions.h.


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