KiCad PCB EDA Suite
|
An implementation of class VIEW_CONTROLS for wxWidgets library. More...
#include <wx_view_controls.h>
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 | onZoomGesture (wxZoomGestureEvent &aEvent) |
void | onPanGesture (wxPanGestureEvent &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 |
VECTOR2D | GetMousePosition (bool aWorldCoordinates=true) const override |
Return the current mouse pointer position. | |
VECTOR2D | GetCursorPosition (bool aSnappingEnabled) const override |
Return the current cursor position in world coordinates. | |
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 cursor to the requested position expressed in world coordinates. | |
void | SetCrossHairCursorPosition (const VECTOR2D &aPosition, bool aWarpView) override |
Move the graphic crosshair cursor to the requested position expressed in world coordinates. | |
void | WarpMouseCursor (const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false) override |
void | CenterOnCursor () override |
Set the viewport center to the current cursor position and warps the cursor to the screen center. | |
void | UpdateScrollbars () |
Adjusts the scrollbars position to match the current viewport. | |
void | CancelDrag () |
End any mouse drag action still in progress. | |
void | ForceCursorPosition (bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0)) override |
Place the cursor immediately at a given point. | |
void | LoadSettings () override |
Applies VIEW_CONTROLS settings from the program COMMON_SETTINGS. | |
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_SETTINGS & | GetSettings () const |
Return the current VIEW_CONTROLS settings. | |
void | ApplySettings (const VC_SETTINGS &aSettings) |
Apply VIEW_CONTROLS settings from an object. | |
Public Attributes | |
std::unique_ptr< PROF_COUNTER > | m_MotionEventCounter |
Static Public Attributes | |
static const wxEventType | EVT_REFRESH_MOUSE = wxNewEventType() |
Event that forces mouse move event in the dispatcher (eg. | |
Protected Attributes | |
VIEW * | m_view |
Pointer to controlled VIEW. | |
bool | m_cursorWarped |
Application warped the cursor, not the user (keyboard). | |
VC_SETTINGS | m_settings |
Current VIEW_CONTROLS 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) |
Set 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 |
Current state of VIEW_CONTROLS. | |
EDA_DRAW_PANEL_GAL * | m_parentPanel |
Panel that is affected by VIEW_CONTROLS. | |
VECTOR2D | m_dragStartPoint |
Store information about point where dragging has started. | |
VECTOR2D | m_panDirection |
Current direction of panning (only autopanning mode). | |
wxTimer | m_panTimer |
Timer responsible for handling autopanning. | |
VECTOR2D | m_scrollScale |
Ratio used for scaling world coordinates to scrollbar position. | |
VECTOR2I | m_scrollPos |
Current scrollbar position. | |
VECTOR2D | m_zoomStartPoint |
The mouse position when a drag zoom started. | |
VECTOR2D | m_cursorPos |
Current cursor position (world coordinates). | |
bool | m_updateCursor |
Flag deciding whether the cursor position should be calculated using the mouse position. | |
bool | m_infinitePanWorks |
Flag to indicate if infinite panning works on this platform. | |
std::unique_ptr< ZOOM_CONTROLLER > | m_zoomController |
A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific. | |
double | m_gestureLastZoomFactor |
Used to track gesture events. | |
VECTOR2D | m_gestureLastPos |
An implementation of class VIEW_CONTROLS for wxWidgets library.
Definition at line 51 of file wx_view_controls.h.
|
private |
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 125 of file wx_view_controls.h.
WX_VIEW_CONTROLS::WX_VIEW_CONTROLS | ( | VIEW * | aView, |
EDA_DRAW_PANEL_GAL * | aParentPanel | ||
) |
Definition at line 75 of file wx_view_controls.cpp.
References LoadSettings(), KIGFX::VIEW_CONTROLS::m_cursorWarped, KIGFX::VC_SETTINGS::m_lastKeyboardCursorCommand, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPosition, KIGFX::VC_SETTINGS::m_lastKeyboardCursorPositionValid, m_MotionEventCounter, m_panTimer, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, onButton(), onCaptureLost(), onEnter(), onLeave(), onMagnify(), onMotion(), onPanGesture(), onScroll(), onTimer(), onWheel(), and onZoomGesture().
|
virtual |
Definition at line 152 of file wx_view_controls.cpp.
References m_parentPanel.
|
inherited |
Apply VIEW_CONTROLS settings from an object.
Definition at line 90 of file view_controls.cpp.
References KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW_CONTROLS::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::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW_CONTROLS::SetAutoPanMargin(), KIGFX::VIEW_CONTROLS::SetAutoPanSpeed(), KIGFX::VIEW_CONTROLS::SetGrabMouse(), and KIGFX::VIEW_CONTROLS::ShowCursor().
Referenced by TOOL_MANAGER::applyViewControls(), DIALOG_PAD_PROPERTIES::prepareCanvas(), and KIGFX::VIEW_CONTROLS::Reset().
void WX_VIEW_CONTROLS::CancelDrag | ( | ) |
End any mouse drag action still in progress.
Definition at line 785 of file wx_view_controls.cpp.
References DRAG_PANNING, DRAG_ZOOMING, IDLE, KIGFX::VC_SETTINGS::m_cursorCaptured, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, m_state, and setState().
Referenced by EDA_DRAW_PANEL_GAL::onLostFocus().
|
overridevirtual |
Force the cursor to stay within the drawing panel area.
aEnabled | determines if the cursor should be captured. |
Reimplemented from KIGFX::VIEW_CONTROLS.
Definition at line 754 of file wx_view_controls.cpp.
References KIGFX::VIEW_CONTROLS::CaptureCursor(), DRAG_PANNING, DRAG_ZOOMING, KIUI::IsModalDialogFocused(), EDA_DRAW_PANEL_GAL::m_MouseCapturedLost, m_parentPanel, and m_state.
|
overridevirtual |
Set the viewport center to the current cursor position and warps the cursor to the screen center.
Implements KIGFX::VIEW_CONTROLS.
Definition at line 915 of file wx_view_controls.cpp.
References GetCursorPosition(), KIGFX::VIEW::GetGAL(), GetMousePosition(), KIGFX::GAL::GetScreenPixelSize(), m_dragStartPoint, m_parentPanel, KIGFX::VIEW_CONTROLS::m_view, KIGFX::VIEW::SetCenter(), KIPLATFORM::UI::WarpPointer(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by onWheel().
|
inlinevirtualinherited |
Turn on/off auto panning (user setting to disable it entirely).
aEnabled | tells if the autopanning should be enabled. |
Definition at line 178 of file view_controls.h.
|
inlineinherited |
Enable or disable warping the cursor.
aEnable | is true if the cursor is allowed to be warped. |
Definition at line 349 of file view_controls.h.
|
overridevirtual |
Place the cursor immediately at a given point.
Mouse movement is ignored.
aEnabled | enable forced cursor position |
aPosition | the position (world coordinates). |
Reimplemented from KIGFX::VIEW_CONTROLS.
Definition at line 1145 of file wx_view_controls.cpp.
References GetClampedCoords(), KIGFX::VC_SETTINGS::m_forceCursorPosition, KIGFX::VC_SETTINGS::m_forcedPosition, and KIGFX::VIEW_CONTROLS::m_settings.
|
inline |
Return the current cursor position in world coordinates.
Definition at line 239 of file view_controls.h.
Referenced by CenterOnCursor().
|
virtual |
Return the current cursor position in world coordinates.
aEnableSnapping | selects whether cursor position should be snapped to the grid. |
Implements KIGFX::VIEW_CONTROLS.
|
overridevirtual |
Return the current cursor position in world coordinates.
Implements KIGFX::VIEW_CONTROLS.
Definition at line 823 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().
|
overridevirtual |
Return the current mouse pointer position.
aWorldCoordinates | if true, the result is given in world coordinates, otherwise it is given in screen coordinates. |
Implements KIGFX::VIEW_CONTROLS.
Definition at line 799 of file wx_view_controls.cpp.
References GetClampedCoords(), getMouseScreenPosition(), KIGFX::VIEW_CONTROLS::m_view, and KIGFX::VIEW::ToWorld().
Referenced by CenterOnCursor(), and PinCursorInsideNonAutoscrollArea().
|
private |
Get the cursor position in the screen coordinates.
Definition at line 1097 of file wx_view_controls.cpp.
References KIPLATFORM::UI::GetMousePosition(), and m_parentPanel.
Referenced by GetMousePosition(), and refreshMouse().
|
overridevirtual |
Return the current cursor position in world coordinates ignoring the cursorUp position force mode.
Implements KIGFX::VIEW_CONTROLS.
Definition at line 808 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().
|
inlineinherited |
Return the current VIEW_CONTROLS settings.
Definition at line 374 of file view_controls.h.
Referenced by EDIT_TOOL::doMoveSelection(), TOOL_MANAGER::GetCurrentToolVC(), DIALOG_PAD_PROPERTIES::prepareCanvas(), and TOOL_MANAGER::saveViewControls().
|
private |
Compute new viewport settings while in autopanning mode.
aEvent | is an event to be processed and decide if autopanning should happen. |
Definition at line 965 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().
|
private |
Limit the cursor position to within the canvas by warping it.
x | Mouse position |
y | Mouse position |
Definition at line 1041 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().
|
inherited |
Return true when cursor is visible.
Definition at line 41 of file view_controls.cpp.
References KIGFX::VIEW_CONTROLS::m_settings, and KIGFX::VC_SETTINGS::m_showCursor.
|
inlineinherited |
Definition at line 357 of file view_controls.h.
Referenced by onWheel().
|
overridevirtual |
Applies VIEW_CONTROLS settings from the program COMMON_SETTINGS.
Reimplemented from KIGFX::VIEW_CONTROLS.
Definition at line 161 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::VC_SETTINGS::m_scrollReverseZoom, 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, COMMON_SETTINGS::INPUT::reverse_scroll_zoom, 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().
void WX_VIEW_CONTROLS::onButton | ( | wxMouseEvent & | aEvent | ) |
Definition at line 474 of file wx_view_controls.cpp.
References AUTO_PANNING, DRAG_PANNING, DRAG_ZOOMING, IDLE, KIPLATFORM::UI::InfiniteDragPrepareWindow(), KIPLATFORM::UI::InfiniteDragReleaseWindow(), KIGFX::VC_SETTINGS::m_cursorCaptured, KIGFX::VC_SETTINGS::m_dragMiddle, KIGFX::VC_SETTINGS::m_dragRight, m_dragStartPoint, m_infinitePanWorks, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, m_state, m_zoomStartPoint, and setState().
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onCaptureLost | ( | wxMouseEvent & | WXUNUSEDaEvent | ) |
Definition at line 566 of file wx_view_controls.cpp.
References EDA_DRAW_PANEL_GAL::m_MouseCapturedLost, and m_parentPanel.
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onEnter | ( | wxMouseEvent & | WXUNUSEDaEvent | ) |
Definition at line 530 of file wx_view_controls.cpp.
References KIUI::IsInputControlFocused(), KIPLATFORM::UI::IsWindowActive(), m_parentPanel, and EDA_DRAW_PANEL_GAL::SetFocus().
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onLeave | ( | wxMouseEvent & | WXUNUSEDaEvent | ) |
Definition at line 558 of file wx_view_controls.cpp.
References onMotion().
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onMagnify | ( | wxMouseEvent & | aEvent | ) |
Definition at line 458 of file wx_view_controls.cpp.
References anchor, KIGFX::VIEW::GetScale(), KIGFX::VIEW_CONTROLS::m_view, KIGFX::VIEW::SetScale(), and KIGFX::VIEW::ToWorld().
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onMotion | ( | wxMouseEvent & | aEvent | ) |
Definition at line 205 of file wx_view_controls.cpp.
References delta, DRAG_PANNING, DRAG_ZOOMING, FRAME_PCB_EDITOR, FRAME_SCH, KIGFX::VIEW::GetCenter(), GetClampedCoords(), KIPLATFORM::UI::GetMousePosition(), EDA_DRAW_PANEL_GAL::GetParentEDAFrame(), KIGFX::VIEW::GetScale(), handleAutoPanning(), handleCursorCapture(), KIPLATFORM::UI::IsWindowActive(), KIWAY_HOLDER::Kiway(), KIGFX::VC_SETTINGS::m_autoPanEnabled, KIGFX::VC_SETTINGS::m_autoPanSettingEnabled, m_cursorPos, m_dragStartPoint, KIGFX::VC_SETTINGS::m_focusFollowSchPcb, m_infinitePanWorks, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, m_state, m_updateCursor, KIGFX::VIEW_CONTROLS::m_view, KIGFX::VC_SETTINGS::m_zoomSpeed, m_zoomStartPoint, KIWAY::Player(), scale, KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::ToWorld(), traceZoomScroll, KIPLATFORM::UI::WarpPointer(), and VECTOR2< T >::y.
Referenced by onLeave(), and WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onPanGesture | ( | wxPanGestureEvent & | aEvent | ) |
Definition at line 667 of file wx_view_controls.cpp.
References KIGFX::VIEW::GetCenter(), KIGFX::VIEW_CONTROLS::m_view, refreshMouse(), KIGFX::VIEW::SetCenter(), and KIGFX::VIEW::ToWorld().
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onScroll | ( | wxScrollWinEvent & | aEvent | ) |
Definition at line 678 of file wx_view_controls.cpp.
References delta, KIGFX::VIEW::GetBoundary(), KIGFX::VIEW::GetCenter(), KIGFX::VIEW::GetScreenPixelSize(), BOX2< Vec >::GetTop(), KIGFX::VIEW::IsMirroredX(), m_parentPanel, m_scrollScale, KIGFX::VIEW_CONTROLS::m_view, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onTimer | ( | wxTimerEvent & | WXUNUSEDaEvent | ) |
Definition at line 577 of file wx_view_controls.cpp.
References AUTO_PANNING, DRAG_PANNING, DRAG_ZOOMING, VECTOR2< T >::EuclideanNorm(), KIGFX::VIEW::GetCenter(), KIGFX::VIEW::GetScreenPixelSize(), IDLE, KIGFX::VC_SETTINGS::m_autoPanAcceleration, KIGFX::VC_SETTINGS::m_autoPanEnabled, KIGFX::VC_SETTINGS::m_autoPanMargin, m_panDirection, m_panTimer, m_parentPanel, KIGFX::VIEW_CONTROLS::m_settings, m_state, KIGFX::VIEW_CONTROLS::m_view, refreshMouse(), VECTOR2< T >::Resize(), KIGFX::VIEW::SetCenter(), setState(), EDA_DRAW_PANEL_GAL::StatusPopupHasFocus(), KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onWheel | ( | wxMouseEvent & | aEvent | ) |
Handler functions.
Definition at line 359 of file wx_view_controls.cpp.
References anchor, CenterOnCursor(), delta, KIGFX::VIEW::GetCenter(), KIGFX::VIEW::GetScale(), KIGFX::VIEW::GetScreenPixelSize(), KIGFX::VIEW_CONTROLS::IsCursorWarpingEnabled(), KIGFX::VC_SETTINGS::m_horizontalPan, KIGFX::VC_SETTINGS::m_scrollModifierPanH, KIGFX::VC_SETTINGS::m_scrollModifierZoom, KIGFX::VC_SETTINGS::m_scrollReversePanH, KIGFX::VC_SETTINGS::m_scrollReverseZoom, KIGFX::VIEW_CONTROLS::m_settings, KIGFX::VIEW_CONTROLS::m_view, m_zoomController, refreshMouse(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onZoomGesture | ( | wxZoomGestureEvent & | aEvent | ) |
Definition at line 644 of file wx_view_controls.cpp.
References KIGFX::VIEW::GetCenter(), KIGFX::VIEW::GetScale(), m_gestureLastPos, m_gestureLastZoomFactor, KIGFX::VIEW_CONTROLS::m_view, refreshMouse(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetScale(), and KIGFX::VIEW::ToWorld().
Referenced by WX_VIEW_CONTROLS().
|
overridevirtual |
Implements KIGFX::VIEW_CONTROLS.
Definition at line 933 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.
|
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).
aSetModifiers | If false, don't change the modifiers (they were set using the keyboard motion). |
Definition at line 1076 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 onPanGesture(), onTimer(), onWheel(), onZoomGesture(), UpdateScrollbars(), and WarpMouseCursor().
|
virtualinherited |
Restore the default VIEW_CONTROLS settings.
Definition at line 50 of file view_controls.cpp.
References KIGFX::VIEW_CONTROLS::ApplySettings(), and dummy.
|
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).
aEnabled | tells if the autopanning should be active. |
Definition at line 168 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(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawOneBezier(), SCH_DRAWING_TOOLS::DrawRuleArea(), 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(), POSITION_RELATIVE_TOOL::PositionRelativeInteractively(), 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().
|
inlinevirtualinherited |
Set the speed of autopanning.
aSpeed | is a new speed for autopanning. |
Definition at line 198 of file view_controls.h.
|
inlinevirtualinherited |
Set the margin for autopanning (ie.
the area when autopanning becomes active).
aMargin | is a new margin for autopanning. |
Definition at line 208 of file view_controls.h.
Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().
|
inlinevirtualinherited |
Set the speed of autopanning.
aSpeed | is a new speed for autopanning. |
Definition at line 188 of file view_controls.h.
Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().
|
overridevirtual |
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
aPosition | is the requested cursor position in the world coordinates. |
aWarpView | enables/disables view warp if the cursor is outside the current viewport. |
Implements KIGFX::VIEW_CONTROLS.
Definition at line 863 of file wx_view_controls.cpp.
References BOX2< Vec >::Contains(), GetClampedCoords(), KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetScreenPixelSize(), m_cursorPos, m_updateCursor, KIGFX::VIEW_CONTROLS::m_view, KIGFX::VIEW::SetCenter(), and KIGFX::VIEW::ToScreen().
|
overridevirtual |
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.
aPosition | is the requested cursor position in the world coordinates. |
aWarpView | enables/disables view warp if the cursor is outside the current viewport. |
Implements KIGFX::VIEW_CONTROLS.
Definition at line 836 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().
|
inlinevirtualinherited |
Turn on/off mouse grabbing.
When the mouse is grabbed, it cannot go outside the VIEW.
aEnabled | tells if mouse should be grabbed or not. |
Definition at line 157 of file view_controls.h.
Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().
|
private |
Set the interaction state, simply a internal setter to make it easier to debug changes.
Definition at line 468 of file wx_view_controls.cpp.
References m_state.
Referenced by CancelDrag(), handleAutoPanning(), onButton(), and onTimer().
|
virtualinherited |
Enable or disables display of cursor.
aEnabled | decides 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(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawOneBezier(), SCH_DRAWING_TOOLS::DrawRuleArea(), 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(), SCH_DRAWING_TOOLS::ImportSheet(), 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(), POSITION_RELATIVE_TOOL::PositionRelativeInteractively(), 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().
void WX_VIEW_CONTROLS::UpdateScrollbars | ( | ) |
Adjusts the scrollbars position to match the current viewport.
Definition at line 1105 of file wx_view_controls.cpp.
References BOX2< Vec >::Centre(), KIGFX::VIEW::GetBoundary(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), KIGFX::VIEW::GetViewport(), BOX2< Vec >::GetWidth(), KIGFX::VIEW::IsMirroredX(), m_parentPanel, m_scrollPos, m_scrollScale, KIGFX::VIEW_CONTROLS::m_view, refreshMouse(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().
|
overridevirtual |
Implements KIGFX::VIEW_CONTROLS.
Definition at line 881 of file wx_view_controls.cpp.
References BOX2< Vec >::Contains(), GetClampedCoords(), KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetScreenPixelSize(), m_parentPanel, m_updateCursor, KIGFX::VIEW_CONTROLS::m_view, refreshMouse(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::ToScreen(), KIPLATFORM::UI::WarpPointer(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PinCursorInsideNonAutoscrollArea(), and SetCursorPosition().
|
static |
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)
Definition at line 119 of file wx_view_controls.h.
Referenced by TOOL_DISPATCHER::DispatchWxEvent(), EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), and refreshMouse().
|
private |
Current cursor position (world coordinates).
Definition at line 197 of file wx_view_controls.h.
Referenced by GetRawCursorPosition(), onMotion(), refreshMouse(), SetCrossHairCursorPosition(), and SetCursorPosition().
|
protectedinherited |
Application warped the cursor, not the user (keyboard).
Definition at line 390 of file view_controls.h.
Referenced by handleAutoPanning(), SetCursorPosition(), and WX_VIEW_CONTROLS().
|
private |
Store information about point where dragging has started.
Definition at line 179 of file wx_view_controls.h.
Referenced by CenterOnCursor(), onButton(), and onMotion().
|
private |
Definition at line 210 of file wx_view_controls.h.
Referenced by onZoomGesture().
|
private |
Used to track gesture events.
Definition at line 209 of file wx_view_controls.h.
Referenced by onZoomGesture().
|
private |
Flag to indicate if infinite panning works on this platform.
Definition at line 203 of file wx_view_controls.h.
Referenced by onButton(), and onMotion().
std::unique_ptr<PROF_COUNTER> KIGFX::WX_VIEW_CONTROLS::m_MotionEventCounter |
Definition at line 121 of file wx_view_controls.h.
Referenced by EVT_UPDATE_UI_RANGE(), and WX_VIEW_CONTROLS().
|
private |
Current direction of panning (only autopanning mode).
Definition at line 182 of file wx_view_controls.h.
Referenced by handleAutoPanning(), and onTimer().
|
private |
Timer responsible for handling autopanning.
Definition at line 185 of file wx_view_controls.h.
Referenced by handleAutoPanning(), onTimer(), and WX_VIEW_CONTROLS().
|
private |
Panel that is affected by VIEW_CONTROLS.
Definition at line 176 of file wx_view_controls.h.
Referenced by CancelDrag(), CaptureCursor(), CenterOnCursor(), getMouseScreenPosition(), handleCursorCapture(), onButton(), onCaptureLost(), onEnter(), onMotion(), onScroll(), onTimer(), refreshMouse(), UpdateScrollbars(), WarpMouseCursor(), WX_VIEW_CONTROLS(), and ~WX_VIEW_CONTROLS().
|
private |
Current scrollbar position.
Definition at line 191 of file wx_view_controls.h.
Referenced by UpdateScrollbars().
|
private |
Ratio used for scaling world coordinates to scrollbar position.
Definition at line 188 of file wx_view_controls.h.
Referenced by onScroll(), and UpdateScrollbars().
|
protectedinherited |
Current VIEW_CONTROLS settings.
Definition at line 393 of file view_controls.h.
Referenced by CancelDrag(), ForceCursorPosition(), GetCursorPosition(), handleAutoPanning(), handleCursorCapture(), KIGFX::VIEW_CONTROLS::IsCursorShown(), LoadSettings(), onButton(), onMotion(), onTimer(), onWheel(), PinCursorInsideNonAutoscrollArea(), SetCursorPosition(), KIGFX::VIEW_CONTROLS::ShowCursor(), and WX_VIEW_CONTROLS().
|
private |
Current state of VIEW_CONTROLS.
Definition at line 173 of file wx_view_controls.h.
Referenced by CancelDrag(), CaptureCursor(), handleAutoPanning(), onButton(), onMotion(), onTimer(), and setState().
|
private |
Flag deciding whether the cursor position should be calculated using the mouse position.
Definition at line 200 of file wx_view_controls.h.
Referenced by onMotion(), SetCrossHairCursorPosition(), SetCursorPosition(), and WarpMouseCursor().
|
protectedinherited |
Pointer to controlled VIEW.
Definition at line 387 of file view_controls.h.
Referenced by CenterOnCursor(), GetMousePosition(), GetRawCursorPosition(), handleAutoPanning(), onMagnify(), onMotion(), onPanGesture(), onScroll(), onTimer(), onWheel(), onZoomGesture(), PinCursorInsideNonAutoscrollArea(), refreshMouse(), SetCrossHairCursorPosition(), KIGFX::VIEW_CONTROLS::ShowCursor(), UpdateScrollbars(), and WarpMouseCursor().
|
private |
A #ZOOM_CONTROLLER that determines zoom steps. This is platform-specific.
Definition at line 206 of file wx_view_controls.h.
Referenced by LoadSettings(), and onWheel().
|
private |
The mouse position when a drag zoom started.
Definition at line 194 of file wx_view_controls.h.
Referenced by onButton(), and onMotion().