KiCad PCB EDA Suite
COMMON_TOOLS Class Reference

Class COMMON_TOOLS. More...

#include <common_tools.h>

Inheritance diagram for COMMON_TOOLS:
TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 COMMON_TOOLS ()
 
 ~COMMON_TOOLS ()
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
int ZoomInOut (const TOOL_EVENT &aEvent)
 
int ZoomInOutCenter (const TOOL_EVENT &aEvent)
 
int ZoomCenter (const TOOL_EVENT &aEvent)
 
int ZoomFitScreen (const TOOL_EVENT &aEvent)
 
int ZoomPreset (const TOOL_EVENT &aEvent)
 
int ToggleCursor (const TOOL_EVENT &aEvent)
 
int GridNext (const TOOL_EVENT &aEvent)
 
int GridPrev (const TOOL_EVENT &aEvent)
 
int GridPreset (const TOOL_EVENT &aEvent)
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
void SetContextMenu (CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
OPT_TOOL_EVENT Wait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
virtual bool Init ()
 Function Init() Init() is called once upon a registration of the tool. More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
TOOL_SETTINGSGetSettings ()
 
bool IsToolActive () const
 

Protected Member Functions

const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

int doZoomInOut (bool aDirection, bool aCenterOnCursor)
 
int doZoomToPreset (int idx, bool aCenterOnCursor)
 

Note: idx == 0 is Auto; idx == 1 is first entry in zoomList

More...
 
void updateGrid ()
 

Applies the legacy canvas grid settings for GAL.

More...
 

Private Attributes

EDA_DRAW_FRAMEm_frame
 

Pointer to the currently used edit frame.

More...
 

Detailed Description

Class COMMON_TOOLS.

Handles actions that are shared between different applications

Definition at line 38 of file common_tools.h.

Member Enumeration Documentation

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

81  {
82  RUN,
83  MODEL_RELOAD,
84  GAL_SWITCH
85  };
Model changes (required full reload)
Definition: tool_base.h:83
Tool is invoked after being inactive.
Definition: tool_base.h:82
Rendering engine changes.
Definition: tool_base.h:84

Constructor & Destructor Documentation

COMMON_TOOLS::COMMON_TOOLS ( )

Definition at line 43 of file common_tools.cpp.

43  :
44  TOOL_INTERACTIVE( "common.Control" ), m_frame( NULL )
45 {
46 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Constructor.
COMMON_TOOLS::~COMMON_TOOLS ( )

Definition at line 49 of file common_tools.cpp.

50 {
51 }

Member Function Documentation

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 49 of file tool_interactive.cpp.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by EDIT_TOOL::copyToClipboard(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

50 {
52 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID...
void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets the TOOL_MANAGER the tool will belong to. Called by TOOL_MANAGER::RegisterTool()

Definition at line 59 of file tool_base.cpp.

References TOOL_BASE::m_toolMgr, TOOL_BASE::m_toolSettings, and TOOL_BASE::TOOL_SETTINGS.

Referenced by TOOL_MANAGER::RegisterTool().

60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
friend class TOOL_SETTINGS
Definition: tool_base.h:155
int COMMON_TOOLS::doZoomInOut ( bool  aDirection,
bool  aCenterOnCursor 
)
private

Definition at line 74 of file common_tools.cpp.

References doZoomToPreset(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetLegacyZoom(), EDA_DRAW_FRAME::GetScreen(), m_frame, and BASE_SCREEN::m_ZoomList.

Referenced by ZoomInOut(), and ZoomInOutCenter().

75 {
76  double zoom = m_frame->GetGalCanvas()->GetLegacyZoom();
77 
78  // Step must be AT LEAST 1.3
79  if( aDirection )
80  zoom /= 1.3;
81  else
82  zoom *= 1.3;
83 
84  // Now look for the next closest menu step
85  std::vector<double>& zoomList = m_frame->GetScreen()->m_ZoomList;
86  int idx;
87 
88  if( aDirection )
89  {
90  for( idx = zoomList.size() - 1; idx >= 0; --idx )
91  {
92  if( zoomList[idx] <= zoom )
93  break;
94  }
95 
96  if( idx < 0 )
97  idx = 0; // if we ran off the end then peg to the end
98  }
99  else
100  {
101  for( idx = 0; idx < (int)zoomList.size(); ++idx )
102  {
103  if( zoomList[idx] >= zoom )
104  break;
105  }
106 
107  if( idx >= (int)zoomList.size() )
108  idx = zoomList.size() - 1; // if we ran off the end then peg to the end
109  }
110 
111  return doZoomToPreset( idx + 1, aCenterOnCursor );
112 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
double GetLegacyZoom() const
Function GetLegacyZoom() Returns current view scale converted to zoom value used by the legacy canvas...
int doZoomToPreset(int idx, bool aCenterOnCursor)
Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:903
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
int COMMON_TOOLS::doZoomToPreset ( int  idx,
bool  aCenterOnCursor 
)
private

Note: idx == 0 is Auto; idx == 1 is first entry in zoomList

Definition at line 175 of file common_tools.cpp.

References KIGFX::VIEW_CONTROLS::CenterOnCursor(), dummy(), EDA_DRAW_PANEL_GAL::GetGAL(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_PANEL_GAL::GetView(), TOOL_BASE::getViewControls(), KIGFX::GAL::GetWorldScale(), KIGFX::GAL::GetZoomFactor(), m_frame, BASE_SCREEN::m_ZoomList, scale, EDA_DRAW_FRAME::SetPresetZoom(), KIGFX::VIEW::SetScale(), and ZoomFitScreen().

Referenced by doZoomInOut(), and ZoomPreset().

176 {
177  std::vector<double>& zoomList = m_frame->GetScreen()->m_ZoomList;
178  KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
179  KIGFX::GAL* gal = m_frame->GetGalCanvas()->GetGAL();
180 
181  m_frame->SetPresetZoom( idx );
182 
183  if( idx == 0 ) // Zoom Auto
184  {
186  return ZoomFitScreen( dummy );
187  }
188  else
189  idx--;
190 
191  double selectedZoom = zoomList[idx];
192  double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
193  double scale = 1.0 / ( zoomFactor * selectedZoom );
194 
195  if( aCenterOnCursor )
196  {
197  view->SetScale( scale, getViewControls()->GetCursorPosition() );
198 
199  if( getViewControls()->IsCursorWarpingEnabled() )
201  }
202  else
203  view->SetScale( scale );
204 
205  return 0;
206 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
int ZoomFitScreen(const TOOL_EVENT &aEvent)
double GetWorldScale() const
Get the world scale.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void SetScale(double aScale)
Function SetScale() Sets the scaling factor.
Definition: view.h:247
virtual void CenterOnCursor() const =0
Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the curso...
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
Class TOOL_EVENT.
Definition: tool_event.h:162
void SetPresetZoom(int aIndex)
Function SetPresetZoom() changes zoom to one of the preset values.
Definition: zoom.cpp:249
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
const int scale
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
double GetZoomFactor() const
Get the zoom factor.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:903
Class VIEW.
Definition: view.h:58
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
Class GAL is the abstract interface for drawing on a 2D-surface.
const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited
template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

Returns the application window object, casted to requested user type.

Definition at line 188 of file tool_base.h.

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), and TOOL_SETTINGS::getConfigBase().

189  {
190  return static_cast<T*>( getEditFrameInt() );
191  }
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:47
TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Function GetId() Returns the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 122 of file tool_base.h.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::saveViewControls().

123  {
124  return m_toolId;
125  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 144 of file tool_base.h.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), PCB_TOOL::doInteractiveItemPlacement(), CONTEXT_MENU::getToolManager(), EDIT_TOOL::MeasureTool(), and CONTEXT_MENU::onMenuEvent().

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), ZONE_CREATE_HELPER::createZoneFromExisting(), and ZONE_CREATE_HELPER::performZoneCutout().

200  {
201  EDA_ITEM* m = getModelInt();
202 
203  return static_cast<T*>( m );
204  }
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53
const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Function GetName() Returns the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

Referenced by TOOL_SETTINGS::getKeyName(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), and TOOL_MANAGER::RegisterTool().

134  {
135  return m_toolName;
136  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:214
TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

Referenced by GERBVIEW_CONTROL::HighlightControl(), ROUTER_TOOL::Init(), SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

78 {
79  return m_toolSettings;
80 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), and TOOL_MANAGER::runTool().

112  {
113  return m_type;
114  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:207
KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Function getView()

Returns the instance of VIEW object used in the application. It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 35 of file tool_base.cpp.

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCBNEW_CONTROL::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PCBNEW_CONTROL::PanControl(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), SELECTION_TOOL::Reset(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), GERBVIEW_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), POINT_EDITOR::updateEditedPoint(), updateGrid(), PCBNEW_CONTROL::updateGrid(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

36 {
37  return m_toolMgr->GetView();
38 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Function getViewControls()

Returns the instance of VIEW_CONTROLS object used in the application. It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.)

Returns
The instance of VIEW_CONTROLS.

Definition at line 41 of file tool_base.cpp.

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by POINT_EDITOR::addCorner(), PCBNEW_CONTROL::CursorControl(), doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawZone(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), ROUTER_TOOL::mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), GERBVIEW_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), PICKER_TOOL::setControls(), POINT_EDITOR::setEditedPoint(), EDIT_TOOL::updateModificationPoint(), and ZoomCenter().

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257
template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 135 of file tool_interactive.h.

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PAD_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), setTransitions(), GERBVIEW_CONTROL::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), SELECTION_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), and DRAWING_TOOL::setTransitions().

137 {
138  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
139 
140  goInternal( sptr, aConditions );
141 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
int COMMON_TOOLS::GridNext ( const TOOL_EVENT aEvent)

Definition at line 210 of file common_tools.cpp.

References m_frame, EDA_DRAW_FRAME::SetNextGrid(), and updateGrid().

Referenced by setTransitions().

211 {
212  m_frame->SetNextGrid();
213  updateGrid();
214 
215  return 0;
216 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
void updateGrid()
Applies the legacy canvas grid settings for GAL.
virtual void SetNextGrid()
Function SetNextGrid() changes the grid size settings to the next one available.
Definition: draw_frame.cpp:641
int COMMON_TOOLS::GridPreset ( const TOOL_EVENT aEvent)

Definition at line 228 of file common_tools.cpp.

References m_frame, TOOL_EVENT::Parameter(), EDA_DRAW_FRAME::SetPresetGrid(), and updateGrid().

Referenced by setTransitions().

229 {
230  long idx = aEvent.Parameter<intptr_t>();
231 
232  m_frame->SetPresetGrid( idx );
233  updateGrid();
234 
235  return 0;
236 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
void updateGrid()
Applies the legacy canvas grid settings for GAL.
void SetPresetGrid(int aIndex)
Function SetPresetGrid() changes the grid size to one of the preset values.
Definition: draw_frame.cpp:669
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
int COMMON_TOOLS::GridPrev ( const TOOL_EVENT aEvent)

Definition at line 219 of file common_tools.cpp.

References m_frame, EDA_DRAW_FRAME::SetPrevGrid(), and updateGrid().

Referenced by setTransitions().

220 {
221  m_frame->SetPrevGrid();
222  updateGrid();
223 
224  return 0;
225 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
void updateGrid()
Applies the legacy canvas grid settings for GAL.
virtual void SetPrevGrid()
Function SetPrevGrid() changes the grid size settings to the previous one available.
Definition: draw_frame.cpp:655
virtual bool TOOL_BASE::Init ( )
inlinevirtualinherited

Function Init() Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented in SELECTION_TOOL, DRAWING_TOOL, GERBVIEW_SELECTION_TOOL, EDIT_TOOL, POSITION_RELATIVE_TOOL, PCB_EDITOR_CONTROL, POINT_EDITOR, MICROWAVE_TOOL, PAD_TOOL, ALIGN_DISTRIBUTE_TOOL, PICKER_TOOL, and ROUTER_TOOL.

Definition at line 93 of file tool_base.h.

Referenced by TOOL_MANAGER::InitTools().

94  {
95  return true;
96  }
bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

31 {
32  return m_toolMgr->IsToolActive( m_toolId );
33 }
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing) ...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
void COMMON_TOOLS::Reset ( RESET_REASON  aReason)
overridevirtual

Function Reset() Brings the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 54 of file common_tools.cpp.

References m_frame.

55 {
56  m_frame = getEditFrame<EDA_DRAW_FRAME>();
57 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 85 of file tool_interactive.cpp.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

86 {
87  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
88 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)
void TOOL_INTERACTIVE::SetContextMenu ( CONTEXT_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Function SetContextMenu()

Assigns a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 74 of file tool_interactive.cpp.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and CONTEXT_MENU::SetTool().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), and TOOL_MENU::ShowContextMenu().

75 {
76  if( aMenu )
77  aMenu->SetTool( this );
78  else
79  aTrigger = CMENU_OFF;
80 
81  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
82 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void ScheduleContextMenu(TOOL_BASE *aTool, CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool&#39;s context popup menu.
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void COMMON_TOOLS::setTransitions ( )
overridevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 250 of file common_tools.cpp.

References ACT_toggleCursor, TOOL_INTERACTIVE::Go(), GridNext(), ACTIONS::gridNext, GridPreset(), ACTIONS::gridPreset, GridPrev(), ACTIONS::gridPrev, TOOL_ACTION::MakeEvent(), ToggleCursor(), ZoomCenter(), ACTIONS::zoomCenter, ZoomFitScreen(), ACTIONS::zoomFitScreen, ACTIONS::zoomIn, ACTIONS::zoomInCenter, ZoomInOut(), ZoomInOutCenter(), ACTIONS::zoomOut, ACTIONS::zoomOutCenter, ZoomPreset(), and ACTIONS::zoomPreset.

251 {
252  Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
259 
263 
265 }
int ZoomFitScreen(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomPreset
Definition: actions.h:57
static TOOL_ACTION ACT_toggleCursor("common.Control.toggleCursor", AS_GLOBAL, TOOL_ACTION::LegacyHotKey(HK_TOGGLE_CURSOR), _("Toggle Always Show Cursor"), _("Toogle display of the cursor, even when not in an interactive tool"))
static TOOL_ACTION zoomInCenter
Definition: actions.h:53
static TOOL_ACTION zoomFitScreen
Definition: actions.h:56
int GridPreset(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION zoomOutCenter
Definition: actions.h:54
int GridNext(const TOOL_EVENT &aEvent)
int ZoomInOutCenter(const TOOL_EVENT &aEvent)
static TOOL_ACTION gridPreset
Definition: actions.h:67
static TOOL_ACTION gridPrev
Definition: actions.h:64
int GridPrev(const TOOL_EVENT &aEvent)
int ZoomCenter(const TOOL_EVENT &aEvent)
int ZoomInOut(const TOOL_EVENT &aEvent)
int ToggleCursor(const TOOL_EVENT &aEvent)
TOOL_EVENT MakeEvent() const
Function HasHotKey() Checks if the action has a hot key assigned.
Definition: tool_action.h:104
static TOOL_ACTION zoomCenter
Definition: actions.h:55
int ZoomPreset(const TOOL_EVENT &aEvent)
static TOOL_ACTION gridNext
Definition: actions.h:63
static TOOL_ACTION zoomIn
Definition: actions.h:51
static TOOL_ACTION zoomOut
Definition: actions.h:52
int COMMON_TOOLS::ToggleCursor ( const TOOL_EVENT aEvent)

Definition at line 239 of file common_tools.cpp.

References EDA_DRAW_FRAME::GetGalDisplayOptions(), KIGFX::GAL_DISPLAY_OPTIONS::m_forceDisplayCursor, and m_frame.

Referenced by setTransitions().

240 {
241  auto& galOpts = m_frame->GetGalDisplayOptions();
242 
243  galOpts.m_forceDisplayCursor = !galOpts.m_forceDisplayCursor;
244  galOpts.NotifyChanged();
245 
246  return 0;
247 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:924
bool m_forceDisplayCursor
Force cursor display
void COMMON_TOOLS::updateGrid ( )
private

Applies the legacy canvas grid settings for GAL.

Definition at line 268 of file common_tools.cpp.

References KIGFX::VIEW::GetGAL(), BASE_SCREEN::GetGridSize(), EDA_DRAW_FRAME::GetScreen(), TOOL_BASE::getView(), m_frame, KIGFX::VIEW::MarkTargetDirty(), KIGFX::GAL::SetGridSize(), and KIGFX::TARGET_NONCACHED.

Referenced by GridNext(), GridPreset(), and GridPrev().

269 {
270  BASE_SCREEN* screen = m_frame->GetScreen();
271  getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
273 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
Auxiliary rendering target (noncached)
Definition: definitions.h:42
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:177
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target &#39;dirty&#39; flag.
Definition: view.h:577
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
OPT_TOOL_EVENT TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

Suspends execution of the tool until an event specified in aEventList arrives. No parameters means waiting for any event.

Definition at line 55 of file tool_interactive.cpp.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

56 {
57  return m_toolMgr->ScheduleWait( this, aEventList );
58 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
OPT< TOOL_EVENT > ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses execution of a given tool until one or more events matching aConditions arrives.
int COMMON_TOOLS::ZoomCenter ( const TOOL_EVENT aEvent)

Definition at line 115 of file common_tools.cpp.

References KIGFX::VIEW_CONTROLS::CenterOnCursor(), and TOOL_BASE::getViewControls().

Referenced by setTransitions().

116 {
118 
119  ctls->CenterOnCursor();
120 
121  return 0;
122 }
virtual void CenterOnCursor() const =0
Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the curso...
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
int COMMON_TOOLS::ZoomFitScreen ( const TOOL_EVENT aEvent)

Definition at line 125 of file common_tools.cpp.

References FRAME_PCB_MODULE_EDITOR, FRAME_PCB_MODULE_VIEWER, FRAME_PCB_MODULE_VIEWER_MODAL, FRAME_SCH_LIB_EDITOR, FRAME_SCH_VIEWER, FRAME_SCH_VIEWER_MODAL, KIGFX::VIEW::GetCenter(), EDA_DRAW_PANEL_GAL::GetDefaultViewBBox(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetScale(), TOOL_BASE::getView(), m_frame, max, scale, KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::ToWorld(), EDA_ITEM::ViewBBox(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by doZoomToPreset(), and setTransitions().

126 {
127  KIGFX::VIEW* view = getView();
128  EDA_DRAW_PANEL_GAL* galCanvas = m_frame->GetGalCanvas();
129  EDA_ITEM* model = getModel<EDA_ITEM>();
130  EDA_BASE_FRAME* frame = getEditFrame<EDA_BASE_FRAME>();
131 
132  BOX2I bBox = model->ViewBBox();
133  VECTOR2D scrollbarSize = VECTOR2D( galCanvas->GetSize() - galCanvas->GetClientSize() );
134  VECTOR2D screenSize = view->ToWorld( galCanvas->GetClientSize(), false );
135 
136  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
137  {
138  bBox = galCanvas->GetDefaultViewBBox();
139  }
140 
141  VECTOR2D vsize = bBox.GetSize();
142  double scale = view->GetScale() / std::max( fabs( vsize.x / screenSize.x ),
143  fabs( vsize.y / screenSize.y ) );
144 
145  // Reserve a 10% margin around component bounding box.
146  double margin_scale_factor = 1.1;
147 
148  // Leave 20% for library editors & viewers
149  if( frame->IsType( FRAME_PCB_MODULE_VIEWER ) || frame->IsType( FRAME_PCB_MODULE_VIEWER_MODAL )
150  || frame->IsType( FRAME_SCH_VIEWER ) || frame->IsType( FRAME_SCH_VIEWER_MODAL )
151  || frame->IsType( FRAME_SCH_LIB_EDITOR ) || frame->IsType( FRAME_PCB_MODULE_EDITOR ) )
152  {
153  margin_scale_factor = 1.2;
154  }
155 
156  view->SetScale( scale / margin_scale_factor );
157  view->SetCenter( bBox.Centre() );
158 
159  // Take scrollbars into account
160  VECTOR2D worldScrollbarSize = view->ToWorld( scrollbarSize, false );
161  view->SetCenter( view->GetCenter() + worldScrollbarSize / 2.0 );
162 
163  return 0;
164 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
const VECTOR2D & GetCenter() const
Function GetCenter() Returns the center point of this VIEW (in world space coordinates) ...
Definition: view.h:316
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates...
Definition: view.cpp:463
void SetScale(double aScale)
Function SetScale() Sets the scaling factor.
Definition: view.h:247
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:587
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
virtual BOX2I GetDefaultViewBBox() const
Returns the bounding box of the view that should be used if model is not valid For example...
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
const int scale
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
double GetScale() const
Function GetScale()
Definition: view.h:265
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:903
Class VIEW.
Definition: view.h:58
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
int COMMON_TOOLS::ZoomInOut ( const TOOL_EVENT aEvent)

Definition at line 60 of file common_tools.cpp.

References doZoomInOut(), TOOL_EVENT::IsAction(), and ACTIONS::zoomIn.

Referenced by setTransitions().

61 {
62  bool direction = aEvent.IsAction( &ACTIONS::zoomIn );
63  return doZoomInOut( direction, true );
64 }
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:54
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
static TOOL_ACTION zoomIn
Definition: actions.h:51
int COMMON_TOOLS::ZoomInOutCenter ( const TOOL_EVENT aEvent)

Definition at line 67 of file common_tools.cpp.

References doZoomInOut(), TOOL_EVENT::IsAction(), and ACTIONS::zoomInCenter.

Referenced by setTransitions().

68 {
69  bool direction = aEvent.IsAction( &ACTIONS::zoomInCenter );
70  return doZoomInOut( direction, false );
71 }
static TOOL_ACTION zoomInCenter
Definition: actions.h:53
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:54
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
int COMMON_TOOLS::ZoomPreset ( const TOOL_EVENT aEvent)

Definition at line 167 of file common_tools.cpp.

References doZoomToPreset(), and TOOL_EVENT::Parameter().

Referenced by setTransitions().

168 {
169  unsigned int idx = aEvent.Parameter<intptr_t>();
170  return doZoomToPreset( idx, false );
171 }
int doZoomToPreset(int idx, bool aCenterOnCursor)
Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378

Member Data Documentation

EDA_DRAW_FRAME* COMMON_TOOLS::m_frame
private

Pointer to the currently used edit frame.

Definition at line 67 of file common_tools.h.

Referenced by doZoomInOut(), doZoomToPreset(), GridNext(), GridPreset(), GridPrev(), Reset(), ToggleCursor(), updateGrid(), and ZoomFitScreen().

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 210 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), and TOOL_BASE::IsToolActive().

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PAD_TOOL::applyPadSettings(), TOOL_BASE::attachManager(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), GERBVIEW_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::clearSelection(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCBNEW_CONTROL::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandSelectedConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), EDIT_TOOL::Flip(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PICKER_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PAD_TOOL::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), SELECTION_TOOL::SanitizeSelection(), SELECTION_TOOL::selectCopper(), PCB_TOOL::selection(), GERBVIEW_SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), SELECTION_TOOL::selectOnSheetFromEeschema(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), TOOL_INTERACTIVE::SetContextMenu(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName

(eg. pcbnew.InteractiveSelection).

Definition at line 214 of file tool_base.h.

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 216 of file tool_base.h.

Referenced by TOOL_BASE::attachManager().

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 207 of file tool_base.h.


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