KiCad PCB EDA Suite
KIGFX::VIEW_CONTROLS Class Referenceabstract

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 SetAutoPanAcceleration (float aAcceleration)
 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, long aArrowCommand=0)=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 CenterOnCursor () const =0
 Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the cursor to the screen center. More...
 
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...
 
virtual void LoadSettings ()
 

Load new settings from program common settings

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

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

Definition at line 144 of file view_controls.h.

Constructor & Destructor Documentation

◆ VIEW_CONTROLS()

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

Definition at line 147 of file view_controls.h.

147  :
148  m_view( aView ), m_cursorWarped( false )
149  {
150  }
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 152 of file view_controls.h.

153  {
154  }

Member Function Documentation

◆ ApplySettings()

void VIEW_CONTROLS::ApplySettings ( const VC_SETTINGS aSettings)

Applies VIEW_CONTROLS settings from an object

Definition at line 86 of file view_controls.cpp.

87 {
88  ShowCursor( aSettings.m_showCursor );
89  CaptureCursor( aSettings.m_cursorCaptured );
90  SetSnapping( aSettings.m_snappingEnabled );
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)
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:93
bool m_snappingEnabled
Should the cursor snap to grid or move freely
Definition: view_controls.h:78
bool m_grabMouse
Flag for grabbing the mouse cursor
Definition: view_controls.h:81
VECTOR2D m_forcedPosition
Forced cursor position (world coordinates)
Definition: view_controls.h:69
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:72
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:90
bool m_autoPanEnabled
Flag for turning on autopanning
Definition: view_controls.h:84
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:66
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:75

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

◆ CaptureCursor()

◆ 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(), 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 201 of file view_controls.h.

202  {
204  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_autoPanSettingEnabled
Flag for turning on autopanning
Definition: view_controls.h:87

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

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

371  {
372  m_settings.m_warpCursor = aEnable;
373  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_warpCursor
If the cursor is allowed to be warped
Definition: view_controls.h:99

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

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

284  {
286  m_settings.m_forcedPosition = aPosition;
287  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
VECTOR2D m_forcedPosition
Forced cursor position (world coordinates)
Definition: view_controls.h:69
bool m_forceCursorPosition
Is the forced cursor position enabled
Definition: view_controls.h:72

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

Referenced by ApplySettings(), TOOL_MANAGER::DispatchContextMenu(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), ROUTER_TOOL::finishInteractive(), ROUTER_TOOL::InlineDrag(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), DRAWING_TOOL::PlaceImportedGraphics(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), DRAWING_TOOL::SetAnchor(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), 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 313 of file view_controls.h.

314  {
316  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_forceCursorPosition
Is the forced cursor position enabled
Definition: view_controls.h:72

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

255  {
257  }
bool m_snappingEnabled
Should the cursor snap to grid or move freely
Definition: view_controls.h:78
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 EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), KIGFX::WX_VIEW_CONTROLS::CenterOnCursor(), ZONE_CREATE_HELPER::createNewZone(), TOOL_MANAGER::DispatchContextMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), PAD_TOOL::EnumeratePads(), TOOL_MANAGER::GetCursorPosition(), SCH_EDITOR_CONTROL::HighlightNet(), ROUTER_TOOL::InlineDrag(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), COMMON_TOOLS::OnGridChanged(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_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(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), POINT_EDITOR::updateItem(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), PNS::TOOL_BASE::updateStartItem(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and GERBVIEW_FRAME::UpdateStatusBar().

◆ 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(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), TOOL_MANAGER::GetMousePosition(), PCBNEW_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::performTuning(), DRAWING_TOOL::SetAnchor(), 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

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

399  {
400  return m_settings;
401  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings

References m_settings.

Referenced by EDIT_TOOL::doMoveSelection(), TOOL_MANAGER::GetCurrentToolVC(), DIALOG_PAD_PROPERTIES::prepareCanvas(), 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 170 of file view_controls.h.

171  {
173  }
bool m_snappingEnabled
Should the cursor snap to grid or move freely
Definition: view_controls.h:78
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 347 of file view_controls.h.

348  {
350  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_forceCursorPosition
Is the forced cursor position enabled
Definition: view_controls.h:72

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 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
Current VIEW_CONTROLS settings
bool m_showCursor
Flag determining the cursor visibility
Definition: view_controls.h:66

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

380  {
381  return m_settings.m_warpCursor;
382  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_warpCursor
If the cursor is allowed to be warped
Definition: view_controls.h:99

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

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

◆ LoadSettings()

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

Load new settings from program common settings

Reimplemented in KIGFX::WX_VIEW_CONTROLS.

Definition at line 407 of file view_controls.h.

407 {}

Referenced by EDA_DRAW_FRAME::CommonSettingsChanged().

◆ Reset()

void VIEW_CONTROLS::Reset ( )
virtual

Function Reset() Restores the default 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)
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:55

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

◆ SetAutoPan()

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

Function SetAutoPan Turns 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 191 of file view_controls.h.

192  {
193  m_settings.m_autoPanEnabled = aEnabled;
194  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
bool m_autoPanEnabled
Flag for turning on autopanning
Definition: view_controls.h:84

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(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_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(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), POINT_EDITOR::Reset(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetAutoPanAcceleration()

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

Function SetAutoPanSpeed() Sets speed of autopanning.

Parameters
aSpeedis a new speed for autopanning.

Definition at line 221 of file view_controls.h.

222  {
223  m_settings.m_autoPanAcceleration = aAcceleration;
224  }
VC_SETTINGS m_settings
Current VIEW_CONTROLS settings
float m_autoPanAcceleration
How fast does panning accelerate when approaching the window boundary
Definition: view_controls.h:96

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

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

232  {
233  m_settings.m_autoPanMargin = aMargin;
234  }
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:90

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

212  {
213  m_settings.m_autoPanSpeed = aSpeed;
214  }
float m_autoPanSpeed
How fast is panning when in auto mode
Definition: view_controls.h:93
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 FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EDA_DRAW_FRAME::FocusOnLocation(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), 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

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(), EDIT_TOOL::doMoveSelection(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), LIB_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

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

181  {
182  m_settings.m_grabMouse = aEnabled;
183  }
bool m_grabMouse
Flag for grabbing the mouse cursor
Definition: view_controls.h:81
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 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
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:66

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(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_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

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(), ZONE_CREATE_HELPER::createNewZone(), TOOL_MANAGER::DispatchContextMenu(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceText(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

Member Data Documentation

◆ m_cursorWarped

bool KIGFX::VIEW_CONTROLS::m_cursorWarped
protected

Application warped the cursor, not the user (keyboard)

Definition at line 414 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: