KiCad PCB EDA Suite
KIGFX::WX_VIEW_CONTROLS Class Reference

An implementation of class VIEW_CONTROLS for wxWidgets library. More...

#include <wx_view_controls.h>

Inheritance diagram for KIGFX::WX_VIEW_CONTROLS:
KIGFX::VIEW_CONTROLS

Public Member Functions

 WX_VIEW_CONTROLS (VIEW *aView, EDA_DRAW_PANEL_GAL *aParentPanel)
 
virtual ~WX_VIEW_CONTROLS ()
 
void onWheel (wxMouseEvent &aEvent)
 Handler functions. More...
 
void onMotion (wxMouseEvent &aEvent)
 
void onButton (wxMouseEvent &aEvent)
 
void onEnter (wxMouseEvent &WXUNUSED(aEvent))
 
void onLeave (wxMouseEvent &WXUNUSED(aEvent))
 
void onTimer (wxTimerEvent &WXUNUSED(aEvent))
 
void onScroll (wxScrollWinEvent &aEvent)
 
void onCaptureLost (wxMouseEvent &WXUNUSED(aEvent))
 
void CaptureCursor (bool aEnabled) override
 Force the cursor to stay within the drawing panel area. More...
 
VECTOR2D GetMousePosition (bool aWorldCoordinates=true) const override
 Return the current mouse pointer position. More...
 
VECTOR2D GetCursorPosition (bool aSnappingEnabled) const override
 < More...
 
VECTOR2D GetRawCursorPosition (bool aSnappingEnabled=true) const override
 Return the current cursor position in world coordinates ignoring the cursorUp position force mode. More...
 
void SetCursorPosition (const VECTOR2D &aPosition, bool warpView, bool aTriggeredByArrows, long aArrowCommand) override
 Move the graphic crosshair cursor to the requested position expressed in world coordinates. More...
 
void SetCrossHairCursorPosition (const VECTOR2D &aPosition, bool aWarpView) override
 
void WarpCursor (const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false) override
 Set the viewport center to the current cursor position and warps the cursor to the screen center. More...
 
void CenterOnCursor () const override
 Adjusts the scrollbars position to match the current viewport. More...
 
void UpdateScrollbars ()
 End any mouse drag action still in progress. More...
 
void CancelDrag ()
 
void ForceCursorPosition (bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0)) override
 Applies VIEW_CONTROLS settings from the program COMMON_SETTINGS. More...
 
