29#ifndef __VIEW_CONTROLS_H
30#define __VIEW_CONTROLS_H
138 m_view( aView ), m_cursorWarped( false )
154 m_settings.m_grabMouse = aEnabled;
165 m_settings.m_autoPanEnabled = aEnabled;
175 m_settings.m_autoPanSettingEnabled = aEnabled;
185 m_settings.m_autoPanSpeed = aSpeed;
195 m_settings.m_autoPanAcceleration = aAcceleration;
205 m_settings.m_autoPanMargin = aMargin;
236 return GetCursorPosition( m_settings.m_snappingEnabled );
270 m_settings.m_forceCursorPosition = aEnabled;
271 m_settings.m_forcedPosition = aPosition;
286 bool aTriggeredByArrows =
false,
long aArrowCommand = 0 ) = 0;
304 virtual void ShowCursor(
bool aEnabled );
311 bool IsCursorShown()
const;
320 m_settings.m_cursorCaptured = aEnabled;
337 bool aWarpView =
false ) = 0;
346 m_settings.m_warpCursor = aEnable;
354 return m_settings.m_warpCursor;
366 virtual void Reset();
375 void ApplySettings(
const VC_SETTINGS& aSettings );
An interface for classes handling user events controlling the view behavior such as zooming,...
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.
bool m_cursorWarped
Current VIEW_CONTROLS settings.
virtual void SetAutoPanMargin(float aMargin)
Set the margin for autopanning (ie.
virtual void EnableAutoPan(bool aEnabled)
Turn on/off auto panning (user setting to disable it entirely).
virtual VECTOR2D GetRawCursorPosition(bool aSnappingEnabled=true) const =0
Return the current cursor position in world coordinates ignoring the cursorUp position force mode.
virtual void SetAutoPanAcceleration(float aAcceleration)
Set the speed of autopanning.
bool IsCursorWarpingEnabled() const
virtual void WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
virtual void SetGrabMouse(bool aEnabled)
Turn on/off mouse grabbing.
virtual void SetAutoPanSpeed(float aSpeed)
Set the speed of autopanning.
virtual void CenterOnCursor()=0
Set the viewport center to the current cursor position and warps the cursor to the screen center.
virtual void LoadSettings()
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
virtual VECTOR2D GetCursorPosition(bool aEnableSnapping) const =0
Return the current cursor position in world coordinates.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
VIEW * m_view
< Pointer to controlled VIEW.
virtual void PinCursorInsideNonAutoscrollArea(bool aWarpMouseCursor)=0
void EnableCursorWarping(bool aEnable)
Enable or disable warping the cursor.
const VC_SETTINGS & GetSettings() const
Apply VIEW_CONTROLS settings from an object.
VIEW_CONTROLS(VIEW *aView)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
The Cairo implementation of the graphics abstraction layer.
Structure to keep VIEW_CONTROLS settings for easy store/restore operations.
float m_autoPanMargin
How fast is panning when in auto mode.
VECTOR2D m_forcedPosition
Is the forced cursor position enabled.
MOUSE_DRAG_ACTION m_dragLeft
bool m_horizontalPan
Enable the accelerating zoom controller.
bool m_autoPanSettingEnabled
Distance from cursor to VIEW edge when panning is active.
bool m_focusFollowSchPcb
Flag for turning on autopanning.
float m_autoPanAcceleration
If the cursor is allowed to be warped.
MOUSE_DRAG_ACTION m_dragMiddle
bool m_cursorCaptured
Should the cursor snap to grid or move freely.
int m_zoomSpeed
When true, ignore zoom_speed and pick a platform-specific default.
int m_scrollModifierZoom
What modifier key to enable horizontal pan with the (vertical) scroll wheel.
int m_scrollModifierPanH
What modifier key to enable vertical with the (vertical) scroll wheel.
VECTOR2D m_lastKeyboardCursorPosition
Wether to invert the scroll wheel movement for horizontal pan.
float m_autoPanSpeed
How fast does panning accelerate when approaching the window boundary.
bool m_warpCursor
Enable horizontal panning with the horizontal scroll/trackpad input.
MOUSE_DRAG_ACTION m_dragRight
Is last cursor motion event coming from keyboard arrow cursor motion action.
bool m_grabMouse
Flag for automatic focus switching between Schematic and PCB editors.
bool m_zoomAcceleration
Zoom speed for the non-accelerating zoom controller.
bool m_lastKeyboardCursorPositionValid
ACTIONS::CURSOR_UP, ACTIONS::CURSOR_DOWN, etc.
VC_SETTINGS()
Restore the default settings.
bool m_zoomSpeedAuto
What modifier key to enable zoom with the (vertical) scroll wheel.
bool m_autoPanEnabled
Flag for turning on autopanning.
bool m_snappingEnabled
Flag for grabbing the mouse cursor.
bool m_showCursor
Forced cursor position (world coordinates).
long m_lastKeyboardCursorCommand
Position of the above event.
bool m_forceCursorPosition
Should the cursor be locked within the parent window area.
VECTOR2< double > VECTOR2D