KiCad PCB EDA Suite
KIGFX::VIEW_CONTROLS Class Referenceabstract

An interface for classes handling user events controlling the view behavior 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 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...
 
virtual void PinCursorInsideNonAutoscrollArea (bool aWarpMouseCursor)=0
 
virtual VECTOR2D GetMousePosition (bool aWorldCoordinates=true) const =0
 Return the current mouse pointer position. More...
 
VECTOR2D GetCursorPosition () const
 Return the current cursor position in world coordinates. More...
 
virtual VECTOR2D GetRawCursorPosition (bool aSnappingEnabled=true) const =0
 Return the current cursor position in world coordinates ignoring the cursorUp position force mode. More...
 
virtual VECTOR2D GetCursorPosition (bool aEnableSnapping) const =0
 Return the current cursor position in world coordinates. More...
 
virtual void ForceCursorPosition (bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
 Place the cursor immediately at a given point. More...
 
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. More...
 
virtual void SetCrossHairCursorPosition (const VECTOR2D &aPosition, bool aWarpView=true)=0
 Move the graphic crosshair cursor to the requested position expressed in world coordinates. More...
 
virtual void ShowCursor (bool aEnabled)
 Enable or disables display of cursor. More...
 
bool IsCursorShown () const
 Return true when cursor is visible. More...
 
virtual void CaptureCursor (bool aEnabled)
 Force the cursor to stay within the drawing panel area. More...
 
virtual void WarpMouseCursor (const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
 If enabled (. More...
 
void EnableCursorWarping (bool aEnable)
 Enable or disable warping the cursor. More...
 
bool IsCursorWarpingEnabled () const
 
virtual void CenterOnCursor () const =0
 Set the viewport center to the current cursor position and warps the cursor to the screen center. More...
 
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...
 
virtual void LoadSettings ()
 

Protected Attributes

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

Detailed Description

An interface for classes handling user events controlling the view behavior such as zooming, panning, mouse grab, etc.

Definition at line 130 of file view_controls.h.

Constructor & Destructor Documentation

◆ VIEW_CONTROLS()

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

Definition at line 133 of file view_controls.h.

133 :
134 m_view( aView ), m_cursorWarped( false )
135 {
136 }
bool m_cursorWarped
Current VIEW_CONTROLS settings.
VIEW * m_view
< Pointer to controlled VIEW.

◆ ~VIEW_CONTROLS()

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

Definition at line 138 of file view_controls.h.

139 {
140 }

Member Function Documentation

◆ ApplySettings()

void VIEW_CONTROLS::ApplySettings ( const VC_SETTINGS aSettings)

Load new settings from program common settings.

Definition at line 87 of file view_controls.cpp.

88{
89 ShowCursor( aSettings.m_showCursor );
91 SetGrabMouse( aSettings.m_grabMouse );
92 SetAutoPan( aSettings.m_autoPanEnabled );
96}
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.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
virtual void SetAutoPanMargin(float aMargin)
Set the margin for autopanning (ie.
virtual void SetGrabMouse(bool aEnabled)
Turn on/off mouse grabbing.
virtual void SetAutoPanSpeed(float aSpeed)
Set the speed of autopanning.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
float m_autoPanMargin
How fast is panning when in auto mode.
Definition: view_controls.h:79
VECTOR2D m_forcedPosition
Is the forced cursor position enabled.
Definition: view_controls.h:55
bool m_cursorCaptured
Should the cursor snap to grid or move freely.
Definition: view_controls.h:61
float m_autoPanSpeed
How fast does panning accelerate when approaching the window boundary.
Definition: view_controls.h:82
bool m_grabMouse
Flag for automatic focus switching between Schematic and PCB editors.
Definition: view_controls.h:67
bool m_autoPanEnabled
Flag for turning on autopanning.
Definition: view_controls.h:73
bool m_showCursor
Forced cursor position (world coordinates).
Definition: view_controls.h:52
bool m_forceCursorPosition
Should the cursor be locked within the parent window area.
Definition: view_controls.h:58

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, SetAutoPan(), SetAutoPanMargin(), SetAutoPanSpeed(), SetGrabMouse(), and ShowCursor().

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

◆ CaptureCursor()

◆ CenterOnCursor()

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

Set 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(), SCH_BASE_FRAME::RedrawScreen(), and COMMON_TOOLS::ZoomCenter().

◆ EnableAutoPan()

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

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

Parameters
aEnabledtells if the autopanning should be enabled.

Definition at line 169 of file view_controls.h.

170 {
172 }
bool m_autoPanSettingEnabled
Distance from cursor to VIEW edge when panning is active.
Definition: view_controls.h:76

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

◆ EnableCursorWarping()

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

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 }
bool m_warpCursor
Enable horizontal panning with the horizontal scroll/trackpad input.
Definition: view_controls.h:88

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

◆ ForceCursorPosition()

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

Place the cursor immediately at a given point.

Mouse movement is ignored.

Note
The position is clamped if outside of coordinates representation limits.
Parameters
aEnabledenable forced cursor position
aPositionthe position (world coordinates).

Reimplemented in KIGFX::WX_VIEW_CONTROLS.

Definition at line 264 of file view_controls.h.

265 {
267 m_settings.m_forcedPosition = aPosition;
268 }

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

Referenced by ApplySettings(), EE_SELECTION_TOOL::autostartEvent(), TOOL_MANAGER::DispatchContextMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::finishInteractive(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), DRAWING_TOOL::PlaceImportedGraphics(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::RouteSelected(), DRAWING_TOOL::SetAnchor(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), PNS::TOOL_BASE::updateEndItem(), and PNS::TOOL_BASE::updateStartItem().

◆ GetCursorPosition() [1/2]

VECTOR2D KIGFX::VIEW_CONTROLS::GetCursorPosition ( ) const
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.
The position is clamped if outside of coordinates representation limits.
Returns
The current cursor position in world coordinates.

Definition at line 230 of file view_controls.h.

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

References GetCursorPosition(), 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(), SCH_EDIT_TOOL::BreakWire(), ZONE_CREATE_HELPER::createNewZone(), EDIT_TOOL::DeleteItems(), TOOL_MANAGER::DispatchContextMenu(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), PAD_TOOL::EnumeratePads(), TOOL_MANAGER::GetCursorPosition(), GetCursorPosition(), SCH_EDITOR_CONTROL::HighlightNet(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), COMMON_TOOLS::OnGridChanged(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), 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(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), PNS::TOOL_BASE::updateStartItem(), SCH_BASE_FRAME::UpdateStatusBar(), GERBVIEW_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and PL_EDITOR_FRAME::UpdateStatusBar().

◆ GetCursorPosition() [2/2]

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

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.
The position is clamped if outside of coordinates representation limits.
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, and KIGFX::WX_VIEW_CONTROLS.

◆ GetMousePosition()

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

◆ GetRawCursorPosition()

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

Return the current cursor position in world coordinates ignoring 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

◆ IsCursorShown()

bool VIEW_CONTROLS::IsCursorShown ( ) const

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
47}

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

◆ IsCursorWarpingEnabled()

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

Definition at line 348 of file view_controls.h.

349 {
351 }

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

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

◆ LoadSettings()

virtual void KIGFX::VIEW_CONTROLS::LoadSettings ( )
inlinevirtual

Reimplemented in KIGFX::WX_VIEW_CONTROLS.

Definition at line 374 of file view_controls.h.

374{}

Referenced by EDA_DRAW_FRAME::CommonSettingsChanged().

◆ PinCursorInsideNonAutoscrollArea()

◆ Reset()

void VIEW_CONTROLS::Reset ( )
virtual

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_SYMBOL * dummy()
Used when a LIB_SYMBOL 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:42

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

◆ SetAutoPan()

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

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 159 of file view_controls.h.

160 {
161 m_settings.m_autoPanEnabled = aEnabled;
162 }

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

Referenced by 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(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), ROUTER_TOOL::finishInteractive(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_EDIT_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(), DRAWING_TOOL::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PCB_POINT_EDITOR::Reset(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), PICKER_TOOL::setControls(), PCB_PICKER_TOOL::setControls(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ SetAutoPanAcceleration()

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

Set the speed of autopanning.

Parameters
aSpeedis a new speed for autopanning.

Definition at line 189 of file view_controls.h.

190 {
191 m_settings.m_autoPanAcceleration = aAcceleration;
192 }
float m_autoPanAcceleration
If the cursor is allowed to be warped.
Definition: view_controls.h:85

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

◆ SetAutoPanMargin()

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

Set the margin for autopanning (ie.

the area when autopanning becomes active).

Parameters
aMarginis a new margin for autopanning.

Definition at line 199 of file view_controls.h.

200 {
201 m_settings.m_autoPanMargin = aMargin;
202 }

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

Referenced by ApplySettings().

◆ SetAutoPanSpeed()

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

Set the speed of autopanning.

Parameters
aSpeedis a new speed for autopanning.

Definition at line 179 of file view_controls.h.

180 {
181 m_settings.m_autoPanSpeed = aSpeed;
182 }

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

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

Note
The position is clamped if outside of coordinates representation limits.
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 FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDA_DRAW_FRAME::FocusOnLocation(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), COMMON_TOOLS::OnGridChanged(), DIALOG_MIGRATE_BUSES::onItemSelected(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), and SCH_DRAWING_TOOLS::SingleClickPlace().

◆ SetCursorPosition()

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

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

Note
The position is clamped if outside of coordinates representation limits.
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(), EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::handleLayerSwitch(), ROUTER_TOOL::InlineDrag(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_EDIT_TOOL::Main(), PCB_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), DIALOG_NETLIST_IMPORT::~DIALOG_NETLIST_IMPORT(), and DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB().

◆ SetGrabMouse()

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

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 148 of file view_controls.h.

149 {
150 m_settings.m_grabMouse = aEnabled;
151 }

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

Referenced by ApplySettings().

◆ ShowCursor()

void VIEW_CONTROLS::ShowCursor ( bool  aEnabled)
virtual

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.
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:195

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

Referenced by 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(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_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::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::RouteSelected(), DRAWING_TOOL::SetAnchor(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ WarpMouseCursor()

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

If enabled (.

See also
SetEnableCursorWarping(), warps the cursor to the specified position, expressed either in the screen coordinates or the world coordinates.
Note
The position is clamped if outside of coordinates representation limits.
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 ZONE_CREATE_HELPER::createNewZone(), SYMBOL_EDITOR_MOVE_TOOL::Main(), ROUTER_TOOL::performRouting(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

Member Data Documentation

◆ m_cursorWarped

bool KIGFX::VIEW_CONTROLS::m_cursorWarped
protected

◆ m_settings

◆ m_view


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