void LoadSettings () override
 Event that forces mouse move event in the dispatcher (eg. More...
 
VECTOR2D GetCursorPosition () const
 Return the current cursor position in world coordinates. More...
 
virtual VECTOR2D GetCursorPosition (bool aEnableSnapping) const=0
 Return the current cursor position in world coordinates. More...
 
virtual void SetGrabMouse (bool aEnabled)
 Turn on/off mouse grabbing. More...
 
virtual void SetAutoPan (bool aEnabled)
 Turn on/off auto panning (this feature is used when there is a tool active (eg. More...
 
virtual void EnableAutoPan (bool aEnabled)
 Turn on/off auto panning (user setting to disable it entirely). More...
 
virtual void SetAutoPanSpeed (float aSpeed)
 Set the speed of autopanning. More...
 
virtual void SetAutoPanAcceleration (float aAcceleration)
 Set the speed of autopanning. More...
 
virtual void SetAutoPanMargin (float aMargin)
 Set the margin for autopanning (ie. More...
 
VECTOR2D GetCursorPosition () const
 Return the current cursor position in world coordinates. More...
 
bool ForcedCursorPosition () const
 Return true if the current cursor position is forced to a specific location, ignoring the mouse cursor position. More...
 
virtual void ShowCursor (bool aEnabled)
 Enable or disables display of cursor. More...
 
bool IsCursorShown () const
 Return true when cursor is visible. More...
 
bool IsCursorPositionForced () const
 Return true if the cursor position is set by one of the tools. More...
 
void EnableCursorWarping (bool aEnable)
 Enable or disable warping the cursor. More...
 
bool IsCursorWarpingEnabled () const
 
virtual void Reset ()
 Restore the default VIEW_CONTROLS settings. More...
 
const VC_SETTINGSGetSettings () const
 Apply VIEW_CONTROLS settings from an object. More...
 
void ApplySettings (const VC_SETTINGS &aSettings)
 Load new settings from program common settings. More...
 

Static Public Attributes

static const wxEventType EVT_REFRESH_MOUSE = wxNewEventType()
 

Protected Attributes

VIEWm_view
 < Pointer to controlled VIEW. More...
 
bool m_cursorWarped
 Current VIEW_CONTROLS settings. More...
 
VC_SETTINGS m_settings
 

Private Types

enum  STATE { IDLE = 1, DRAG_PANNING, AUTO_PANNING, DRAG_ZOOMING }
 < Possible states for WX_VIEW_CONTROLS. More...
 

Private Member Functions

bool handleAutoPanning (const wxMouseEvent &aEvent)
 Compute new viewport settings while in autopanning mode. More...
 
void handleCursorCapture (int x, int y)
 Limit the cursor position to within the canvas by warping it. More...
 
void refreshMouse ()
 Send an event to refresh mouse position. More...
 
wxPoint getMouseScreenPosition () const
 Get the cursor position in the screen coordinates. More...
 

Private Attributes

STATE m_state
 Panel that is affected by VIEW_CONTROLS. More...
 
EDA_DRAW_PANEL_GALm_parentPanel
 Store information about point where dragging has started. More...
 
VECTOR2D m_dragStartPoint
 Stores information about the center of viewport when dragging has started. More...
 
VECTOR2D m_lookStartPoint
 Current direction of panning (only autopanning mode). More...
 
VECTOR2D m_panDirection
 Timer responsible for handling autopanning. More...
 
wxTimer m_panTimer
 Ratio used for scaling world coordinates to scrollbar position. More...
 
VECTOR2D m_scrollScale
 Current scrollbar position. More...
 
VECTOR2I m_scrollPos
 The zoom scale when a drag zoom started. More...
 
double m_initialZoomScale
 The mouse position when a drag zoom started. More...
 
VECTOR2D m_zoomStartPoint
 Current cursor position (world coordinates). More...
 
VECTOR2D m_cursorPos
 Flag deciding whether the cursor position should be calculated using the mouse position. More...
 
bool m_updateCursor
 A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific. More...
 
std::unique_ptr< ZOOM_CONTROLLERm_zoomController
 

Detailed Description

An implementation of class VIEW_CONTROLS for wxWidgets library.

Definition at line 51 of file wx_view_controls.h.

Member Enumeration Documentation

◆ STATE

< Possible states for WX_VIEW_CONTROLS.

Enumerator
IDLE 

Nothing is happening.

DRAG_PANNING 

Panning with mouse button pressed.

AUTO_PANNING 

Panning on approaching borders of the frame.

DRAG_ZOOMING 

Zooming with mouse button pressed.

Definition at line 121 of file wx_view_controls.h.

122  {
123  IDLE = 1,
124  DRAG_PANNING,
125  AUTO_PANNING,
126  DRAG_ZOOMING,
127  };
Panning with mouse button pressed.
Zooming with mouse button pressed.
Panning on approaching borders of the frame.

Constructor & Destructor Documentation

◆ WX_VIEW_CONTROLS()

WX_VIEW_CONTROLS::WX_VIEW_CONTROLS ( VIEW aView,
EDA_DRAW_PANEL_GAL aParentPanel 
)

Definition at line 69 of file wx_view_controls.cpp.

69  :
70  VIEW_CONTROLS( aView ),
71  m_state( IDLE ),
72  m_parentPanel( aParentPanel ),
73  m_scrollScale( 1.0, 1.0 ),
74  m_initialZoomScale( 0.0 ),
75 #ifdef __WXGTK3__
76  m_lastTimestamp( 0 ),
77 #endif
78  m_cursorPos( 0, 0 ),
79  m_updateCursor( true )
80 {
81  LoadSettings();
82 
83  m_parentPanel->Connect( wxEVT_MOTION,
84  wxMouseEventHandler( WX_VIEW_CONTROLS::onMotion ), NULL, this );
85 #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
86  m_parentPanel->Connect( wxEVT_MAGNIFY,
87  wxMouseEventHandler( WX_VIEW_CONTROLS::onMagnify ), NULL, this );
88 #endif
89  m_parentPanel->Connect( wxEVT_MOUSEWHEEL,
90  wxMouseEventHandler( WX_VIEW_CONTROLS::onWheel ), NULL, this );
91  m_parentPanel->Connect( wxEVT_MIDDLE_UP,
92  wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
93  m_parentPanel->Connect( wxEVT_MIDDLE_DOWN,
94  wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
95  m_parentPanel->Connect( wxEVT_LEFT_UP,
96  wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
97  m_parentPanel->Connect( wxEVT_LEFT_DOWN,
98  wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
99  m_parentPanel->Connect( wxEVT_RIGHT_UP,
100  wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
101  m_parentPanel->Connect( wxEVT_RIGHT_DOWN,
102  wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
103 #if defined __WXMSW__
104  m_parentPanel->Connect( wxEVT_ENTER_WINDOW,
105  wxMouseEventHandler( WX_VIEW_CONTROLS::onEnter ), NULL, this );
106 #endif
107  m_parentPanel->Connect( wxEVT_LEAVE_WINDOW,
108  wxMouseEventHandler( WX_VIEW_CONTROLS::onLeave ), NULL, this );
109  m_parentPanel->Connect( wxEVT_SCROLLWIN_THUMBTRACK,
110  wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
111  m_parentPanel->Connect( wxEVT_SCROLLWIN_PAGEUP,
112  wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
113  m_parentPanel->Connect( wxEVT_SCROLLWIN_PAGEDOWN,
114  wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
115 
116  m_parentPanel->Connect( wxEVT_SCROLLWIN_BOTTOM,
117  wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
118  m_parentPanel->Connect( wxEVT_SCROLLWIN_TOP,
119  wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
120  m_parentPanel->Connect( wxEVT_SCROLLWIN_LINEUP,
121  wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
122  m_parentPanel->Connect( wxEVT_SCROLLWIN_LINEDOWN,
123  wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
124 #if defined USE_MOUSE_CAPTURE
125  m_parentPanel->Connect( wxEVT_MOUSE_CAPTURE_LOST,
126  wxMouseEventHandler( WX_VIEW_CONTROLS::onCaptureLost ), NULL, this );
127 #endif
128 
129  m_cursorWarped = false;
130 
131  m_panTimer.SetOwner( this );
132  this->Connect( wxEVT_TIMER, wxTimerEventHandler( WX_VIEW_CONTROLS::onTimer ), NULL, this );
133 
137 }
void LoadSettings() override
Event that forces mouse move event in the dispatcher (eg.
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
VIEW_CONTROLS(VIEW *aView)
void onButton(wxMouseEvent &aEvent)
VC_SETTINGS m_settings
VECTOR2D m_scrollScale
Current scrollbar position.
void onCaptureLost(wxMouseEvent &WXUNUSED(aEvent))
VECTOR2D m_lastKeyboardCursorPosition
void onWheel(wxMouseEvent &aEvent)
Handler functions.
#define NULL
bool m_cursorWarped
Current VIEW_CONTROLS settings.
void onMotion(wxMouseEvent &aEvent)
void onTimer(wxTimerEvent &WXUNUSED(aEvent))
long m_lastKeyboardCursorCommand
Position of the above event.
bool m_updateCursor
A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific.
bool m_lastKeyboardCursorPositionValid
ACTIONS::CURSOR_UP, ACTIONS::CURSOR_DOWN, etc.
double m_initialZoomScale
The mouse position when a drag zoom started.
void onEnter(wxMouseEvent &WXUNUSED(aEvent))
STATE m_state
Panel that is affected by VIEW_CONTROLS.
void onScroll(wxScrollWinEvent &aEvent)
void onLeave(wxMouseEvent &WXUNUSED(aEvent))
VECTOR2D m_cursorPos
Flag deciding whether the cursor position should be calculated using the mouse position.
wxTimer m_panTimer
Ratio used for scaling world coordinates to scrollbar position.

References LoadSettings(), KIGFX::VIEW_CONTROLS::m_cursorWarped, KIGFX::VC_SETTINGS::m_lastKeyboardCursorCommand, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPosition, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPositionValid, m_panTimer, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, NULL, onButton(), onCaptureLost(), onEnter(), onLeave(), onMotion(), onScroll(), onTimer(), and onWheel().

◆ ~WX_VIEW_CONTROLS()

WX_VIEW_CONTROLS::~WX_VIEW_CONTROLS ( )
virtual

Definition at line 140 of file wx_view_controls.cpp.

141 {
142 #if defined USE_MOUSE_CAPTURE
143  if( m_parentPanel->HasCapture() )
144  m_parentPanel->ReleaseMouse();
145 #endif
146 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.

References m_parentPanel.

Member Function Documentation

◆ ApplySettings()

void VIEW_CONTROLS::ApplySettings ( const VC_SETTINGS aSettings)
inherited

Load new settings from program common settings.

Definition at line 87 of file view_controls.cpp.

88 {
89  ShowCursor( aSettings.m_showCursor );
90  CaptureCursor( aSettings.m_cursorCaptured );
91  SetGrabMouse( aSettings.m_grabMouse );
92  SetAutoPan( aSettings.m_autoPanEnabled );
93  SetAutoPanMargin( aSettings.m_autoPanMargin );
94  SetAutoPanSpeed( aSettings.m_autoPanSpeed );
96 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
virtual void SetAutoPanSpeed(float aSpeed)
Set the speed of autopanning.
float m_autoPanSpeed
How fast does panning accelerate when approaching the window boundary.
Definition: view_controls.h:79
bool m_grabMouse
Flag for turning on autopanning.
Definition: view_controls.h:67
VECTOR2D m_forcedPosition
Is the forced cursor position enabled.
Definition: view_controls.h:55
virtual void SetAutoPanMargin(float aMargin)
Set the margin for autopanning (ie.
bool m_forceCursorPosition
Should the cursor be locked within the parent window area.
Definition: view_controls.h:58
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
float m_autoPanMargin
How fast is panning when in auto mode.
Definition: view_controls.h:76
bool m_autoPanEnabled
Flag for turning on autopanning.
Definition: view_controls.h:70
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
bool m_showCursor
Forced cursor position (world coordinates).
Definition: view_controls.h:52
virtual void SetGrabMouse(bool aEnabled)
Turn on/off mouse grabbing.
bool m_cursorCaptured
Should the cursor snap to grid or move freely.
Definition: view_controls.h:61

References KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), KIGFX::VC_SETTINGS::m_autoPanEnabled, KIGFX::VC_SETTINGS::m_autoPanMargin, KIGFX::VC_SETTINGS::m_autoPanSpeed, KIGFX::VC_SETTINGS::m_cursorCaptured, KIGFX::VC_SETTINGS::m_forceCursorPosition, KIGFX::VC_SETTINGS::m_forcedPosition, KIGFX::VC_SETTINGS::m_grabMouse, KIGFX::VC_SETTINGS::m_showCursor, KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW_CONTROLS::SetAutoPanMargin(), KIGFX::VIEW_CONTROLS::SetAutoPanSpeed(), KIGFX::VIEW_CONTROLS::SetGrabMouse(), and KIGFX::VIEW_CONTROLS::ShowCursor().

Referenced by TOOL_MANAGER::applyViewControls(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), DIALOG_PAD_PROPERTIES::prepareCanvas(), and KIGFX::VIEW_CONTROLS::Reset().

◆ CancelDrag()

void WX_VIEW_CONTROLS::CancelDrag ( )

Definition at line 623 of file wx_view_controls.cpp.

624 {
626  {
627  m_state = IDLE;
628 #if defined USE_MOUSE_CAPTURE
629  if( !m_settings.m_cursorCaptured && m_parentPanel->HasCapture() )
630  m_parentPanel->ReleaseMouse();
631 #endif
632  }
633 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
Panning with mouse button pressed.
VC_SETTINGS m_settings
Zooming with mouse button pressed.
STATE m_state
Panel that is affected by VIEW_CONTROLS.
bool m_cursorCaptured
Should the cursor snap to grid or move freely.
Definition: view_controls.h:61

References DRAG_PANNING, DRAG_ZOOMING, IDLE, KIGFX::VC_SETTINGS::m_cursorCaptured, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, and m_state.

Referenced by EDA_DRAW_PANEL_GAL::onLostFocus().

◆ CaptureCursor()

void WX_VIEW_CONTROLS::CaptureCursor ( bool  aEnabled)
overridevirtual

Force the cursor to stay within the drawing panel area.

Parameters
aEnableddetermines if the cursor should be captured.Return the current mouse pointer position.
Note
The position may be different from the cursor position if snapping is enabled (
See also
GetCursorPosition()).
Parameters
aWorldCoordinatesif true, the result is given in world coordinates, otherwise it is given in screen coordinates.
Returns
The current mouse pointer position in either world or screen coordinates.

Reimplemented from KIGFX::VIEW_CONTROLS.

Definition at line 596 of file wx_view_controls.cpp.

597 {
598 #if defined USE_MOUSE_CAPTURE
599  // Note: for some reason, m_parentPanel->HasCapture() can be false even if CaptureMouse()
600  // was called (i.e. mouse was captured, so when need to test m_MouseCapturedLost to be
601  // sure a wxEVT_MOUSE_CAPTURE_LOST event was fired before. Otherwise wxMSW complains
602  if( aEnabled && !m_parentPanel->HasCapture() && m_parentPanel->m_MouseCapturedLost )
603  {
604  m_parentPanel->CaptureMouse();
605 
606  // Clear the flag to allow calling m_parentPanel->CaptureMouse()
607  // Calling it without calling ReleaseMouse() is not accepted by wxWidgets (MSW specific)
609  }
610  else if( !aEnabled && m_parentPanel->HasCapture()
612  {
613  m_parentPanel->ReleaseMouse();
614 
615  // Mouse is released, calling CaptureMouse() is allowed now:
617  }
618 #endif
619  VIEW_CONTROLS::CaptureCursor( aEnabled );
620 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
Panning with mouse button pressed.
Zooming with mouse button pressed.
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
bool m_MouseCapturedLost
used on wxMSW: true after a wxEVT_MOUSE_CAPTURE_LOST was received false after the mouse is recaptured...
STATE m_state
Panel that is affected by VIEW_CONTROLS.

References KIGFX::VIEW_CONTROLS::CaptureCursor(), DRAG_PANNING, DRAG_ZOOMING, EDA_DRAW_PANEL_GAL::m_MouseCapturedLost, m_parentPanel, and m_state.

◆ CenterOnCursor()

void WX_VIEW_CONTROLS::CenterOnCursor ( ) const
overridevirtual

Adjusts the scrollbars position to match the current viewport.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 744 of file wx_view_controls.cpp.

745 {
746  const VECTOR2I& screenSize = m_view->GetGAL()->GetScreenPixelSize();
747  VECTOR2I screenCenter( screenSize / 2 );
748 
749  if( GetMousePosition( false ) != screenCenter )
750  {
752  m_parentPanel->WarpPointer( KiROUND( screenSize.x / 2 ), KiROUND( screenSize.y / 2 ) );
753  }
754 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const override
Return the current mouse pointer position.
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:189
VIEW * m_view
< Pointer to controlled VIEW.
const VECTOR2I & GetScreenPixelSize() const
Return GAL canvas size in pixels.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:580
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::VIEW::GetGAL(), GetMousePosition(), KIGFX::GAL::GetScreenPixelSize(), KiROUND(), m_parentPanel, KIGFX::VIEW_CONTROLS::m_view, KIGFX::VIEW::SetCenter(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by onWheel().

◆ EnableAutoPan()

virtual void KIGFX::VIEW_CONTROLS::EnableAutoPan ( bool  aEnabled)
inlinevirtualinherited

Turn on/off auto panning (user setting to disable it entirely).

Parameters
aEnabledtells if the autopanning should be enabled.

Definition at line 166 of file view_controls.h.

167  {
169  }
VC_SETTINGS m_settings
bool m_autoPanSettingEnabled
Distance from cursor to VIEW edge when panning is active.
Definition: view_controls.h:73

References KIGFX::VC_SETTINGS::m_autoPanSettingEnabled, and KIGFX::VIEW_CONTROLS::m_settings.

◆ EnableCursorWarping()

void KIGFX::VIEW_CONTROLS::EnableCursorWarping ( bool  aEnable)
inlineinherited

Enable or disable warping the cursor.

Parameters
aEnableis true if the cursor is allowed to be warped.

Definition at line 340 of file view_controls.h.

341  {
342  m_settings.m_warpCursor = aEnable;
343  }
VC_SETTINGS m_settings
bool m_warpCursor
Enable horizontal panning with the horizontal scroll/trackpad input.
Definition: view_controls.h:85

References KIGFX::VIEW_CONTROLS::m_settings, and KIGFX::VC_SETTINGS::m_warpCursor.

◆ ForceCursorPosition()

void WX_VIEW_CONTROLS::ForceCursorPosition ( bool  aEnabled,
const VECTOR2D aPosition = VECTOR2D( 0, 0 ) 
)
overridevirtual

Applies VIEW_CONTROLS settings from the program COMMON_SETTINGS.

Reimplemented from KIGFX::VIEW_CONTROLS.

Definition at line 930 of file wx_view_controls.cpp.

931 {
933  m_settings.m_forcedPosition = aPosition;
934 }
VC_SETTINGS m_settings
VECTOR2D m_forcedPosition
Is the forced cursor position enabled.
Definition: view_controls.h:55
bool m_forceCursorPosition
Should the cursor be locked within the parent window area.
Definition: view_controls.h:58

References KIGFX::VC_SETTINGS::m_forceCursorPosition, KIGFX::VC_SETTINGS::m_forcedPosition, and KIGFX::VIEW_CONTROLS::m_settings.

◆ ForcedCursorPosition()

bool KIGFX::VIEW_CONTROLS::ForcedCursorPosition ( ) const
inlineinherited

Return true if the current cursor position is forced to a specific location, ignoring the mouse cursor position.

Definition at line 282 of file view_controls.h.

283  {
285  }
VC_SETTINGS m_settings
bool m_forceCursorPosition
Should the cursor be locked within the parent window area.
Definition: view_controls.h:58

References KIGFX::VC_SETTINGS::m_forceCursorPosition, and KIGFX::VIEW_CONTROLS::m_settings.

◆ GetCursorPosition() [1/4]

virtual VECTOR2D KIGFX::VIEW_CONTROLS::GetCursorPosition

Return the current cursor position in world coordinates.

Note
The position may be different from the mouse pointer position if snapping is enabled or cursor position is forced to a specific point.
Parameters
aEnableSnappingselects whether cursor position should be snapped to the grid.
Returns
The current cursor position in world coordinates.

◆ GetCursorPosition() [2/4]

VECTOR2D KIGFX::VIEW_CONTROLS::GetCursorPosition
inline

Return the current cursor position in world coordinates.

Note
The position may be different from the mouse pointer position if snapping is enabled or cursor position is forced to a specific point.
Returns
The current cursor position in world coordinates.

Definition at line 221 of file view_controls.h.

222  {
224  }
bool m_snappingEnabled
Flag for grabbing the mouse cursor.
Definition: view_controls.h:64
VC_SETTINGS m_settings
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

◆ GetCursorPosition() [3/4]

VECTOR2D WX_VIEW_CONTROLS::GetCursorPosition ( bool  aSnappingEnabled) const
overridevirtual

<

Return the current cursor position in world coordinates.

Note
The position may be different from the mouse pointer position if snapping is enabled or cursor position is forced to a specific point.
Returns
The current cursor position in world coordinates. Return the current cursor position in world coordinates ignoring the cursorUp position force mode.
The current cursor position in world coordinates.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 660 of file wx_view_controls.cpp.

661 {
663  {
665  }
666  else
667  {
668  return GetRawCursorPosition( aEnableSnapping );
669  }
670 }
VC_SETTINGS m_settings
VECTOR2D m_forcedPosition
Is the forced cursor position enabled.
Definition: view_controls.h:55
VECTOR2D GetRawCursorPosition(bool aSnappingEnabled=true) const override
Return the current cursor position in world coordinates ignoring the cursorUp position force mode.
bool m_forceCursorPosition
Should the cursor be locked within the parent window area.
Definition: view_controls.h:58

References GetRawCursorPosition(), KIGFX::VC_SETTINGS::m_forceCursorPosition, KIGFX::VC_SETTINGS::m_forcedPosition, and KIGFX::VIEW_CONTROLS::m_settings.

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ GetCursorPosition() [4/4]

VECTOR2D KIGFX::VIEW_CONTROLS::GetCursorPosition ( ) const
inlineinherited

Return the current cursor position in world coordinates.

Note
The position may be different from the mouse pointer position if snapping is enabled or cursor position is forced to a specific point.
Returns
The current cursor position in world coordinates.

Definition at line 221 of file view_controls.h.

222  {
224  }
bool m_snappingEnabled
Flag for grabbing the mouse cursor.
Definition: view_controls.h:64
VC_SETTINGS m_settings
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References KIGFX::VIEW_CONTROLS::m_settings, and KIGFX::VC_SETTINGS::m_snappingEnabled.

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), CenterOnCursor(), ZONE_CREATE_HELPER::createNewZone(), TOOL_MANAGER::DispatchContextMenu(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), PAD_TOOL::EnumeratePads(), TOOL_MANAGER::GetCursorPosition(), SCH_EDITOR_CONTROL::HighlightNet(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), COMMON_TOOLS::OnGridChanged(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::ResetLocalCoords(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), EE_SELECTION_TOOL::SelectNode(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), PNS::TOOL_BASE::updateStartItem(), GERBVIEW_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PL_EDITOR_FRAME::UpdateStatusBar(), and PCB_BASE_FRAME::UpdateStatusBar().

◆ GetMousePosition()

VECTOR2D WX_VIEW_CONTROLS::GetMousePosition ( bool  aWorldCoordinates = true) const
overridevirtual

Return the current mouse pointer position.

Note
The position may be different from the cursor position if snapping is enabled (
See also
GetCursorPosition()).
Parameters
aWorldCoordinatesif true, the result is given in world coordinates, otherwise it is given in screen coordinates.
Returns
The current mouse pointer position in either world or screen coordinates.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 636 of file wx_view_controls.cpp.

637 {
638  wxPoint msp = getMouseScreenPosition();
639  VECTOR2D screenPos( msp.x, msp.y );
640 
641  return aWorldCoordinates ? m_view->ToWorld( screenPos ) : screenPos;
642 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:451
wxPoint getMouseScreenPosition() const
Get the cursor position in the screen coordinates.
Define a general 2D-vector/point.
Definition: vector2d.h:61
VIEW * m_view
< Pointer to controlled VIEW.

References getMouseScreenPosition(), KIGFX::VIEW_CONTROLS::m_view, and KIGFX::VIEW::ToWorld().

Referenced by CenterOnCursor().

◆ getMouseScreenPosition()

wxPoint WX_VIEW_CONTROLS::getMouseScreenPosition ( ) const
private

Get the cursor position in the screen coordinates.

Current state of VIEW_CONTROLS.

Definition at line 887 of file wx_view_controls.cpp.

888 {
889  wxPoint msp = wxGetMousePosition();
890  m_parentPanel->ScreenToClient( &msp.x, &msp.y );
891  return msp;
892 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.

References m_parentPanel.

Referenced by GetMousePosition(), and refreshMouse().

◆ GetRawCursorPosition()

VECTOR2D WX_VIEW_CONTROLS::GetRawCursorPosition ( bool  aSnappingEnabled = true) const
overridevirtual

Return the current cursor position in world coordinates ignoring the cursorUp position force mode.

Returns
The current cursor position in world coordinates.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 645 of file wx_view_controls.cpp.

646 {
647  GAL* gal = m_view->GetGAL();
648 
649  if( aEnableSnapping && gal->GetGridSnapping() )
650  {
651  return gal->GetGridPoint( m_cursorPos );
652  }
653  else
654  {
655  return m_cursorPos;
656  }
657 }
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:189
VIEW * m_view
< Pointer to controlled VIEW.
VECTOR2D GetGridPoint(const VECTOR2D &aPoint) const
For a given point it returns the nearest point belonging to the grid in world coordinates.
bool GetGridSnapping() const
Abstract interface for drawing on a 2D-surface.
VECTOR2D m_cursorPos
Flag deciding whether the cursor position should be calculated using the mouse position.

References KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridPoint(), KIGFX::GAL::GetGridSnapping(), m_cursorPos, and KIGFX::VIEW_CONTROLS::m_view.

Referenced by GetCursorPosition().

◆ GetSettings()

◆ handleAutoPanning()

bool WX_VIEW_CONTROLS::handleAutoPanning ( const wxMouseEvent &  aEvent)
private

Compute new viewport settings while in autopanning mode.

Parameters
aEventis an event to be processed and decide if autopanning should happen.
Returns
true if it is currently autopanning (ie. autopanning is active and mouse cursor is in the area that causes autopanning to happen).

Definition at line 757 of file wx_view_controls.cpp.

758 {
759  VECTOR2I p( aEvent.GetX(), aEvent.GetY() );
761 
763  {
764  // last cursor move event came from keyboard cursor control. If auto-panning is enabled and
765  // the next position is inside the autopan zone, check if it really came from a mouse event, otherwise
766  // disable autopan temporarily. Also temporaly disable autopan if the cursor is in the autopan zone
767  // because the application warped the cursor.
768 
769  m_cursorWarped = false;
770  return true;
771  }
772 
773  m_cursorWarped = false;
774 
775  // Compute areas where autopanning is active
776  int borderStart = std::min( m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().x,
778  borderStart = std::max( borderStart, 2 );
779  int borderEndX = m_view->GetScreenPixelSize().x - borderStart;
780  int borderEndY = m_view->GetScreenPixelSize().y - borderStart;
781 
782  if( p.x < borderStart )
783  m_panDirection.x = -( borderStart - p.x );
784  else if( p.x > borderEndX )
785  m_panDirection.x = ( p.x - borderEndX );
786  else
787  m_panDirection.x = 0;
788 
789  if( p.y < borderStart )
790  m_panDirection.y = -( borderStart - p.y );
791  else if( p.y > borderEndY )
792  m_panDirection.y = ( p.y - borderEndY );
793  else
794  m_panDirection.y = 0;
795 
796  bool borderHit = ( m_panDirection.x != 0 || m_panDirection.y != 0 );
797 
798  switch( m_state )
799  {
800  case AUTO_PANNING:
801  if( !borderHit )
802  {
803  m_panTimer.Stop();
804  m_state = IDLE;
805 
806  return false;
807  }
808 
809  return true;
810  break;
811 
812  case IDLE:
813  if( borderHit )
814  {
816  m_panTimer.Start( (int) ( 250.0 / 60.0 ) );
817 
818  return true;
819  }
820 
821  return false;
822  break;
823 
824  case DRAG_PANNING:
825  case DRAG_ZOOMING:
826  return false;
827  }
828 
829  wxASSERT_MSG( false, wxT( "This line should never be reached" ) );
830  return false; // Should not be reached, just avoid the compiler warnings..
831 }
Panning with mouse button pressed.
VC_SETTINGS m_settings
VIEW * m_view
< Pointer to controlled VIEW.
Zooming with mouse button pressed.
VECTOR2D m_lastKeyboardCursorPosition
Panning on approaching borders of the frame.
const VECTOR2I & GetScreenPixelSize() const
Return the size of the our rendering area in pixels.
Definition: view.cpp:1157
float m_autoPanMargin
How fast is panning when in auto mode.
Definition: view_controls.h:76
bool m_cursorWarped
Current VIEW_CONTROLS settings.
VECTOR2D ToScreen(const VECTOR2D &aCoord, bool aAbsolute=true) const
Convert a world space point/vector to a point/vector in screen space coordinates.
Definition: view.cpp:470
VECTOR2D m_panDirection
Timer responsible for handling autopanning.
bool m_lastKeyboardCursorPositionValid
ACTIONS::CURSOR_UP, ACTIONS::CURSOR_DOWN, etc.
STATE m_state
Panel that is affected by VIEW_CONTROLS.
wxTimer m_panTimer
Ratio used for scaling world coordinates to scrollbar position.

References AUTO_PANNING, DRAG_PANNING, DRAG_ZOOMING, KIGFX::VIEW::GetScreenPixelSize(), IDLE, KIGFX::VC_SETTINGS::m_autoPanMargin, KIGFX::VIEW_CONTROLS::m_cursorWarped, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPosition, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPositionValid, m_panDirection, m_panTimer, KIGFX::VIEW_CONTROLS::m_settings, m_state, KIGFX::VIEW_CONTROLS::m_view, KIGFX::VIEW::ToScreen(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by onMotion().

◆ handleCursorCapture()

void WX_VIEW_CONTROLS::handleCursorCapture ( int  x,
int  y 
)
private

Limit the cursor position to within the canvas by warping it.

Parameters
xMouse position
yMouse position

Definition at line 834 of file wx_view_controls.cpp.

835 {
837  {
838  bool warp = false;
839  wxSize parentSize = m_parentPanel->GetClientSize();
840 
841  if( x < 0 )
842  {
843  x = 0;
844  warp = true;
845  }
846  else if( x >= parentSize.x )
847  {
848  x = parentSize.x - 1;
849  warp = true;
850  }
851 
852  if( y < 0 )
853  {
854  y = 0;
855  warp = true;
856  }
857  else if( y >= parentSize.y )
858  {
859  y = parentSize.y - 1;
860  warp = true;
861  }
862 
863  if( warp )
864  m_parentPanel->WarpPointer( x, y );
865  }
866 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
VC_SETTINGS m_settings
bool m_cursorCaptured
Should the cursor snap to grid or move freely.
Definition: view_controls.h:61

References KIGFX::VC_SETTINGS::m_cursorCaptured, m_parentPanel, and KIGFX::VIEW_CONTROLS::m_settings.

Referenced by onMotion().

◆ IsCursorPositionForced()

bool KIGFX::VIEW_CONTROLS::IsCursorPositionForced ( ) const
inlineinherited

Return true if the cursor position is set by one of the tools.

A forced cursor position means it does not react to mouse movement.

Definition at line 316 of file view_controls.h.

317  {
319  }
VC_SETTINGS m_settings
bool m_forceCursorPosition
Should the cursor be locked within the parent window area.
Definition: view_controls.h:58

References KIGFX::VC_SETTINGS::m_forceCursorPosition, and KIGFX::VIEW_CONTROLS::m_settings.

◆ IsCursorShown()

bool VIEW_CONTROLS::IsCursorShown ( ) const
inherited

Return true when cursor is visible.

Returns
True if cursor is visible.

Definition at line 41 of file view_controls.cpp.

42 {
43  // this only says if the VIEW_CONTROLS say the cursor should be
44  // shown: m_view->GetGAL()->IsCursorEnabled() will say if the GAL is
45  // actually going to do show the cursor or not
46  return m_settings.m_showCursor;
47 }
VC_SETTINGS m_settings
bool m_showCursor
Forced cursor position (world coordinates).
Definition: view_controls.h:52

References KIGFX::VIEW_CONTROLS::m_settings, and KIGFX::VC_SETTINGS::m_showCursor.

◆ IsCursorWarpingEnabled()

bool KIGFX::VIEW_CONTROLS::IsCursorWarpingEnabled ( ) const
inlineinherited
Returns
the current setting for cursor warping.

Definition at line 348 of file view_controls.h.

349  {
350  return m_settings.m_warpCursor;
351  }
VC_SETTINGS m_settings
bool m_warpCursor
Enable horizontal panning with the horizontal scroll/trackpad input.
Definition: view_controls.h:85

References KIGFX::VIEW_CONTROLS::m_settings, and KIGFX::VC_SETTINGS::m_warpCursor.

Referenced by onWheel().

◆ LoadSettings()

void WX_VIEW_CONTROLS::LoadSettings ( )
overridevirtual

Event that forces mouse move event in the dispatcher (eg.

used in autopanning, when mouse cursor does not move in screen coordinates, but does in world coordinates)

Reimplemented from KIGFX::VIEW_CONTROLS.

Definition at line 149 of file wx_view_controls.cpp.

150 {
151  COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
152 
166 
167  m_zoomController.reset();
168 
169  if( cfg->m_Input.zoom_speed_auto )
170  {
172  }
173  else
174  {
175  if( cfg->m_Input.zoom_acceleration )
176  {
178  std::make_unique<ACCELERATING_ZOOM_CONTROLLER>( cfg->m_Input.zoom_speed );
179  }
180  else
181  {
183 
184  m_zoomController = std::make_unique<CONSTANT_ZOOM_CONTROLLER>( scale );
185  }
186  }
187 }
MOUSE_DRAG_ACTION m_dragRight
Is last cursor motion event coming from keyboard arrow cursor motion action.
MOUSE_DRAG_ACTION drag_left
std::unique_ptr< ZOOM_CONTROLLER > m_zoomController
VC_SETTINGS m_settings
static std::unique_ptr< ZOOM_CONTROLLER > GetZoomControllerForPlatform(bool aAcceleration)
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
MOUSE_DRAG_ACTION drag_right
int m_scrollModifierPanH
What modifier key to enable vertical with the (vertical) scroll wheel.
bool m_autoPanSettingEnabled
Distance from cursor to VIEW edge when panning is active.
Definition: view_controls.h:73
MOUSE_DRAG_ACTION m_dragLeft
MOUSE_DRAG_ACTION m_dragMiddle
bool m_zoomSpeedAuto
What modifier key to enable zoom with the (vertical) scroll wheel.
Definition: view_controls.h:97
int m_scrollModifierZoom
What modifier key to enable horizontal pan with the (vertical) scroll wheel.
float m_autoPanAcceleration
If the cursor is allowed to be warped.
Definition: view_controls.h:82
int m_zoomSpeed
When true, ignore zoom_speed and pick a platform-specific default.
Definition: view_controls.h:94
bool m_warpCursor
Enable horizontal panning with the horizontal scroll/trackpad input.
Definition: view_controls.h:85
bool m_horizontalPan
Enable the accelerating zoom controller.
Definition: view_controls.h:88
bool m_zoomAcceleration
Zoom speed for the non-accelerating zoom controller.
Definition: view_controls.h:91
const int scale
static constexpr double MANUAL_SCALE_FACTOR
MOUSE_DRAG_ACTION drag_middle

References COMMON_SETTINGS::INPUT::auto_pan, COMMON_SETTINGS::INPUT::auto_pan_acceleration, COMMON_SETTINGS::INPUT::center_on_zoom, COMMON_SETTINGS::INPUT::drag_left, COMMON_SETTINGS::INPUT::drag_middle, COMMON_SETTINGS::INPUT::drag_right, GetZoomControllerForPlatform(), COMMON_SETTINGS::INPUT::horizontal_pan, KIGFX::VC_SETTINGS::m_autoPanAcceleration, KIGFX::VC_SETTINGS::m_autoPanSettingEnabled, KIGFX::VC_SETTINGS::m_dragLeft, KIGFX::VC_SETTINGS::m_dragMiddle, KIGFX::VC_SETTINGS::m_dragRight, KIGFX::VC_SETTINGS::m_horizontalPan, COMMON_SETTINGS::m_Input, KIGFX::VC_SETTINGS::m_scrollModifierPanH, KIGFX::VC_SETTINGS::m_scrollModifierPanV, KIGFX::VC_SETTINGS::m_scrollModifierZoom, KIGFX::VIEW_CONTROLS::m_settings, KIGFX::VC_SETTINGS::m_warpCursor, KIGFX::VC_SETTINGS::m_zoomAcceleration, m_zoomController, KIGFX::VC_SETTINGS::m_zoomSpeed, KIGFX::VC_SETTINGS::m_zoomSpeedAuto, KIGFX::CONSTANT_ZOOM_CONTROLLER::MANUAL_SCALE_FACTOR, Pgm(), scale, COMMON_SETTINGS::INPUT::scroll_modifier_pan_h, COMMON_SETTINGS::INPUT::scroll_modifier_pan_v, COMMON_SETTINGS::INPUT::scroll_modifier_zoom, COMMON_SETTINGS::INPUT::zoom_acceleration, COMMON_SETTINGS::INPUT::zoom_speed, and COMMON_SETTINGS::INPUT::zoom_speed_auto.

Referenced by WX_VIEW_CONTROLS().

◆ onButton()

void WX_VIEW_CONTROLS::onButton ( wxMouseEvent &  aEvent)

Definition at line 387 of file wx_view_controls.cpp.

388 {
389  switch( m_state )
390  {
391  case IDLE:
392  case AUTO_PANNING:
393  if( ( aEvent.MiddleDown() && m_settings.m_dragMiddle == MOUSE_DRAG_ACTION::PAN ) ||
394  ( aEvent.RightDown() && m_settings.m_dragRight == MOUSE_DRAG_ACTION::PAN ) )
395  {
396  m_dragStartPoint = VECTOR2D( aEvent.GetX(), aEvent.GetY() );
399 #if defined USE_MOUSE_CAPTURE
400  if( !m_parentPanel->HasCapture() )
401  m_parentPanel->CaptureMouse();
402 #endif
403  }
404  else if( ( aEvent.MiddleDown() && m_settings.m_dragMiddle == MOUSE_DRAG_ACTION::ZOOM ) ||
405  ( aEvent.RightDown() && m_settings.m_dragRight == MOUSE_DRAG_ACTION::ZOOM ) )
406  {
407  m_dragStartPoint = VECTOR2D( aEvent.GetX(), aEvent.GetY() );
411 #if defined USE_MOUSE_CAPTURE
412  if( !m_parentPanel->HasCapture() )
413  m_parentPanel->CaptureMouse();
414 #endif
415  }
416 
417  if( aEvent.LeftUp() )
418  m_state = IDLE; // Stop autopanning when user release left mouse button
419 
420  break;
421 
422  case DRAG_ZOOMING:
423  case DRAG_PANNING:
424  if( aEvent.MiddleUp() || aEvent.LeftUp() || aEvent.RightUp() )
425  {
426  m_state = IDLE;
427 #if defined USE_MOUSE_CAPTURE
428  if( !m_settings.m_cursorCaptured && m_parentPanel->HasCapture() )
429  m_parentPanel->ReleaseMouse();
430 #endif
431  }
432 
433  break;
434  }
435 
436  aEvent.Skip();
437 }
VECTOR2D m_lookStartPoint
Current direction of panning (only autopanning mode).
MOUSE_DRAG_ACTION m_dragRight
Is last cursor motion event coming from keyboard arrow cursor motion action.
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
Panning with mouse button pressed.
const VECTOR2D & GetCenter() const
Return the center point of this VIEW (in world space coordinates).
Definition: view.h:333
VC_SETTINGS m_settings
VIEW * m_view
< Pointer to controlled VIEW.
Zooming with mouse button pressed.
Panning on approaching borders of the frame.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
MOUSE_DRAG_ACTION m_dragMiddle
VECTOR2D m_zoomStartPoint
Current cursor position (world coordinates).
double m_initialZoomScale
The mouse position when a drag zoom started.
VECTOR2D m_dragStartPoint
Stores information about the center of viewport when dragging has started.
STATE m_state
Panel that is affected by VIEW_CONTROLS.
double GetScale() const
Definition: view.h:263
bool m_cursorCaptured
Should the cursor snap to grid or move freely.
Definition: view_controls.h:61

References AUTO_PANNING, DRAG_PANNING, DRAG_ZOOMING, KIGFX::VIEW::GetCenter(), KIGFX::VIEW::GetScale(), IDLE, KIGFX::VC_SETTINGS::m_cursorCaptured, KIGFX::VC_SETTINGS::m_dragMiddle, KIGFX::VC_SETTINGS::m_dragRight, m_dragStartPoint, m_initialZoomScale, m_lookStartPoint, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, m_state, KIGFX::VIEW_CONTROLS::m_view, m_zoomStartPoint, PAN, and ZOOM.

Referenced by WX_VIEW_CONTROLS().

◆ onCaptureLost()

void WX_VIEW_CONTROLS::onCaptureLost ( wxMouseEvent &  WXUNUSEDaEvent)

Definition at line 474 of file wx_view_controls.cpp.

475 {
476  // This method must be present to suppress the capture-lost assertion
477 
478  // Set the flag to allow calling m_parentPanel->CaptureMouse()
479  // Nots: One cannot call m_parentPanel->CaptureMouse() twice, thit is not accepted
480  // by wxWidgets (MSW specific) so we need this guard
482 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
bool m_MouseCapturedLost
used on wxMSW: true after a wxEVT_MOUSE_CAPTURE_LOST was received false after the mouse is recaptured...

References EDA_DRAW_PANEL_GAL::m_MouseCapturedLost, and m_parentPanel.

Referenced by WX_VIEW_CONTROLS().

◆ onEnter()

void WX_VIEW_CONTROLS::onEnter ( wxMouseEvent &  WXUNUSEDaEvent)

Definition at line 440 of file wx_view_controls.cpp.

441 {
442  // Avoid stealing focus from text controls
443  // This is particularly important for users using On-Screen-Keyboards
444  // They may move the mouse over the canvas to reach the keyboard
446  {
447  return;
448  }
449 
450 #if defined( _WIN32 )
451  // Win32 transmits mouse move and wheel events to all controls below the mouse regardless of focus
452  // Forcing the focus here will cause the EDA FRAMES to immediately become the top level active window
453  if( m_parentPanel->GetParent() != nullptr )
454  {
455  // this assumes the parent panel's parent is the eda window
456  if( GetForegroundWindow() == m_parentPanel->GetParent()->GetHWND() )
457  {
459  }
460  }
461 #else
463 #endif
464 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
bool IsInputControlFocused()
Checks if a input control has focus.
Definition: ui_common.cpp:137
virtual void SetFocus() override

References KIUI::IsInputControlFocused(), m_parentPanel, and EDA_DRAW_PANEL_GAL::SetFocus().

Referenced by WX_VIEW_CONTROLS().

◆ onLeave()

void WX_VIEW_CONTROLS::onLeave ( wxMouseEvent &  WXUNUSEDaEvent)

Definition at line 467 of file wx_view_controls.cpp.

468 {
469 #if !defined USE_MOUSE_CAPTURE
470  onMotion( aEvent );
471 #endif
472 }
void onMotion(wxMouseEvent &aEvent)

References onMotion().

Referenced by WX_VIEW_CONTROLS().

◆ onMotion()

void WX_VIEW_CONTROLS::onMotion ( wxMouseEvent &  aEvent)

Definition at line 190 of file wx_view_controls.cpp.

191 {
192  bool isAutoPanning = false;
193  int x = aEvent.GetX();
194  int y = aEvent.GetY();
195  VECTOR2D mousePos( x, y );
196 
198  handleCursorCapture( x, y );
199 
201  isAutoPanning = handleAutoPanning( aEvent );
202 
203  if( !isAutoPanning && aEvent.Dragging() )
204  {
205  if( m_state == DRAG_PANNING )
206  {
207  static bool justWarped = false;
208  int warpX = 0;
209  int warpY = 0;
210  wxSize parentSize = m_parentPanel->GetClientSize();
211 
212  if( x < 0 )
213  {
214  warpX = parentSize.x;
215  }
216  else if(x >= parentSize.x )
217  {
218  warpX = -parentSize.x;
219  }
220 
221  if( y < 0 )
222  {
223  warpY = parentSize.y;
224  }
225  else if( y >= parentSize.y )
226  {
227  warpY = -parentSize.y;
228  }
229 
230  if( !justWarped )
231  {
232  VECTOR2D d = m_dragStartPoint - mousePos;
233  VECTOR2D delta = m_view->ToWorld( d, false );
234  m_view->SetCenter( m_lookStartPoint + delta );
235  aEvent.StopPropagation();
236  }
237 
238  if( warpX || warpY )
239  {
240  if( !justWarped )
241  {
242  m_parentPanel->WarpPointer( x + warpX, y + warpY );
243  m_dragStartPoint += VECTOR2D( warpX, warpY );
244  justWarped = true;
245  }
246  else
247  justWarped = false;
248  }
249  else
250  justWarped = false;
251  }
252  else if( m_state == DRAG_ZOOMING )
253  {
254  static bool justWarped = false;
255  int warpY = 0;
256  wxSize parentSize = m_parentPanel->GetClientSize();
257 
258  if( y < 0 )
259  {
260  warpY = parentSize.y;
261  }
262  else if( y >= parentSize.y )
263  {
264  warpY = -parentSize.y;
265  }
266 
267  if( !justWarped )
268  {
269  VECTOR2D d = m_dragStartPoint - mousePos;
270  double scale = exp( d.y * m_settings.m_zoomSpeed * 0.001 );
271 
272  wxLogTrace( traceZoomScroll, wxString::Format( "dy: %f scale: %f", d.y, scale ) );
273 
275  aEvent.StopPropagation();
276  }
277 
278  if( warpY )
279  {
280  if( !justWarped )
281  {
282  m_parentPanel->WarpPointer( x, y + warpY );
283  m_dragStartPoint += VECTOR2D( 0, warpY );
284  justWarped = true;
285  }
286  else
287  justWarped = false;
288  }
289  else
290  justWarped = false;
291  }
292  }
293 
294  if( m_updateCursor ) // do not update the cursor position if it was explicitly set
295  m_cursorPos = m_view->ToWorld( mousePos );
296  else
297  m_updateCursor = true;
298 
299  aEvent.Skip();
300 }
VECTOR2D m_lookStartPoint
Current direction of panning (only autopanning mode).
const wxChar *const traceZoomScroll
Flag to enable debug output of zoom-scrolling calculations in KIGFX::ZOOM_CONTROLLER and derivatives.
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
Panning with mouse button pressed.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:451
Define a general 2D-vector/point.
Definition: vector2d.h:61
VC_SETTINGS m_settings
VIEW * m_view
< Pointer to controlled VIEW.
Zooming with mouse button pressed.
bool m_autoPanSettingEnabled
Distance from cursor to VIEW edge when panning is active.
Definition: view_controls.h:73
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:580
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
int m_zoomSpeed
When true, ignore zoom_speed and pick a platform-specific default.
Definition: view_controls.h:94
bool m_autoPanEnabled
Flag for turning on autopanning.
Definition: view_controls.h:70
void handleCursorCapture(int x, int y)
Limit the cursor position to within the canvas by warping it.
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:554
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
VECTOR2D m_zoomStartPoint
Current cursor position (world coordinates).
const int scale
bool m_updateCursor
A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific.
double m_initialZoomScale
The mouse position when a drag zoom started.
bool handleAutoPanning(const wxMouseEvent &aEvent)
Compute new viewport settings while in autopanning mode.
VECTOR2D m_dragStartPoint
Stores information about the center of viewport when dragging has started.
STATE m_state
Panel that is affected by VIEW_CONTROLS.
VECTOR2D m_cursorPos
Flag deciding whether the cursor position should be calculated using the mouse position.

References DRAG_PANNING, DRAG_ZOOMING, Format(), handleAutoPanning(), handleCursorCapture(), KIGFX::VC_SETTINGS::m_autoPanEnabled, KIGFX::VC_SETTINGS::m_autoPanSettingEnabled, m_cursorPos, m_dragStartPoint, m_initialZoomScale, m_lookStartPoint, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, m_state, m_updateCursor, KIGFX::VIEW_CONTROLS::m_view, KIGFX::VC_SETTINGS::m_zoomSpeed, m_zoomStartPoint, scale, KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::ToWorld(), traceZoomScroll, and VECTOR2< T >::y.

Referenced by onLeave(), and WX_VIEW_CONTROLS().

◆ onScroll()

void WX_VIEW_CONTROLS::onScroll ( wxScrollWinEvent &  aEvent)

Definition at line 534 of file wx_view_controls.cpp.

535 {
536  const double linePanDelta = 0.05;
537  const double pagePanDelta = 0.5;
538 
539  int type = aEvent.GetEventType();
540  int dir = aEvent.GetOrientation();
541 
542  if( type == wxEVT_SCROLLWIN_THUMBTRACK )
543  {
544  auto center = m_view->GetCenter();
545  const auto& boundary = m_view->GetBoundary();
546 
547  // Flip scroll direction in flipped view
548  const double xstart = ( m_view->IsMirroredX() ?
549  boundary.GetRight() : boundary.GetLeft() );
550  const double xdelta = ( m_view->IsMirroredX() ? -1 : 1 );
551 
552  if( dir == wxHORIZONTAL )
553  center.x = xstart + xdelta * ( aEvent.GetPosition() / m_scrollScale.x );
554  else
555  center.y = boundary.GetTop() + aEvent.GetPosition() / m_scrollScale.y;
556 
557  m_view->SetCenter( center );
558  }
559  else
560  {
561  double dist = 0;
562 
563  if( type == wxEVT_SCROLLWIN_PAGEUP )
564  dist = pagePanDelta;
565  else if( type == wxEVT_SCROLLWIN_PAGEDOWN )
566  dist = -pagePanDelta;
567  else if( type == wxEVT_SCROLLWIN_LINEUP )
568  dist = linePanDelta;
569  else if( type == wxEVT_SCROLLWIN_LINEDOWN )
570  dist = -linePanDelta;
571  else
572  {
573  wxASSERT( "Unhandled event type" );
574  return;
575  }
576 
577  VECTOR2D scroll = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) * dist;
578 
579  double scrollX = 0.0;
580  double scrollY = 0.0;
581 
582  if ( dir == wxHORIZONTAL )
583  scrollX = -scroll.x;
584  else
585  scrollY = -scroll.y;
586 
587  VECTOR2D delta( scrollX, scrollY );
588 
589  m_view->SetCenter( m_view->GetCenter() + delta );
590  }
591 
593 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
const BOX2D & GetBoundary() const
Definition: view.h:292
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:451
coord_type GetTop() const
Definition: box2.h:204
const VECTOR2D & GetCenter() const
Return the center point of this VIEW (in world space coordinates).
Definition: view.h:333
Define a general 2D-vector/point.
Definition: vector2d.h:61
VIEW * m_view
< Pointer to controlled VIEW.
VECTOR2D m_scrollScale
Current scrollbar position.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:580
const VECTOR2I & GetScreenPixelSize() const
Return the size of the our rendering area in pixels.
Definition: view.cpp:1157
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...
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:237

References KIGFX::VIEW::GetBoundary(), KIGFX::VIEW::GetCenter(), KIGFX::VIEW::GetScreenPixelSize(), BOX2< Vec >::GetTop(), KIGFX::VIEW::IsMirroredX(), m_parentPanel, m_scrollScale, KIGFX::VIEW_CONTROLS::m_view, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WX_VIEW_CONTROLS().

◆ onTimer()

void WX_VIEW_CONTROLS::onTimer ( wxTimerEvent &  WXUNUSEDaEvent)

Definition at line 484 of file wx_view_controls.cpp.

485 {
486  switch( m_state )
487  {
488  case AUTO_PANNING:
489  {
491  {
492  m_state = IDLE;
493  return;
494  }
495 
496  if( !m_parentPanel->HasFocus() )
497  break;
498 
499  double borderSize = std::min( m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().x,
501 
502  // When the mouse cursor is outside the area with no pan,
503  // m_panDirection is the dist to this area limit ( in pixels )
504  // It will be used also as pan value (the pan speed depends on this dist).
505  VECTOR2D dir( m_panDirection );
506 
507  // When the mouse cursor is outside the area with no pan, the pan value
508  // is accelerated depending on the dist between the area and the cursor
509  float accel = 0.5f + ( m_settings.m_autoPanAcceleration / 5.0f );
510 
511  // For a small mouse cursor dist to area, just use the distance.
512  // But for a dist > borderSize / 2, use an accelerated pan value
513 
514  if( dir.EuclideanNorm() >= borderSize ) // far from area limits
515  dir = dir.Resize( borderSize * accel );
516  else if( dir.EuclideanNorm() > borderSize / 2 ) // Near from area limits
517  dir = dir.Resize( borderSize );
518 
519  dir = m_view->ToWorld( dir, false );
520  m_view->SetCenter( m_view->GetCenter() + dir );
521 
522  refreshMouse();
523  }
524  break;
525 
526  case IDLE: // Just remove unnecessary warnings
527  case DRAG_PANNING:
528  case DRAG_ZOOMING:
529  break;
530  }
531 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
Panning with mouse button pressed.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:451
const VECTOR2D & GetCenter() const
Return the center point of this VIEW (in world space coordinates).
Definition: view.h:333
Define a general 2D-vector/point.
Definition: vector2d.h:61
VC_SETTINGS m_settings
VIEW * m_view
< Pointer to controlled VIEW.
Zooming with mouse button pressed.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:580
Panning on approaching borders of the frame.
float m_autoPanAcceleration
If the cursor is allowed to be warped.
Definition: view_controls.h:82
const VECTOR2I & GetScreenPixelSize() const
Return the size of the our rendering area in pixels.
Definition: view.cpp:1157
float m_autoPanMargin
How fast is panning when in auto mode.
Definition: view_controls.h:76
void refreshMouse()
Send an event to refresh mouse position.
bool m_autoPanEnabled
Flag for turning on autopanning.
Definition: view_controls.h:70
VECTOR2D m_panDirection
Timer responsible for handling autopanning.
STATE m_state
Panel that is affected by VIEW_CONTROLS.

References AUTO_PANNING, DRAG_PANNING, DRAG_ZOOMING, KIGFX::VIEW::GetCenter(), KIGFX::VIEW::GetScreenPixelSize(), IDLE, KIGFX::VC_SETTINGS::m_autoPanAcceleration, KIGFX::VC_SETTINGS::m_autoPanEnabled, KIGFX::VC_SETTINGS::m_autoPanMargin, m_panDirection, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, m_state, KIGFX::VIEW_CONTROLS::m_view, refreshMouse(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WX_VIEW_CONTROLS().

◆ onWheel()

void WX_VIEW_CONTROLS::onWheel ( wxMouseEvent &  aEvent)

Handler functions.

Definition at line 303 of file wx_view_controls.cpp.

304 {
305 #ifdef __WXGTK3__
306  if( aEvent.GetTimestamp() == m_lastTimestamp )
307  {
308  aEvent.Skip( false );
309  return;
310  }
311 
312  m_lastTimestamp = aEvent.GetTimestamp();
313 #endif
314 
315  const double wheelPanSpeed = 0.001;
316  const int axis = aEvent.GetWheelAxis();
317 
318  if( axis == wxMOUSE_WHEEL_HORIZONTAL && !m_settings.m_horizontalPan )
319  return;
320 
321  // Pick the modifier, if any. Shift beats control beats alt, we don't support more than one.
322  int modifiers =
323  aEvent.ShiftDown() ? WXK_SHIFT :
324  ( aEvent.ControlDown() ? WXK_CONTROL : ( aEvent.AltDown() ? WXK_ALT : 0 ) );
325 
326  // Restrict zoom handling to the vertical axis, otherwise horizontal
327  // scrolling events (e.g. touchpads and some mice) end up interpreted
328  // as vertical scroll events and confuse the user.
329  if( axis == wxMOUSE_WHEEL_VERTICAL && modifiers == m_settings.m_scrollModifierZoom )
330  {
331  const int rotation = aEvent.GetWheelRotation();
332  const double zoomScale = m_zoomController->GetScaleForRotation( rotation );
333 
334  if( IsCursorWarpingEnabled() )
335  {
336  CenterOnCursor();
337  m_view->SetScale( m_view->GetScale() * zoomScale );
338  }
339  else
340  {
341  const VECTOR2D anchor = m_view->ToWorld( VECTOR2D( aEvent.GetX(), aEvent.GetY() ) );
342  m_view->SetScale( m_view->GetScale() * zoomScale, anchor );
343  }
344 
345  // Refresh the zoom level and mouse position on message panel
346  // (mouse position has not changed, only the zoom level has changed):
347  refreshMouse();
348  }
349  else
350  {
351  // Scrolling
352  VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
353  ( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
354  double scrollX = 0.0;
355  double scrollY = 0.0;
356 
357  if( axis == wxMOUSE_WHEEL_HORIZONTAL || modifiers == m_settings.m_scrollModifierPanH )
358  scrollX = scrollVec.x;
359  else
360  scrollY = -scrollVec.y;
361 
362  VECTOR2D delta( scrollX, scrollY );
363 
364  m_view->SetCenter( m_view->GetCenter() + delta );
365  refreshMouse();
366  }
367 
368  // Do not skip this event, otherwise wxWidgets will fire
369  // 3 wxEVT_SCROLLWIN_LINEUP or wxEVT_SCROLLWIN_LINEDOWN (normal wxWidgets behavior)
370  // and we do not want that.
372 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:451
const VECTOR2D & GetCenter() const
Return the center point of this VIEW (in world space coordinates).
Definition: view.h:333
std::unique_ptr< ZOOM_CONTROLLER > m_zoomController
Define a general 2D-vector/point.
Definition: vector2d.h:61
VC_SETTINGS m_settings
VIEW * m_view
< Pointer to controlled VIEW.
int m_scrollModifierPanH
What modifier key to enable vertical with the (vertical) scroll wheel.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:580
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
int m_scrollModifierZoom
What modifier key to enable horizontal pan with the (vertical) scroll wheel.
const VECTOR2I & GetScreenPixelSize() const
Return the size of the our rendering area in pixels.
Definition: view.cpp:1157
bool IsCursorWarpingEnabled() const
bool m_horizontalPan
Enable the accelerating zoom controller.
Definition: view_controls.h:88
void refreshMouse()
Send an event to refresh mouse position.
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...
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:554
double GetScale() const
Definition: view.h:263
void CenterOnCursor() const override
Adjusts the scrollbars position to match the current viewport.

References anchor, CenterOnCursor(), KIGFX::VIEW::GetCenter(), KIGFX::VIEW::GetScale(), KIGFX::VIEW::GetScreenPixelSize(), KIGFX::VIEW_CONTROLS::IsCursorWarpingEnabled(), KIGFX::VC_SETTINGS::m_horizontalPan, m_parentPanel, KIGFX::VC_SETTINGS::m_scrollModifierPanH, KIGFX::VC_SETTINGS::m_scrollModifierZoom, KIGFX::VIEW_CONTROLS::m_settings, KIGFX::VIEW_CONTROLS::m_view, m_zoomController, EDA_DRAW_PANEL_GAL::Refresh(), refreshMouse(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WX_VIEW_CONTROLS().

◆ refreshMouse()

void WX_VIEW_CONTROLS::refreshMouse ( )
private

Send an event to refresh mouse position.

It is mostly used for notifying the tools that the cursor position in the world coordinates has changed, whereas the screen coordinates remained the same (e.g. frame edge autopanning).

Definition at line 869 of file wx_view_controls.cpp.

870 {
871  // Notify tools that the cursor position has changed in the world coordinates
872  wxMouseEvent moveEvent( EVT_REFRESH_MOUSE );
873  wxPoint msp = getMouseScreenPosition();
874  moveEvent.SetX( msp.x );
875  moveEvent.SetY( msp.y );
876 
877  // Set the modifiers state
878  moveEvent.SetControlDown( wxGetKeyState( WXK_CONTROL ) );
879  moveEvent.SetShiftDown( wxGetKeyState( WXK_SHIFT ) );
880  moveEvent.SetAltDown( wxGetKeyState( WXK_ALT ) );
881 
882  m_cursorPos = m_view->ToWorld( VECTOR2D( msp.x, msp.y ) );
883  wxPostEvent( m_parentPanel, moveEvent );
884 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
static const wxEventType EVT_REFRESH_MOUSE
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:451
wxPoint getMouseScreenPosition() const
Get the cursor position in the screen coordinates.
VIEW * m_view
< Pointer to controlled VIEW.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
VECTOR2D m_cursorPos
Flag deciding whether the cursor position should be calculated using the mouse position.

References EVT_REFRESH_MOUSE, getMouseScreenPosition(), m_cursorPos, m_parentPanel, KIGFX::VIEW_CONTROLS::m_view, and KIGFX::VIEW::ToWorld().

Referenced by onTimer(), onWheel(), UpdateScrollbars(), and WarpCursor().

◆ Reset()

void VIEW_CONTROLS::Reset ( )
virtualinherited

Restore the default VIEW_CONTROLS settings.

Return the current VIEW_CONTROLS settings.

Definition at line 50 of file view_controls.cpp.

51 {
52  // Get the default settings from the default constructor
55 }
void ApplySettings(const VC_SETTINGS &aSettings)
Load new settings from program common settings.
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape.
Structure to keep VIEW_CONTROLS settings for easy store/restore operations.
Definition: view_controls.h:41

References KIGFX::VIEW_CONTROLS::ApplySettings(), and KIGFX::dummy().

◆ SetAutoPan()

virtual void KIGFX::VIEW_CONTROLS::SetAutoPan ( bool  aEnabled)
inlinevirtualinherited

Turn on/off auto panning (this feature is used when there is a tool active (eg.

drawing a track) and user moves mouse to the VIEW edge - then the view can be translated or not).

Parameters
aEnabledtells if the autopanning should be active.

Definition at line 156 of file view_controls.h.

157  {
158  m_settings.m_autoPanEnabled = aEnabled;
159  }
VC_SETTINGS m_settings
bool m_autoPanEnabled
Flag for turning on autopanning.
Definition: view_controls.h:70

References KIGFX::VC_SETTINGS::m_autoPanEnabled, and KIGFX::VIEW_CONTROLS::m_settings.

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), ROUTER_TOOL::finishInteractive(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PCB_POINT_EDITOR::Reset(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetAutoPanAcceleration()

virtual void KIGFX::VIEW_CONTROLS::SetAutoPanAcceleration ( float  aAcceleration)
inlinevirtualinherited

Set the speed of autopanning.

Parameters
aSpeedis a new speed for autopanning.

Definition at line 186 of file view_controls.h.

187  {
188  m_settings.m_autoPanAcceleration = aAcceleration;
189  }
VC_SETTINGS m_settings
float m_autoPanAcceleration
If the cursor is allowed to be warped.
Definition: view_controls.h:82

References KIGFX::VC_SETTINGS::m_autoPanAcceleration, and KIGFX::VIEW_CONTROLS::m_settings.

◆ SetAutoPanMargin()

virtual void KIGFX::VIEW_CONTROLS::SetAutoPanMargin ( float  aMargin)
inlinevirtualinherited

Set the margin for autopanning (ie.

the area when autopanning becomes active).

Parameters
aMarginis a new margin for autopanning.

Definition at line 196 of file view_controls.h.

197  {
198  m_settings.m_autoPanMargin = aMargin;
199  }
VC_SETTINGS m_settings
float m_autoPanMargin
How fast is panning when in auto mode.
Definition: view_controls.h:76

References KIGFX::VC_SETTINGS::m_autoPanMargin, and KIGFX::VIEW_CONTROLS::m_settings.

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().

◆ SetAutoPanSpeed()

virtual void KIGFX::VIEW_CONTROLS::SetAutoPanSpeed ( float  aSpeed)
inlinevirtualinherited

Set the speed of autopanning.

Parameters
aSpeedis a new speed for autopanning.

Definition at line 176 of file view_controls.h.

177  {
178  m_settings.m_autoPanSpeed = aSpeed;
179  }
float m_autoPanSpeed
How fast does panning accelerate when approaching the window boundary.
Definition: view_controls.h:79
VC_SETTINGS m_settings

References KIGFX::VC_SETTINGS::m_autoPanSpeed, and KIGFX::VIEW_CONTROLS::m_settings.

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().

◆ SetCrossHairCursorPosition()

void WX_VIEW_CONTROLS::SetCrossHairCursorPosition ( const VECTOR2D aPosition,
bool  aWarpView = true 
)
overridevirtual

Implements KIGFX::VIEW_CONTROLS.

Definition at line 698 of file wx_view_controls.cpp.

699 {
700  m_updateCursor = false;
701 
702  const VECTOR2I& screenSize = m_view->GetGAL()->GetScreenPixelSize();
703  BOX2I screen( VECTOR2I( 0, 0 ), screenSize );
704  VECTOR2D screenPos = m_view->ToScreen( aPosition );
705 
706  if( aWarpView && !screen.Contains( screenPos ) )
707  m_view->SetCenter( aPosition );
708 
709  m_cursorPos = aPosition;
710 }
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:189
VIEW * m_view
< Pointer to controlled VIEW.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
const VECTOR2I & GetScreenPixelSize() const
Return GAL canvas size in pixels.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:580
VECTOR2D ToScreen(const VECTOR2D &aCoord, bool aAbsolute=true) const
Convert a world space point/vector to a point/vector in screen space coordinates.
Definition: view.cpp:470
bool m_updateCursor
A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific.
VECTOR2D m_cursorPos
Flag deciding whether the cursor position should be calculated using the mouse position.

References BOX2< Vec >::Contains(), KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetScreenPixelSize(), m_cursorPos, m_updateCursor, KIGFX::VIEW_CONTROLS::m_view, KIGFX::VIEW::SetCenter(), and KIGFX::VIEW::ToScreen().

◆ SetCursorPosition()

void WX_VIEW_CONTROLS::SetCursorPosition ( const VECTOR2D aPosition,
bool  warpView,
bool  aTriggeredByArrows,
long  aArrowCommand 
)
overridevirtual

Move the graphic crosshair cursor to the requested position expressed in world coordinates.

Parameters
aPositionis the requested cursor position in the world coordinates.
aWarpViewenables/disables view warp if the cursor is outside the current viewport.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 673 of file wx_view_controls.cpp.

675 {
676  m_updateCursor = false;
677 
678  if( aTriggeredByArrows )
679  {
682  m_settings.m_lastKeyboardCursorCommand = aArrowCommand;
683  m_cursorWarped = false;
684  }
685  else
686  {
690  m_cursorWarped = true;
691  }
692 
693  WarpCursor( aPosition, true, aWarpView );
694  m_cursorPos = aPosition;
695 }
VC_SETTINGS m_settings
VECTOR2D m_lastKeyboardCursorPosition
bool m_cursorWarped
Current VIEW_CONTROLS settings.
void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false) override
Set the viewport center to the current cursor position and warps the cursor to the screen center.
long m_lastKeyboardCursorCommand
Position of the above event.
bool m_updateCursor
A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific.
bool m_lastKeyboardCursorPositionValid
ACTIONS::CURSOR_UP, ACTIONS::CURSOR_DOWN, etc.
VECTOR2D m_cursorPos
Flag deciding whether the cursor position should be calculated using the mouse position.

References m_cursorPos, KIGFX::VIEW_CONTROLS::m_cursorWarped, KIGFX::VC_SETTINGS::m_lastKeyboardCursorCommand, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPosition, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPositionValid, KIGFX::VIEW_CONTROLS::m_settings, m_updateCursor, and WarpCursor().

◆ SetGrabMouse()

virtual void KIGFX::VIEW_CONTROLS::SetGrabMouse ( bool  aEnabled)
inlinevirtualinherited

Turn on/off mouse grabbing.

When the mouse is grabbed, it cannot go outside the VIEW.

Parameters
aEnabledtells if mouse should be grabbed or not.

Definition at line 145 of file view_controls.h.

146  {
147  m_settings.m_grabMouse = aEnabled;
148  }
bool m_grabMouse
Flag for turning on autopanning.
Definition: view_controls.h:67
VC_SETTINGS m_settings

References KIGFX::VC_SETTINGS::m_grabMouse, and KIGFX::VIEW_CONTROLS::m_settings.

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().

◆ ShowCursor()

void VIEW_CONTROLS::ShowCursor ( bool  aEnabled)
virtualinherited

Enable or disables display of cursor.

Parameters
aEnableddecides if the cursor should be shown.

Definition at line 34 of file view_controls.cpp.

35 {
36  m_settings.m_showCursor = aEnabled;
37  m_view->GetGAL()->SetCursorEnabled( aEnabled );
38 }
void SetCursorEnabled(bool aCursorEnabled)
Enable/disable cursor.
VC_SETTINGS m_settings
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:189
VIEW * m_view
< Pointer to controlled VIEW.
bool m_showCursor
Forced cursor position (world coordinates).
Definition: view_controls.h:52

References KIGFX::VIEW::GetGAL(), KIGFX::VIEW_CONTROLS::m_settings, KIGFX::VC_SETTINGS::m_showCursor, KIGFX::VIEW_CONTROLS::m_view, and KIGFX::GAL::SetCursorEnabled().

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ UpdateScrollbars()

void WX_VIEW_CONTROLS::UpdateScrollbars ( )

End any mouse drag action still in progress.

Definition at line 895 of file wx_view_controls.cpp.

896 {
897  const BOX2D viewport = m_view->GetViewport();
898  const BOX2D& boundary = m_view->GetBoundary();
899 
900  m_scrollScale.x = 2e3 / viewport.GetWidth(); // TODO it does not have to be updated so often
901  m_scrollScale.y = 2e3 / viewport.GetHeight();
902  VECTOR2I newScroll( ( viewport.Centre().x - boundary.GetLeft() ) * m_scrollScale.x,
903  ( viewport.Centre().y - boundary.GetTop() ) * m_scrollScale.y );
904 
905  // We add the width of the scroll bar thumb to the range because the scroll range is given by
906  // the full bar while the position is given by the left/top position of the thumb
907  VECTOR2I newRange( m_scrollScale.x * boundary.GetWidth() + m_parentPanel->GetScrollThumb( wxSB_HORIZONTAL ),
908  m_scrollScale.y * boundary.GetHeight() + m_parentPanel->GetScrollThumb( wxSB_VERTICAL ) );
909 
910  // Flip scroll direction in flipped view
911  if( m_view->IsMirroredX() )
912  newScroll.x = ( boundary.GetRight() - viewport.Centre().x ) * m_scrollScale.x;
913 
914  // Adjust scrollbars only if it is needed. Otherwise there are cases when canvas is continuously
915  // refreshed (Windows)
916  if( m_scrollPos != newScroll || newRange.x != m_parentPanel->GetScrollRange( wxSB_HORIZONTAL )
917  || newRange.y != m_parentPanel->GetScrollRange( wxSB_VERTICAL ) )
918  {
919  m_parentPanel->SetScrollbars( 1, 1, newRange.x, newRange.y, newScroll.x, newScroll.y, true );
920  m_scrollPos = newScroll;
921 
922 #if !defined( __APPLE__ ) && !defined( WIN32 )
923  // Trigger a mouse refresh to get the canvas update in GTK (re-draws the scrollbars).
924  // Note that this causes an infinite loop on OSX and Windows (in certain cases) as it generates a paint event.
925  refreshMouse();
926 #endif
927  }
928 }
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:514
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
const BOX2D & GetBoundary() const
Definition: view.h:292
coord_type GetTop() const
Definition: box2.h:204
coord_type GetRight() const
Definition: box2.h:199
VIEW * m_view
< Pointer to controlled VIEW.
VECTOR2D m_scrollScale
Current scrollbar position.
coord_type GetWidth() const
Definition: box2.h:197
void refreshMouse()
Send an event to refresh mouse position.
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:237
Vec Centre() const
Definition: box2.h:79
VECTOR2I m_scrollPos
The zoom scale when a drag zoom started.
coord_type GetHeight() const
Definition: box2.h:198
coord_type GetLeft() const
Definition: box2.h:203

References BOX2< Vec >::Centre(), KIGFX::VIEW::GetBoundary(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), KIGFX::VIEW::GetViewport(), BOX2< Vec >::GetWidth(), KIGFX::VIEW::IsMirroredX(), m_parentPanel, m_scrollPos, m_scrollScale, KIGFX::VIEW_CONTROLS::m_view, refreshMouse(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ WarpCursor()

void WX_VIEW_CONTROLS::WarpCursor ( const VECTOR2D aPosition,
bool  aWorldCoordinates = false,
bool  aWarpView = false 
)
overridevirtual

Set the viewport center to the current cursor position and warps the cursor to the screen center.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 713 of file wx_view_controls.cpp.

715 {
716  if( aWorldCoordinates )
717  {
718  const VECTOR2I& screenSize = m_view->GetGAL()->GetScreenPixelSize();
719  BOX2I screen( VECTOR2I( 0, 0 ), screenSize );
720  VECTOR2D screenPos = m_view->ToScreen( aPosition );
721 
722  if( !screen.Contains( screenPos ) )
723  {
724  if( aWarpView )
725  {
726  m_view->SetCenter( aPosition );
727  m_parentPanel->WarpPointer( screenSize.x / 2, screenSize.y / 2 );
728  }
729  }
730  else
731  {
732  m_parentPanel->WarpPointer( screenPos.x, screenPos.y );
733  }
734  }
735  else
736  {
737  m_parentPanel->WarpPointer( aPosition.x, aPosition.y );
738  }
739 
740  refreshMouse();
741 }
EDA_DRAW_PANEL_GAL * m_parentPanel
Store information about point where dragging has started.
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:189
VIEW * m_view
< Pointer to controlled VIEW.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
const VECTOR2I & GetScreenPixelSize() const
Return GAL canvas size in pixels.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:580
void refreshMouse()
Send an event to refresh mouse position.
VECTOR2D ToScreen(const VECTOR2D &aCoord, bool aAbsolute=true) const
Convert a world space point/vector to a point/vector in screen space coordinates.
Definition: view.cpp:470

References BOX2< Vec >::Contains(), KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetScreenPixelSize(), m_parentPanel, KIGFX::VIEW_CONTROLS::m_view, refreshMouse(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::ToScreen(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SetCursorPosition().

Member Data Documentation

◆ EVT_REFRESH_MOUSE

const wxEventType WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE = wxNewEventType()
static

◆ m_cursorPos

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_cursorPos
private

Flag deciding whether the cursor position should be calculated using the mouse position.

Definition at line 196 of file wx_view_controls.h.

Referenced by GetRawCursorPosition(), onMotion(), refreshMouse(), SetCrossHairCursorPosition(), and SetCursorPosition().

◆ m_cursorWarped

bool KIGFX::VIEW_CONTROLS::m_cursorWarped
protectedinherited

Current VIEW_CONTROLS settings.

Definition at line 381 of file view_controls.h.

Referenced by handleAutoPanning(), SetCursorPosition(), and WX_VIEW_CONTROLS().

◆ m_dragStartPoint

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_dragStartPoint
private

Stores information about the center of viewport when dragging has started.

Definition at line 167 of file wx_view_controls.h.

Referenced by onButton(), and onMotion().

◆ m_initialZoomScale

double KIGFX::WX_VIEW_CONTROLS::m_initialZoomScale
private

The mouse position when a drag zoom started.

Definition at line 185 of file wx_view_controls.h.

Referenced by onButton(), and onMotion().

◆ m_lookStartPoint

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_lookStartPoint
private

Current direction of panning (only autopanning mode).

Definition at line 170 of file wx_view_controls.h.

Referenced by onButton(), and onMotion().

◆ m_panDirection

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_panDirection
private

Timer responsible for handling autopanning.

Definition at line 173 of file wx_view_controls.h.

Referenced by handleAutoPanning(), and onTimer().

◆ m_panTimer

wxTimer KIGFX::WX_VIEW_CONTROLS::m_panTimer
private

Ratio used for scaling world coordinates to scrollbar position.

Definition at line 176 of file wx_view_controls.h.

Referenced by handleAutoPanning(), and WX_VIEW_CONTROLS().

◆ m_parentPanel

EDA_DRAW_PANEL_GAL* KIGFX::WX_VIEW_CONTROLS::m_parentPanel
private

◆ m_scrollPos

VECTOR2I KIGFX::WX_VIEW_CONTROLS::m_scrollPos
private

The zoom scale when a drag zoom started.

Definition at line 182 of file wx_view_controls.h.

Referenced by UpdateScrollbars().

◆ m_scrollScale

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_scrollScale
private

Current scrollbar position.

Definition at line 179 of file wx_view_controls.h.

Referenced by onScroll(), and UpdateScrollbars().

◆ m_settings

◆ m_state

STATE KIGFX::WX_VIEW_CONTROLS::m_state
private

Panel that is affected by VIEW_CONTROLS.

Definition at line 161 of file wx_view_controls.h.

Referenced by CancelDrag(), CaptureCursor(), handleAutoPanning(), onButton(), onMotion(), and onTimer().

◆ m_updateCursor

bool KIGFX::WX_VIEW_CONTROLS::m_updateCursor
private

A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific.

Definition at line 199 of file wx_view_controls.h.

Referenced by onMotion(), SetCrossHairCursorPosition(), and SetCursorPosition().

◆ m_view

VIEW* KIGFX::VIEW_CONTROLS::m_view
protectedinherited

◆ m_zoomController

std::unique_ptr<ZOOM_CONTROLLER> KIGFX::WX_VIEW_CONTROLS::m_zoomController
private

Definition at line 202 of file wx_view_controls.h.

Referenced by LoadSettings(), and onWheel().

◆ m_zoomStartPoint

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_zoomStartPoint
private

Current cursor position (world coordinates).

Definition at line 188 of file wx_view_controls.h.

Referenced by onButton(), and onMotion().


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