KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::WX_VIEW_CONTROLS Class Reference

An implementation of class VIEW_CONTROLS for wxWidgets library. More...

#include <wx_view_controls.h>

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

Public Member Functions

 WX_VIEW_CONTROLS (VIEW *aView, EDA_DRAW_PANEL_GAL *aParentPanel)
 
virtual ~WX_VIEW_CONTROLS ()
 
void onWheel (wxMouseEvent &aEvent)
 Handler functions.
 
void onMotion (wxMouseEvent &aEvent)
 
void onMagnify (wxMouseEvent &aEvent)
 
void onButton (wxMouseEvent &aEvent)
 
void onEnter (wxMouseEvent &WXUNUSED(aEvent))
 
void onLeave (wxMouseEvent &WXUNUSED(aEvent))
 
void onTimer (wxTimerEvent &WXUNUSED(aEvent))
 
void onScroll (wxScrollWinEvent &aEvent)
 
void onCaptureLost (wxMouseEvent &WXUNUSED(aEvent))
 
void CaptureCursor (bool aEnabled) override
 Force the cursor to stay within the drawing panel area.
 
void PinCursorInsideNonAutoscrollArea (bool aWarpMouseCursor) override
 Return the current mouse pointer position.
 
VECTOR2D GetMousePosition (bool aWorldCoordinates=true) const override
 Return the current mouse pointer position.
 
VECTOR2D GetCursorPosition (bool aSnappingEnabled) const override
 <
 
VECTOR2D GetRawCursorPosition (bool aSnappingEnabled=true) const override
 Return the current cursor position in world coordinates ignoring the cursorUp position force mode.
 
void SetCursorPosition (const VECTOR2D &aPosition, bool warpView, bool aTriggeredByArrows, long aArrowCommand) override
 Move the graphic crosshair cursor to the requested position expressed in world coordinates.
 
void SetCrossHairCursorPosition (const VECTOR2D &aPosition, bool aWarpView) override
 
void WarpMouseCursor (const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false) override
 Set the viewport center to the current cursor position and warps the cursor to the screen center.
 
void CenterOnCursor () override
 Adjusts the scrollbars position to match the current viewport.
 
void UpdateScrollbars ()
 End any mouse drag action still in progress.
 
void CancelDrag ()
 
void ForceCursorPosition (bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0)) override
 Applies VIEW_CONTROLS settings from the program COMMON_SETTINGS.
 
