KiCad PCB EDA Suite
KIGFX::VIEW_CONTROLS Class Referenceabstract

Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such as zooming, panning, mouse grab, etc.) More...

#include <view_controls.h>

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

Public Member Functions

 VIEW_CONTROLS (VIEW *aView)
 
virtual ~VIEW_CONTROLS ()
 
virtual void SetSnapping (bool aEnabled)
 Function SetSnapping() Enables/disables snapping cursor to grid. More...
 
virtual bool GetSnappingState ()
 
virtual void SetGrabMouse (bool aEnabled)
 Function SetGrabMouse Turns on/off mouse grabbing. More...
 
virtual void SetAutoPan (bool aEnabled)
 Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg. More...
 
virtual void EnableAutoPan (bool aEnabled)
 Function EnableAutoPan Turns on/off auto panning (user setting to disable it entirely). More...
 
virtual void SetAutoPanSpeed (float aSpeed)
 Function SetAutoPanSpeed() Sets speed of autopanning. More...
 
virtual void SetAutoPanMargin (float aMargin)
 Function SetAutoPanMArgin() Sets margin for autopanning (ie. More...
 
virtual VECTOR2D GetMousePosition (bool aWorldCoordinates=true) const =0
 Function GetMousePosition() Returns the current mouse pointer position. More...
 
VECTOR2D GetCursorPosition () const
 Returns the current cursor position in world coordinates. More...
 
virtual VECTOR2D GetRawCursorPosition (bool aSnappingEnabled=true) const =0
 Returns the current cursor position in world coordinates - ingoring the cursorUp position force mode. More...
 
virtual VECTOR2D GetCursorPosition (bool aEnableSnapping) const =0
 Returns the current cursor position in world coordinates. More...
 
virtual void ForceCursorPosition (bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
 Function ForceCursorPosition() Places the cursor immediately at a given point. More...
 
virtual void SetCursorPosition (const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
 Moves cursor to the requested position expressed in world coordinates. More...
 
virtual void SetCrossHairCursorPosition (const VECTOR2D &aPosition, bool aWarpView=true)=0
 Moves the graphic crosshair cursor to the requested position expressed in world coordinates. More...
 
bool ForcedCursorPosition () const
 Function ForcedCursorPosition() Returns true if the current cursor position is forced to a specific location, ignoring the mouse cursor position. More...
 
virtual void ShowCursor (bool aEnabled)
 Function ShowCursor() Enables or disables display of cursor. More...
 
bool IsCursorShown () const
 Function IsCursorShown() Returns true when cursor is visible. More...
 
virtual void CaptureCursor (bool aEnabled)
 Function CaptureCursor() Forces the cursor to stay within the drawing panel area. More...
 
bool IsCursorPositionForced () const
 Function IsCursorPositionForced() Returns true if the cursor position is set by one of the tools. More...
 
virtual void WarpCursor (const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
 Function WarpCursor() If enabled (. More...
 
void EnableCursorWarping (bool aEnable)
 Function EnableCursorWarping() Enables or disables warping the cursor. More...
 
bool IsCursorWarpingEnabled () const
 Function IsCursorWarpingEnabled() More...
 
virtual void EnableMousewheelPan (bool aEnable)
 Function EnableMousewheelPan() Enables or disables mousewheel panning. More...
 
virtual bool IsMousewheelPanEnabled () const
 Function IsMousewheelPanEnabled() More...
 
virtual void CenterOnCursor () const =0
 Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the cursor to the screen center. More...
 
void SetAdditionalPanButtons (bool aLeft=false, bool aRight=false)
 
virtual void Reset ()
 Function Reset() Restores the default VIEW_CONTROLS settings. More...
 
const VC_SETTINGSGetSettings () const
 

Returns the current VIEW_CONTROLS settings

More...
 
void ApplySettings (const VC_SETTINGS &aSettings)
 

Applies VIEW_CONTROLS settings from an object

More...
 

Protected Attributes

VIEWm_view
 

Pointer to controlled VIEW.

More...
 
bool m_cursorWarped
 

Application warped the cursor, not the user (keyboard)

More...
 
VC_SETTINGS m_settings
 

Current VIEW_CONTROLS settings

More...
 

Detailed Description

Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such as zooming, panning, mouse grab, etc.)

Definition at line 109 of file view_controls.h.

Constructor & Destructor Documentation

◆ VIEW_CONTROLS()

KIGFX::VIEW_CONTROLS::VIEW_CONTROLS ( VIEW aView)
inline

Definition at line 112 of file view_controls.h.

112  :
113  m_view( aView ), m_cursorWarped( false )
114  {
115  }
VIEW * m_view
Pointer to controlled VIEW.
bool m_cursorWarped
Application warped the cursor, not the user (keyboard)

◆ ~VIEW_CONTROLS()

virtual KIGFX::VIEW_CONTROLS::~VIEW_CONTROLS ( )
inlinevirtual

Definition at line 117 of file view_controls.h.

118  {
119  }

Member Function Documentation

◆ ApplySettings()

void VIEW_CONTROLS::ApplySettings ( const VC_SETTINGS aSettings)

Applies VIEW_CONTROLS settings from an object

Definition at line 76 of file view_controls.cpp.

77 {
78  ShowCursor( aSettings.m_showCursor );
79  CaptureCursor( aSettings.m_cursorCaptured );
80  SetSnapping( aSettings.m_snappingEnabled );
81  SetGrabMouse( aSettings.m_grabMouse );
82  SetAutoPan( aSettings.m_autoPanEnabled );
83  SetAutoPanMargin( aSettings.m_autoPanMargin );
84  SetAutoPanSpeed( aSettings.m_autoPanSpeed );
86 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
virtual void SetAutoPanSpeed(float aSpeed)
Function SetAutoPanSpeed() Sets speed of autopanning.
float m_autoPanSpeed
How fast is panning when in auto mode
Definition: view_controls.h:82
bool m_snappingEnabled
Should the cursor snap to grid or move freely
Definition: view_controls.h:67
bool m_grabMouse
Flag for grabbing the mouse cursor
Definition: view_controls.h:70
VECTOR2D m_forcedPosition
Forced cursor position (world coordinates)
Definition: view_controls.h:58
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
virtual void SetAutoPanMargin(float aMargin)
Function SetAutoPanMArgin() Sets margin for autopanning (ie.
bool m_forceCursorPosition
Is the forced cursor position enabled
Definition: view_controls.h:61
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
float m_autoPanMargin
Distance from cursor to VIEW edge when panning is active
Definition: view_controls.h:79
bool m_autoPanEnabled
Flag for turning on autopanning
Definition: view_controls.h:73
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
bool m_showCursor
Flag determining the cursor visibility
Definition: view_controls.h:55
virtual void SetGrabMouse(bool aEnabled)
Function SetGrabMouse Turns on/off mouse grabbing.
bool m_cursorCaptured
Should the cursor be locked within the parent window area
Definition: view_controls.h:64

References CaptureCursor(), 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::VC_SETTINGS::m_snappingEnabled, SetAutoPan(), SetAutoPanMargin(), SetAutoPanSpeed(), SetGrabMouse(), SetSnapping(), and ShowCursor().

Referenced by TOOL_MANAGER::applyViewControls(), and Reset().

◆ CaptureCursor()

virtual void KIGFX::VIEW_CONTROLS::CaptureCursor ( bool  aEnabled)
inlinevirtual

Function CaptureCursor() Forces the cursor to stay within the drawing panel area.

Parameters
aEnableddetermines if the cursor should be captured.

Definition at line 291 of file view_controls.h.

292  {
293  m_settings.m_cursorCaptured = aEnabled;
294  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_cursorCaptured
Should the cursor be locked within the parent window area
Definition: view_controls.h:64

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

Referenced by ApplySettings(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), EDIT_TOOL::MeasureTool(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), and PICKER_TOOL::setControls().

◆ CenterOnCursor()

virtual void KIGFX::VIEW_CONTROLS::CenterOnCursor ( ) const
pure virtual

Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the cursor to the screen center.

Implemented in KIGFX::WX_VIEW_CONTROLS.

Referenced by COMMON_TOOLS::doZoomToPreset(), EDA_DRAW_FRAME::OnZoom(), SCH_BASE_FRAME::RedrawScreen(), and COMMON_TOOLS::ZoomCenter().

◆ EnableAutoPan()

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

Function EnableAutoPan Turns 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
Current VIEW_CONTROLS settings
bool m_autoPanSettingEnabled
Flag for turning on autopanning
Definition: view_controls.h:76

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

Referenced by EDA_DRAW_FRAME::UseGalCanvas().

◆ EnableCursorWarping()

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

Function EnableCursorWarping() Enables or disables warping the cursor.

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

Definition at line 324 of file view_controls.h.

325  {
326  m_settings.m_warpCursor = aEnable;
327  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_warpCursor
If the cursor is allowed to be warped
Definition: view_controls.h:85

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

Referenced by EDA_DRAW_FRAME::UseGalCanvas().

◆ EnableMousewheelPan()

virtual void KIGFX::VIEW_CONTROLS::EnableMousewheelPan ( bool  aEnable)
inlinevirtual

Function EnableMousewheelPan() Enables or disables mousewheel panning.

Parameters
aEnableis true if mouse-wheel panning is enabled.

Definition at line 343 of file view_controls.h.

344  {
346  }
bool m_enableMousewheelPan
Mousewheel (2-finger touchpad) panning
Definition: view_controls.h:88
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings

References KIGFX::VC_SETTINGS::m_enableMousewheelPan, and m_settings.

Referenced by DIALOG_PAD_PROPERTIES::prepareCanvas(), and EDA_DRAW_FRAME::UseGalCanvas().

◆ ForceCursorPosition()

virtual void KIGFX::VIEW_CONTROLS::ForceCursorPosition ( bool  aEnabled,
const VECTOR2D aPosition = VECTOR2D( 0, 0 ) 
)
inlinevirtual

Function ForceCursorPosition() Places the cursor immediately at a given point.

Mouse movement is ignored.

Parameters
aEnabledenable forced cursor position
aPositionthe position (world coordinates).

Reimplemented in KIGFX::WX_VIEW_CONTROLS.

Definition at line 238 of file view_controls.h.

239  {
241  m_settings.m_forcedPosition = aPosition;
242  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
VECTOR2D m_forcedPosition
Forced cursor position (world coordinates)
Definition: view_controls.h:58
bool m_forceCursorPosition
Is the forced cursor position enabled
Definition: view_controls.h:61

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

Referenced by ApplySettings(), TOOL_MANAGER::dispatchContextMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), SELECTION_TOOL::findMove(), ROUTER_TOOL::finishInteractive(), ROUTER_TOOL::InlineDrag(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), DRAWING_TOOL::PlaceImportedGraphics(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), POINT_EDITOR::setEditedPoint(), PNS::TOOL_BASE::updateEndItem(), and PNS::TOOL_BASE::updateStartItem().

◆ ForcedCursorPosition()

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

Function ForcedCursorPosition() Returns true if the current cursor position is forced to a specific location, ignoring the mouse cursor position.

Definition at line 267 of file view_controls.h.

268  {
270  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_forceCursorPosition
Is the forced cursor position enabled
Definition: view_controls.h:61

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

◆ GetCursorPosition() [1/2]

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

Returns the current cursor position in world coordinates.

Note, that it 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 209 of file view_controls.h.

210  {
212  }
bool m_snappingEnabled
Should the cursor snap to grid or move freely
Definition: view_controls.h:67
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

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

Referenced by POINT_EDITOR::addCorner(), KIGFX::WX_VIEW_CONTROLS::CenterOnCursor(), TOOL_MANAGER::dispatchContextMenu(), PCB_TOOL::doInteractiveItemPlacement(), MICROWAVE_TOOL::drawMicrowaveInductor(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), EDA_DRAW_FRAME::GetCrossHairPosition(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::Main(), ROUTER_TOOL::mainLoop(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), CVPCB_CONTROL::ResetCoords(), GERBVIEW_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), DRAWING_TOOL::SetAnchor(), EDIT_TOOL::updateModificationPoint(), and PNS::TOOL_BASE::updateStartItem().

◆ GetCursorPosition() [2/2]

virtual VECTOR2D KIGFX::VIEW_CONTROLS::GetCursorPosition ( bool  aEnableSnapping) const
pure virtual

Returns the current cursor position in world coordinates.

Note, that it 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.

Implemented in KIGFX::WX_VIEW_CONTROLS.

◆ GetMousePosition()

virtual VECTOR2D KIGFX::VIEW_CONTROLS::GetMousePosition ( bool  aWorldCoordinates = true) const
pure virtual

Function GetMousePosition() Returns the current mouse pointer position.

Note, that it 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.

Implemented in KIGFX::WX_VIEW_CONTROLS.

Referenced by TOOL_DISPATCHER::DispatchWxEvent(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), EDIT_TOOL::MeasureTool(), and PNS::TOOL_BASE::updateEndItem().

◆ GetRawCursorPosition()

virtual VECTOR2D KIGFX::VIEW_CONTROLS::GetRawCursorPosition ( bool  aSnappingEnabled = true) const
pure virtual

Returns the current cursor position in world coordinates - ingoring the cursorUp position force mode.

Returns
The current cursor position in world coordinates.

Implemented in KIGFX::WX_VIEW_CONTROLS.

Referenced by COMMON_TOOLS::CursorControl().

◆ GetSettings()

const VC_SETTINGS& KIGFX::VIEW_CONTROLS::GetSettings ( ) const
inline

Returns the current VIEW_CONTROLS settings

Definition at line 377 of file view_controls.h.

378  {
379  return m_settings;
380  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings

References m_settings.

Referenced by TOOL_MANAGER::GetCurrentToolVC(), and TOOL_MANAGER::saveViewControls().

◆ GetSnappingState()

virtual bool KIGFX::VIEW_CONTROLS::GetSnappingState ( )
inlinevirtual
Returns
the current state of the snapping cursor to grid.

Definition at line 135 of file view_controls.h.

136  {
138  }
bool m_snappingEnabled
Should the cursor snap to grid or move freely
Definition: view_controls.h:67
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings

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

◆ IsCursorPositionForced()

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

Function IsCursorPositionForced() Returns true if the cursor position is set by one of the tools.

Forced cursor position means it does not react to mouse movement.

Definition at line 301 of file view_controls.h.

302  {
304  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_forceCursorPosition
Is the forced cursor position enabled
Definition: view_controls.h:61

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

◆ IsCursorShown()

bool VIEW_CONTROLS::IsCursorShown ( ) const

Function IsCursorShown() Returns true when cursor is visible.

Returns
True if cursor is visible.

Definition at line 40 of file view_controls.cpp.

41 {
42  // this only says if the VIEW_CONTROLS say the cursor should be
43  // shown: m_view->GetGAL()->IsCursorEnabled() will say if the GAL is
44  // actually going to do show the cursor or not
45  return m_settings.m_showCursor;
46 }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_showCursor
Flag determining the cursor visibility
Definition: view_controls.h:55

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

◆ IsCursorWarpingEnabled()

bool KIGFX::VIEW_CONTROLS::IsCursorWarpingEnabled ( ) const
inline

Function IsCursorWarpingEnabled()

Returns
the current setting for cursor warping.

Definition at line 333 of file view_controls.h.

334  {
335  return m_settings.m_warpCursor;
336  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_warpCursor
If the cursor is allowed to be warped
Definition: view_controls.h:85

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

Referenced by KIGFX::WX_VIEW_CONTROLS::onWheel().

◆ IsMousewheelPanEnabled()

virtual bool KIGFX::VIEW_CONTROLS::IsMousewheelPanEnabled ( ) const
inlinevirtual

Function IsMousewheelPanEnabled()

Returns
the current setting for mousewheel panning

Definition at line 352 of file view_controls.h.

353  {
355  }
bool m_enableMousewheelPan
Mousewheel (2-finger touchpad) panning
Definition: view_controls.h:88
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings

References KIGFX::VC_SETTINGS::m_enableMousewheelPan, and m_settings.

◆ Reset()

void VIEW_CONTROLS::Reset ( )
virtual

Function Reset() Restores the default VIEW_CONTROLS settings.

Definition at line 49 of file view_controls.cpp.

50 {
51  // Get the default settings from the default constructor
54 }
void ApplySettings(const VC_SETTINGS &aSettings)
Applies VIEW_CONTROLS settings from an object
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:44

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

◆ SetAdditionalPanButtons()

void KIGFX::VIEW_CONTROLS::SetAdditionalPanButtons ( bool  aLeft = false,
bool  aRight = false 
)
inline

Definition at line 364 of file view_controls.h.

365  {
368  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_panWithRightButton
Allow panning with the right button in addition to middle
Definition: view_controls.h:91
bool m_panWithLeftButton
Allow panning with the left button in addition to middle
Definition: view_controls.h:94

References KIGFX::VC_SETTINGS::m_panWithLeftButton, KIGFX::VC_SETTINGS::m_panWithRightButton, and m_settings.

Referenced by CVPCB_SELECTION_TOOL::Main(), and GERBVIEW_SELECTION_TOOL::Main().

◆ SetAutoPan()

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

◆ SetAutoPanMargin()

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

Function SetAutoPanMArgin() Sets margin for autopanning (ie.

the area when autopanning becomes active).

Parameters
aMarginis a new margin for autopanning.

Definition at line 186 of file view_controls.h.

187  {
188  m_settings.m_autoPanMargin = aMargin;
189  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
float m_autoPanMargin
Distance from cursor to VIEW edge when panning is active
Definition: view_controls.h:79

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

Referenced by ApplySettings().

◆ SetAutoPanSpeed()

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

Function SetAutoPanSpeed() Sets 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 is panning when in auto mode
Definition: view_controls.h:82
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings

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

Referenced by ApplySettings().

◆ SetCrossHairCursorPosition()

virtual void KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition ( const VECTOR2D aPosition,
bool  aWarpView = true 
)
pure virtual

Moves 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.

Implemented in KIGFX::WX_VIEW_CONTROLS.

Referenced by EDA_DRAW_FRAME::FocusOnLocation(), and EDA_DRAW_FRAME::SetCrossHairPosition().

◆ SetCursorPosition()

virtual void KIGFX::VIEW_CONTROLS::SetCursorPosition ( const VECTOR2D aPosition,
bool  aWarpView = true,
bool  aTriggeredByArrows = false 
)
pure virtual

Moves cursor to the requested position expressed in world coordinates.

The position is not forced and will be overridden with the next mouse motion event. Mouse cursor follows the world cursor.

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

Implemented in KIGFX::WX_VIEW_CONTROLS.

Referenced by COMMON_TOOLS::CursorControl(), SELECTION_TOOL::findMove(), EDA_DRAW_FRAME::FocusOnLocation(), EDIT_TOOL::Main(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), and PCB_EDITOR_CONTROL::PlaceModule().

◆ SetGrabMouse()

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

Function SetGrabMouse Turns on/off mouse grabbing.

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

Parameters
aEnabledtells if mouse should be grabbed or not.

Reimplemented in KIGFX::WX_VIEW_CONTROLS.

Definition at line 145 of file view_controls.h.

146  {
147  m_settings.m_grabMouse = aEnabled;
148  }
bool m_grabMouse
Flag for grabbing the mouse cursor
Definition: view_controls.h:70
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings

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

Referenced by ApplySettings(), and KIGFX::WX_VIEW_CONTROLS::SetGrabMouse().

◆ SetSnapping()

◆ ShowCursor()

void VIEW_CONTROLS::ShowCursor ( bool  aEnabled)
virtual

Function ShowCursor() Enables or disables display of cursor.

Parameters
aEnableddecides if the cursor should be shown.

Definition at line 33 of file view_controls.cpp.

34 {
35  m_settings.m_showCursor = aEnabled;
36  m_view->GetGAL()->SetCursorEnabled( aEnabled );
37 }
void SetCursorEnabled(bool aCursorEnabled)
Enable/disable cursor.
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
VIEW * m_view
Pointer to controlled VIEW.
bool m_showCursor
Flag determining the cursor visibility
Definition: view_controls.h:55

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

Referenced by ApplySettings(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), MODULE_EDITOR_TOOLS::EnumeratePads(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), PICKER_TOOL::setControls(), and POINT_EDITOR::setEditedPoint().

◆ WarpCursor()

virtual void KIGFX::VIEW_CONTROLS::WarpCursor ( const VECTOR2D aPosition,
bool  aWorldCoordinates = false,
bool  aWarpView = false 
)
pure virtual

Function WarpCursor() If enabled (.

See also
SetEnableCursorWarping(), warps the cursor to the specified position, expressed either in the screen coordinates or the world coordinates.
Parameters
aPositionis the position where the cursor should be warped.
aWorldCoordinatesif true treats aPosition as the world coordinates, otherwise it uses it as the screen coordinates.
aWarpViewdetermines if the view can be warped too (only matters if the position is specified in the world coordinates and its not visible in the current viewport).

Implemented in KIGFX::WX_VIEW_CONTROLS.

Referenced by SCH_BASE_FRAME::CenterScreen(), TOOL_MANAGER::dispatchContextMenu(), SCH_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::OnMoveItem(), and DRAWING_TOOL::PlaceText().

Member Data Documentation

◆ m_cursorWarped

bool KIGFX::VIEW_CONTROLS::m_cursorWarped
protected

Application warped the cursor, not the user (keyboard)

Definition at line 390 of file view_controls.h.

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

◆ m_settings

◆ m_view


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