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 | 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_SETTINGS & | GetSettings () 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_COUNTER > | m_MotionEventCounter |
Static Public Attributes | |
static const wxEventType | EVT_REFRESH_MOUSE = wxNewEventType() |
Protected Attributes | |
VIEW * | m_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_GAL * | m_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_CONTROLLER > | m_zoomController |
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 123 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(), onScroll(), onTimer(), and onWheel().
|
virtual |
Definition at line 146 of file wx_view_controls.cpp.
References m_parentPanel.
|
inherited |
Load new settings from program common settings.
Definition at line 89 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 | ( | ) |
Definition at line 718 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 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.
|
overridevirtual |
Adjusts the scrollbars position to match the current viewport.
Implements KIGFX::VIEW_CONTROLS.
Definition at line 847 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 174 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 345 of file view_controls.h.
|
overridevirtual |
Applies VIEW_CONTROLS settings from the program COMMON_SETTINGS.
Reimplemented from KIGFX::VIEW_CONTROLS.
Definition at line 1076 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 235 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.
Return the current cursor position in world coordinates ignoring the cursorUp position force mode.
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().
|
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 731 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.
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().
|
overridevirtual |
Return the current cursor position in world coordinates ignoring the cursorUp position force mode.
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().
|
inlineinherited |
Apply VIEW_CONTROLS settings from an object.
Definition at line 370 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 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().
|
private |
Limit the cursor position to within the canvas by warping it.
x | Mouse position |
y | Mouse 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().
|
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 353 of file view_controls.h.
Referenced by onWheel().
|
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().
void WX_VIEW_CONTROLS::onButton | ( | wxMouseEvent & | aEvent | ) |
Definition at line 446 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 537 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 502 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 530 of file wx_view_controls.cpp.
References onMotion().
Referenced by WX_VIEW_CONTROLS().
void WX_VIEW_CONTROLS::onMagnify | ( | wxMouseEvent & | aEvent | ) |
Definition at line 431 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 198 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::onScroll | ( | wxScrollWinEvent & | aEvent | ) |
Definition at line 615 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 548 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 346 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::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().
|
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 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.
|
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 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().
|
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().
|
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 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().
|
inlinevirtualinherited |
Set the speed of autopanning.
aSpeed | is a new speed for autopanning. |
Definition at line 194 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 204 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 184 of file view_controls.h.
Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().
|
overridevirtual |
Implements KIGFX::VIEW_CONTROLS.
Definition at line 795 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 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 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().
|
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 153 of file view_controls.h.
Referenced by KIGFX::VIEW_CONTROLS::ApplySettings().
|
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().
|
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(), 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().
void WX_VIEW_CONTROLS::UpdateScrollbars | ( | ) |
End any mouse drag action still in progress.
Definition at line 1037 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 |
Set the viewport center to the current cursor position and warps the cursor to the screen center.
Implements KIGFX::VIEW_CONTROLS.
Definition at line 813 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 |
Definition at line 117 of file wx_view_controls.h.
Referenced by TOOL_DISPATCHER::DispatchWxEvent(), EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), and refreshMouse().
|
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().
|
protectedinherited |
Current VIEW_CONTROLS settings.
Definition at line 386 of file view_controls.h.
Referenced by handleAutoPanning(), SetCursorPosition(), and WX_VIEW_CONTROLS().
|
private |
Current direction of panning (only autopanning mode).
Definition at line 175 of file wx_view_controls.h.
Referenced by CenterOnCursor(), onButton(), and onMotion().
|
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().
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().
|
private |
Timer responsible for handling autopanning.
Definition at line 178 of file wx_view_controls.h.
Referenced by handleAutoPanning(), and onTimer().
|
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().
|
private |
Store information about point where dragging has started.
Definition at line 172 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 |
The mouse position when a drag zoom started.
Definition at line 187 of file wx_view_controls.h.
Referenced by UpdateScrollbars().
|
private |
Current scrollbar position.
Definition at line 184 of file wx_view_controls.h.
Referenced by onScroll(), and UpdateScrollbars().
|
protectedinherited |
Definition at line 389 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 |
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().
|
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().
|
protectedinherited |
< Pointer to controlled VIEW.
Application warped the cursor, not the user (keyboard).
Definition at line 383 of file view_controls.h.
Referenced by CenterOnCursor(), GetMousePosition(), GetRawCursorPosition(), handleAutoPanning(), onMagnify(), onMotion(), onScroll(), onTimer(), onWheel(), PinCursorInsideNonAutoscrollArea(), refreshMouse(), SetCrossHairCursorPosition(), KIGFX::VIEW_CONTROLS::ShowCursor(), UpdateScrollbars(), and WarpMouseCursor().
|
private |
Definition at line 207 of file wx_view_controls.h.
Referenced by LoadSettings(), and onWheel().
|
private |
Current cursor position (world coordinates).
Definition at line 190 of file wx_view_controls.h.
Referenced by onButton(), and onMotion().