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 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...
 
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...
 
virtual void CaptureCursor (bool aEnabled)
 Force the cursor to stay within the drawing panel area. More...
 
bool IsCursorPositionForced () const
 Return 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
 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 127 of file view_controls.h.

Constructor & Destructor Documentation

◆ VIEW_CONTROLS()

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

Definition at line 130 of file view_controls.h.

130  :
131  m_view( aView ), m_cursorWarped( false )
132  {
133  }
VIEW * m_view
< Pointer to controlled VIEW.
bool m_cursorWarped
Current VIEW_CONTROLS settings.

◆ ~VIEW_CONTROLS()

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

Definition at line 135 of file view_controls.h.

136  {
137  }

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 );
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 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(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), DIALOG_PAD_PROPERTIES::prepareCanvas(), and Reset().

◆ CaptureCursor()

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

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

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.

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

Reimplemented in KIGFX::WX_VIEW_CONTROLS.

Definition at line 251 of file view_controls.h.

252  {
254  m_settings.m_forcedPosition = aPosition;
255  }
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 m_settings.

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

◆ ForcedCursorPosition()

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

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

◆ 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.
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 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(), KIGFX::WX_VIEW_CONTROLS::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(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::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(), PNS::TOOL_BASE::updateStartItem(), GERBVIEW_FRAME::UpdateStatusBar(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), and PCB_BASE_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.
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

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.

Implemented in KIGFX::WX_VIEW_CONTROLS.

Referenced by TOOL_DISPATCHER::DispatchWxEvent(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), TOOL_MANAGER::GetMousePosition(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::performTuning(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), PNS::TOOL_BASE::updateEndItem(), DIALOG_NETLIST::~DIALOG_NETLIST(), and DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB().

◆ 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()

◆ IsCursorPositionForced()

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

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

◆ 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
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 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  {
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 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().

◆ 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.
Structure to keep VIEW_CONTROLS settings for easy store/restore operations.
Definition: view_controls.h:41
static LIB_SYMBOL * dummy()
Used when a LIB_SYMBOL is not found in library to draw a dummy shape.

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 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 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(), 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)
inlinevirtual

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

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(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), EDA_DRAW_FRAME::FocusOnLocation(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), COMMON_TOOLS::OnGridChanged(), DIALOG_MIGRATE_BUSES::onItemSelected(), 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.

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(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), DIALOG_NETLIST::~DIALOG_NETLIST(), 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 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 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.
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(), 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(), 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().

◆ WarpCursor()

virtual void KIGFX::VIEW_CONTROLS::WarpCursor ( 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.
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(), ZONE_CREATE_HELPER::createNewZone(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_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: