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  * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Maciej Suminski <maciej.suminski@cern.ch>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <bitmaps.h>
27 #include <tool/actions.h>
28 #include <tool/tool_manager.h>
29 #include <eda_draw_frame.h>
30 #include <class_draw_panel_gal.h>
31 #include <view/view.h>
32 #include <view/view_controls.h>
34 #include <settings/app_settings.h>
35 #include <base_screen.h>
36 #include <tool/common_tools.h>
37 #include <id.h>
38 #include <project.h>
39 #include <kiface_i.h>
40 #include <dialog_configure_paths.h>
41 #include <base_units.h>
42 
43 
45 {
46  m_frame = getEditFrame<EDA_DRAW_FRAME>();
47 
49 
50  m_grids.clear();
51 
52  for( const wxString& gridDef : settings.sizes )
53  {
54  int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef, true );
55  m_grids.emplace_back( gridSize, gridSize );
56  }
57 
58  m_grids.emplace_back( ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_x, true ),
60 
61  OnGridChanged();
62 }
63 
64 
66 {
67  // Since selection tools are run permanently underneath the toolStack, this is really
68  // just a cancel of whatever other tools might be running.
69 
71  return 0;
72 }
73 
74 
75 // Cursor control
77 {
78  long type = aEvent.Parameter<intptr_t>();
79  bool fastMove = type & ACTIONS::CURSOR_FAST_MOVE;
80  type &= ~ACTIONS::CURSOR_FAST_MOVE;
81  bool mirroredX = getView()->IsMirroredX();
82 
83  VECTOR2D cursor = getViewControls()->GetRawCursorPosition( false );
84  VECTOR2D gridSize = getView()->GetGAL()->GetGridSize();
85 
86  if( fastMove )
87  gridSize = gridSize * 10;
88 
89  switch( type )
90  {
91  case ACTIONS::CURSOR_UP:
92  cursor -= VECTOR2D( 0, gridSize.y );
93  break;
94 
96  cursor += VECTOR2D( 0, gridSize.y );
97  break;
98 
100  cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
101  break;
102 
104  cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
105  break;
106 
107  case ACTIONS::CURSOR_CLICK: // fall through
110  {
111  TOOL_ACTIONS action = TA_MOUSE_CLICK;
112  TOOL_MOUSE_BUTTONS button = BUT_LEFT;
113  int modifiers = 0;
114 
115  modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
116  modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
117  modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
118 
119  if( type == ACTIONS::CURSOR_DBL_CLICK )
120  action = TA_MOUSE_DBLCLICK;
121 
122  if( type == ACTIONS::CURSOR_RIGHT_CLICK )
123  button = BUT_RIGHT;
124 
125  TOOL_EVENT evt( TC_MOUSE, action, button | modifiers );
126  evt.SetMousePosition( getViewControls()->GetCursorPosition() );
127  m_toolMgr->ProcessEvent( evt );
128 
129  return 0;
130  }
131  default:
132  wxFAIL_MSG( "CursorControl(): unexpected request" );
133  }
134 
135  getViewControls()->SetCursorPosition( cursor, true, true, type );
137 
138  return 0;
139 }
140 
141 
143 {
144  long type = aEvent.Parameter<intptr_t>();
145  KIGFX::VIEW* view = getView();
146  VECTOR2D center = view->GetCenter();
147  VECTOR2D gridSize = getView()->GetGAL()->GetGridSize() * 10;
148  bool mirroredX = view->IsMirroredX();
149 
150  switch( type )
151  {
152  case ACTIONS::CURSOR_UP:
153  center -= VECTOR2D( 0, gridSize.y );
154  break;
155 
157  center += VECTOR2D( 0, gridSize.y );
158  break;
159 
161  center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
162  break;
163 
165  center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
166  break;
167 
168  default:
169  wxFAIL;
170  break;
171  }
172 
173  view->SetCenter( center );
174 
175  return 0;
176 }
177 
178 
180 {
181  m_frame->HardRedraw();
182  return 0;
183 }
184 
185 
187 {
188  bool direction = aEvent.IsAction( &ACTIONS::zoomIn );
189  return doZoomInOut( direction, true );
190 }
191 
192 
194 {
195  bool direction = aEvent.IsAction( &ACTIONS::zoomInCenter );
196  return doZoomInOut( direction, false );
197 }
198 
199 
200 int COMMON_TOOLS::doZoomInOut( bool aDirection, bool aCenterOnCursor )
201 {
202  double zoom = getView()->GetGAL()->GetZoomFactor() / ZOOM_COEFF;
203 
204  // Step must be AT LEAST 1.3
205  if( aDirection )
206  zoom *= 1.3;
207  else
208  zoom /= 1.3;
209 
210  // Now look for the next closest menu step
211  std::vector<double>& zoomList = m_toolMgr->GetSettings()->m_Window.zoom_factors;
212  int idx;
213 
214  if( aDirection )
215  {
216  for( idx = 0; idx < int( zoomList.size() ); ++idx )
217  {
218  if( zoomList[idx] >= zoom )
219  break;
220  }
221 
222  if( idx >= int( zoomList.size() ) )
223  idx = (int) zoomList.size() - 1; // if we ran off the end then peg to the end
224  }
225  else
226  {
227  for( idx = int( zoomList.size() ) - 1; idx >= 0; --idx )
228  {
229  if( zoomList[idx] <= zoom )
230  break;
231  }
232 
233  if( idx < 0 )
234  idx = 0; // if we ran off the end then peg to the end
235  }
236 
237  return doZoomToPreset( idx + 1, aCenterOnCursor );
238 }
239 
240 
242 {
244 
245  ctls->CenterOnCursor();
246 
247  return 0;
248 }
249 
250 
252 {
253  KIGFX::VIEW* view = getView();
254  EDA_DRAW_PANEL_GAL* canvas = m_frame->GetCanvas();
255  EDA_DRAW_FRAME* frame = getEditFrame<EDA_DRAW_FRAME>();
256 
257  BOX2I bBox = frame->GetDocumentExtents();
258  BOX2I defaultBox = canvas->GetDefaultViewBBox();
259  VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() );
260 
261  view->SetScale( 1.0 ); // the best scale will be fixed later, from this initial value
262  // but this call ensure all view parameters are up to date
263  // especially at init time
264  VECTOR2D screenSize = view->ToWorld( canvas->GetClientSize(), false );
265 
266  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
267  bBox = defaultBox;
268 
269  VECTOR2D vsize = bBox.GetSize();
270  double scale = view->GetScale() / std::max( fabs( vsize.x / screenSize.x ),
271  fabs( vsize.y / screenSize.y ) );
272 
273  // Reserve a 10% margin around component bounding box.
274  double margin_scale_factor = 1.1;
275 
276  // Leave a bigger margin for library editors & viewers
278  || frame->IsType( FRAME_SCH_VIEWER ) || frame->IsType( FRAME_SCH_VIEWER_MODAL ) )
279  {
280  margin_scale_factor = 1.4;
281  }
282  else if( frame->IsType( FRAME_SCH_LIB_EDITOR ) || frame->IsType( FRAME_FOOTPRINT_EDITOR ) )
283  {
284  margin_scale_factor = 2;
285  }
286 
287  view->SetScale( scale / margin_scale_factor );
288  view->SetCenter( bBox.Centre() );
289 
290  // Take scrollbars into account
291  VECTOR2D worldScrollbarSize = view->ToWorld( scrollbarSize, false );
292  view->SetCenter( view->GetCenter() + worldScrollbarSize / 2.0 );
293 
294  return 0;
295 }
296 
297 
299 {
300  EDA_DRAW_PANEL_GAL* canvas = m_frame->GetCanvas();
301  BOX2I bBox = getModel<EDA_ITEM>()->ViewBBox();
302 
303  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
304  bBox = canvas->GetDefaultViewBBox();
305 
306  getView()->SetCenter( bBox.Centre() );
307 
308  // Take scrollbars into account
309  VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() );
310  VECTOR2D worldScrollbarSize = getView()->ToWorld( scrollbarSize, false );
311  getView()->SetCenter( getView()->GetCenter() + worldScrollbarSize / 2.0 );
312 
313  return 0;
314 }
315 
316 
318 {
319  unsigned int idx = aEvent.Parameter<intptr_t>();
320  return doZoomToPreset( (int) idx, false );
321 }
322 
323 
324 // Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
325 int COMMON_TOOLS::doZoomToPreset( int idx, bool aCenterOnCursor )
326 {
327  std::vector<double>& zoomList = m_toolMgr->GetSettings()->m_Window.zoom_factors;
328 
329  if( idx == 0 ) // Zoom Auto
330  {
332  return ZoomFitScreen( dummy );
333  }
334  else
335  {
336  idx--;
337  }
338 
339  double scale = zoomList[idx] * ZOOM_COEFF;
340 
341  if( aCenterOnCursor )
342  {
343  getView()->SetScale( scale, getViewControls()->GetCursorPosition() );
344 
345  if( getViewControls()->IsCursorWarpingEnabled() )
347  }
348  else
349  {
350  getView()->SetScale( scale );
351  }
352 
353  return 0;
354 }
355 
356 
357 // Grid control
358 int COMMON_TOOLS::GridNext( const TOOL_EVENT& aEvent )
359 {
360  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
361 
362  if( currentGrid + 1 < int( m_grids.size() ) )
363  currentGrid++;
364 
365  return OnGridChanged();
366 }
367 
368 
369 int COMMON_TOOLS::GridPrev( const TOOL_EVENT& aEvent )
370 {
371  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
372 
373  if( currentGrid > 0 )
374  currentGrid--;
375 
376  return OnGridChanged();
377 }
378 
379 
381 {
382  return GridPreset( aEvent.Parameter<intptr_t>() );
383 }
384 
385 
387 {
388  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
389 
390  currentGrid = std::max( 0, std::min( idx, (int) m_grids.size() - 1 ) );
391 
392  return OnGridChanged();
393 }
394 
395 
397 {
398  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
399 
400  currentGrid = std::max( 0, std::min( currentGrid, static_cast<int>( m_grids.size() ) - 1 ) );
401 
402  // Update the combobox (if any)
403  wxUpdateUIEvent dummy;
405 
406  // Update GAL canvas from screen
407  getView()->GetGAL()->SetGridSize( m_grids[ currentGrid ] );
410 
411  // Put cursor on new grid
412  VECTOR2D gridCursor = getViewControls()->GetCursorPosition( true );
413  getViewControls()->SetCrossHairCursorPosition( gridCursor, false );
414 
415  return 0;
416 }
417 
418 
420 {
422 }
423 
424 
426 {
428 }
429 
430 
432 {
434 
435  return 0;
436 }
437 
438 
440 {
441  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
442 
443  cmd.SetId( ID_GRID_SETTINGS );
444  m_frame->ProcessEvent( cmd );
445 
446  return 0;
447 }
448 
449 
451 {
453  return 0;
454 }
455 
456 
458 {
460  return 0;
461 }
462 
463 
465 {
469  return 0;
470 }
471 
472 
474 {
475  m_frame->SetStatusText( wxEmptyString );
478 
479  return 0;
480 }
481 
482 
484 {
485  auto vcSettings = m_toolMgr->GetCurrentToolVC();
486 
487  // Use either the active tool forced cursor position or the general settings
488  if( vcSettings.m_forceCursorPosition )
489  m_frame->GetScreen()->m_LocalOrigin = vcSettings.m_forcedPosition;
490  else
492 
494 
495  return 0;
496 }
497 
498 
500 {
501  auto& galOpts = m_frame->GetGalDisplayOptions();
502 
503  galOpts.m_forceDisplayCursor = !galOpts.m_forceDisplayCursor;
504  galOpts.NotifyChanged();
505 
506  return 0;
507 }
508 
509 
511 {
513 
514  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
515  galOpts.NotifyChanged();
516 
517  return 0;
518 }
519 
520 
522 {
523  if( aEvent.IsAction( &ACTIONS::acceleratedGraphics ) )
525  else if( aEvent.IsAction( &ACTIONS::standardGraphics ) )
527  else
528  wxFAIL_MSG( "Unknown canvas type" );
529 
530  return 0;
531 }
532 
533 
535 {
537 
538  // Cursor control
547 
551 
552  // Pan control
553  Go( &COMMON_TOOLS::PanControl, ACTIONS::panUp.MakeEvent() );
557 
558  // Zoom control
560  Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
568 
569  // Grid control
577 
578  // Units and coordinates
584 
585  // Misc
590 }
591 
592 
int MetricUnits(const TOOL_EVENT &aEvent)
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
int ZoomFitScreen(const TOOL_EVENT &aEvent)
int GridFast1(const TOOL_EVENT &aEvent)
wxString user_grid_y
Definition: app_settings.h:54
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.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
wxString user_grid_x
Definition: app_settings.h:53
Implementation of conversion functions that require both schematic and board internal units.
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:479
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
void SetShowPolarCoords(bool aShow)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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:112
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:140
static TOOL_ACTION standardGraphics
Definition: actions.h:160
static TOOL_ACTION cursorRightFast
Definition: actions.h:117
static TOOL_ACTION gridFast1
Definition: actions.h:129
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
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:125
bool m_forceDisplayCursor
Force cursor display
int ResetLocalCoords(const TOOL_EVENT &aEvent)
The base class for create windows for drawing purpose.
#define ZOOM_COEFF
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:140
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
std::vector< double > zoom_factors
Definition: app_settings.h:79
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 GridFast2(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
static TOOL_ACTION gridFast2
Definition: actions.h:130
std::vector< wxString > sizes
Definition: app_settings.h:52
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:608
static TOOL_ACTION toggleCursor
Definition: actions.h:97
static TOOL_ACTION gridPreset
Definition: actions.h:135
static TOOL_ACTION gridPrev
Definition: actions.h:132
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
static TOOL_ACTION panDown
Definition: actions.h:124
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
int GridPrev(const TOOL_EVENT &aEvent)
bool IsGridVisible() const
static TOOL_ACTION toggleGrid
Definition: actions.h:136
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
GRID_SETTINGS grid
Definition: app_settings.h:82
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
Update the checked item in the grid combobox.
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:197
TOOL_EVENT.
Definition: tool_event.h:171
static TOOL_ACTION cursorUpFast
Definition: actions.h:114
static TOOL_ACTION cursorDownFast
Definition: actions.h:115
static TOOL_ACTION cursorLeft
Definition: actions.h:111
static TOOL_ACTION panRight
Definition: actions.h:126
int ZoomCenter(const TOOL_EVENT &aEvent)
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:143
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)
double GetZoomFactor() const
Get the zoom factor.
static TOOL_ACTION cursorLeftFast
Definition: actions.h:116
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.
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:582
TOOL_MOUSE_BUTTONS
Definition: tool_event.h:124
const VECTOR2D & GetGridSize() const
Returns the grid size.
int CenterContents(const TOOL_EVENT &aEvent)
static TOOL_ACTION metricUnits
Definition: actions.h:141
int SelectionTool(const TOOL_EVENT &aEvent)
std::vector< VECTOR2I > m_grids
Definition: common_tools.h:102
WINDOW_SETTINGS m_Window
Definition: app_settings.h:154
const int scale
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:79
static TOOL_ACTION zoomCenter
Definition: actions.h:92
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
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:109
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
static TOOL_ACTION cursorDblClick
Definition: actions.h:120
int ZoomPreset(const TOOL_EVENT &aEvent)
static TOOL_ACTION acceleratedGraphics
Definition: actions.h:159
static TOOL_ACTION resetLocalCoords
Definition: actions.h:144
coord_type GetHeight() const
Definition: box2.h:198
static TOOL_ACTION gridNext
Definition: actions.h:131
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
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.
static TOOL_ACTION gridProperties
Definition: actions.h:137
ACTIONS.
Definition: actions.h:43
static TOOL_ACTION panUp
Definition: actions.h:123
static TOOL_ACTION zoomIn
Definition: actions.h:88
static TOOL_ACTION zoomOut
Definition: actions.h:89
int TogglePolarCoords(const TOOL_EVENT &aEvent)
const Vec & GetSize() const
Definition: box2.h:189
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
double GetScale() const
Function GetScale()
Definition: view.h:257
BASE_SCREEN class implementation.
static TOOL_ACTION showContextMenu
Definition: actions.h:66
static TOOL_ACTION cursorDown
Definition: actions.h:110
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:142
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
virtual void SetGridVisibility(bool aVisible)
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:147
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, bool aUseMils, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:471
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:293
static TOOL_ACTION refreshPreview
Definition: actions.h:102
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:119
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:62
Common grid settings, available to every frame.
Definition: app_settings.h:49
virtual const BOX2I GetDocumentExtents() const