void LoadSettings () override
 Event that forces mouse move event in the dispatcher (eg.
 
VECTOR2D GetCursorPosition () const
 Return the current cursor position in world coordinates.
 
virtual VECTOR2D GetCursorPosition (bool aEnableSnapping) const=0
 Return the current cursor position in world coordinates.
 
virtual void SetGrabMouse (bool aEnabled)
 Turn on/off mouse grabbing.
 
virtual void SetAutoPan (bool aEnabled)
 Turn on/off auto panning (this feature is used when there is a tool active (eg.
 
virtual void EnableAutoPan (bool aEnabled)
 Turn on/off auto panning (user setting to disable it entirely).
 
virtual void SetAutoPanSpeed (float aSpeed)
 Set the speed of autopanning.
 
virtual void SetAutoPanAcceleration (float aAcceleration)
 Set the speed of autopanning.
 
virtual void SetAutoPanMargin (float aMargin)
 Set the margin for autopanning (ie.
 
virtual void ShowCursor (bool aEnabled)
 Enable or disables display of cursor.
 
bool IsCursorShown () const
 Return true when cursor is visible.
 
void EnableCursorWarping (bool aEnable)
 Enable or disable warping the cursor.
 
bool IsCursorWarpingEnabled () const
 
virtual void Reset ()
 Restore the default VIEW_CONTROLS settings.
 
const VC_SETTINGSGetSettings () const
 Apply VIEW_CONTROLS settings from an object.
 
void ApplySettings (const VC_SETTINGS &aSettings)
 Load new settings from program common settings.
 

Public Attributes

std::unique_ptr< PROF_COUNTERm_MotionEventCounter
 

Static Public Attributes

static const wxEventType EVT_REFRESH_MOUSE = wxNewEventType()
 

Protected Attributes

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

Private Types

enum  STATE { IDLE = 1 , DRAG_PANNING , AUTO_PANNING , DRAG_ZOOMING }
 < Possible states for WX_VIEW_CONTROLS. More...
 

Private Member Functions

void setState (STATE aNewState)
 Sets the interaction state, simply a internal setter to make it easier to debug changes.
 
bool handleAutoPanning (const wxMouseEvent &aEvent)
 Compute new viewport settings while in autopanning mode.
 
void handleCursorCapture (int x, int y)
 Limit the cursor position to within the canvas by warping it.
 
void refreshMouse (bool aSetModifiers)
 Send an event to refresh mouse position.
 
wxPoint getMouseScreenPosition () const
 Get the cursor position in the screen coordinates.
 

Private Attributes

STATE m_state
 Panel that is affected by VIEW_CONTROLS.
 
EDA_DRAW_PANEL_GALm_parentPanel
 Store information about point where dragging has started.
 
VECTOR2D m_dragStartPoint
 Current direction of panning (only autopanning mode).
 
VECTOR2D m_panDirection
 Timer responsible for handling autopanning.
 
wxTimer m_panTimer
 Ratio used for scaling world coordinates to scrollbar position.
 
VECTOR2D m_scrollScale
 Current scrollbar position.
 
VECTOR2I m_scrollPos
 The mouse position when a drag zoom started.
 
VECTOR2D m_zoomStartPoint
 Current cursor position (world coordinates).
 
VECTOR2D m_cursorPos
 Flag deciding whether the cursor position should be calculated using the mouse position.
 
bool m_updateCursor
 Flag to indicate if infinite panning works on this platform.
 
bool m_infinitePanWorks
 A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific.
 
std::unique_ptr< ZOOM_CONTROLLERm_zoomController
 

Detailed Description

An implementation of class VIEW_CONTROLS for wxWidgets library.

Definition at line 51 of file wx_view_controls.h.

Member Enumeration Documentation

◆ STATE

< Possible states for WX_VIEW_CONTROLS.

Enumerator
IDLE 

Nothing is happening.

DRAG_PANNING 

Panning with mouse button pressed.

AUTO_PANNING 

Panning on approaching borders of the frame.

DRAG_ZOOMING 

Zooming with mouse button pressed.

Definition at line 123 of file wx_view_controls.h.

Constructor & Destructor Documentation

◆ WX_VIEW_CONTROLS()

◆ ~WX_VIEW_CONTROLS()

WX_VIEW_CONTROLS::~WX_VIEW_CONTROLS ( )
virtual

Definition at line 146 of file wx_view_controls.cpp.

References m_parentPanel.

Member Function Documentation

◆ ApplySettings()

◆ CancelDrag()

◆ CaptureCursor()

void WX_VIEW_CONTROLS::CaptureCursor ( bool  aEnabled)
overridevirtual

Force the cursor to stay within the drawing panel area.

Parameters
aEnableddetermines if the cursor should be captured.

Reimplemented from KIGFX::VIEW_CONTROLS.

Definition at line 691 of file wx_view_controls.cpp.

References KIGFX::VIEW_CONTROLS::CaptureCursor(), DRAG_PANNING, DRAG_ZOOMING, EDA_DRAW_PANEL_GAL::m_MouseCapturedLost, m_parentPanel, and m_state.

◆ CenterOnCursor()

void WX_VIEW_CONTROLS::CenterOnCursor ( )
overridevirtual

◆ EnableAutoPan()

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

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

Parameters
aEnabledtells if the autopanning should be enabled.

Definition at line 174 of file view_controls.h.

◆ EnableCursorWarping()

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

Enable or disable warping the cursor.

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

Definition at line 345 of file view_controls.h.

◆ ForceCursorPosition()

void WX_VIEW_CONTROLS::ForceCursorPosition ( bool  aEnabled,
const VECTOR2D aPosition = VECTOR2D( 0, 0 ) 
)
overridevirtual

◆ GetCursorPosition() [1/3]

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

Referenced by CenterOnCursor().

◆ GetCursorPosition() [2/3]

virtual VECTOR2D KIGFX::VIEW_CONTROLS::GetCursorPosition ( bool  aEnableSnapping) const
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.

Implements KIGFX::VIEW_CONTROLS.

◆ GetCursorPosition() [3/3]

VECTOR2D WX_VIEW_CONTROLS::GetCursorPosition ( bool  aSnappingEnabled) const
overridevirtual

<

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.

Return the current cursor position in world coordinates ignoring the cursorUp position force mode.

Returns
The current cursor position in world coordinates.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 755 of file wx_view_controls.cpp.

References GetClampedCoords(), GetRawCursorPosition(), KIGFX::VC_SETTINGS::m_forceCursorPosition, KIGFX::VC_SETTINGS::m_forcedPosition, and KIGFX::VIEW_CONTROLS::m_settings.

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ GetMousePosition()

VECTOR2D WX_VIEW_CONTROLS::GetMousePosition ( bool  aWorldCoordinates = true) const
overridevirtual

Return the current mouse pointer position.

Note
The position may be different from the cursor position if snapping is enabled (
See also
GetCursorPosition()).
Note
The position is clamped if outside of coordinates representation limits.
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.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 731 of file wx_view_controls.cpp.

References GetClampedCoords(), getMouseScreenPosition(), KIGFX::VIEW_CONTROLS::m_view, and KIGFX::VIEW::ToWorld().

Referenced by CenterOnCursor(), and PinCursorInsideNonAutoscrollArea().

◆ getMouseScreenPosition()

wxPoint WX_VIEW_CONTROLS::getMouseScreenPosition ( ) const
private

Get the cursor position in the screen coordinates.

Current state of VIEW_CONTROLS.

Definition at line 1029 of file wx_view_controls.cpp.

References KIPLATFORM::UI::GetMousePosition(), and m_parentPanel.

Referenced by GetMousePosition(), and refreshMouse().

◆ GetRawCursorPosition()

VECTOR2D WX_VIEW_CONTROLS::GetRawCursorPosition ( bool  aSnappingEnabled = true) const
overridevirtual

Return the current cursor position in world coordinates ignoring the cursorUp position force mode.

Returns
The current cursor position in world coordinates.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 740 of file wx_view_controls.cpp.

References KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridPoint(), KIGFX::GAL::GetGridSnapping(), m_cursorPos, and KIGFX::VIEW_CONTROLS::m_view.

Referenced by GetCursorPosition().

◆ GetSettings()

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

◆ handleAutoPanning()

bool WX_VIEW_CONTROLS::handleAutoPanning ( const wxMouseEvent &  aEvent)
private

Compute new viewport settings while in autopanning mode.

Parameters
aEventis an event to be processed and decide if autopanning should happen.
Returns
true if it is currently autopanning (ie. autopanning is active and mouse cursor is in the area that causes autopanning to happen).

Definition at line 897 of file wx_view_controls.cpp.

References AUTO_PANNING, DRAG_PANNING, DRAG_ZOOMING, KIGFX::VIEW::GetScreenPixelSize(), IDLE, KIGFX::VC_SETTINGS::m_autoPanMargin, KIGFX::VIEW_CONTROLS::m_cursorWarped, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPosition, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPositionValid, m_panDirection, m_panTimer, KIGFX::VIEW_CONTROLS::m_settings, m_state, KIGFX::VIEW_CONTROLS::m_view, setState(), KIGFX::VIEW::ToScreen(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by onMotion().

◆ handleCursorCapture()

void WX_VIEW_CONTROLS::handleCursorCapture ( int  x,
int  y 
)
private

Limit the cursor position to within the canvas by warping it.

Parameters
xMouse position
yMouse position

Definition at line 973 of file wx_view_controls.cpp.

References KIGFX::VC_SETTINGS::m_cursorCaptured, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, and KIPLATFORM::UI::WarpPointer().

Referenced by onMotion().

◆ IsCursorShown()

bool VIEW_CONTROLS::IsCursorShown ( ) const
inherited

Return true when cursor is visible.

Returns
True if cursor is visible.

Definition at line 41 of file view_controls.cpp.

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

◆ IsCursorWarpingEnabled()

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

Definition at line 353 of file view_controls.h.

Referenced by onWheel().

◆ LoadSettings()

void WX_VIEW_CONTROLS::LoadSettings ( )
overridevirtual

Event that forces mouse move event in the dispatcher (eg.

used in autopanning, when mouse cursor does not move in screen coordinates, but does in world coordinates)

Reimplemented from KIGFX::VIEW_CONTROLS.

Definition at line 155 of file wx_view_controls.cpp.

References COMMON_SETTINGS::INPUT::auto_pan, COMMON_SETTINGS::INPUT::auto_pan_acceleration, COMMON_SETTINGS::INPUT::center_on_zoom, COMMON_SETTINGS::INPUT::drag_left, COMMON_SETTINGS::INPUT::drag_middle, COMMON_SETTINGS::INPUT::drag_right, COMMON_SETTINGS::INPUT::focus_follow_sch_pcb, PGM_BASE::GetCommonSettings(), GetZoomControllerForPlatform(), COMMON_SETTINGS::INPUT::horizontal_pan, KIGFX::VC_SETTINGS::m_autoPanAcceleration, KIGFX::VC_SETTINGS::m_autoPanSettingEnabled, KIGFX::VC_SETTINGS::m_dragLeft, KIGFX::VC_SETTINGS::m_dragMiddle, KIGFX::VC_SETTINGS::m_dragRight, KIGFX::VC_SETTINGS::m_focusFollowSchPcb, KIGFX::VC_SETTINGS::m_horizontalPan, COMMON_SETTINGS::m_Input, KIGFX::VC_SETTINGS::m_scrollModifierPanH, KIGFX::VC_SETTINGS::m_scrollModifierPanV, KIGFX::VC_SETTINGS::m_scrollModifierZoom, KIGFX::VC_SETTINGS::m_scrollReversePanH, KIGFX::VIEW_CONTROLS::m_settings, KIGFX::VC_SETTINGS::m_warpCursor, KIGFX::VC_SETTINGS::m_zoomAcceleration, m_zoomController, KIGFX::VC_SETTINGS::m_zoomSpeed, KIGFX::VC_SETTINGS::m_zoomSpeedAuto, KIGFX::CONSTANT_ZOOM_CONTROLLER::MANUAL_SCALE_FACTOR, Pgm(), COMMON_SETTINGS::INPUT::reverse_scroll_pan_h, scale, COMMON_SETTINGS::INPUT::scroll_modifier_pan_h, COMMON_SETTINGS::INPUT::scroll_modifier_pan_v, COMMON_SETTINGS::INPUT::scroll_modifier_zoom, COMMON_SETTINGS::INPUT::zoom_acceleration, COMMON_SETTINGS::INPUT::zoom_speed, and COMMON_SETTINGS::INPUT::zoom_speed_auto.

Referenced by WX_VIEW_CONTROLS().

◆ onButton()

◆ onCaptureLost()

void WX_VIEW_CONTROLS::onCaptureLost ( wxMouseEvent &  WXUNUSEDaEvent)

Definition at line 537 of file wx_view_controls.cpp.

References EDA_DRAW_PANEL_GAL::m_MouseCapturedLost, and m_parentPanel.

Referenced by WX_VIEW_CONTROLS().

◆ onEnter()

void WX_VIEW_CONTROLS::onEnter ( wxMouseEvent &  WXUNUSEDaEvent)

◆ onLeave()

void WX_VIEW_CONTROLS::onLeave ( wxMouseEvent &  WXUNUSEDaEvent)

Definition at line 530 of file wx_view_controls.cpp.

References onMotion().

Referenced by WX_VIEW_CONTROLS().

◆ onMagnify()

void WX_VIEW_CONTROLS::onMagnify ( wxMouseEvent &  aEvent)

◆ onMotion()

◆ onScroll()

◆ onTimer()

◆ onWheel()

◆ PinCursorInsideNonAutoscrollArea()

void WX_VIEW_CONTROLS::PinCursorInsideNonAutoscrollArea ( bool  aWarpMouseCursor)
overridevirtual

Return the current mouse pointer position.

Note
The position may be different from the cursor position if snapping is enabled (
See also
GetCursorPosition()).
Note
The position is clamped if outside of coordinates representation limits.
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.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 865 of file wx_view_controls.cpp.

References GetMousePosition(), KIGFX::VIEW::GetScreenPixelSize(), KIGFX::VC_SETTINGS::m_autoPanMargin, KIGFX::VIEW_CONTROLS::m_settings, KIGFX::VIEW_CONTROLS::m_view, SetCursorPosition(), KIGFX::VIEW::ToWorld(), WarpMouseCursor(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ refreshMouse()

void WX_VIEW_CONTROLS::refreshMouse ( bool  aSetModifiers)
private

Send an event to refresh mouse position.

It is mostly used for notifying the tools that the cursor position in the world coordinates has changed, whereas the screen coordinates remained the same (e.g. frame edge autopanning).

Parameters
aSetModifiersIf false, don't change the modifiers (they were set using the keyboard motion)

Definition at line 1008 of file wx_view_controls.cpp.

References EVT_REFRESH_MOUSE, GetClampedCoords(), getMouseScreenPosition(), m_cursorPos, m_parentPanel, KIGFX::VIEW_CONTROLS::m_view, and KIGFX::VIEW::ToWorld().

Referenced by onTimer(), onWheel(), UpdateScrollbars(), and WarpMouseCursor().

◆ Reset()

void VIEW_CONTROLS::Reset ( )
virtualinherited

Restore the default VIEW_CONTROLS settings.

Return the current VIEW_CONTROLS settings.

Definition at line 50 of file view_controls.cpp.

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

◆ SetAutoPan()

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

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

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_DRAWING_TOOLS::DrawTable(), DRAWING_TOOL::DrawTable(), DRAWING_TOOL::DrawZone(), ROUTER_TOOL::finishInteractive(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceReferenceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::PlaceTuningPattern(), ROUTER_TOOL::prepareInteractive(), PCB_POINT_EDITOR::Reset(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), PCB_SELECTION_TOOL::selectTableCells(), EE_SELECTION_TOOL::selectTableCells(), 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)
inlinevirtualinherited

Set the speed of autopanning.

Parameters
aSpeedis a new speed for autopanning.

Definition at line 194 of file view_controls.h.

◆ SetAutoPanMargin()

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

Set the margin for autopanning (ie.

the area when autopanning becomes active).

Parameters
aMarginis a new margin for autopanning.

Definition at line 204 of file view_controls.h.

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().

◆ SetAutoPanSpeed()

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

Set the speed of autopanning.

Parameters
aSpeedis a new speed for autopanning.

Definition at line 184 of file view_controls.h.

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().

◆ SetCrossHairCursorPosition()

void WX_VIEW_CONTROLS::SetCrossHairCursorPosition ( const VECTOR2D aPosition,
bool  aWarpView = true 
)
overridevirtual

◆ SetCursorPosition()

void WX_VIEW_CONTROLS::SetCursorPosition ( const VECTOR2D aPosition,
bool  warpView,
bool  aTriggeredByArrows,
long  aArrowCommand 
)
overridevirtual

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.

Implements KIGFX::VIEW_CONTROLS.

Definition at line 768 of file wx_view_controls.cpp.

References GetClampedCoords(), m_cursorPos, KIGFX::VIEW_CONTROLS::m_cursorWarped, KIGFX::VC_SETTINGS::m_lastKeyboardCursorCommand, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPosition, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPositionValid, KIGFX::VIEW_CONTROLS::m_settings, m_updateCursor, and WarpMouseCursor().

Referenced by PinCursorInsideNonAutoscrollArea().

◆ SetGrabMouse()

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

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

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().

◆ setState()

void WX_VIEW_CONTROLS::setState ( STATE  aNewState)
private

Sets the interaction state, simply a internal setter to make it easier to debug changes.

Definition at line 441 of file wx_view_controls.cpp.

References m_state.

Referenced by CancelDrag(), handleAutoPanning(), onButton(), and onTimer().

◆ ShowCursor()

void VIEW_CONTROLS::ShowCursor ( bool  aEnabled)
virtualinherited

Enable or disables display of cursor.

Parameters
aEnableddecides if the cursor should be shown.

Definition at line 34 of file view_controls.cpp.

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

Referenced by KIGFX::VIEW_CONTROLS::ApplySettings(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_DRAWING_TOOLS::DrawTable(), DRAWING_TOOL::DrawTable(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), SCH_DRAWING_TOOLS::ImportGraphics(), SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), 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::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceReferenceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::PlaceTuningPattern(), 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().

◆ UpdateScrollbars()

◆ WarpMouseCursor()

void WX_VIEW_CONTROLS::WarpMouseCursor ( const VECTOR2D aPosition,
bool  aWorldCoordinates = false,
bool  aWarpView = false 
)
overridevirtual

Member Data Documentation

◆ EVT_REFRESH_MOUSE

const wxEventType WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE = wxNewEventType()
static

◆ m_cursorPos

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_cursorPos
private

Flag deciding whether the cursor position should be calculated using the mouse position.

Definition at line 198 of file wx_view_controls.h.

Referenced by GetRawCursorPosition(), onMotion(), refreshMouse(), SetCrossHairCursorPosition(), and SetCursorPosition().

◆ m_cursorWarped

bool KIGFX::VIEW_CONTROLS::m_cursorWarped
protectedinherited

Current VIEW_CONTROLS settings.

Definition at line 386 of file view_controls.h.

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

◆ m_dragStartPoint

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_dragStartPoint
private

Current direction of panning (only autopanning mode).

Definition at line 175 of file wx_view_controls.h.

Referenced by CenterOnCursor(), onButton(), and onMotion().

◆ m_infinitePanWorks

bool KIGFX::WX_VIEW_CONTROLS::m_infinitePanWorks
private

A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific.

Definition at line 204 of file wx_view_controls.h.

Referenced by onButton(), and onMotion().

◆ m_MotionEventCounter

std::unique_ptr<PROF_COUNTER> KIGFX::WX_VIEW_CONTROLS::m_MotionEventCounter

Definition at line 119 of file wx_view_controls.h.

Referenced by EVT_UPDATE_UI_RANGE(), and WX_VIEW_CONTROLS().

◆ m_panDirection

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_panDirection
private

Timer responsible for handling autopanning.

Definition at line 178 of file wx_view_controls.h.

Referenced by handleAutoPanning(), and onTimer().

◆ m_panTimer

wxTimer KIGFX::WX_VIEW_CONTROLS::m_panTimer
private

Ratio used for scaling world coordinates to scrollbar position.

Definition at line 181 of file wx_view_controls.h.

Referenced by handleAutoPanning(), onTimer(), and WX_VIEW_CONTROLS().

◆ m_parentPanel

EDA_DRAW_PANEL_GAL* KIGFX::WX_VIEW_CONTROLS::m_parentPanel
private

◆ m_scrollPos

VECTOR2I KIGFX::WX_VIEW_CONTROLS::m_scrollPos
private

The mouse position when a drag zoom started.

Definition at line 187 of file wx_view_controls.h.

Referenced by UpdateScrollbars().

◆ m_scrollScale

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_scrollScale
private

Current scrollbar position.

Definition at line 184 of file wx_view_controls.h.

Referenced by onScroll(), and UpdateScrollbars().

◆ m_settings

◆ m_state

STATE KIGFX::WX_VIEW_CONTROLS::m_state
private

Panel that is affected by VIEW_CONTROLS.

Definition at line 169 of file wx_view_controls.h.

Referenced by CancelDrag(), CaptureCursor(), handleAutoPanning(), onButton(), onMotion(), onTimer(), and setState().

◆ m_updateCursor

bool KIGFX::WX_VIEW_CONTROLS::m_updateCursor
private

Flag to indicate if infinite panning works on this platform.

Definition at line 201 of file wx_view_controls.h.

Referenced by onMotion(), SetCrossHairCursorPosition(), SetCursorPosition(), and WarpMouseCursor().

◆ m_view

VIEW* KIGFX::VIEW_CONTROLS::m_view
protectedinherited

◆ m_zoomController

std::unique_ptr<ZOOM_CONTROLLER> KIGFX::WX_VIEW_CONTROLS::m_zoomController
private

Definition at line 207 of file wx_view_controls.h.

Referenced by LoadSettings(), and onWheel().

◆ m_zoomStartPoint

VECTOR2D KIGFX::WX_VIEW_CONTROLS::m_zoomStartPoint
private

Current cursor position (world coordinates).

Definition at line 190 of file wx_view_controls.h.

Referenced by onButton(), and onMotion().


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