KiCad PCB EDA Suite
common_tools.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2014-2016 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <bitmaps.h>
26 #include <tool/actions.h>
27 #include <tool/tool_manager.h>
28 #include <eda_draw_frame.h>
29 #include <class_draw_panel_gal.h>
30 #include <view/view.h>
31 #include <view/view_controls.h>
33 #include <base_screen.h>
34 #include <tool/common_tools.h>
35 #include <id.h>
36 #include <project.h>
37 #include <kiface_i.h>
38 #include <dialog_configure_paths.h>
39 
41 {
42  m_frame = getEditFrame<EDA_DRAW_FRAME>();
43 }
44 
45 
47 {
48  // Since selection tools are run permanently underneath the toolStack, this is really
49  // just a cancel of whatever other tools might be running.
50 
52  return 0;
53 }
54 
55 
56 // Cursor control
58 {
59  long type = aEvent.Parameter<intptr_t>();
60  bool fastMove = type & ACTIONS::CURSOR_FAST_MOVE;
61  type &= ~ACTIONS::CURSOR_FAST_MOVE;
62  bool mirroredX = getView()->IsMirroredX();
63 
64  VECTOR2D cursor = getViewControls()->GetRawCursorPosition( false );
65  VECTOR2I gridSize = VECTOR2D( m_frame->GetScreen()->GetGridSize() );
66 
67  if( fastMove )
68  gridSize = gridSize * 10;
69 
70  switch( type )
71  {
72  case ACTIONS::CURSOR_UP:
73  cursor -= VECTOR2D( 0, gridSize.y );
74  break;
75 
77  cursor += VECTOR2D( 0, gridSize.y );
78  break;
79 
81  cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
82  break;
83 
85  cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
86  break;
87 
88  case ACTIONS::CURSOR_CLICK: // fall through
91  {
94  int modifiers = 0;
95 
96  modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
97  modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
98  modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
99 
100  if( type == ACTIONS::CURSOR_DBL_CLICK )
101  action = TA_MOUSE_DBLCLICK;
102 
103  if( type == ACTIONS::CURSOR_RIGHT_CLICK )
104  button = BUT_RIGHT;
105 
106  TOOL_EVENT evt( TC_MOUSE, action, button | modifiers );
107  evt.SetMousePosition( getViewControls()->GetCursorPosition() );
108  m_toolMgr->ProcessEvent( evt );
109 
110  return 0;
111  }
112  default:
113  wxFAIL_MSG( "CursorControl(): unexpected request" );
114  }
115 
116  getViewControls()->SetCursorPosition( cursor, true, true, type );
118 
119  return 0;
120 }
121 
122 
124 {
125  long type = aEvent.Parameter<intptr_t>();
126  KIGFX::VIEW* view = getView();
127  VECTOR2D center = view->GetCenter();
128  VECTOR2I gridSize = VECTOR2D( m_frame->GetScreen()->GetGridSize() ) * 10;
129  bool mirroredX = view->IsMirroredX();
130 
131  switch( type )
132  {
133  case ACTIONS::CURSOR_UP:
134  center -= VECTOR2D( 0, gridSize.y );
135  break;
136 
138  center += VECTOR2D( 0, gridSize.y );
139  break;
140 
142  center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
143  break;
144 
146  center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
147  break;
148 
149  default:
150  wxFAIL;
151  break;
152  }
153 
154  view->SetCenter( center );
155 
156  return 0;
157 }
158 
159 
161 {
162  m_frame->HardRedraw();
163  return 0;
164 }
165 
166 
168 {
169  bool direction = aEvent.IsAction( &ACTIONS::zoomIn );
170  return doZoomInOut( direction, true );
171 }
172 
173 
175 {
176  bool direction = aEvent.IsAction( &ACTIONS::zoomInCenter );
177  return doZoomInOut( direction, false );
178 }
179 
180 
181 int COMMON_TOOLS::doZoomInOut( bool aDirection, bool aCenterOnCursor )
182 {
183  double zoom = m_frame->GetCanvas()->GetLegacyZoom();
184 
185  // Step must be AT LEAST 1.3
186  if( aDirection )
187  zoom /= 1.3;
188  else
189  zoom *= 1.3;
190 
191  // Now look for the next closest menu step
192  std::vector<double>& zoomList = m_frame->GetScreen()->m_ZoomList;
193  int idx;
194 
195  if( aDirection )
196  {
197  for( idx = zoomList.size() - 1; idx >= 0; --idx )
198  {
199  if( zoomList[idx] <= zoom )
200  break;
201  }
202 
203  if( idx < 0 )
204  idx = 0; // if we ran off the end then peg to the end
205  }
206  else
207  {
208  for( idx = 0; idx < (int)zoomList.size(); ++idx )
209  {
210  if( zoomList[idx] >= zoom )
211  break;
212  }
213 
214  if( idx >= (int)zoomList.size() )
215  idx = zoomList.size() - 1; // if we ran off the end then peg to the end
216  }
217 
218  return doZoomToPreset( idx + 1, aCenterOnCursor );
219 }
220 
221 
223 {
225 
226  ctls->CenterOnCursor();
227 
228  return 0;
229 }
230 
231 
233 {
234  KIGFX::VIEW* view = getView();
235  EDA_DRAW_PANEL_GAL* canvas = m_frame->GetCanvas();
236  EDA_DRAW_FRAME* frame = getEditFrame<EDA_DRAW_FRAME>();
237 
238  BOX2I bBox = frame->GetDocumentExtents();
239  BOX2I defaultBox = canvas->GetDefaultViewBBox();
240  VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() );
241 
242  view->SetScale( 1.0 ); // the best scale will be fixed later, from this initial value
243  // but this call ensure all view parameters are up to date
244  // especially at init time
245  VECTOR2D screenSize = view->ToWorld( canvas->GetClientSize(), false );
246 
247  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
248  bBox = defaultBox;
249 
250  VECTOR2D vsize = bBox.GetSize();
251  double scale = view->GetScale() / std::max( fabs( vsize.x / screenSize.x ),
252  fabs( vsize.y / screenSize.y ) );
253 
254  // Reserve a 10% margin around component bounding box.
255  double margin_scale_factor = 1.1;
256 
257  // Leave a bigger margin for library editors & viewers
259  || frame->IsType( FRAME_SCH_VIEWER ) || frame->IsType( FRAME_SCH_VIEWER_MODAL ) )
260  {
261  margin_scale_factor = 1.4;
262  }
263  else if( frame->IsType( FRAME_SCH_LIB_EDITOR ) || frame->IsType( FRAME_FOOTPRINT_EDITOR ) )
264  {
265  margin_scale_factor = 2;
266  }
267 
268  view->SetScale( scale / margin_scale_factor );
269  view->SetCenter( bBox.Centre() );
270 
271  // Take scrollbars into account
272  VECTOR2D worldScrollbarSize = view->ToWorld( scrollbarSize, false );
273  view->SetCenter( view->GetCenter() + worldScrollbarSize / 2.0 );
274 
275  return 0;
276 }
277 
278 
280 {
281  EDA_DRAW_PANEL_GAL* canvas = m_frame->GetCanvas();
282  BOX2I bBox = getModel<EDA_ITEM>()->ViewBBox();
283 
284  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
285  bBox = canvas->GetDefaultViewBBox();
286 
287  getView()->SetCenter( bBox.Centre() );
288 
289  // Take scrollbars into account
290  VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() );
291  VECTOR2D worldScrollbarSize = getView()->ToWorld( scrollbarSize, false );
292  getView()->SetCenter( getView()->GetCenter() + worldScrollbarSize / 2.0 );
293 
294  return 0;
295 }
296 
297 
299 {
300  unsigned int idx = aEvent.Parameter<intptr_t>();
301  return doZoomToPreset( idx, false );
302 }
303 
304 
305 // Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
306 int COMMON_TOOLS::doZoomToPreset( int idx, bool aCenterOnCursor )
307 {
308  std::vector<double>& zoomList = m_frame->GetScreen()->m_ZoomList;
309  KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
310 
311  if( idx == 0 ) // Zoom Auto
312  {
314  return ZoomFitScreen( dummy );
315  }
316  else
317  {
318  idx--;
319  }
320 
321  double scale = m_frame->GetZoomLevelCoeff() / zoomList[idx];
322 
323  if( aCenterOnCursor )
324  {
325  view->SetScale( scale, getViewControls()->GetCursorPosition() );
326 
327  if( getViewControls()->IsCursorWarpingEnabled() )
329  }
330  else
331  {
332  view->SetScale( scale );
333  }
334 
335  return 0;
336 }
337 
338 
349 static OPT<int> getNextPreviousGrid( const BASE_SCREEN& aScreen, int aOffset )
350 {
351  const GRIDS& grids = aScreen.GetGrids();
352  const GRID_TYPE& currGrid = aScreen.GetGrid();
353 
354  auto iter = std::find_if( grids.begin(), grids.end(),
355  [&]( const GRID_TYPE& aCandidate ) { return aCandidate.m_CmdId == currGrid.m_CmdId; } );
356 
357  wxCHECK_MSG( iter != grids.end(), {}, "Grid not found in screen's grid list" );
358 
359  int index = std::distance( grids.begin(), iter ) + aOffset;
360 
361  // If we go off the end, return invalid, but we could also wrap around if wanted.
362  if( index < 0 || static_cast<size_t>( index ) >= grids.size() )
363  return {};
364 
365  return grids[index].m_CmdId;
366 }
367 
368 
369 // Grid control
370 int COMMON_TOOLS::GridNext( const TOOL_EVENT& aEvent )
371 {
372  const OPT<int> next_grid_id = getNextPreviousGrid( *m_frame->GetScreen(), 1 );
373 
374  if( next_grid_id )
375  return GridPreset( *next_grid_id - ID_POPUP_GRID_LEVEL_1000 );
376 
377  return 1;
378 }
379 
380 
381 int COMMON_TOOLS::GridPrev( const TOOL_EVENT& aEvent )
382 {
383  const OPT<int> next_grid_id = getNextPreviousGrid( *m_frame->GetScreen(), -1 );
384 
385  if( next_grid_id )
386  return GridPreset( *next_grid_id - ID_POPUP_GRID_LEVEL_1000 );
387 
388  return 1;
389 }
390 
391 
393 {
394  return GridPreset( aEvent.Parameter<intptr_t>() );
395 }
396 
397 
399 {
400  BASE_SCREEN* screen = m_frame->GetScreen();
401 
402  if( !screen->GridExists( idx + ID_POPUP_GRID_LEVEL_1000 ) )
403  idx = 0;
404 
405  screen->SetGrid( idx + ID_POPUP_GRID_LEVEL_1000 );
406 
407  // Be sure m_LastGridSizeId is up to date.
408  m_frame->SetLastGridSizeId( idx );
409 
410  // Update the combobox (if any)
411  wxUpdateUIEvent dummy;
413 
414  // Update GAL canvas from screen
415  getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
417 
418  // Put cursor on new grid
419  VECTOR2D gridCursor = getViewControls()->GetCursorPosition( true );
420  getViewControls()->SetCrossHairCursorPosition( gridCursor, false );
421  return 0;
422 }
423 
424 
426 {
428 
431  m_frame->GetCanvas()->Refresh();
432 
433  return 0;
434 }
435 
436 
438 {
439  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
440 
441  cmd.SetId( ID_GRID_SETTINGS );
442  m_frame->ProcessEvent( cmd );
443 
444  return 0;
445 }
446 
447 
449 {
451  return 0;
452 }
453 
454 
456 {
458  return 0;
459 }
460 
461 
463 {
467  return 0;
468 }
469 
470 
472 {
473  m_frame->SetStatusText( wxEmptyString );
476 
477  return 0;
478 }
479 
480 
482 {
483  auto vcSettings = m_toolMgr->GetCurrentToolVC();
484 
485  // Use either the active tool forced cursor position or the general settings
486  if( vcSettings.m_forceCursorPosition )
487  m_frame->GetScreen()->m_LocalOrigin = vcSettings.m_forcedPosition;
488  else
490 
492 
493  return 0;
494 }
495 
496 
498 {
499  auto& galOpts = m_frame->GetGalDisplayOptions();
500 
501  galOpts.m_forceDisplayCursor = !galOpts.m_forceDisplayCursor;
502  galOpts.NotifyChanged();
503 
504  return 0;
505 }
506 
507 
509 {
511 
512  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
513  galOpts.NotifyChanged();
514 
515  return 0;
516 }
517 
518 
520 {
521  if( aEvent.IsAction( &ACTIONS::acceleratedGraphics ) )
523  else if( aEvent.IsAction( &ACTIONS::standardGraphics ) )
525  else
526  wxFAIL_MSG( "Unknown canvas type" );
527 
528  return 0;
529 }
530 
531 
533 {
535 
536  // Cursor control
545 
549 
550  // Pan control
551  Go( &COMMON_TOOLS::PanControl, ACTIONS::panUp.MakeEvent() );
555 
556  // Zoom control
558  Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
566 
567  // Grid control
573 
574  // Units and coordinates
580 
581  // Misc
586 }
587 
588 
int MetricUnits(const TOOL_EVENT &aEvent)
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:92
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:279
int ZoomFitScreen(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomPreset
Definition: actions.h:94
static TOOL_ACTION zoomInCenter
Definition: actions.h:90
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
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:475
const VECTOR2D & GetCenter() const
Function GetCenter() Returns the center point of this VIEW (in world space coordinates)
Definition: view.h:328
VIEW_CONTROLS class definition.
int ToggleCursorStyle(const TOOL_EVENT &aEvent)
TOOL_ACTIONS
Definition: tool_event.h:61
virtual bool IsGridVisible() const
void SetShowPolarCoords(bool aShow)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
static TOOL_ACTION cursorRight
Definition: actions.h:111
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
static TOOL_ACTION standardGraphics
Definition: actions.h:159
static TOOL_ACTION cursorRightFast
Definition: actions.h:116
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:286
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Moves cursor to the requested position expressed in world coordinates.
int GridPreset(const TOOL_EVENT &aEvent)
void ChangeUserUnits(EDA_UNITS aUnits)
static TOOL_ACTION panLeft
Definition: actions.h:124
bool m_forceDisplayCursor
Force cursor display
int ResetLocalCoords(const TOOL_EVENT &aEvent)
The base class for create windows for drawing purpose.
void SetMousePosition(const VECTOR2D &aP)
Definition: tool_event.h:468
int doZoomToPreset(int idx, bool aCenterOnCursor)
Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
static TOOL_ACTION imperialUnits
Definition: actions.h:139
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int ImperialUnits(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomOutCenter
Definition: actions.h:91
Auxiliary rendering target (noncached)
Definition: definitions.h:49
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:67
int GridNext(const TOOL_EVENT &aEvent)
int ToggleUnits(const TOOL_EVENT &aEvent)
int ZoomInOutCenter(const TOOL_EVENT &aEvent)
virtual void CenterOnCursor() const =0
Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the curso...
static TOOL_ACTION centerContents
Definition: actions.h:96
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
static TOOL_ACTION toggleCursor
Definition: actions.h:97
static TOOL_ACTION gridPreset
Definition: actions.h:134
double GetZoomLevelCoeff() const
Return the coefficient to convert internal display scale factor to zoom level.
static TOOL_ACTION gridPrev
Definition: actions.h:131
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
static TOOL_ACTION panDown
Definition: actions.h:123
std::vector< GRID_TYPE > GRIDS
Definition: base_screen.h:67
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
int GridPrev(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleGrid
Definition: actions.h:135
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:74
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
coord_type GetWidth() const
Definition: box2.h:196
double GetLegacyZoom() const
Function GetLegacyZoom() Returns current view scale converted to zoom value used by the legacy canvas...
TOOL_EVENT.
Definition: tool_event.h:171
static TOOL_ACTION cursorUpFast
Definition: actions.h:113
static TOOL_ACTION cursorDownFast
Definition: actions.h:114
static TOOL_ACTION cursorLeft
Definition: actions.h:110
static TOOL_ACTION panRight
Definition: actions.h:125
int ZoomCenter(const TOOL_EVENT &aEvent)
const GRIDS & GetGrids() const
Function GetGrids().
Definition: base_screen.h:339
const KIGFX::VC_SETTINGS & GetCurrentToolVC() const
Returns the view controls settings for the current tool or the general settings if there is no active...
static TOOL_ACTION togglePolarCoords
Definition: actions.h:142
int ToggleGrid(const TOOL_EVENT &aEvent)
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
int ZoomInOut(const TOOL_EVENT &aEvent)
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
static TOOL_ACTION cursorLeftFast
Definition: actions.h:115
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
int CursorControl(const TOOL_EVENT &aEvent)
int ToggleCursor(const TOOL_EVENT &aEvent)
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
int SwitchCanvas(const TOOL_EVENT &aEvent)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void HardRedraw()
Rebuild the GAL and redraws the screen.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void setTransitions() override
Sets up handlers for various events.
bool IsMirroredX() const
Function IsMirroredX() Returns true if view is flipped across the X axis.
Definition: view.h:230
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
TOOL_MOUSE_BUTTONS
Definition: tool_event.h:124
int CenterContents(const TOOL_EVENT &aEvent)
static TOOL_ACTION metricUnits
Definition: actions.h:140
int SelectionTool(const TOOL_EVENT &aEvent)
const int scale
bool GridExists(int aCommandId)
Function GridExists tests for grid command ID (not an index in grid list, but a wxID) exists in grid ...
virtual VECTOR2D GetRawCursorPosition(bool aSnappingEnabled=true) const =0
Returns the current cursor position in world coordinates - ingoring the cursorUp position force mode.
bool GetShowPolarCoords() const
For those frames that support polar coordinates.
bool IsType(FRAME_T aType) const
Vec Centre() const
Definition: box2.h:78
static TOOL_ACTION zoomCenter
Definition: actions.h:92
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
GRID_TYPE is for grid arrays.
Definition: base_screen.h:43
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
static TOOL_ACTION cursorUp
Cursor control with keyboard.
Definition: actions.h:108
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
static OPT< int > getNextPreviousGrid(const BASE_SCREEN &aScreen, int aOffset)
Advance a BASE_SCREEN's grid forwards or backwards by the given offset and return the cmd ID of that ...
static TOOL_ACTION cursorDblClick
Definition: actions.h:119
int ZoomPreset(const TOOL_EVENT &aEvent)
static TOOL_ACTION acceleratedGraphics
Definition: actions.h:158
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
void SetLastGridSizeId(int aId)
static TOOL_ACTION resetLocalCoords
Definition: actions.h:143
coord_type GetHeight() const
Definition: box2.h:197
static TOOL_ACTION gridNext
Definition: actions.h:130
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:78
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
boost::optional< T > OPT
Definition: optional.h:7
static TOOL_ACTION gridProperties
Definition: actions.h:136
ACTIONS.
Definition: actions.h:43
static TOOL_ACTION panUp
Definition: actions.h:122
static TOOL_ACTION zoomIn
Definition: actions.h:88
static TOOL_ACTION zoomOut
Definition: actions.h:89
int TogglePolarCoords(const TOOL_EVENT &aEvent)
virtual void SetGridVisibility(bool aVisible)
const Vec & GetSize() const
Definition: box2.h:188
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:98
void UpdateStatusBar() override
Update the status bar information.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
VIEW.
Definition: view.h:61
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
double GetScale() const
Function GetScale()
Definition: view.h:257
int m_CmdId
Definition: base_screen.h:46
BASE_SCREEN class implementation.
static TOOL_ACTION showContextMenu
Definition: actions.h:66
static TOOL_ACTION cursorDown
Definition: actions.h:109
int PanControl(const TOOL_EVENT &aEvent)
int ZoomRedraw(const TOOL_EVENT &aEvent)
virtual BOX2I GetDefaultViewBBox() const
Returns the bounding box of the view that should be used if model is not valid For example,...
static TOOL_ACTION toggleUnits
Definition: actions.h:141
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool m_fullscreenCursor
Fullscreen crosshair or small cross
bool ProcessEvent(wxEvent &aEvent) override
Override the default process event handler to implement the auto save feature.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
int GridProperties(const TOOL_EVENT &aEvent)
static TOOL_ACTION selectionTool
Definition: actions.h:146
static TOOL_ACTION refreshPreview
Definition: actions.h:101
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:118
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:138
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:114
virtual const BOX2I GetDocumentExtents() const