KiCad PCB EDA Suite
SCH_DRAW_PANEL Class Reference

#include <sch_draw_panel.h>

Inheritance diagram for SCH_DRAW_PANEL:
EDA_DRAW_PANEL EDA_DRAW_PANEL_GAL

Public Types

enum  GAL_TYPE { GAL_TYPE_NONE, GAL_TYPE_OPENGL, GAL_TYPE_CAIRO, GAL_TYPE_LAST }
 

Public Member Functions

 SCH_DRAW_PANEL (wxWindow *aParentWindow, wxWindowID aWindowId, const wxPoint &aPosition, const wxSize &aSize, KIGFX::GAL_DISPLAY_OPTIONS &aOptions, GAL_TYPE aGalType=GAL_TYPE_OPENGL)
 
 ~SCH_DRAW_PANEL ()
 
virtual wxWindow * GetWindow () override
 
void DisplayComponent (const LIB_PART *aComponent)
 Function DisplayBoard FIXME adds all items from the current board to the VIEW, so they can be displayed by GAL. More...
 
void DisplaySheet (const SCH_SHEET *aSheet)
 
void DisplaySheet (const SCH_SCREEN *aScreen)
 
void UseColorScheme (const COLORS_DESIGN_SETTINGS *aSettings)
 Function UseColorScheme Applies layer color settings. More...
 
void OnShow () override
 > More...
 
bool SwitchBackend (GAL_TYPE aGalType) override
 Function SwitchBackend Switches method of rendering graphics. More...
 
void OnMouseEvent (wxMouseEvent &event)
 
bool OnRightClick (wxMouseEvent &event)
 
void OnKeyEvent (wxKeyEvent &event)
 
void OnCharHook (wxKeyEvent &event)
 
void OnTimer (wxTimerEvent &event)
 
void SetEnableMousewheelPan (bool aEnable) override
 
void SetEnableZoomNoCenter (bool aEnable) override
 
void SetEnableAutoPan (bool aEnable) override
 
BASE_SCREENGetScreen () override
 
virtual EDA_DRAW_FRAMEGetParent () const override
 
virtual void CallMouseCapture (wxDC *aDC, const wxPoint &aPosition, bool aErase) override
 Function CallMouseCapture calls the mouse capture callback. More...
 
virtual void CallEndMouseCapture (wxDC *aDC) override
 Function CallEndMouseCapture calls the end mouse capture callback. More...
 
virtual void EndMouseCapture (int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true) override
 Function EndMouseCapture ends mouse a capture. More...
 
virtual void CrossHairOff (wxDC *DC=nullptr) override
 
virtual void CrossHairOn (wxDC *DC=nullptr) override
 
virtual void MoveCursorToCrossHair () override
 Function MoveCursorToCrossHair warps the cursor to the current cross hair position. More...
 
KIGFX::SCH_VIEWGetView () const
 
void Refresh (bool aEraseBackground=true, const wxRect *aRect=NULL) override
 Update the board display after modifying it by a python script (note: it is automatically called by action plugins, after running the plugin, so call this function is usually not needed inside action plugins. More...
 
virtual void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
virtual EDA_RECTGetClipBox ()
 
EDA_RECTGetClipBox ()
 
void SetClipBox (const EDA_RECT &aRect)
 
virtual void SetClipBox (wxDC &aDC, const wxRect *aRect=NULL)
 Function SetClipBox sets the clip box in drawing (logical) units from aRect in device units. More...
 
void SetClipBox (const EDA_RECT &aRect)
 
void SetClipBox (wxDC &aDC, const wxRect *aRect=NULL)
 Function SetClipBox sets the clip box in drawing (logical) units from aRect in device units. More...
 
bool GetAbortRequest () const
 
bool GetAbortRequest () const
 
void SetAbortRequest (bool aAbortRequest)
 
void SetAbortRequest (bool aAbortRequest)
 
bool GetEnableMousewheelPan () const
 
bool GetEnableMousewheelPan () const
 
bool GetEnableZoomNoCenter () const
 
bool GetEnableZoomNoCenter () const
 
bool GetEnableAutoPan () const
 
bool GetEnableAutoPan () const
 
void SetAutoPanRequest (bool aEnable)
 
void SetAutoPanRequest (bool aEnable)
 
void SetIgnoreMouseEvents (bool aIgnore)
 
void SetIgnoreMouseEvents (bool aIgnore)
 
void SetIgnoreLeftButtonReleaseEvent (bool aIgnore)
 
void SetIgnoreLeftButtonReleaseEvent (bool aIgnore)
 
void SetEnableBlockCommands (bool aEnable)
 
void SetEnableBlockCommands (bool aEnable)
 
bool GetPrintMirrored () const
 
bool GetPrintMirrored () const
 
void SetPrintMirrored (bool aMirror)
 
void SetPrintMirrored (bool aMirror)
 
void SetCanStartBlock (int aStartBlock)
 
void SetCanStartBlock (int aStartBlock)
 
virtual void DrawBackGround (wxDC *DC)
 Function DrawBackGround. More...
 
void DrawBackGround (wxDC *DC)
 Function DrawBackGround. More...
 
virtual void DrawGrid (wxDC *aDC)
 Function DrawGrid draws a grid to aDC. More...
 
void DrawGrid (wxDC *aDC)
 Function DrawGrid draws a grid to aDC. More...
 
virtual void DrawAuxiliaryAxis (wxDC *aDC, GR_DRAWMODE aDrawMode)
 Function DrawAuxiliaryAxis Draw the Auxiliary Axis, used in Pcbnew which as origin coordinates for gerber and excellon files. More...
 
void DrawAuxiliaryAxis (wxDC *aDC, GR_DRAWMODE aDrawMode)
 Function DrawAuxiliaryAxis Draw the Auxiliary Axis, used in Pcbnew which as origin coordinates for gerber and excellon files. More...
 
virtual void DrawGridAxis (wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aGridOrigin)
 Function DrawGridAxis Draw on auxiliary axis, used in Pcbnew to show grid origin, when the grid origin is set by user, and is not (0,0) More...
 
void DrawGridAxis (wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aGridOrigin)
 Function DrawGridAxis Draw on auxiliary axis, used in Pcbnew to show grid origin, when the grid origin is set by user, and is not (0,0) More...
 
virtual wxRect DeviceToLogical (const wxRect &aRect, wxDC &aDC)
 Function DeviceToLogical converts aRect from device to drawing (logical) coordinates. More...
 
wxRect DeviceToLogical (const wxRect &aRect, wxDC &aDC)
 Function DeviceToLogical converts aRect from device to drawing (logical) coordinates. More...
 
virtual void EraseScreen (wxDC *DC)
 Function OnMouseWheel handles mouse wheel events. More...
 
void EraseScreen (wxDC *DC)
 
virtual void SetZoom (double mode)
 
void SetZoom (double mode)
 
virtual double GetZoom ()
 
double GetZoom ()
 
virtual bool IsPointOnDisplay (const wxPoint &aPosition)
 Function IsPointOnDisplay. More...
 
bool IsPointOnDisplay (const wxPoint &aPosition)
 Function IsPointOnDisplay. More...
 
virtual void ReDraw (wxDC *aDC, bool aEraseBackground=true)
 
void ReDraw (wxDC *aDC, bool aEraseBackground=true)
 
virtual void RefreshDrawingRect (const EDA_RECT &aRect, bool aEraseBackground=true)
 Function RefreshDrawingRect redraws the contents of aRect in drawing units. More...
 
void RefreshDrawingRect (const EDA_RECT &aRect, bool aEraseBackground=true)
 Function RefreshDrawingRect redraws the contents of aRect in drawing units. More...
 
virtual wxPoint GetScreenCenterLogicalPosition ()
 Update the board display after modifying it by a python script (note: it is automatically called by action plugins, after running the plugin, so call this function is usually not needed inside action plugins. More...
 
wxPoint GetScreenCenterLogicalPosition ()
 Function GetScreenCenterLogicalPosition. More...
 
virtual wxPoint ToDeviceXY (const wxPoint &pos)
 Function ToDeviceXY transforms logical to device coordinates. More...
 
wxPoint ToDeviceXY (const wxPoint &pos)
 Function ToDeviceXY transforms logical to device coordinates. More...
 
virtual wxPoint ToLogicalXY (const wxPoint &pos)
 Function ToLogicalXY transforms device to logical coordinates. More...
 
wxPoint ToLogicalXY (const wxPoint &pos)
 Function ToLogicalXY transforms device to logical coordinates. More...
 
virtual void MoveCursor (const wxPoint &aPosition)
 Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units. More...
 
void MoveCursor (const wxPoint &aPosition)
 Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units. More...
 
virtual void DrawCrossHair (wxDC *aDC=nullptr, COLOR4D aColor=COLOR4D::WHITE)
 Function DrawCrossHair draws the user cross hair. More...
 
void DrawCrossHair (wxDC *aDC, COLOR4D aColor=COLOR4D::WHITE)
 Function DrawCrossHair draws the user cross hair. More...
 
virtual void SetMouseCapture (MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
 Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallback and aEndMouseCaptureCallback respectively. More...
 
void SetMouseCapture (MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
 Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallback and aEndMouseCaptureCallback respectively. More...
 
virtual void SetMouseCaptureCallback (MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
 
void SetMouseCaptureCallback (MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
 
bool IsMouseCaptured () const
 
bool IsMouseCaptured () const
 
void OnPaint (wxPaintEvent &event)
 
void OnEraseBackground (wxEraseEvent &event)
 
void OnActivate (wxActivateEvent &event)
 Function OnActivate handles window activation events. More...
 
virtual void DoPrepareDC (wxDC &aDC) override
 Function DoPrepareDC sets up the device context aDC for drawing. More...
 
void OnMouseWheel (wxMouseEvent &event)
 Function OnMouseWheel handles mouse wheel events. More...
 
void OnMouseEntering (wxMouseEvent &aEvent)
 
void OnMouseLeaving (wxMouseEvent &event)
 
void OnPan (wxCommandEvent &event)
 
void OnScrollWin (wxCommandEvent &event)
 
void OnScroll (wxScrollWinEvent &event)
 
void SetGrid (const wxRealPoint &size)
 
wxRealPoint GetGrid ()
 
void SetCurrentCursor (int aCursor)
 Function SetCurrentCursor Set the current cursor shape for drawpanel. More...
 
int GetDefaultCursor () const
 Function GetDefaultCursor. More...
 
int GetCurrentCursor () const
 Function GetCurrentCursor. More...
 
virtual void SetFocus () override
 
GAL_TYPE GetBackend () const
 Function GetBackend Returns the type of backend currently used by GAL canvas. More...
 
KIGFX::GALGetGAL () const
 Function GetGAL() Returns a pointer to the GAL instance used in the panel. More...
 
KIGFX::VIEW_CONTROLSGetViewControls () const
 Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel. More...
 
void ForceRefresh ()
 Function ForceRefresh() Forces a redraw. More...
 
void SetEventDispatcher (TOOL_DISPATCHER *aEventDispatcher)
 Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools. More...
 
void StartDrawing ()
 Function StartDrawing() Begins drawing if it was stopped previously. More...
 
void StopDrawing ()
 Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDrawing() is called. More...
 
virtual void SetHighContrastLayer (int aLayer)
 Function SetHighContrastLayer Takes care of display settings for the given layer to be displayed in high contrast mode. More...
 
virtual void SetTopLayer (int aLayer)
 Function SetTopLayer Moves the selected layer to the top, so it is displayed above all others. More...
 
virtual void GetMsgPanelInfo (EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList)
 
double GetLegacyZoom () const
 Function GetLegacyZoom() Returns current view scale converted to zoom value used by the legacy canvas. More...
 
EDA_DRAW_FRAMEGetParentEDAFrame () const
 Function GetParentEDAFrame() Returns parent EDA_DRAW_FRAME, if available or NULL otherwise. More...
 
void SetStealsFocus (bool aStealsFocus)
 Set whether focus is taken on certain events (mouseover, keys, etc). More...
 
bool GetStealsFocus () const
 Get whether focus is taken on certain events (see SetStealsFocus()). More...
 
virtual void SetDefaultCursor ()
 
virtual void SetCurrentCursor (int aCursor)
 Function SetCurrentCursor Set the current cursor shape for this panel. More...
 
virtual int GetDefaultCursor () const
 Function GetDefaultCursor. More...
 
int GetCurrentCursor () const
 Function GetCurrentCursor. More...
 
virtual BOX2I GetDefaultViewBBox () const
 Returns the bounding box of the view that should be used if model is not valid For example, the worksheet bounding box for an empty PCB. More...
 
void OnEvent (wxEvent &aEvent)
 Used to forward events to the canvas from popups, etc. More...
 

Protected Member Functions

virtual void onPaint (wxPaintEvent &WXUNUSED(aEvent)) override
 
KIGFX::SCH_VIEWview () const
 
void setDefaultLayerOrder ()
 

Reassigns layer order to the initial settings.

More...
 
void setDefaultLayerDeps ()
 

Sets rendering targets & dependencies for layers.

More...
 
void onSize (wxSizeEvent &aEvent)
 
void onEnter (wxEvent &aEvent)
 
void onLostFocus (wxFocusEvent &aEvent)
 
void onRefreshTimer (wxTimerEvent &aEvent)
 
void onShowTimer (wxTimerEvent &aEvent)
 

Protected Attributes

wxWindow * m_parent
 
bool m_showCrossHair
 Indicate if cross hair is to be shown. More...
 
int m_cursorLevel
 Index for cursor redraw in XOR mode. More...
 
int m_scrollIncrementX
 X axis scroll increment in pixels per unit. More...
 
int m_scrollIncrementY
 Y axis scroll increment in pixels per unit. More...
 
wxPoint m_CursorStartPos
 Used for testing the cursor movement. More...
 
wxPoint m_PanStartCenter
 Initial scroll center position when pan started. More...
 
wxPoint m_PanStartEventPosition
 Initial position of mouse event when pan started. More...
 
EDA_RECT m_ClipBox
 The drawing area used to redraw the screen which is usually the visible area of the drawing in internal units. More...
 
bool m_abortRequest
 Flag used to abort long commands. More...
 
bool m_enableZoomNoCenter
 True to enable zooming around the crosshair instead of the center. More...
 
bool m_enableMousewheelPan
 True to enable mousewheel panning by default. More...
 
bool m_enableAutoPan
 True to enable automatic panning. More...
 
bool m_requestAutoPan
 true to request an auto pan. Valid only when m_enableAutoPan = true. More...
 
bool m_ignoreMouseEvents
 Ignore mouse events when true. More...
 
bool m_ignoreNextLeftButtonRelease
 Ignore the next mouse left button release when true. More...
 
bool m_enableBlockCommands
 True enables block commands. More...
 
int m_minDragEventCount
 Count the drag events. More...
 
bool m_PrintIsMirrored
 True when drawing in mirror mode. More...
 
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
 Mouse capture move callback function. More...
 
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
 Abort mouse capture callback function. More...
 
int m_canStartBlock
 useful to avoid false start block in certain cases (like switch from a sheet to another sheet >= 0 (or >= n) if a block can start More...
 
int m_doubleClickInterval
 
int m_currentCursor
 Current mouse cursor shape id. More...
 
int m_defaultCursor
 The default mouse cursor shape id. More...
 
EDA_DRAW_FRAMEm_edaFrame
 Parent EDA_DRAW_FRAME (if available) More...
 
wxLongLong m_lastRefresh
 Last timestamp when the panel was refreshed. More...
 
bool m_pendingRefresh
 Is there a redraw event requested? More...
 
bool m_drawing
 True if GAL is currently redrawing the view. More...
 
bool m_drawingEnabled
 Flag that determines if VIEW may use GAL for redrawing the screen. More...
 
wxTimer m_refreshTimer
 Timer responsible for preventing too frequent refresh. More...
 
wxTimer m_onShowTimer
 Timer used to execute OnShow() when the window finally appears on the screen. More...
 
KIGFX::GALm_gal
 Interface for drawing objects on a 2D-surface. More...
 
KIGFX::VIEWm_view
 Stores view settings (scale, center, etc.) and items to be drawn. More...
 
std::unique_ptr< KIGFX::PAINTERm_painter
 Contains information about how to draw items using GAL. More...
 
KIGFX::WX_VIEW_CONTROLSm_viewControls
 Control for VIEW (moving, zooming, etc.) More...
 
GAL_TYPE m_backend
 Currently used GAL. More...
 
KIGFX::GAL_DISPLAY_OPTIONSm_options
 
TOOL_DISPATCHERm_eventDispatcher
 Processes and forwards events to tools. More...
 
bool m_lostFocus
 Flag to indicate that focus should be regained on the next mouse event. More...
 
bool m_stealsFocus
 Flag to indicate whether the panel should take focus at certain times (when moused over, and on various mouse/key events) More...
 

Static Protected Attributes

static const int MinRefreshPeriod = 17
 60 FPS. More...
 

Detailed Description

Definition at line 29 of file sch_draw_panel.h.

Member Enumeration Documentation

Enumerator
GAL_TYPE_NONE 

Not used.

GAL_TYPE_OPENGL 

OpenGL implementation.

GAL_TYPE_CAIRO 

Cairo implementation.

GAL_TYPE_LAST 

Sentinel, do not use as a parameter.

Definition at line 60 of file class_draw_panel_gal.h.

Constructor & Destructor Documentation

SCH_DRAW_PANEL::SCH_DRAW_PANEL ( wxWindow *  aParentWindow,
wxWindowID  aWindowId,
const wxPoint aPosition,
const wxSize &  aSize,
KIGFX::GAL_DISPLAY_OPTIONS aOptions,
GAL_TYPE  aGalType = GAL_TYPE_OPENGL 
)

Definition at line 63 of file sch_draw_panel.cpp.

References PGM_BASE::CommonSettings(), ENBL_AUTO_PAN_KEY, ENBL_MOUSEWHEEL_PAN_KEY, ENBL_ZOOM_NO_CENTER_KEY, OnCharHook(), OnKeyEvent(), OnMouseEvent(), Pgm(), and SCH_WORLD_UNIT.

65  :
66  EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalType ),
67  m_parent( aParentWindow )
68 {
69  m_defaultCursor = m_currentCursor = wxCURSOR_ARROW;
70  m_showCrossHair = true;
71  m_view = new KIGFX::SCH_VIEW( true );
72  m_view->SetGAL( m_gal );
73 
75 
76  m_painter.reset( new KIGFX::SCH_PAINTER( m_gal ) );
77 
78  m_view->SetPainter( m_painter.get() );
79  m_view->SetScaleLimits( 50.0, 0.05 ); // This fixes the zoom in and zoom out limits
80  m_view->SetMirror( false, false );
81 
84 
86 
87  // View controls is the first in the event handler chain, so the Tool Framework operates
88  // on updated viewport data.
90 
91  const wxEventType events[] =
92  {
93  wxEVT_LEFT_UP, wxEVT_LEFT_DOWN, wxEVT_LEFT_DCLICK,
94  wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK,
95  wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK,
96  wxEVT_MOTION, wxEVT_MOUSEWHEEL,
97  };
98 
99  for( auto e : events )
100  {
101  Connect( e, wxMouseEventHandler( SCH_DRAW_PANEL::OnMouseEvent ), NULL, this );
102  }
103 
104  Connect( wxEVT_CHAR, wxKeyEventHandler( SCH_DRAW_PANEL::OnKeyEvent ), NULL, this );
105  Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( SCH_DRAW_PANEL::OnCharHook ), NULL, this );
106 
110 
111  m_canStartBlock = -1; // Command block can start if >= 0
112  m_abortRequest = false;
113  m_ignoreMouseEvents = false;
114  // Be sure a mouse release button event will be ignored when creating the canvas
115  // if the mouse click was not made inside the canvas (can happen sometimes, when
116  // launching a editor from a double click made in another frame)
118 
119  m_mouseCaptureCallback = NULL;
121 
122  m_requestAutoPan = false;
123  m_enableBlockCommands = false;
125 
126  m_cursorLevel = 0;
127  m_PrintIsMirrored = false;
128 
129  m_doubleClickInterval = 250;
130 
131  m_viewControls->SetSnapping( true );
132 
133  SetEvtHandlerEnabled( true );
134  SetFocus();
135  Show( true );
136  Raise();
137  StartDrawing();
138 }
wxWindow * m_parent
void SetScaleLimits(double aMaximum, double aMinimum)
Function SetScaleLimits() Sets minimum and maximum values for scale.
Definition: view.h:309
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
bool m_abortRequest
Flag used to abort long commands.
int m_canStartBlock
useful to avoid false start block in certain cases (like switch from a sheet to another sheet >= 0 (o...
KIGFX::SCH_VIEW * view() const
KIGFX::WX_VIEW_CONTROLS * m_viewControls
Control for VIEW (moving, zooming, etc.)
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
Class WX_VIEW_CONTROLS is a specific implementation of class VIEW_CONTROLS for wxWidgets library...
constexpr double SCH_WORLD_UNIT
Definition: sch_view.h:40
bool m_requestAutoPan
true to request an auto pan. Valid only when m_enableAutoPan = true.
bool m_PrintIsMirrored
True when drawing in mirror mode.
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
Abort mouse capture callback function.
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
int m_currentCursor
Current mouse cursor shape id.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
void UpdateAllLayersOrder()
Function UpdateLayerOrder() Does everything that is needed to apply the rendering order of layers...
Definition: view.cpp:915
void SetMirror(bool aMirrorX, bool aMirrorY)
Function SetMirror() Controls the mirroring of the VIEW.
Definition: view.cpp:554
bool m_enableBlockCommands
True enables block commands.
int m_defaultCursor
The default mouse cursor shape id.
#define ENBL_ZOOM_NO_CENTER_KEY
Definition: pgm_base.h:47
void OnMouseEvent(wxMouseEvent &event)
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
#define ENBL_AUTO_PAN_KEY
Definition: pgm_base.h:50
void OnKeyEvent(wxKeyEvent &event)
std::unique_ptr< KIGFX::PAINTER > m_painter
Contains information about how to draw items using GAL.
Class SCH_PAINTER Contains methods for drawing schematic-specific items.
Definition: sch_painter.h:112
bool m_ignoreMouseEvents
Ignore mouse events when true.
#define ENBL_MOUSEWHEEL_PAN_KEY
Definition: pgm_base.h:48
EDA_DRAW_PANEL_GAL(wxWindow *aParentWindow, wxWindowID aWindowId, const wxPoint &aPosition, const wxSize &aSize, KIGFX::GAL_DISPLAY_OPTIONS &aOptions, GAL_TYPE aGalType=GAL_TYPE_OPENGL)
virtual void SetFocus() override
void setDefaultLayerDeps()
Sets rendering targets & dependencies for layers.
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.
bool m_ignoreNextLeftButtonRelease
Ignore the next mouse left button release when true.
bool m_showCrossHair
Indicate if cross hair is to be shown.
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
bool m_enableMousewheelPan
True to enable mousewheel panning by default.
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:187
void OnCharHook(wxKeyEvent &event)
int m_minDragEventCount
Count the drag events.
void SetPainter(PAINTER *aPainter)
Function SetPainter() Sets the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:189
bool m_enableAutoPan
True to enable automatic panning.
void SetGAL(GAL *aGal)
Function SetGAL() Assigns a rendering device for the VIEW.
Definition: view.cpp:508
void setDefaultLayerOrder()
Reassigns layer order to the initial settings.
int m_cursorLevel
Index for cursor redraw in XOR mode.
SCH_DRAW_PANEL::~SCH_DRAW_PANEL ( )

Definition at line 141 of file sch_draw_panel.cpp.

142 {
143 }

Member Function Documentation

void SCH_DRAW_PANEL::CallEndMouseCapture ( wxDC *  aDC)
overridevirtual

Function CallEndMouseCapture calls the end mouse capture callback.

Parameters
aDCA point to a wxDC object to perform any drawing upon.

Reimplemented from EDA_DRAW_PANEL.

Definition at line 556 of file sch_draw_panel.cpp.

557 {
558  // CallEndMouseCapture is sometimes called with m_endMouseCaptureCallback == NULL
559  // for instance after an ABORT in block paste.
561  m_endMouseCaptureCallback( this, aDC );
562 }
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
Abort mouse capture callback function.
void SCH_DRAW_PANEL::CallMouseCapture ( wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 
)
overridevirtual

Function CallMouseCapture calls the mouse capture callback.

Parameters
aDCA point to a wxDC object to perform any drawing upon.
aPositionA referecnce to a wxPoint object containing the current cursor position.
aEraseTrue indicates the item being drawn should be erase before drawing it a aPosition.

Reimplemented from EDA_DRAW_PANEL.

Definition at line 548 of file sch_draw_panel.cpp.

Referenced by LIB_EDIT_FRAME::OnRotate().

549 {
550  wxCHECK_RET( m_mouseCaptureCallback != NULL, wxT( "Mouse capture callback not set." ) );
551 
552  m_mouseCaptureCallback( this, aDC, aPosition, aErase );
553 }
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
void SCH_DRAW_PANEL::CrossHairOff ( wxDC *  DC = nullptr)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 584 of file sch_draw_panel.cpp.

585 {
586  m_viewControls->ShowCursor( false );
587 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
KIGFX::WX_VIEW_CONTROLS * m_viewControls
Control for VIEW (moving, zooming, etc.)
void SCH_DRAW_PANEL::CrossHairOn ( wxDC *  DC = nullptr)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 590 of file sch_draw_panel.cpp.

591 {
592  m_viewControls->ShowCursor( true );
593 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
KIGFX::WX_VIEW_CONTROLS * m_viewControls
Control for VIEW (moving, zooming, etc.)
virtual wxRect EDA_DRAW_PANEL::DeviceToLogical ( const wxRect &  aRect,
wxDC &  aDC 
)
inlinevirtualinherited

Function DeviceToLogical converts aRect from device to drawing (logical) coordinates.

aRect must be in scrolled device units.

Parameters
aRectThe rectangle to convert.
aDCThe device context used for the conversion.
Returns
A rectangle converted to drawing units.

Definition at line 187 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnEraseBackground().

187 { printf("EDA_DRAW_PANEL:Unimplemented5\n");wxASSERT(false); return wxRect(); };
wxRect EDA_DRAW_PANEL::DeviceToLogical ( const wxRect &  aRect,
wxDC &  aDC 
)
inherited

Function DeviceToLogical converts aRect from device to drawing (logical) coordinates.

aRect must be in scrolled device units.

Parameters
aRectThe rectangle to convert.
aDCThe device context used for the conversion.
Returns
A rectangle converted to drawing units.
void SCH_DRAW_PANEL::DisplayComponent ( const LIB_PART aComponent)

Function DisplayBoard FIXME adds all items from the current board to the VIEW, so they can be displayed by GAL.

Parameters
aBoardis the PCB to be loaded.

Definition at line 146 of file sch_draw_panel.cpp.

Referenced by LIB_EDIT_FRAME::RebuildView().

147 {
148  view()->Clear();
149  view()->DisplayComponent( const_cast<LIB_PART*>(aComponent) );
150 
151 }
KIGFX::SCH_VIEW * view() const
void DisplayComponent(LIB_PART *aPart)
Definition: sch_view.cpp:78
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1099
void SCH_DRAW_PANEL::DisplaySheet ( const SCH_SHEET aSheet)

Definition at line 153 of file sch_draw_panel.cpp.

Referenced by SCH_EDIT_FRAME::SetScreen().

154 {
155  view()->Clear();
156  view()->DisplaySheet( const_cast<SCH_SHEET*>(aSheet) );
157 }
KIGFX::SCH_VIEW * view() const
void DisplaySheet(SCH_SHEET *aSheet)
Definition: sch_view.cpp:72
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1099
void SCH_DRAW_PANEL::DisplaySheet ( const SCH_SCREEN aScreen)

Definition at line 159 of file sch_draw_panel.cpp.

160 {
161  view()->Clear();
162 
163  if( aScreen )
164  view()->DisplaySheet( const_cast<SCH_SCREEN*>( aScreen ) );
165 }
KIGFX::SCH_VIEW * view() const
void DisplaySheet(SCH_SHEET *aSheet)
Definition: sch_view.cpp:72
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1099
void EDA_DRAW_PANEL::DoPrepareDC ( wxDC &  aDC)
overridevirtualinherited

Function DoPrepareDC sets up the device context aDC for drawing.

This overrides wxScrolledWindow::DoPrepareDC() for setting up the the device context used for drawing. The scale factor and drawing logical offset are set and the base method is called to set the DC device origin (scroll bar position). This connects everything together to achieve the appropriate coordinate manipulation using wxDC LogicalToDeviceXXX and DeviceToLogixalXXX methods. This gets called automatically for a paint event. If you do any drawing outside the paint event, you must call DoPrepareDC manually.

Parameters
aDCThe device context to prepare.

Definition at line 576 of file eda_draw_panel.cpp.

References BASE_SCREEN::GetScalingFactor(), EDA_DRAW_PANEL::GetScreen(), GRResetPenAndBrush(), BASE_SCREEN::m_DrawOrg, scale, EDA_DRAW_PANEL::SetClipBox(), wxPoint::x, and wxPoint::y.

Referenced by GBR_LAYOUT::Draw(), and EDA_DRAW_PANEL::OnEraseBackground().

577 {
578  wxScrolledWindow::DoPrepareDC( dc );
579 
580  if( GetScreen() != NULL )
581  {
582  double scale = GetScreen()->GetScalingFactor();
583  dc.SetUserScale( scale, scale );
584 
585  wxPoint pt = GetScreen()->m_DrawOrg;
586  dc.SetLogicalOrigin( pt.x, pt.y );
587  }
588 
589  SetClipBox( dc ); // Reset the clip box to the entire screen.
590  GRResetPenAndBrush( &dc );
591  dc.SetBackgroundMode( wxTRANSPARENT );
592 }
virtual BASE_SCREEN * GetScreen()=0
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:123
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:95
void SetClipBox(const EDA_RECT &aRect)
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:183
void EDA_DRAW_PANEL::DrawAuxiliaryAxis ( wxDC *  aDC,
GR_DRAWMODE  aDrawMode 
)
inlinevirtualinherited

Function DrawAuxiliaryAxis Draw the Auxiliary Axis, used in Pcbnew which as origin coordinates for gerber and excellon files.

Parameters
aDC= current Device Context
aDrawMode= draw mode (GR_COPY, GR_OR ..)

Definition at line 165 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnPaint(), and EDA_DRAW_PANEL::SetCanStartBlock().

165 { printf("EDA_DRAW_PANEL:Unimplemented2\n");};
void EDA_DRAW_PANEL::DrawAuxiliaryAxis ( wxDC *  aDC,
GR_DRAWMODE  aDrawMode 
)
inherited

Function DrawAuxiliaryAxis Draw the Auxiliary Axis, used in Pcbnew which as origin coordinates for gerber and excellon files.

Parameters
aDC= current Device Context
aDrawMode= draw mode (GR_COPY, GR_OR ..)
void EDA_DRAW_PANEL::DrawBackGround ( wxDC *  DC)
inlinevirtualinherited

Function DrawBackGround.

Parameters
DC= current Device Context Draws (if allowed) : the grid X and Y axis X and Y auxiliary axis

Definition at line 146 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnPaint(), PL_EDITOR_FRAME::RedrawActiveWindow(), FOOTPRINT_EDIT_FRAME::RedrawActiveWindow(), FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow(), FOOTPRINT_WIZARD_FRAME::RedrawActiveWindow(), GERBVIEW_FRAME::RedrawActiveWindow(), LIB_EDIT_FRAME::RedrawActiveWindow(), PCB_EDIT_FRAME::RedrawActiveWindow(), and EDA_DRAW_PANEL::SetCanStartBlock().

146 { printf("EDA_DRAW_PANEL:Unimplemented1\n"); };
void EDA_DRAW_PANEL::DrawBackGround ( wxDC *  DC)
inherited

Function DrawBackGround.

Parameters
DC= current Device Context Draws (if allowed) : the grid X and Y axis X and Y auxiliary axis
void EDA_DRAW_PANEL::DrawCrossHair ( wxDC *  aDC = nullptr,
COLOR4D  aColor = COLOR4D::WHITE 
)
inlinevirtualinherited

Function DrawCrossHair draws the user cross hair.

The user cross hair is not the mouse cursor although they may be at the same screen position. The mouse cursor is still render by the OS. This is a drawn cross hair that is used to snap to grid when grid snapping is enabled. This is as an indicator to where the next user action will take place.

Parameters
aDC- the device context to draw the cursor
aColor- the color to draw the cursor

Definition at line 294 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::GetScreen(), EDA_DRAW_PANEL::OnEraseBackground(), PL_EDITOR_FRAME::RedrawActiveWindow(), FOOTPRINT_EDIT_FRAME::RedrawActiveWindow(), FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow(), FOOTPRINT_WIZARD_FRAME::RedrawActiveWindow(), GERBVIEW_FRAME::RedrawActiveWindow(), LIB_EDIT_FRAME::RedrawActiveWindow(), and PCB_EDIT_FRAME::RedrawActiveWindow().

294 { printf("EDA_DRAW_PANEL:Unimplemented18\n"); };;
void EDA_DRAW_PANEL::DrawCrossHair ( wxDC *  aDC,
COLOR4D  aColor = COLOR4D::WHITE 
)
inherited

Function DrawCrossHair draws the user cross hair.

The user cross hair is not the mouse cursor although they may be at the same screen position. The mouse cursor is still render by the OS. This is a drawn cross hair that is used to snap to grid when grid snapping is enabled. This is as an indicator to where the next user action will take place.

Parameters
aDC- the device context to draw the cursor
aColor- the color to draw the cursor
void EDA_DRAW_PANEL::DrawGrid ( wxDC *  aDC)
inlinevirtualinherited

Function DrawGrid draws a grid to aDC.

See also
m_ClipBox to determine the damaged area of the drawing to draw the grid.
EDA_DRAW_FRAME::IsGridVisible() to determine if grid is shown.
EDA_DRAW_FRAME::GetGridColor() for the color of the grid.
Parameters
aDCThe device context to draw the grid.

Definition at line 156 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnPaint(), and EDA_DRAW_PANEL::SetCanStartBlock().

156 { printf("EDA_DRAW_PANEL:Unimplemented2\n"); };
void EDA_DRAW_PANEL::DrawGrid ( wxDC *  aDC)
inherited

Function DrawGrid draws a grid to aDC.

See also
m_ClipBox to determine the damaged area of the drawing to draw the grid.
EDA_DRAW_FRAME::IsGridVisible() to determine if grid is shown.
EDA_DRAW_FRAME::GetGridColor() for the color of the grid.
Parameters
aDCThe device context to draw the grid.
void EDA_DRAW_PANEL::DrawGridAxis ( wxDC *  aDC,
GR_DRAWMODE  aDrawMode,
const wxPoint aGridOrigin 
)
inlinevirtualinherited

Function DrawGridAxis Draw on auxiliary axis, used in Pcbnew to show grid origin, when the grid origin is set by user, and is not (0,0)

Parameters
aDC= current Device Context
aDrawMode= draw mode (GR_COPY, GR_OR ..)
aGridOrigin= the absolute coordinate of grid origin for snap.

Definition at line 175 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnPaint(), and EDA_DRAW_PANEL::SetCanStartBlock().

175 { printf("EDA_DRAW_PANEL:Unimplemented4\n"); };
void EDA_DRAW_PANEL::DrawGridAxis ( wxDC *  aDC,
GR_DRAWMODE  aDrawMode,
const wxPoint aGridOrigin 
)
inherited

Function DrawGridAxis Draw on auxiliary axis, used in Pcbnew to show grid origin, when the grid origin is set by user, and is not (0,0)

Parameters
aDC= current Device Context
aDrawMode= draw mode (GR_COPY, GR_OR ..)
aGridOrigin= the absolute coordinate of grid origin for snap.
void SCH_DRAW_PANEL::EndMouseCapture ( int  aId = -1,
int  aCursorId = -1,
const wxString &  aTitle = wxEmptyString,
bool  aCallEndFunc = true 
)
overridevirtual

Function EndMouseCapture ends mouse a capture.

Check to see if the cursor is being managed for block or editing commands and release it.

Parameters
aIdThe command ID to restore or -1 to keep the current command ID.
aCursorIdThe wxWidgets stock cursor ID to set the cursor to or -1 to keep the current cursor.
aTitleThe tool message to display in the status bar or wxEmptyString to clear the message.
aCallEndFuncCall the abort mouse capture callback if true.

Reimplemented from EDA_DRAW_PANEL.

Definition at line 565 of file sch_draw_panel.cpp.

567 {
568  if( m_mouseCaptureCallback && m_endMouseCaptureCallback && aCallEndFunc )
569  {
570  m_endMouseCaptureCallback( this, nullptr );
571  }
572 
573  m_mouseCaptureCallback = NULL;
575  m_requestAutoPan = false;
576 
577  if( id != -1 && cursor != -1 )
578  {
579  //wxASSERT( cursor > wxCURSOR_NONE && cursor < wxCURSOR_MAX );
580  GetParent()->SetToolID( id, cursor, title );
581  }
582 }
virtual EDA_DRAW_FRAME * GetParent() const override
bool m_requestAutoPan
true to request an auto pan. Valid only when m_enableAutoPan = true.
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
Abort mouse capture callback function.
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.
void EDA_DRAW_PANEL::EraseScreen ( wxDC *  DC)
inlinevirtualinherited

Function OnMouseWheel handles mouse wheel events.

The mouse wheel is used to provide support for zooming and panning. This is accomplished by converting mouse wheel events in pseudo menu command events and sending them to the appropriate parent window event handler.

Definition at line 201 of file legacy_gal/class_drawpanel.h.

Referenced by DrawPageOnClipboard(), EDA_DRAW_PANEL::OnEraseBackground(), EDA_DRAW_PANEL::OnPaint(), EDA_DRAW_PANEL::OnScroll(), and PL_EDITOR_FRAME::RedrawActiveWindow().

201 { printf("EDA_DRAW_PANEL:Unimplemented6\n"); };;
void EDA_DRAW_PANEL::EraseScreen ( wxDC *  DC)
inherited
bool EDA_DRAW_PANEL::GetAbortRequest ( ) const
inlineinherited

Definition at line 143 of file legacy_wx/class_drawpanel.h.

References EDA_DRAW_PANEL::m_abortRequest.

143 { return m_abortRequest; }
bool m_abortRequest
Flag used to abort long commands.
GAL_TYPE EDA_DRAW_PANEL_GAL::GetBackend ( ) const
inlineinherited
virtual EDA_RECT* EDA_DRAW_PANEL::GetClipBox ( )
inlinevirtualinherited

Definition at line 105 of file legacy_gal/class_drawpanel.h.

References EDA_DRAW_PANEL::m_ClipBox.

Referenced by Autoroute_One_Track(), DisplayRoutingMatrix(), SCH_NO_CONNECT::Draw(), SCH_JUNCTION::Draw(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), SCH_BUS_ENTRY_BASE::Draw(), SCH_BITMAP::Draw(), GBR_LAYOUT::Draw(), SCH_LINE::Draw(), EDGE_MODULE::Draw(), ZONE_CONTAINER::Draw(), SCH_TEXT::Draw(), BLOCK_SELECTOR::Draw(), SCH_FIELD::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DIMENSION::Draw(), LIB_ITEM::Draw(), DRAWSEGMENT::Draw(), GERBER_DRAW_ITEM::Draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), MODULE::Draw(), SEGZONE::Draw(), VIA::Draw(), SCH_SHEET::Draw(), LIB_PART::Draw(), SCH_COMPONENT::Draw(), D_PAD::Draw(), MODULE::DrawAncre(), DrawDanglingSymbol(), ZONE_CONTAINER::DrawFilledArea(), PCB_BASE_FRAME::DrawGeneralRatsnest(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_TEXT::drawGraphic(), LIB_ARC::drawGraphic(), LIB_FIELD::drawGraphic(), LIB_PIN::drawGraphic(), GBR_LAYOUT::DrawItemsDCodeID(), PLEDITOR_PRINTOUT::DrawPage(), DrawPageLayout(), DrawPageOnClipboard(), LIB_PIN::DrawPinElectricalTypeName(), LIB_PIN::DrawPinSymbol(), LIB_PIN::DrawPinTexts(), D_PAD::DrawShape(), TRACK::DrawShortNetname(), TEXTE_MODULE::DrawUmbilical(), ZONE_CONTAINER::DrawWhileCreateOutline(), EDA_DRAW_FRAME::DrawWorkSheet(), ShowBoundingBoxMicroWaveInductor(), ShowNewTrackWhenMovingCursor(), PCB_BASE_FRAME::TraceAirWiresToTargets(), and PCB_BASE_FRAME::TraceModuleRatsNest().

105 { return &m_ClipBox; }
EDA_RECT m_ClipBox
The drawing area used to redraw the screen which is usually the visible area of the drawing in intern...
EDA_RECT* EDA_DRAW_PANEL::GetClipBox ( )
inlineinherited

Definition at line 139 of file legacy_wx/class_drawpanel.h.

References EDA_DRAW_PANEL::m_ClipBox.

139 { return &m_ClipBox; }
EDA_RECT m_ClipBox
The drawing area used to redraw the screen which is usually the visible area of the drawing in intern...
int EDA_DRAW_PANEL_GAL::GetCurrentCursor ( ) const
inlineinherited

Function GetCurrentCursor.

Returns
the current cursor shape, depending on the current selected tool

Definition at line 224 of file class_draw_panel_gal.h.

224 { return m_currentCursor; }
int m_currentCursor
Current mouse cursor shape id.
int EDA_DRAW_PANEL::GetCurrentCursor ( ) const
inlineinherited
virtual int EDA_DRAW_PANEL_GAL::GetDefaultCursor ( ) const
inlinevirtualinherited

Function GetDefaultCursor.

Returns
the default cursor shape

Definition at line 218 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_FRAME::SetNoToolSelected().

218 { return m_defaultCursor; }
int m_defaultCursor
The default mouse cursor shape id.
int EDA_DRAW_PANEL::GetDefaultCursor ( ) const
inlineinherited
virtual BOX2I EDA_DRAW_PANEL_GAL::GetDefaultViewBBox ( ) const
inlinevirtualinherited

Returns the bounding box of the view that should be used if model is not valid For example, the worksheet bounding box for an empty PCB.

Returns
the default bounding box for the panel

Reimplemented in PCB_DRAW_PANEL_GAL, and GERBVIEW_DRAW_PANEL_GAL.

Definition at line 232 of file class_draw_panel_gal.h.

Referenced by COMMON_TOOLS::CenterContents(), SCH_BASE_FRAME::Zoom_Automatique(), and COMMON_TOOLS::ZoomFitScreen().

233  {
234  return BOX2I();
235  }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520
void * EDA_DRAW_PANEL::GetDisplayOptions ( )
inlinevirtualinherited
void* EDA_DRAW_PANEL::GetDisplayOptions ( )
inherited

Function GetDisplayOptions A way to pass info to draw functions.

this is just an accessor to the GetDisplayOptions() parent frame function.

bool EDA_DRAW_PANEL::GetEnableAutoPan ( ) const
inlineinherited

Definition at line 121 of file legacy_gal/class_drawpanel.h.

References EDA_DRAW_PANEL::m_enableAutoPan.

Referenced by EDA_DRAW_FRAME::PushPreferences(), and EDA_DRAW_FRAME::UseGalCanvas().

121 { return m_enableAutoPan; }
bool m_enableAutoPan
True to enable automatic panning.
bool EDA_DRAW_PANEL::GetEnableAutoPan ( ) const
inlineinherited

Definition at line 155 of file legacy_wx/class_drawpanel.h.

References EDA_DRAW_PANEL::m_enableAutoPan, and EDA_DRAW_PANEL::SetEnableAutoPan().

155 { return m_enableAutoPan; }
bool m_enableAutoPan
True to enable automatic panning.
bool EDA_DRAW_PANEL::GetEnableMousewheelPan ( ) const
inlineinherited

Definition at line 113 of file legacy_gal/class_drawpanel.h.

References EDA_DRAW_PANEL::m_enableMousewheelPan.

Referenced by DIALOG_PAD_PROPERTIES::prepareCanvas(), and EDA_DRAW_FRAME::UseGalCanvas().

113 { return m_enableMousewheelPan; }
bool m_enableMousewheelPan
True to enable mousewheel panning by default.
bool EDA_DRAW_PANEL::GetEnableMousewheelPan ( ) const
inlineinherited

Definition at line 147 of file legacy_wx/class_drawpanel.h.

References EDA_DRAW_PANEL::m_enableMousewheelPan, and EDA_DRAW_PANEL::SetEnableMousewheelPan().

147 { return m_enableMousewheelPan; }
bool m_enableMousewheelPan
True to enable mousewheel panning by default.
bool EDA_DRAW_PANEL::GetEnableZoomNoCenter ( ) const
inlineinherited

Definition at line 117 of file legacy_gal/class_drawpanel.h.

References EDA_DRAW_PANEL::m_enableZoomNoCenter.

Referenced by EDA_DRAW_FRAME::OnZoom(), EDA_DRAW_FRAME::PushPreferences(), and EDA_DRAW_FRAME::UseGalCanvas().

117 { return m_enableZoomNoCenter; }
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
bool EDA_DRAW_PANEL::GetEnableZoomNoCenter ( ) const
inlineinherited

Definition at line 151 of file legacy_wx/class_drawpanel.h.

References EDA_DRAW_PANEL::m_enableZoomNoCenter, and EDA_DRAW_PANEL::SetEnableZoomNoCenter().

151 { return m_enableZoomNoCenter; }
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
double EDA_DRAW_PANEL_GAL::GetLegacyZoom ( ) const
inherited

Function GetLegacyZoom() Returns current view scale converted to zoom value used by the legacy canvas.

Definition at line 354 of file draw_panel_gal.cpp.

References KIGFX::GAL::GetZoomFactor(), EDA_DRAW_FRAME::GetZoomLevelCoeff(), EDA_DRAW_PANEL_GAL::m_edaFrame, and EDA_DRAW_PANEL_GAL::m_gal.

Referenced by COMMON_TOOLS::doZoomInOut(), EDA_DRAW_PANEL_GAL::onPaint(), GERBVIEW_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSelectZoom(), EDA_DRAW_FRAME::SetNextZoomAndRedraw(), and EDA_DRAW_FRAME::SetPreviousZoomAndRedraw().

355 {
357 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
double GetZoomLevelCoeff() const
Return the coefficient to convert internal display scale factor to zoom level.
Definition: draw_frame.h:464
EDA_DRAW_FRAME * m_edaFrame
Parent EDA_DRAW_FRAME (if available)
double GetZoomFactor() const
Get the zoom factor.
virtual void EDA_DRAW_PANEL_GAL::GetMsgPanelInfo ( EDA_UNITS_T  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
inlinevirtualinherited

Reimplemented in PCB_DRAW_PANEL_GAL, and GERBVIEW_DRAW_PANEL_GAL.

Definition at line 163 of file class_draw_panel_gal.h.

Referenced by PCB_BASE_FRAME::UpdateMsgPanel().

164  {
165  wxASSERT( false );
166  }
EDA_DRAW_FRAME * SCH_DRAW_PANEL::GetParent ( ) const
overridevirtual

Implements EDA_DRAW_PANEL.

Definition at line 265 of file sch_draw_panel.cpp.

Referenced by DrawMovingBlockOutlines().

266 {
267  return static_cast<EDA_DRAW_FRAME*>(m_parent); // static_cast<SCH_EDIT_FRAME*> (m_parent);
268 }
wxWindow * m_parent
The base class for create windows for drawing purpose.
Definition: draw_frame.h:78
EDA_DRAW_FRAME* EDA_DRAW_PANEL_GAL::GetParentEDAFrame ( ) const
inlineinherited

Function GetParentEDAFrame() Returns parent EDA_DRAW_FRAME, if available or NULL otherwise.

Definition at line 178 of file class_draw_panel_gal.h.

Referenced by GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), EDA_DRAW_PANEL_GAL::onPaint(), and PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL().

179  {
180  return m_edaFrame;
181  }
EDA_DRAW_FRAME * m_edaFrame
Parent EDA_DRAW_FRAME (if available)
bool EDA_DRAW_PANEL::GetPrintMirrored ( ) const
inlineinherited

Definition at line 133 of file legacy_gal/class_drawpanel.h.

References EDA_DRAW_PANEL::m_PrintIsMirrored.

Referenced by EDGE_MODULE::Draw(), and DRAWSEGMENT::Draw().

133 { return m_PrintIsMirrored; }
bool m_PrintIsMirrored
True when drawing in mirror mode.
bool EDA_DRAW_PANEL::GetPrintMirrored ( ) const
inlineinherited

Definition at line 167 of file legacy_wx/class_drawpanel.h.

References EDA_DRAW_PANEL::m_PrintIsMirrored.

167 { return m_PrintIsMirrored; }
bool m_PrintIsMirrored
True when drawing in mirror mode.
BASE_SCREEN * SCH_DRAW_PANEL::GetScreen ( )
overridevirtual

Implements EDA_DRAW_PANEL.

Definition at line 260 of file sch_draw_panel.cpp.

261 {
262  return GetParent()->GetScreen();
263 }
virtual EDA_DRAW_FRAME * GetParent() const override
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition ( )
inlinevirtualinherited

Update the board display after modifying it by a python script (note: it is automatically called by action plugins, after running the plugin, so call this function is usually not needed inside action plugins.

Could be deprecated because modifying a board (especially deleting items) outside a action plugin can crash Pcbnew. Function GetScreenCenterLogicalPosition

Returns
The current screen center position in logical (drawing) units.

Definition at line 254 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::GetGrid(), EDA_DRAW_PANEL::OnEraseBackground(), and EDA_DRAW_FRAME::UseGalCanvas().

254 { printf("EDA_DRAW_PANEL:Unimplemented13\n"); return wxPoint(0, 0); };;
wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition ( )
inherited

Function GetScreenCenterLogicalPosition.

Returns
The current screen center position in logical (drawing) units.
bool EDA_DRAW_PANEL_GAL::GetStealsFocus ( ) const
inlineinherited

Get whether focus is taken on certain events (see SetStealsFocus()).

Definition at line 202 of file class_draw_panel_gal.h.

203  {
204  return m_stealsFocus;
205  }
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over...
KIGFX::SCH_VIEW* SCH_DRAW_PANEL::GetView ( ) const
inline

Definition at line 86 of file sch_draw_panel.h.

References Refresh().

Referenced by abortMoveItem(), SCH_EDIT_FRAME::AddJunction(), SCH_EDIT_FRAME::AddNoConnect(), SCH_BASE_FRAME::AddToScreen(), SCH_BASE_FRAME::CenterScreen(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DrawAndSizingBlockOutlines(), DrawMovePin(), DrawMovingBlockOutlines(), LIB_EDIT_FRAME::EditField(), LIB_EDIT_FRAME::EditGraphicSymbol(), SCH_EDIT_FRAME::EditSheet(), LIB_EDIT_FRAME::EditSymbolText(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), SCH_BASE_FRAME::HandleBlockBegin(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::LoadSettings(), LIB_EDIT_FRAME::LoadSettings(), SCH_EDIT_FRAME::MirrorSheet(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnCancelCurrentCommand(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnFindReplace(), SCH_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnOrient(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectOptionToolbar(), LIB_VIEW_FRAME::OnShowElectricalType(), LIB_EDIT_FRAME::OnShowElectricalType(), SCH_EDIT_FRAME::PutDataInPreviousState(), LIB_EDIT_FRAME::RebuildView(), SCH_BASE_FRAME::RedrawScreen(), SCH_BASE_FRAME::RedrawScreen2(), SCH_BASE_FRAME::RefreshItem(), SCH_BASE_FRAME::RemoveFromScreen(), resizeSheetWithMouseCursor(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::SaveWireImage(), LIB_VIEW_FRAME::SetUnitAndConvert(), SCH_EDIT_FRAME::TestDanglingEnds(), DIALOG_ERC::TestErc(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), LIB_VIEW_FRAME::updatePreviewSymbol(), and LIB_VIEW_FRAME::~LIB_VIEW_FRAME().

86 { return view(); }
KIGFX::SCH_VIEW * view() const
KIGFX::VIEW_CONTROLS* EDA_DRAW_PANEL_GAL::GetViewControls ( ) const
inlineinherited

Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.

Returns
The instance of VIEW_CONTROLS.

Definition at line 115 of file class_draw_panel_gal.h.

References Refresh().

Referenced by SCH_BASE_FRAME::CenterScreen(), EVT_GRID_CMD_CELL_CHANGED(), PCB_BASE_FRAME::FocusOnLocation(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), EDA_DRAW_FRAME::GetCrossHairPosition(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnMoveItem(), EDA_DRAW_PANEL::OnPaint(), EDA_DRAW_FRAME::OnZoom(), DIALOG_PAD_PROPERTIES::prepareCanvas(), SCH_BASE_FRAME::RedrawScreen(), PCB_BASE_EDIT_FRAME::SetBoard(), EDA_DRAW_FRAME::SetCrossHairPosition(), FOOTPRINT_EDIT_FRAME::setupTools(), and EDA_DRAW_FRAME::UseGalCanvas().

116  {
118  }
KIGFX::WX_VIEW_CONTROLS * m_viewControls
Control for VIEW (moving, zooming, etc.)
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
virtual wxWindow* SCH_DRAW_PANEL::GetWindow ( )
inlineoverridevirtual

Implements EDA_DRAW_PANEL.

Definition at line 38 of file sch_draw_panel.h.

38 { return this; }
double EDA_DRAW_PANEL::GetZoom ( )
inlinevirtualinherited

Definition at line 204 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_FRAME::GeneralControl(), EDA_DRAW_PANEL::GetScreen(), EDA_DRAW_PANEL::OnEraseBackground(), EDA_DRAW_PANEL::OnMouseWheel(), and EDA_DRAW_FRAME::UseGalCanvas().

204 { printf("EDA_DRAW_PANEL:Unimplemented8\n"); return 1.0; };;
double EDA_DRAW_PANEL::GetZoom ( )
inherited
bool EDA_DRAW_PANEL::IsMouseCaptured ( ) const
inlineinherited

Definition at line 337 of file legacy_gal/class_drawpanel.h.

Referenced by AbortBlockCurrentCommand(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment(), LIB_EDIT_FRAME::deleteItem(), SCH_BUS_ENTRY_BASE::Draw(), SCH_COMPONENT::Draw(), Exit_Self(), SCH_EDIT_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), SCH_BASE_FRAME::HandleBlockBegin(), EDA_DRAW_FRAME::HandleBlockBegin(), PL_EDITOR_FRAME::HandleBlockEnd(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), GERBVIEW_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockEnd(), PCB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), PL_EDITOR_FRAME::HandleBlockPlace(), FOOTPRINT_EDIT_FRAME::HandleBlockPlace(), GERBVIEW_FRAME::HandleBlockPlace(), LIB_EDIT_FRAME::HandleBlockPlace(), PCB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::OnCancelCurrentCommand(), EDA_DRAW_PANEL::OnKeyEvent(), EDA_DRAW_PANEL::OnMouseEvent(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PL_EDITOR_FRAME::RedrawActiveWindow(), FOOTPRINT_EDIT_FRAME::RedrawActiveWindow(), GERBVIEW_FRAME::RedrawActiveWindow(), SCH_EDIT_FRAME::RedrawActiveWindow(), LIB_EDIT_FRAME::RedrawActiveWindow(), PCB_EDIT_FRAME::RedrawActiveWindow(), EDA_DRAW_FRAME::RefreshCrossHair(), and PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event().

337 { return m_mouseCaptureCallback != NULL; }
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
bool EDA_DRAW_PANEL::IsMouseCaptured ( ) const
inlineinherited

Definition at line 430 of file legacy_wx/class_drawpanel.h.

References EDA_DRAW_PANEL::CallEndMouseCapture(), and EDA_DRAW_PANEL::CallMouseCapture().

430 { return m_mouseCaptureCallback != NULL; }
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
bool EDA_DRAW_PANEL::IsPointOnDisplay ( const wxPoint aPosition)
inlinevirtualinherited

Function IsPointOnDisplay.

Parameters
aPositionThe position to test in logical (drawing) units.
Returns
true if aPosition is visible on the screen. false if aPosition is not visible on the screen.

Definition at line 216 of file legacy_gal/class_drawpanel.h.

Referenced by PCB_BASE_FRAME::FocusOnLocation(), EDA_DRAW_PANEL::GetGrid(), PL_EDITOR_FRAME::MoveItem(), and EDA_DRAW_PANEL::OnEraseBackground().

216 { printf("EDA_DRAW_PANEL:Unimplemented9\n"); return false; };;
bool EDA_DRAW_PANEL::IsPointOnDisplay ( const wxPoint aPosition)
inherited

Function IsPointOnDisplay.

Parameters
aPositionThe position to test in logical (drawing) units.
Returns
true if aPosition is visible on the screen. false if aPosition is not visible on the screen.
void EDA_DRAW_PANEL::MoveCursor ( const wxPoint aPosition)
inlinevirtualinherited

Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.

Parameters
aPositionThe position in logical units to move the cursor.

Definition at line 279 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_FRAME::GeneralControlKeyMovement(), EDA_DRAW_PANEL::GetGrid(), and EDA_DRAW_PANEL::OnEraseBackground().

279 { printf("EDA_DRAW_PANEL:Unimplemented17\n"); };;
void EDA_DRAW_PANEL::MoveCursor ( const wxPoint aPosition)
inherited

Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.

Parameters
aPositionThe position in logical units to move the cursor.
void SCH_DRAW_PANEL::MoveCursorToCrossHair ( )
overridevirtual

Function MoveCursorToCrossHair warps the cursor to the current cross hair position.

Reimplemented from EDA_DRAW_PANEL.

Definition at line 596 of file sch_draw_panel.cpp.

Referenced by SCH_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_EDIT_FRAME::OrientComponent(), and DIALOG_LABEL_EDITOR::TransferDataFromWindow().

597 {
598  GetViewControls()->WarpCursor( GetParent()->GetCrossHairPosition(), true );
599 }
virtual EDA_DRAW_FRAME * GetParent() const override
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
void EDA_DRAW_PANEL::OnActivate ( wxActivateEvent &  event)
inherited

Function OnActivate handles window activation events.

The member m_canStartBlock is initialize to avoid a block start command on activation (because a left mouse button can be pressed and no block command wanted. This happens when enter on a hierarchy sheet on double click.

Definition at line 396 of file eda_draw_panel.cpp.

References EDA_DRAW_PANEL::m_canStartBlock.

Referenced by EDA_DRAW_FRAME::GeneralControl(), and EDA_DRAW_PANEL::OnEraseBackground().

397 {
398  m_canStartBlock = -1; // Block Command can't start
399  event.Skip();
400 }
int m_canStartBlock
useful to avoid false start block in certain cases (like switch from a sheet to another sheet >= 0 (o...
void SCH_DRAW_PANEL::OnCharHook ( wxKeyEvent &  event)

Definition at line 608 of file sch_draw_panel.cpp.

Referenced by SCH_DRAW_PANEL().

609 {
610  event.Skip();
611 }
void EDA_DRAW_PANEL_GAL::onEnter ( wxEvent &  aEvent)
protectedinherited

Definition at line 446 of file draw_panel_gal.cpp.

References EDA_DRAW_PANEL_GAL::m_stealsFocus, and EDA_DRAW_PANEL_GAL::SetFocus().

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

447 {
448  // Getting focus is necessary in order to receive key events properly
449  if( m_stealsFocus )
450  SetFocus();
451 
452  aEvent.Skip();
453 }
virtual void SetFocus() override
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over...
void EDA_DRAW_PANEL_GAL::OnEvent ( wxEvent &  aEvent)
inherited

Used to forward events to the canvas from popups, etc.

Definition at line 432 of file draw_panel_gal.cpp.

References TOOL_DISPATCHER::DispatchWxEvent(), EDA_DRAW_PANEL_GAL::m_eventDispatcher, EDA_DRAW_PANEL_GAL::m_lostFocus, EDA_DRAW_PANEL_GAL::m_stealsFocus, EDA_DRAW_PANEL_GAL::Refresh(), and EDA_DRAW_PANEL_GAL::SetFocus().

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), and STATUS_POPUP::onCharHook().

433 {
434  if( m_lostFocus && m_stealsFocus )
435  SetFocus();
436 
437  if( !m_eventDispatcher )
438  aEvent.Skip();
439  else
441 
442  Refresh();
443 }
virtual void DispatchWxEvent(wxEvent &aEvent)
Function DispatchWxEvent() Processes wxEvents (mostly UI events), translates them to TOOL_EVENTs...
bool m_lostFocus
Flag to indicate that focus should be regained on the next mouse event.
virtual void SetFocus() override
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
TOOL_DISPATCHER * m_eventDispatcher
Processes and forwards events to tools.
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over...
void SCH_DRAW_PANEL::OnKeyEvent ( wxKeyEvent &  event)

Definition at line 614 of file sch_draw_panel.cpp.

References GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, and ID_NO_TOOL_SELECTED.

Referenced by SCH_DRAW_PANEL().

615 {
616  int localkey;
617 
618  localkey = event.GetKeyCode();
619 
620  switch( localkey )
621  {
622  default:
623  break;
624 
625  case WXK_ESCAPE:
626  m_abortRequest = true;
627 
628  if( IsMouseCaptured() )
629  EndMouseCapture();
630  else
631  EndMouseCapture( ID_NO_TOOL_SELECTED, 0 /*m_defaultCursor*/, wxEmptyString );
632  break;
633  }
634 
635  /* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
636  * They have an ascii code from 1 to 27 remapped
637  * to GR_KB_CTRL + 'A' to GR_KB_CTRL + 'Z'
638  */
639  if( event.ControlDown() && localkey >= WXK_CONTROL_A && localkey <= WXK_CONTROL_Z )
640  localkey += 'A' - 1;
641 
642  /* Disallow shift for keys that have two keycodes on them (e.g. number and
643  * punctuation keys) leaving only the "letter keys" of A-Z.
644  * Then, you can have, e.g. Ctrl-5 and Ctrl-% (GB layout)
645  * and Ctrl-( and Ctrl-5 (FR layout).
646  * Otherwise, you'd have to have to say Ctrl-Shift-5 on a FR layout
647  */
648  bool keyIsLetter = ( localkey >= 'A' && localkey <= 'Z' ) ||
649  ( localkey >= 'a' && localkey <= 'z' );
650 
651  if( event.ShiftDown() && ( keyIsLetter || localkey > 256 ) )
652  localkey |= GR_KB_SHIFT;
653 
654  if( event.ControlDown() )
655  localkey |= GR_KB_CTRL;
656 
657  if( event.AltDown() )
658  localkey |= GR_KB_ALT;
659 
660 
661  // Some key commands use the current mouse position: refresh it.
662  //pos = wxGetMousePosition() - GetScreenPosition();
663 
664  // Compute the cursor position in drawing units. Also known as logical units to wxDC.
665  //pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
666 
667  auto p = GetViewControls()->GetCursorPosition( false );
668 
669  wxPoint pos ((int)p.x, (int)p.y);
670 
671  GetParent()->SetMousePosition( pos );
672 
673  if( !GetParent()->GeneralControl( nullptr, pos, localkey ) )
674  event.Skip();
675 }
#define GR_KB_ALT
bool m_abortRequest
Flag used to abort long commands.
virtual EDA_DRAW_FRAME * GetParent() const override
#define GR_KB_CTRL
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true) override
Function EndMouseCapture ends mouse a capture.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
#define GR_KB_SHIFT
void SetMousePosition(const wxPoint &aPosition)
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
void EDA_DRAW_PANEL_GAL::onLostFocus ( wxFocusEvent &  aEvent)
protectedinherited

Definition at line 456 of file draw_panel_gal.cpp.

References EDA_DRAW_PANEL_GAL::m_lostFocus.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

457 {
458  m_lostFocus = true;
459 
460  aEvent.Skip();
461 }
bool m_lostFocus
Flag to indicate that focus should be regained on the next mouse event.
void EDA_DRAW_PANEL::OnMouseEntering ( wxMouseEvent &  aEvent)
inherited

Definition at line 909 of file eda_draw_panel.cpp.

References EDA_DRAW_PANEL::m_cursorLevel.

Referenced by EDA_DRAW_PANEL::OnEraseBackground().

910 {
911  // This is an ugly hack that fixes some cross hair display bugs when the mouse leaves the
912  // canvas area during middle button mouse panning.
913  if( m_cursorLevel != 0 )
914  m_cursorLevel = 0;
915 
916  aEvent.Skip();
917 }
int m_cursorLevel
Index for cursor redraw in XOR mode.
void SCH_DRAW_PANEL::OnMouseEvent ( wxMouseEvent &  event)

Definition at line 271 of file sch_draw_panel.cpp.

References abs, BLOCK_MINSIZE_LIMIT, BLOCK_ZOOM, DBG, EDA_RECT::GetHeight(), BLOCK_SELECTOR::GetState(), EDA_RECT::GetWidth(), GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, GR_M_DCLICK, GR_M_LEFT_DOWN, GR_M_MIDDLE_DOWN, ID_ZOOM_SELECTION, BASE_SCREEN::IsBlockActive(), BASE_SCREEN::m_BlockLocate, MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND, EDA_RECT::SetOrigin(), STATE_BLOCK_END, STATE_BLOCK_MOVE, and STATE_NO_BLOCK.

Referenced by SCH_DRAW_PANEL().

272 {
273  int localbutt = 0;
274  BASE_SCREEN* screen = GetScreen();
275  auto controls = GetViewControls();
276  auto vmp = VECTOR2I( controls->GetMousePosition() );
277  wxPoint mousePos ( vmp.x, vmp.y );
278 
279  event.Skip();
280 
281  if( !screen )
282  return;
283 
284  /* Adjust value to filter mouse displacement before consider the drag
285  * mouse is really a drag command, not just a movement while click
286  */
287 #define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
288 
289  if( event.Leaving() )
290  m_canStartBlock = -1;
291 
292  if( !IsMouseCaptured() ) // No mouse capture in progress.
293  m_requestAutoPan = false;
294 
295  if( GetParent()->IsActive() )
296  SetFocus();
297  else
298  return;
299 
300  if( !event.IsButton() && !event.Moving() && !event.Dragging() )
301  return;
302 
303  if( event.RightUp() )
304  {
305  OnRightClick( event );
306  return;
307  }
308 
309  if( m_ignoreMouseEvents )
310  return;
311 
312  if( event.LeftDown() )
313  localbutt = GR_M_LEFT_DOWN;
314 
315  if( event.ButtonDClick( 1 ) )
316  localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK;
317 
318  if( event.MiddleDown() )
319  localbutt = GR_M_MIDDLE_DOWN;
320 
321  // Compute the cursor position in drawing (logical) units.
322  //GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
323 
324  int kbstat = 0;
325 
326  if( event.ShiftDown() )
327  kbstat |= GR_KB_SHIFT;
328 
329  if( event.ControlDown() )
330  kbstat |= GR_KB_CTRL;
331 
332  if( event.AltDown() )
333  kbstat |= GR_KB_ALT;
334 
335  // Calling Double Click and Click functions :
336  if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
337  {
338  GetParent()->OnLeftDClick( nullptr, mousePos );
339 
340  // inhibit a response to the mouse left button release,
341  // because we have a double click, and we do not want a new
342  // OnLeftClick command at end of this Double Click
344  }
345  else if( event.LeftUp() )
346  {
347  // A block command is in progress: a left up is the end of block
348  // or this is the end of a double click, already seen
349  // Note also m_ignoreNextLeftButtonRelease can be set by
350  // the call to OnLeftClick(), so do not change it after calling OnLeftClick
351  bool ignoreEvt = m_ignoreNextLeftButtonRelease;
353 
354  if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
355  GetParent()->OnLeftClick( nullptr, mousePos );
356 
357  }
358  else if( !event.LeftIsDown() )
359  {
360  /* be sure there is a response to a left button release command
361  * even when a LeftUp event is not seen. This happens when a
362  * double click opens a dialog box, and the release mouse button
363  * is made when the dialog box is opened.
364  */
366  }
367 
368  if( event.ButtonDown( wxMOUSE_BTN_MIDDLE ) )
369  {
371  m_PanStartEventPosition = event.GetPosition();
372 
373  CrossHairOff( );
374  SetCurrentCursor( wxCURSOR_SIZING );
375  }
376 
377  if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) )
378  {
379  CrossHairOn();
381  }
382 
383  if( event.MiddleIsDown() )
384  {
385  // already managed by EDA_DRAW_PANEL_GAL mouse event handler.
386  return;
387  }
388 
389  // Calling the general function on mouse changes (and pseudo key commands)
390  GetParent()->GeneralControl( nullptr, mousePos );
391 
392  /*******************************/
393  /* Control of block commands : */
394  /*******************************/
395 
396  // Command block can't start if mouse is dragging a new panel
397  static SCH_DRAW_PANEL* lastPanel;
398  if( lastPanel != this )
399  {
401  m_canStartBlock = -1;
402  }
403 
404  /* A new command block can start after a release buttons
405  * and if the drag is enough
406  * This is to avoid a false start block when a dialog box is dismissed,
407  * or when changing panels in hierarchy navigation
408  * or when clicking while and moving mouse
409  */
410  if( !event.LeftIsDown() && !event.MiddleIsDown() )
411  {
413  m_canStartBlock = 0;
414 
415  /* Remember the last cursor position when a drag mouse starts
416  * this is the last position ** before ** clicking a button
417  * this is useful to start a block command from the point where the
418  * mouse was clicked first
419  * (a filter creates a delay for the real block command start, and
420  * we must remember this point)
421  */
423  }
424 
425  if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) )
426  {
427  if( !screen->IsBlockActive() )
428  {
430  }
431 
432  if( event.LeftDown() )
433  {
434  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
435  {
436  m_requestAutoPan = false;
437  GetParent()->HandleBlockPlace( nullptr );
439  }
440  }
441  else if( ( m_canStartBlock >= 0 ) && event.LeftIsDown() && !IsMouseCaptured() )
442  {
443  // Mouse is dragging: if no block in progress, start a block command.
444  if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
445  {
446  // Start a block command
447  int cmd_type = kbstat;
448 
449  // A block command is started if the drag is enough. A small
450  // drag is ignored (it is certainly a little mouse move when
451  // clicking) not really a drag mouse
454  else
455  {
456  auto cmd = (GetParent()->GetToolId() == ID_ZOOM_SELECTION) ? BLOCK_ZOOM : 0;
457 
458  DBG(printf("start block\n");)
459 
460  if( !GetParent()->HandleBlockBegin( nullptr, cmd_type, m_CursorStartPos, cmd ) )
461  {
462  // should not occur: error
464  wxT( "EDA_DRAW_PANEL::OnMouseEvent() Block Error" ) );
465  }
466  else
467  {
468  m_requestAutoPan = true;
469  SetCursor( wxCURSOR_SIZING );
470  }
471  }
472  }
473  }
474 
475  if( event.ButtonUp( wxMOUSE_BTN_LEFT ) )
476  {
477  /* Release the mouse button: end of block.
478  * The command can finish (DELETE) or have a next command (MOVE,
479  * COPY). However the block command is canceled if the block
480  * size is small because a block command filtering is already
481  * made, this case happens, but only when the on grid cursor has
482  * not moved.
483  */
484  #define BLOCK_MINSIZE_LIMIT 1
485  bool BlockIsSmall =
487  && ( std::abs( screen->m_BlockLocate.GetHeight() ) < BLOCK_MINSIZE_LIMIT );
488 
489  if( (screen->m_BlockLocate.GetState() != STATE_NO_BLOCK) && BlockIsSmall )
490  {
492  {
493  m_endMouseCaptureCallback( this, nullptr );
494  m_requestAutoPan = false;
495  }
496 
497  //SetCursor( (wxStockCursor) m_currentCursor );
498  }
499  else if( screen->m_BlockLocate.GetState() == STATE_BLOCK_END )
500  {
501  m_requestAutoPan = false;
502  GetParent()->HandleBlockEnd( nullptr );
503  //SetCursor( (wxStockCursor) m_currentCursor );
504  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
505  {
506  m_requestAutoPan = true;
507  SetCursor( wxCURSOR_HAND );
508  }
509  }
510  }
511  }
512 
513  // End of block command on a double click
514  // To avoid an unwanted block move command if the mouse is moved while double clicking
515  if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
516  {
517  if( !screen->IsBlockActive() && IsMouseCaptured() )
518  {
519  m_endMouseCaptureCallback( this, nullptr );
520  }
521  }
522 
523  lastPanel = this;
524 
525 }
bool OnRightClick(wxMouseEvent &event)
#define GR_KB_ALT
#define GR_M_DCLICK
Definition: gr_basic.h:77
int m_canStartBlock
useful to avoid false start block in certain cases (like switch from a sheet to another sheet >= 0 (o...
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
#define GR_M_MIDDLE_DOWN
Definition: gr_basic.h:76
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
virtual void HandleBlockPlace(wxDC *DC)
Called after HandleBlockEnd, when a block command needs to be executed after the block is moved to it...
virtual EDA_DRAW_FRAME * GetParent() const override
#define BLOCK_MINSIZE_LIMIT
bool m_requestAutoPan
true to request an auto pan. Valid only when m_enableAutoPan = true.
int GetHeight() const
Definition: eda_rect.h:118
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
Abort mouse capture callback function.
#define GR_KB_CTRL
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
const wxPoint & GetScrollCenterPosition() const
wxPoint m_PanStartEventPosition
Initial position of mouse event when pan started.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
bool m_enableBlockCommands
True enables block commands.
#define abs(a)
Definition: auxiliary.h:84
bool IsBlockActive() const
Definition: base_screen.h:499
virtual void CrossHairOff(wxDC *DC=nullptr) override
virtual void OnLeftClick(wxDC *DC, const wxPoint &MousePos)=0
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
bool m_ignoreMouseEvents
Ignore mouse events when true.
virtual void CrossHairOn(wxDC *DC=nullptr) override
virtual void SetFocus() override
virtual void SetCurrentCursor(int aCursor)
Function SetCurrentCursor Set the current cursor shape for this panel.
#define GR_KB_SHIFT
bool m_ignoreNextLeftButtonRelease
Ignore the next mouse left button release when true.
virtual bool HandleBlockEnd(wxDC *DC)
Handle the "end" of a block command, i.e.
wxPoint m_PanStartCenter
Initial scroll center position when pan started.
#define GR_M_LEFT_DOWN
Definition: gr_basic.h:74
void DisplayToolMsg(const wxString &msg)
BLOCK_STATE_T GetState() const
int GetToolId() const
Definition: draw_frame.h:519
int GetWidth() const
Definition: eda_rect.h:117
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
int m_minDragEventCount
Count the drag events.
BASE_SCREEN * GetScreen() override
wxPoint m_CursorStartPos
Used for testing the cursor movement.
virtual bool GeneralControl(wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0)
Perform application specific control using aDC at aPosition in logical units.
Definition: draw_frame.h:630
#define DBG(x)
Definition: fctsys.h:33
virtual void OnLeftDClick(wxDC *DC, const wxPoint &MousePos)
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
virtual void SetDefaultCursor()
void EDA_DRAW_PANEL::OnMouseLeaving ( wxMouseEvent &  event)
inherited

Definition at line 920 of file eda_draw_panel.cpp.

References EDA_DRAW_PANEL::GetParent(), ID_POPUP_ZOOM_CENTER, INSTALL_UNBUFFERED_DC, EDA_DRAW_PANEL::m_enableAutoPan, EDA_DRAW_PANEL::m_ignoreMouseEvents, EDA_DRAW_PANEL::m_mouseCaptureCallback, EDA_DRAW_PANEL::m_requestAutoPan, EDA_DRAW_FRAME::SetCrossHairPosition(), wxPoint::x, and wxPoint::y.

Referenced by EDA_DRAW_PANEL::OnEraseBackground().

921 {
922  if( m_mouseCaptureCallback == NULL ) // No command in progress.
923  m_requestAutoPan = false;
924 
926  return;
927 
928  // Auto pan when mouse has left the client window
929  // Ensure the cross_hair position is updated,
930  // because it will be used to center the screen.
931  // We use a position inside the client window
932  wxRect area( wxPoint( 0, 0 ), GetClientSize() );
933  wxPoint cross_hair_pos = event.GetPosition();
934 
935  // Certain window managers (e.g. awesome wm) incorrectly trigger "on leave" event,
936  // therefore test if the cursor has really left the panel area
937  if( !area.Contains( cross_hair_pos ) )
938  {
939  INSTALL_UNBUFFERED_DC( dc, this );
940  cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x );
941  cross_hair_pos.y = dc.DeviceToLogicalY( cross_hair_pos.y );
942 
943  GetParent()->SetCrossHairPosition( cross_hair_pos );
944 
945  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
946  cmd.SetEventObject( this );
947  GetEventHandler()->ProcessEvent( cmd );
948  }
949 
950  event.Skip();
951 }
bool m_requestAutoPan
true to request an auto pan. Valid only when m_enableAutoPan = true.
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
virtual EDA_DRAW_FRAME * GetParent() const =0
bool m_ignoreMouseEvents
Ignore mouse events when true.
#define INSTALL_UNBUFFERED_DC(name, parent)
bool m_enableAutoPan
True to enable automatic panning.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
void EDA_DRAW_PANEL::OnMouseWheel ( wxMouseEvent &  event)
inherited

Function OnMouseWheel handles mouse wheel events.

The mouse wheel is used to provide support for zooming and panning. This is accomplished by converting mouse wheel events in pseudo menu command events and sending them to the appropriate parent window event handler.

Definition at line 954 of file eda_draw_panel.cpp.

References EDA_DRAW_FRAME::GetCursorPosition(), EDA_DRAW_PANEL::GetParent(), BASE_SCREEN::GetScalingFactor(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), EDA_DRAW_PANEL::GetZoom(), ID_OFFCENTER_ZOOM_IN, ID_OFFCENTER_ZOOM_OUT, ID_PAN_DOWN, ID_PAN_LEFT, ID_POPUP_ZOOM_IN, ID_POPUP_ZOOM_OUT, INSTALL_UNBUFFERED_DC, kicadTraceCoords, KiROUND(), EDA_DRAW_PANEL::m_enableMousewheelPan, EDA_DRAW_PANEL::m_enableZoomNoCenter, EDA_DRAW_PANEL::m_ignoreMouseEvents, EDA_DRAW_FRAME::RedrawScreen(), scale, EDA_DRAW_FRAME::SetCrossHairPosition(), EDA_DRAW_FRAME::SetScrollCenterPosition(), EDA_DRAW_PANEL::SetZoom(), wxPoint::x, and wxPoint::y.

Referenced by EDA_DRAW_PANEL::OnEraseBackground().

955 {
956  if( m_ignoreMouseEvents )
957  return;
958 
959  wxRect rect = wxRect( wxPoint( 0, 0 ), GetClientSize() );
960 
961  // Ignore scroll events if the cursor is outside the drawing area.
962  if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
963  || !rect.Contains( event.GetPosition() ) )
964  {
965  wxLogTrace( kicadTraceCoords,
966  wxT( "OnMouseWheel() position(%d, %d) rectangle(%d, %d, %d, %d)" ),
967  event.GetPosition().x, event.GetPosition().y,
968  rect.x, rect.y, rect.width, rect.height );
969  event.Skip();
970  return;
971  }
972 
973  INSTALL_UNBUFFERED_DC( dc, this );
974  GetParent()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
975 
976  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
977  cmd.SetEventObject( this );
978 
979  bool offCenterReq = event.ControlDown() && event.ShiftDown();
980  offCenterReq = offCenterReq || m_enableZoomNoCenter;
981 
982  int axis = event.GetWheelAxis();
983  int wheelRotation = event.GetWheelRotation();
984 
986  {
987  // MousewheelPAN + Ctrl = zooming
988  if( event.ControlDown() && !event.ShiftDown() )
989  {
990  if( wheelRotation > 0 )
991  cmd.SetId( ID_POPUP_ZOOM_IN );
992  else if( wheelRotation < 0)
993  cmd.SetId( ID_POPUP_ZOOM_OUT );
994  }
995  // MousewheelPAN + Shift = horizontal scrolling
996  // Without modifiers MousewheelPAN - just pan
997  else
998  {
999  if( event.ShiftDown() && !event.ControlDown() )
1000  axis = wxMOUSE_WHEEL_HORIZONTAL;
1001 
1002  wxPoint newStart = GetViewStart();
1004  double scale = GetParent()->GetScreen()->GetScalingFactor();
1005 
1006  if( axis == wxMOUSE_WHEEL_HORIZONTAL )
1007  {
1008  newStart.x += wheelRotation;
1009  center.x += KiROUND( (double) wheelRotation / scale );
1010  }
1011  else
1012  {
1013  newStart.y -= wheelRotation;
1014  center.y -= KiROUND( (double) wheelRotation / scale );
1015  }
1016  Scroll( newStart );
1017 
1018  GetParent()->SetScrollCenterPosition( center );
1019  GetParent()->SetCrossHairPosition( center, true );
1020  GetParent()->RedrawScreen( center, false );
1021  }
1022  }
1023  else if( wheelRotation > 0 )
1024  {
1025  if( event.ShiftDown() && !event.ControlDown() )
1026  cmd.SetId( ID_PAN_UP );
1027  else if( event.ControlDown() && !event.ShiftDown() )
1028  cmd.SetId( ID_PAN_LEFT );
1029  else if( offCenterReq )
1030  cmd.SetId( ID_OFFCENTER_ZOOM_IN );
1031  else
1032  cmd.SetId( ID_POPUP_ZOOM_IN );
1033  }
1034  else if( wheelRotation < 0 )
1035  {
1036  if( event.ShiftDown() && !event.ControlDown() )
1037  cmd.SetId( ID_PAN_DOWN );
1038  else if( event.ControlDown() && !event.ShiftDown() )
1039  cmd.SetId( ID_PAN_RIGHT );
1040  else if( offCenterReq )
1041  cmd.SetId( ID_OFFCENTER_ZOOM_OUT );
1042  else
1043  cmd.SetId( ID_POPUP_ZOOM_OUT );
1044  }
1045 
1046  if( cmd.GetId() )
1047  GetEventHandler()->ProcessEvent( cmd );
1048  event.Skip();
1049 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:95
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
void SetScrollCenterPosition(const wxPoint &aPoint)
const wxPoint & GetScrollCenterPosition() const
virtual EDA_DRAW_FRAME * GetParent() const =0
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
bool m_ignoreMouseEvents
Ignore mouse events when true.
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterP...
const int scale
bool m_enableMousewheelPan
True to enable mousewheel panning by default.
#define INSTALL_UNBUFFERED_DC(name, parent)
Definition: id.h:255
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
const wxChar *const kicadTraceCoords
Flag to enable draw panel coordinate debug tracing.
void SCH_DRAW_PANEL::onPaint ( wxPaintEvent &  WXUNUSEDaEvent)
overrideprotectedvirtual

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 678 of file sch_draw_panel.cpp.

References EDA_DRAW_PANEL_GAL::onPaint(), and SCH_SCREEN::UpdateSymbolLinks().

679 {
680  if( !m_gal->IsInitialized() )
681  // The first wxPaintEvent can be fired at startup before the GAL engine is fully initialized
682  // (depending on platforms). Do nothing in this case
683  return;
684 
685  SCH_SCREEN* screen = static_cast<SCH_SCREEN*>( GetScreen() );
686 
687  // The screen might be null if the wxPaintEvent is fired after the parent frame deletion
688  if( !screen )
689  return;
690 
691  // Ensure links are up to date, even if a library was reloaded for some reason:
692  screen->UpdateSymbolLinks();
693 
694  if( m_painter )
695  static_cast<KIGFX::SCH_PAINTER*>(m_painter.get())->GetSettings()->ImportLegacyColors( nullptr );
696 
697  EDA_DRAW_PANEL_GAL::onPaint( aEvent );
698 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
void UpdateSymbolLinks(bool aForce=false)
Initialize or reinitialize the weak reference to the LIB_PART for each SCH_COMPONENT found in m_drawL...
Definition: sch_screen.cpp:476
virtual bool IsInitialized() const
Returns the initalization status for the canvas.
virtual void onPaint(wxPaintEvent &WXUNUSED(aEvent))
std::unique_ptr< KIGFX::PAINTER > m_painter
Contains information about how to draw items using GAL.
Class SCH_PAINTER Contains methods for drawing schematic-specific items.
Definition: sch_painter.h:112
BASE_SCREEN * GetScreen() override
void EDA_DRAW_PANEL::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 595 of file eda_draw_panel.cpp.

References BLACK, BLUE, EDA_DRAW_PANEL::DrawAuxiliaryAxis(), EDA_DRAW_PANEL::DrawBackGround(), EDA_DRAW_PANEL::DrawGrid(), EDA_DRAW_PANEL::DrawGridAxis(), KIGFX::VIEW_CONTROLS::EnableAutoPan(), KIGFX::VIEW_CONTROLS::EnableCursorWarping(), KIGFX::VIEW_CONTROLS::EnableMousewheelPan(), EDA_DRAW_PANEL::EraseScreen(), g_GhostColor, g_XorMode, EDA_RECT::GetBottom(), KIGFX::COLOR4D::GetBrightness(), EDA_DRAW_FRAME::GetDrawBgColor(), EDA_DRAW_FRAME::GetGalCanvas(), BASE_SCREEN::GetGridSize(), EDA_DRAW_FRAME::GetNearestGridPosition(), EDA_DRAW_FRAME::GetPageSizeIU(), EDA_DRAW_PANEL::GetParent(), EDA_RECT::GetPosition(), EDA_RECT::GetRight(), EDA_DRAW_PANEL::GetScreen(), EDA_DRAW_PANEL_GAL::GetViewControls(), EDA_RECT::GetX(), EDA_RECT::GetY(), GR_COPY, GR_NXOR, GR_XOR, GRLine(), GRResetPenAndBrush(), GRSetColorPen(), GRSetDrawMode(), INSTALL_PAINTDC, kicadTraceCoords, KiROUND(), EDA_DRAW_PANEL::m_ClipBox, EDA_DRAW_PANEL::m_enableAutoPan, EDA_DRAW_PANEL::m_enableMousewheelPan, EDA_DRAW_PANEL::m_enableZoomNoCenter, BASE_SCREEN::m_StartVisu, MIN_GRID_SIZE, EDA_DRAW_PANEL::ReDraw(), EDA_DRAW_FRAME::RedrawActiveWindow(), EDA_DRAW_PANEL::SetClipBox(), EDA_DRAW_PANEL::SetEnableAutoPan(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), WHITE, wxPoint::x, and wxPoint::y.

596 {
597  if( GetScreen() == NULL )
598  {
599  event.Skip();
600  return;
601  }
602 
603  INSTALL_PAINTDC( paintDC, this );
604 
605  wxRect region = GetUpdateRegion().GetBox();
606  SetClipBox( paintDC, &region );
607  ReDraw( &paintDC, true );
608 }
virtual BASE_SCREEN * GetScreen()=0
#define INSTALL_PAINTDC(name, parent)
void SetClipBox(const EDA_RECT &aRect)
virtual void ReDraw(wxDC *aDC, bool aEraseBackground=true)
void EDA_DRAW_PANEL::OnPan ( wxCommandEvent &  event)
inherited

Definition at line 1440 of file eda_draw_panel.cpp.

References EDA_DRAW_PANEL::CallEndMouseCapture(), EDA_DRAW_PANEL::CallMouseCapture(), EDA_DRAW_PANEL::EndMouseCapture(), EDA_DRAW_PANEL::GetParent(), BASE_SCREEN::GetScalingFactor(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), ID_PAN_DOWN, ID_PAN_LEFT, INSTALL_UNBUFFERED_DC, kicadTraceCoords, KiROUND(), EDA_DRAW_PANEL::m_endMouseCaptureCallback, EDA_DRAW_PANEL::m_mouseCaptureCallback, EDA_DRAW_PANEL::m_requestAutoPan, EDA_DRAW_PANEL::m_scrollIncrementX, EDA_DRAW_PANEL::m_scrollIncrementY, scale, EDA_DRAW_FRAME::SetScrollCenterPosition(), EDA_DRAW_FRAME::SetToolID(), wxPoint::x, and wxPoint::y.

Referenced by EDA_DRAW_PANEL::OnEraseBackground().

1441 {
1442  int x, y;
1443  int ppux, ppuy;
1444  int unitsX, unitsY;
1445  int maxX, maxY;
1446  int tmpX, tmpY;
1447 
1448  GetViewStart( &x, &y );
1449  GetScrollPixelsPerUnit( &ppux, &ppuy );
1450  GetVirtualSize( &unitsX, &unitsY );
1451  tmpX = x;
1452  tmpY = y;
1453  maxX = unitsX;
1454  maxY = unitsY;
1455  unitsX /= ppux;
1456  unitsY /= ppuy;
1457 
1458  wxLogTrace( kicadTraceCoords,
1459  wxT( "Scroll center position before pan: (%d, %d)" ), tmpX, tmpY );
1460 
1461  switch( event.GetId() )
1462  {
1463  case ID_PAN_UP:
1464  y -= m_scrollIncrementY;
1465  break;
1466 
1467  case ID_PAN_DOWN:
1468  y += m_scrollIncrementY;
1469  break;
1470 
1471  case ID_PAN_LEFT:
1472  x -= m_scrollIncrementX;
1473  break;
1474 
1475  case ID_PAN_RIGHT:
1476  x += m_scrollIncrementX;
1477  break;
1478 
1479  default:
1480  wxLogDebug( wxT( "Unknown ID %d in EDA_DRAW_PANEL::OnPan()." ), event.GetId() );
1481  }
1482 
1483  bool updateCenterScrollPos = true;
1484 
1485  if( x < 0 )
1486  {
1487  x = 0;
1488  updateCenterScrollPos = false;
1489  }
1490 
1491  if( y < 0 )
1492  {
1493  y = 0;
1494  updateCenterScrollPos = false;
1495  }
1496 
1497  if( x > maxX )
1498  {
1499  x = maxX;
1500  updateCenterScrollPos = false;
1501  }
1502 
1503  if( y > maxY )
1504  {
1505  y = maxY;
1506  updateCenterScrollPos = false;
1507  }
1508 
1509  // Don't update the scroll position beyond the scroll limits.
1510  if( updateCenterScrollPos )
1511  {
1512  double scale = GetParent()->GetScreen()->GetScalingFactor();
1513 
1515  center.x += KiROUND( (double) ( x - tmpX ) / scale );
1516  center.y += KiROUND( (double) ( y - tmpY ) / scale );
1517  GetParent()->SetScrollCenterPosition( center );
1518 
1519  wxLogTrace( kicadTraceCoords,
1520  wxT( "Scroll center position after pan: (%d, %d)" ), center.x, center.y );
1521  }
1522 
1523  Scroll( x/ppux, y/ppuy );
1524 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:95
int m_scrollIncrementX
X axis scroll increment in pixels per unit.
void SetScrollCenterPosition(const wxPoint &aPoint)
const wxPoint & GetScrollCenterPosition() const
virtual EDA_DRAW_FRAME * GetParent() const =0
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
const int scale
Definition: id.h:255
const wxChar *const kicadTraceCoords
Flag to enable draw panel coordinate debug tracing.
int m_scrollIncrementY
Y axis scroll increment in pixels per unit.
void EDA_DRAW_PANEL_GAL::onRefreshTimer ( wxTimerEvent &  aEvent)
protectedinherited

Definition at line 464 of file draw_panel_gal.cpp.

References KIGFX::GAL::IsInitialized(), EDA_DRAW_PANEL_GAL::m_drawing, EDA_DRAW_PANEL_GAL::m_drawingEnabled, EDA_DRAW_PANEL_GAL::m_gal, EDA_DRAW_PANEL_GAL::m_pendingRefresh, EDA_DRAW_PANEL_GAL::m_refreshTimer, and EDA_DRAW_PANEL_GAL::onPaint().

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

465 {
466  if( !m_drawingEnabled )
467  {
468  if( m_gal && m_gal->IsInitialized() )
469  {
470  m_drawing = false;
471  m_pendingRefresh = true;
472  Connect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
473  m_drawingEnabled = true;
474  }
475  else
476  {
477  // Try again soon
478  m_refreshTimer.StartOnce( 100 );
479  return;
480  }
481  }
482 
483  wxPaintEvent redrawEvent;
484  wxPostEvent( this, redrawEvent );
485 }
bool m_pendingRefresh
Is there a redraw event requested?
wxTimer m_refreshTimer
Timer responsible for preventing too frequent refresh.
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
virtual bool IsInitialized() const
Returns the initalization status for the canvas.
bool m_drawing
True if GAL is currently redrawing the view.
virtual void onPaint(wxPaintEvent &WXUNUSED(aEvent))
bool m_drawingEnabled
Flag that determines if VIEW may use GAL for redrawing the screen.
bool SCH_DRAW_PANEL::OnRightClick ( wxMouseEvent &  event)

Definition at line 528 of file sch_draw_panel.cpp.

529 {
530  auto controls = GetViewControls();
531  auto vmp = controls->GetMousePosition();
532  wxPoint mouseWorldPos ( (int) vmp.x, (int) vmp.y );
533 
534  wxMenu MasterMenu;
535 
536  if( !GetParent()->OnRightClick( mouseWorldPos, &MasterMenu ) )
537  return false;
538 
539  GetParent()->AddMenuZoomAndGrid( &MasterMenu );
540 
541  m_ignoreMouseEvents = true;
542  PopupMenu( &MasterMenu, event.GetPosition() );
543  m_ignoreMouseEvents = false;
544 
545  return true;
546 }
bool OnRightClick(wxMouseEvent &event)
virtual EDA_DRAW_FRAME * GetParent() const override
bool m_ignoreMouseEvents
Ignore mouse events when true.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
virtual void AddMenuZoomAndGrid(wxMenu *aMasterMenu)
Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info...
void EDA_DRAW_PANEL::OnScroll ( wxScrollWinEvent &  event)
inherited

Definition at line 411 of file eda_draw_panel.cpp.

References CLIP_BOX_PADDING, EDA_DRAW_PANEL::EraseScreen(), EDA_RECT::GetBottom(), EDA_DRAW_FRAME::GetDrawBgColor(), BASE_SCREEN::GetGridSize(), EDA_RECT::GetHeight(), EDA_DRAW_PANEL::GetParent(), EDA_RECT::GetRight(), BASE_SCREEN::GetScalingFactor(), EDA_DRAW_PANEL::GetScreen(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), GR_COPY, GRRect(), GRSetDrawMode(), GRSFilledRect(), kicadTraceCoords, KiROUND(), LIGHTMAGENTA, EDA_DRAW_PANEL::m_ClipBox, BASE_SCREEN::m_ScrollbarPos, EDA_DRAW_PANEL::m_scrollIncrementX, EDA_DRAW_PANEL::m_scrollIncrementY, BASE_SCREEN::m_StartVisu, max, scale, EDA_DRAW_PANEL::SetClipBox(), EDA_RECT::SetOrigin(), EDA_DRAW_FRAME::SetScrollCenterPosition(), EDA_RECT::SetSize(), wxPoint::x, and wxPoint::y.

Referenced by EDA_DRAW_PANEL::OnEraseBackground().

412 {
413  int id = event.GetEventType();
414  int x, y;
415  int ppux, ppuy;
416  int csizeX, csizeY;
417  int unitsX, unitsY;
418 
419  GetViewStart( &x, &y );
420  GetScrollPixelsPerUnit( &ppux, &ppuy );
421  GetClientSize( &csizeX, &csizeY );
422  GetVirtualSize( &unitsX, &unitsY );
423 
424  int tmpX = x;
425  int tmpY = y;
426 
427  csizeX /= ppux;
428  csizeY /= ppuy;
429 
430  unitsX /= ppux;
431  unitsY /= ppuy;
432 
433  int dir = event.GetOrientation(); // wxHORIZONTAL or wxVERTICAL
434 
435  // On windows and on wxWidgets >= 2.9.5 and < 3.1,
436  // there is a bug in mousewheel event which always generates 2 scroll events
437  // (should be the case only for the default mousewheel event)
438  // with id = wxEVT_SCROLLWIN_LINEUP or wxEVT_SCROLLWIN_LINEDOWN
439  // so we skip these events.
440  // Note they are here just in case, because they are not actually used
441  // in Kicad
442 #if wxCHECK_VERSION( 3, 1, 0 ) || !wxCHECK_VERSION( 2, 9, 5 ) || ( !defined (__WINDOWS__) && !defined (__WXMAC__) )
443  int maxX = unitsX - csizeX;
444  int maxY = unitsY - csizeY;
445 
446  if( id == wxEVT_SCROLLWIN_LINEUP )
447  {
448  if( dir == wxHORIZONTAL )
449  {
450  x -= m_scrollIncrementX;
451 
452  if( x < 0 )
453  x = 0;
454  }
455  else
456  {
457  y -= m_scrollIncrementY;
458 
459  if( y < 0 )
460  y = 0;
461  }
462  }
463  else if( id == wxEVT_SCROLLWIN_LINEDOWN )
464  {
465  if( dir == wxHORIZONTAL )
466  {
467  x += m_scrollIncrementX;
468  if( x > maxX )
469  x = maxX;
470  }
471  else
472  {
473  y += m_scrollIncrementY;
474 
475  if( y > maxY )
476  y = maxY;
477  }
478  }
479  else
480 #endif
481  if( id == wxEVT_SCROLLWIN_THUMBTRACK )
482  {
483  if( dir == wxHORIZONTAL )
484  x = event.GetPosition();
485  else
486  y = event.GetPosition();
487  }
488  else
489  {
490  event.Skip();
491  return;
492  }
493 
494  wxLogTrace( kicadTraceCoords,
495  wxT( "Setting scroll bars ppuX=%d, ppuY=%d, unitsX=%d, unitsY=%d, posX=%d, posY=%d" ),
496  ppux, ppuy, unitsX, unitsY, x, y );
497 
498  double scale = GetParent()->GetScreen()->GetScalingFactor();
499 
501  center.x += KiROUND( (double) ( x - tmpX ) / scale );
502  center.y += KiROUND( (double) ( y - tmpY ) / scale );
503  GetParent()->SetScrollCenterPosition( center );
504 
505  Scroll( x, y );
506  event.Skip();
507 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:95
int m_scrollIncrementX
X axis scroll increment in pixels per unit.
void SetScrollCenterPosition(const wxPoint &aPoint)
const wxPoint & GetScrollCenterPosition() const
virtual EDA_DRAW_FRAME * GetParent() const =0
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
const int scale
const wxChar *const kicadTraceCoords
Flag to enable draw panel coordinate debug tracing.
int m_scrollIncrementY
Y axis scroll increment in pixels per unit.
void EDA_DRAW_PANEL::OnScrollWin ( wxCommandEvent &  event)
inherited
void SCH_DRAW_PANEL::OnShow ( )
overridevirtual

>

Function OnShow() Called when the window is shown for the first time.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 167 of file sch_draw_panel.cpp.

168 {
169  //m_view->RecacheAllItems();
170 }
void EDA_DRAW_PANEL_GAL::onShowTimer ( wxTimerEvent &  aEvent)
protectedinherited

Definition at line 488 of file draw_panel_gal.cpp.

References KIGFX::GAL::IsVisible(), EDA_DRAW_PANEL_GAL::m_gal, EDA_DRAW_PANEL_GAL::m_onShowTimer, and EDA_DRAW_PANEL_GAL::OnShow().

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

489 {
490  if( m_gal && m_gal->IsVisible() )
491  {
492  m_onShowTimer.Stop();
493  OnShow();
494  }
495 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
virtual void OnShow()
Function OnShow() Called when the window is shown for the first time.
virtual bool IsVisible() const
Returns true if the GAL canvas is visible on the screen.
wxTimer m_onShowTimer
Timer used to execute OnShow() when the window finally appears on the screen.
void EDA_DRAW_PANEL_GAL::onSize ( wxSizeEvent &  aEvent)
protectedinherited

Definition at line 240 of file draw_panel_gal.cpp.

References EDA_DRAW_PANEL_GAL::m_gal, EDA_DRAW_PANEL_GAL::m_view, KIGFX::VIEW::MarkTargetDirty(), KIGFX::GAL::ResizeScreen(), KIGFX::TARGET_CACHED, and KIGFX::TARGET_NONCACHED.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

241 {
243  wxSize clientSize = GetClientSize();
244  m_gal->ResizeScreen( clientSize.x, clientSize.y );
245 
246  if( m_view )
247  {
250  }
251 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
Auxiliary rendering target (noncached)
Definition: definitions.h:42
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target &#39;dirty&#39; flag.
Definition: view.h:596
virtual void ResizeScreen(int aWidth, int aHeight)
Resizes the canvas.
Main rendering target (cached)
Definition: definitions.h:41
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
void SCH_DRAW_PANEL::OnTimer ( wxTimerEvent &  event)
void EDA_DRAW_PANEL::ReDraw ( wxDC *  aDC,
bool  aEraseBackground = true 
)
inlinevirtualinherited

Definition at line 236 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnEraseBackground(), and EDA_DRAW_PANEL::OnPaint().

236 { printf("EDA_DRAW_PANEL:Unimplemented11\n"); };;
void EDA_DRAW_PANEL::ReDraw ( wxDC *  aDC,
bool  aEraseBackground = true 
)
inherited
void SCH_DRAW_PANEL::Refresh ( bool  aEraseBackground = true,
const wxRect *  aRect = NULL 
)
overridevirtual

Update the board display after modifying it by a python script (note: it is automatically called by action plugins, after running the plugin, so call this function is usually not needed inside action plugins.

Could be deprecated because modifying a board (especially deleting items) outside a action plugin can crash Pcbnew.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 602 of file sch_draw_panel.cpp.

References EDA_DRAW_PANEL_GAL::Refresh().

Referenced by SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::backAnnotateFootprints(), SCH_EDIT_FRAME::DeleteAnnotation(), LIB_EDIT_FRAME::deleteItem(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), LIB_EDIT_FRAME::EditField(), LIB_EDIT_FRAME::EditGraphicSymbol(), LIB_EDIT_FRAME::EditSymbolText(), LIB_EDIT_FRAME::EndDrawGraphicItem(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_EDIT_FRAME::GetSchematicFromRedoList(), SCH_EDIT_FRAME::GetSchematicFromUndoList(), LIB_EDIT_FRAME::GlobalSetPins(), LIB_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), SCH_BASE_FRAME::HardRedraw(), SCH_EDIT_FRAME::HardRedraw(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), DIALOG_EDIT_COMPONENTS_LIBID::onApplyButton(), DIALOG_ANNOTATE::OnApplyClick(), LIB_EDIT_FRAME::OnEditComponentProperties(), LIB_EDIT_FRAME::OnEditPin(), DIALOG_ERC::OnEraseDrcMarkersClick(), SCH_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnOpenPinTable(), LIB_EDIT_FRAME::OnOrient(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectOptionToolbar(), LIB_VIEW_FRAME::OnShowElectricalType(), LIB_EDIT_FRAME::OnShowElectricalType(), LIB_EDIT_FRAME::pasteClipboard(), LIB_EDIT_FRAME::PlacePin(), SCH_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::RebuildView(), SCH_BASE_FRAME::RedrawScreen(), SCH_BASE_FRAME::RefreshItem(), LIB_EDIT_FRAME::RepeatPinItem(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), LIB_VIEW_FRAME::SetUnitAndConvert(), DIALOG_ERC::TestErc(), PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow(), DIALOG_UPDATE_FIELDS::TransferDataFromWindow(), DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow(), and DIALOG_LABEL_EDITOR::TransferDataFromWindow().

603 {
604  EDA_DRAW_PANEL_GAL::Refresh( aEraseBackground, aRect );
605 }
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void EDA_DRAW_PANEL::RefreshDrawingRect ( const EDA_RECT aRect,
bool  aEraseBackground = true 
)
inlinevirtualinherited
void EDA_DRAW_PANEL::RefreshDrawingRect ( const EDA_RECT aRect,
bool  aEraseBackground = true 
)
inherited

Function RefreshDrawingRect redraws the contents of aRect in drawing units.

aRect is converted to screen coordinates and wxWindow::RefreshRect() is called to repaint the region.

Parameters
aRectThe rectangle to repaint.
aEraseBackgroundErases the background if true.
void EDA_DRAW_PANEL::SetAbortRequest ( bool  aAbortRequest)
inlineinherited

Definition at line 145 of file legacy_wx/class_drawpanel.h.

145 { m_abortRequest = aAbortRequest; }
bool m_abortRequest
Flag used to abort long commands.
void EDA_DRAW_PANEL::SetAutoPanRequest ( bool  aEnable)
inlineinherited

Definition at line 159 of file legacy_wx/class_drawpanel.h.

159 { m_requestAutoPan = aEnable; }
bool m_requestAutoPan
true to request an auto pan. Valid only when m_enableAutoPan = true.
void EDA_DRAW_PANEL::SetCanStartBlock ( int  aStartBlock)
inlineinherited

Definition at line 136 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_FRAME::OnActivate(), EDA_DRAW_FRAME::OnMenuOpen(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), and PCB_EDIT_FRAME::OnRightClick().

136 { m_canStartBlock = aStartBlock; }
int m_canStartBlock
useful to avoid false start block in certain cases (like switch from a sheet to another sheet >= 0 (o...
void EDA_DRAW_PANEL::SetCanStartBlock ( int  aStartBlock)
inlineinherited

Definition at line 170 of file legacy_wx/class_drawpanel.h.

References EDA_DRAW_PANEL::DrawAuxiliaryAxis(), EDA_DRAW_PANEL::DrawBackGround(), EDA_DRAW_PANEL::DrawGrid(), and EDA_DRAW_PANEL::DrawGridAxis().

170 { m_canStartBlock = aStartBlock; }
int m_canStartBlock
useful to avoid false start block in certain cases (like switch from a sheet to another sheet >= 0 (o...
void EDA_DRAW_PANEL::SetClipBox ( const EDA_RECT aRect)
inlineinherited

Definition at line 107 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::DoPrepareDC(), GBR_LAYOUT::Draw(), PLEDITOR_PRINTOUT::DrawPage(), DrawPageOnClipboard(), EDA_DRAW_PANEL::GetGrid(), EDA_DRAW_PANEL::OnEraseBackground(), EDA_DRAW_PANEL::OnPaint(), and EDA_DRAW_PANEL::OnScroll().

107 { m_ClipBox = aRect; }
EDA_RECT m_ClipBox
The drawing area used to redraw the screen which is usually the visible area of the drawing in intern...
void EDA_DRAW_PANEL::SetClipBox ( const EDA_RECT aRect)
inlineinherited

Definition at line 141 of file legacy_wx/class_drawpanel.h.

141 { m_ClipBox = aRect; }
EDA_RECT m_ClipBox
The drawing area used to redraw the screen which is usually the visible area of the drawing in intern...
void EDA_DRAW_PANEL::SetClipBox ( wxDC &  aDC,
const wxRect *  aRect = NULL 
)
inlinevirtualinherited

Function SetClipBox sets the clip box in drawing (logical) units from aRect in device units.

If aRect is NULL, then the entire visible area of the screen is used as the clip area. The clip box is used when drawing to determine which objects are not visible and do not need to be drawn. Note that this is not the same as setting the device context clipping with wxDC::SetClippingRegion(). This is the rectangle used by the drawing functions in gr_basic.cpp used to determine if the item to draw is off screen and therefore not drawn.

Parameters
aDCThe device context use for drawing with the correct scale and offsets already configured. See DoPrepareDC().
aRectThe clip rectangle in device units or NULL for the entire visible area of the screen.

Definition at line 234 of file legacy_gal/class_drawpanel.h.

234 { printf("EDA_DRAW_PANEL:Unimplemented10\n"); };;
void EDA_DRAW_PANEL::SetClipBox ( wxDC &  aDC,
const wxRect *  aRect = NULL 
)
inherited

Function SetClipBox sets the clip box in drawing (logical) units from aRect in device units.

If aRect is NULL, then the entire visible area of the screen is used as the clip area. The clip box is used when drawing to determine which objects are not visible and do not need to be drawn. Note that this is not the same as setting the device context clipping with wxDC::SetClippingRegion(). This is the rectangle used by the drawing functions in gr_basic.cpp used to determine if the item to draw is off screen and therefore not drawn.

Parameters
aDCThe device context use for drawing with the correct scale and offsets already configured. See DoPrepareDC().
aRectThe clip rectangle in device units or NULL for the entire visible area of the screen.
void EDA_DRAW_PANEL_GAL::SetCurrentCursor ( int  aCursor)
virtualinherited

Function SetCurrentCursor Set the current cursor shape for this panel.

Definition at line 496 of file draw_panel_gal.cpp.

References EDA_DRAW_PANEL_GAL::m_currentCursor.

Referenced by EDA_DRAW_PANEL_GAL::SetDefaultCursor(), and EDA_DRAW_FRAME::SetToolID().

497 {
498  if ( aCursor > wxCURSOR_NONE && aCursor < wxCURSOR_MAX )
499  {
500  m_currentCursor = aCursor;
501  }
502  else
503  {
504  m_currentCursor = wxCURSOR_ARROW;
505  }
506 
507  SetCursor( (wxStockCursor) m_currentCursor );
508 }
int m_currentCursor
Current mouse cursor shape id.
void EDA_DRAW_PANEL::SetCurrentCursor ( int  aCursor)
inlineinherited

Function SetCurrentCursor Set the current cursor shape for drawpanel.

Definition at line 456 of file legacy_wx/class_drawpanel.h.

457  {
458  m_currentCursor = aCursor;
459  SetCursor( (wxStockCursor) m_currentCursor );
460  }
int m_currentCursor
Current mouse cursor shape id.
void EDA_DRAW_PANEL_GAL::SetDefaultCursor ( )
virtualinherited

Definition at line 510 of file draw_panel_gal.cpp.

References EDA_DRAW_PANEL_GAL::m_defaultCursor, and EDA_DRAW_PANEL_GAL::SetCurrentCursor().

Referenced by AbortBlockCurrentCommand().

511 {
513 }
int m_defaultCursor
The default mouse cursor shape id.
virtual void SetCurrentCursor(int aCursor)
Function SetCurrentCursor Set the current cursor shape for this panel.
void SCH_DRAW_PANEL::setDefaultLayerDeps ( )
protected

Sets rendering targets & dependencies for layers.

Definition at line 232 of file sch_draw_panel.cpp.

References i, LAYER_DRAW_BITMAPS, LAYER_GP_OVERLAY, LAYER_SELECT_OVERLAY, LAYER_WORKSHEET, KIGFX::TARGET_CACHED, KIGFX::TARGET_NONCACHED, KIGFX::TARGET_OVERLAY, and KIGFX::VIEW::VIEW_MAX_LAYERS.

233 {
234  // caching makes no sense for Cairo and other software renderers
236 
237  for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
238  m_view->SetLayerTarget( i, target );
239 
240  // Bitmaps are draw on a non cached GAL layer:
242 
243  // Some draw layers need specific settings
246 
249 
252 }
GAL_TYPE m_backend
Currently used GAL.
to handle and draw images bitmaps
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:699
Auxiliary rendering target (noncached)
Definition: definitions.h:42
void SetLayerTarget(int aLayer, RENDER_TARGET aTarget)
Function SetLayerTarget() Changes the rendering target for a particular layer.
Definition: view.h:445
void SetLayerDisplayOnly(int aLayer, bool aDisplayOnly=true)
Definition: view.h:433
Items that may change while the view stays the same (noncached)
Definition: definitions.h:43
general purpose overlay
Main rendering target (cached)
Definition: definitions.h:41
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
size_t i
Definition: json11.cpp:597
currently selected items overlay
void SCH_DRAW_PANEL::setDefaultLayerOrder ( )
protected

Reassigns layer order to the initial settings.

Definition at line 173 of file sch_draw_panel.cpp.

References i, SCH_LAYER_ORDER, and KIGFX::VIEW::VIEW_MAX_LAYERS.

174 {
175  for( LAYER_NUM i = 0; (unsigned) i < sizeof( SCH_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
176  {
177  LAYER_NUM layer = SCH_LAYER_ORDER[i];
178  wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
179 
180  m_view->SetLayerOrder( layer, i );
181  }
182 }
void SetLayerOrder(int aLayer, int aRenderingOrder)
Function SetLayerOrder() Sets rendering order of a particular layer.
Definition: view.cpp:652
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:699
static const LAYER_NUM SCH_LAYER_ORDER[]
Definition: sch_view.h:42
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
size_t i
Definition: json11.cpp:597
void SCH_DRAW_PANEL::SetEnableAutoPan ( bool  aEnable)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 214 of file sch_draw_panel.cpp.

215 {
216  m_enableAutoPan = aEnable;
217 
218  if( GetParent()->IsGalCanvasActive() )
220 }
virtual EDA_DRAW_FRAME * GetParent() const override
virtual void EnableAutoPan(bool aEnabled)
Function EnableAutoPan Turns on/off auto panning (user setting to disable it entirely).
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:908
bool m_enableAutoPan
True to enable automatic panning.
void EDA_DRAW_PANEL::SetEnableBlockCommands ( bool  aEnable)
inlineinherited

Definition at line 131 of file legacy_gal/class_drawpanel.h.

Referenced by GERBVIEW_FRAME::GERBVIEW_FRAME(), and PL_EDITOR_FRAME::PL_EDITOR_FRAME().

131 { m_enableBlockCommands = aEnable; }
bool m_enableBlockCommands
True enables block commands.
void EDA_DRAW_PANEL::SetEnableBlockCommands ( bool  aEnable)
inlineinherited

Definition at line 165 of file legacy_wx/class_drawpanel.h.

165 { m_enableBlockCommands = aEnable; }
bool m_enableBlockCommands
True enables block commands.
void SCH_DRAW_PANEL::SetEnableMousewheelPan ( bool  aEnable)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 205 of file sch_draw_panel.cpp.

206 {
207  m_enableMousewheelPan = aEnable;
208 
209  if( GetParent()->IsGalCanvasActive() )
211 }
virtual EDA_DRAW_FRAME * GetParent() const override
virtual void EnableMousewheelPan(bool aEnable)
Function EnableMousewheelPan() Enables or disables mousewheel panning.
bool m_enableMousewheelPan
True to enable mousewheel panning by default.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:908
void SCH_DRAW_PANEL::SetEnableZoomNoCenter ( bool  aEnable)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 223 of file sch_draw_panel.cpp.

224 {
225  m_enableZoomNoCenter = aEnable;
226 
227  if( GetParent()->IsGalCanvasActive() )
229 }
virtual EDA_DRAW_FRAME * GetParent() const override
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
void EnableCursorWarping(bool aEnable)
Function EnableCursorWarping() Enables or disables warping the cursor.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:908
void EDA_DRAW_PANEL_GAL::SetEventDispatcher ( TOOL_DISPATCHER aEventDispatcher)
inherited

Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools.

Parameters
aEventDispatcheris the object that will be used for dispatching events. DRAW_PANEL_GAL does not take over the ownership. Passing NULL disconnects all event handlers from the DRAW_PANEL_GAL and parent frame.

Definition at line 290 of file draw_panel_gal.cpp.

References TOOL_DISPATCHER::DispatchWxCommand(), EDA_DRAW_PANEL_GAL::m_eventDispatcher, and EDA_DRAW_PANEL_GAL::m_parent.

Referenced by EVT_GRID_CMD_CELL_CHANGED(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_EDIT_FRAME::setupTools(), PCB_BASE_FRAME::UseGalCanvas(), and GERBVIEW_FRAME::UseGalCanvas().

291 {
292  m_eventDispatcher = aEventDispatcher;
293  const wxEventType eventTypes[] = { wxEVT_TOOL };
294 
295  if( m_eventDispatcher )
296  {
297  for( wxEventType type : eventTypes )
298  {
299  m_parent->Connect( type, wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
300  NULL, m_eventDispatcher );
301  }
302  }
303  else
304  {
305  for( wxEventType type : eventTypes )
306  {
307  // While loop is used to be sure that all event handlers are removed.
308  while( m_parent->Disconnect( type,
309  wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
310  NULL, m_eventDispatcher ) );
311  }
312  }
313 }
wxWindow * m_parent
Pointer to the parent window.
TOOL_DISPATCHER * m_eventDispatcher
Processes and forwards events to tools.
virtual void DispatchWxCommand(wxCommandEvent &aEvent)
Function DispatchWxCommand() Processes wxCommands (mostly menu related events) and runs appropriate a...
void EDA_DRAW_PANEL_GAL::SetFocus ( )
overridevirtualinherited

Definition at line 133 of file draw_panel_gal.cpp.

References EDA_DRAW_PANEL_GAL::m_lostFocus.

Referenced by EDA_DRAW_PANEL_GAL::onEnter(), EDA_DRAW_PANEL_GAL::OnEvent(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), and GERBVIEW_FRAME::SetActiveLayer().

134 {
135 // Windows has a strange manner on bringing up and activating windows
136 // containing a GAL canvas just after moving the mouse cursor into its area.
137 // Feel free to uncomment or extend the following #ifdef if you experience
138 // similar problems on your platform.
139 #ifdef __WINDOWS__
140  if( !GetParent()->IsDescendant( wxWindow::FindFocus() ) )
141  return;
142 #endif
143 
144  wxScrolledCanvas::SetFocus();
145  m_lostFocus = false;
146 }
bool m_lostFocus
Flag to indicate that focus should be regained on the next mouse event.
void EDA_DRAW_PANEL::SetGrid ( const wxRealPoint &  size)
inherited
void EDA_DRAW_PANEL_GAL::SetHighContrastLayer ( int  aLayer)
virtualinherited

Function SetHighContrastLayer Takes care of display settings for the given layer to be displayed in high contrast mode.

Reimplemented in PCB_DRAW_PANEL_GAL, and GERBVIEW_DRAW_PANEL_GAL.

Definition at line 332 of file draw_panel_gal.cpp.

References KIGFX::RENDER_SETTINGS::ClearActiveLayers(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), EDA_DRAW_PANEL_GAL::m_view, KIGFX::RENDER_SETTINGS::SetActiveLayer(), EDA_DRAW_PANEL_GAL::SetTopLayer(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by GERBVIEW_FRAME::SetActiveLayer().

333 {
334  // Set display settings for high contrast mode
336 
337  SetTopLayer( aLayer );
338 
339  rSettings->ClearActiveLayers();
340  rSettings->SetActiveLayer( aLayer );
341 
343 }
Class RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output ...
Definition: painter.h:56
void SetActiveLayer(int aLayerId, bool aEnabled=true)
Function SetActiveLayer Sets the specified layer as active - it means that it can be drawn in a speci...
Definition: painter.h:76
void ClearActiveLayers()
Function ClearActiveLayers Clears the list of active layers.
Definition: painter.h:98
virtual void SetTopLayer(int aLayer)
Function SetTopLayer Moves the selected layer to the top, so it is displayed above all others...
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:786
void EDA_DRAW_PANEL::SetIgnoreLeftButtonReleaseEvent ( bool  aIgnore)
inlineinherited

Definition at line 129 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent().

129 { m_ignoreNextLeftButtonRelease = aIgnore; }
bool m_ignoreNextLeftButtonRelease
Ignore the next mouse left button release when true.
void EDA_DRAW_PANEL::SetIgnoreLeftButtonReleaseEvent ( bool  aIgnore)
inlineinherited

Definition at line 163 of file legacy_wx/class_drawpanel.h.

163 { m_ignoreNextLeftButtonRelease = aIgnore; }
bool m_ignoreNextLeftButtonRelease
Ignore the next mouse left button release when true.
void EDA_DRAW_PANEL::SetIgnoreMouseEvents ( bool  aIgnore)
inlineinherited

Definition at line 161 of file legacy_wx/class_drawpanel.h.

161 { m_ignoreMouseEvents = aIgnore; }
bool m_ignoreMouseEvents
Ignore mouse events when true.
virtual void EDA_DRAW_PANEL::SetMouseCapture ( MOUSE_CAPTURE_CALLBACK  aMouseCaptureCallback,
END_MOUSE_CAPTURE_CALLBACK  aEndMouseCaptureCallback 
)
inlinevirtualinherited

Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallback and aEndMouseCaptureCallback respectively.

Definition at line 307 of file legacy_gal/class_drawpanel.h.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortBlockCurrentCommand(), AbortMoveAndEditTarget(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Self(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), SCH_EDIT_FRAME::BeginSegment(), LIB_EDIT_FRAME::CreateGraphicItem(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Texte_Pcb(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::End_Zone(), LIB_EDIT_FRAME::EndDrawGraphicItem(), Exit_Self(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), BLOCK_SELECTOR::InitData(), PL_EDITOR_FRAME::MoveItem(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PL_EDITOR_FRAME::PlaceItem(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), LIB_EDIT_FRAME::PlacePin(), PCB_BASE_FRAME::PlaceTexteModule(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), and PCB_EDIT_FRAME::StartMoveTextePcb().

309  {
310  m_mouseCaptureCallback = aMouseCaptureCallback;
311  m_endMouseCaptureCallback = aEndMouseCaptureCallback;
312  }
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
Abort mouse capture callback function.
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
void EDA_DRAW_PANEL::SetMouseCapture ( MOUSE_CAPTURE_CALLBACK  aMouseCaptureCallback,
END_MOUSE_CAPTURE_CALLBACK  aEndMouseCaptureCallback 
)
inlineinherited

Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallback and aEndMouseCaptureCallback respectively.

Definition at line 400 of file legacy_wx/class_drawpanel.h.

402  {
403  m_mouseCaptureCallback = aMouseCaptureCallback;
404  m_endMouseCaptureCallback = aEndMouseCaptureCallback;
405  }
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
Abort mouse capture callback function.
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
void EDA_DRAW_PANEL::SetMouseCaptureCallback ( MOUSE_CAPTURE_CALLBACK  aMouseCaptureCallback)
inlineinherited

Definition at line 408 of file legacy_wx/class_drawpanel.h.

References EDA_DRAW_PANEL::EndMouseCapture().

409  {
410  m_mouseCaptureCallback = aMouseCaptureCallback;
411  }
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
void EDA_DRAW_PANEL::SetPrintMirrored ( bool  aMirror)
inlineinherited

Definition at line 134 of file legacy_gal/class_drawpanel.h.

134 { m_PrintIsMirrored = aMirror; }
bool m_PrintIsMirrored
True when drawing in mirror mode.
void EDA_DRAW_PANEL::SetPrintMirrored ( bool  aMirror)
inlineinherited

Definition at line 168 of file legacy_wx/class_drawpanel.h.

168 { m_PrintIsMirrored = aMirror; }
bool m_PrintIsMirrored
True when drawing in mirror mode.
void EDA_DRAW_PANEL_GAL::SetStealsFocus ( bool  aStealsFocus)
inlineinherited

Set whether focus is taken on certain events (mouseover, keys, etc).

This should be true (and is by default) for any primary canvas, but can be false to make well-behaved preview panes and the like.

Definition at line 194 of file class_draw_panel_gal.h.

Referenced by FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL(), DIALOG_PAD_PROPERTIES::prepareCanvas(), and SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET().

195  {
196  m_stealsFocus = aStealsFocus;
197  }
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over...
void EDA_DRAW_PANEL_GAL::SetTopLayer ( int  aLayer)
virtualinherited

Function SetTopLayer Moves the selected layer to the top, so it is displayed above all others.

Reimplemented in PCB_DRAW_PANEL_GAL, and GERBVIEW_DRAW_PANEL_GAL.

Definition at line 346 of file draw_panel_gal.cpp.

References KIGFX::VIEW::ClearTopLayers(), EDA_DRAW_PANEL_GAL::m_view, KIGFX::VIEW::SetTopLayer(), and KIGFX::VIEW::UpdateAllLayersOrder().

Referenced by EDA_DRAW_PANEL_GAL::SetHighContrastLayer().

347 {
349  m_view->SetTopLayer( aLayer );
351 }
virtual void SetTopLayer(int aLayer, bool aEnabled=true)
Function SetTopLayer() Sets given layer to be displayed on the top or sets back the default order of ...
Definition: view.cpp:848
void UpdateAllLayersOrder()
Function UpdateLayerOrder() Does everything that is needed to apply the rendering order of layers...
Definition: view.cpp:915
void ClearTopLayers()
Function ClearTopLayers() Removes all layers from the on-the-top set (they are no longer displayed ov...
Definition: view.cpp:900
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
void EDA_DRAW_PANEL::SetZoom ( double  mode)
inlinevirtualinherited

Definition at line 203 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::GetScreen(), EDA_DRAW_PANEL::OnEraseBackground(), and EDA_DRAW_PANEL::OnMouseWheel().

203 { printf("EDA_DRAW_PANEL:Unimplemented7\n"); };;
void EDA_DRAW_PANEL::SetZoom ( double  mode)
inherited
void EDA_DRAW_PANEL_GAL::StartDrawing ( )
inherited

Function StartDrawing() Begins drawing if it was stopped previously.

Definition at line 316 of file draw_panel_gal.cpp.

References EDA_DRAW_PANEL_GAL::m_refreshTimer.

Referenced by FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL(), DIALOG_PAD_PROPERTIES::prepareCanvas(), DIALOG_PAD_PROPERTIES::redraw(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), PCB_BASE_FRAME::UseGalCanvas(), and GERBVIEW_FRAME::UseGalCanvas().

317 {
318  // Start querying GAL if it is ready
319  m_refreshTimer.StartOnce( 100 );
320 }
wxTimer m_refreshTimer
Timer responsible for preventing too frequent refresh.
void EDA_DRAW_PANEL_GAL::StopDrawing ( )
inherited

Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDrawing() is called.

Definition at line 323 of file draw_panel_gal.cpp.

References EDA_DRAW_PANEL_GAL::m_drawingEnabled, EDA_DRAW_PANEL_GAL::m_pendingRefresh, EDA_DRAW_PANEL_GAL::m_refreshTimer, and EDA_DRAW_PANEL_GAL::onPaint().

Referenced by DIALOG_PAD_PROPERTIES::OnCancel(), LIB_VIEW_FRAME::OnCloseWindow(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), DIALOG_PAD_PROPERTIES::redraw(), EDA_DRAW_PANEL_GAL::SwitchBackend(), GERBVIEW_FRAME::UseGalCanvas(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), and FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME().

324 {
325  m_drawingEnabled = false;
326  Disconnect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
327  m_pendingRefresh = false;
328  m_refreshTimer.Stop();
329 }
bool m_pendingRefresh
Is there a redraw event requested?
wxTimer m_refreshTimer
Timer responsible for preventing too frequent refresh.
virtual void onPaint(wxPaintEvent &WXUNUSED(aEvent))
bool m_drawingEnabled
Flag that determines if VIEW may use GAL for redrawing the screen.
bool SCH_DRAW_PANEL::SwitchBackend ( GAL_TYPE  aGalType)
overridevirtual

Function SwitchBackend Switches method of rendering graphics.

Parameters
aGalTypeis a type of rendering engine that you want to use.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 185 of file sch_draw_panel.cpp.

References EDA_DRAW_FRAME::IsGridVisible(), Refresh(), SCH_WORLD_UNIT, EDA_DRAW_FRAME::SetGridVisibility(), and EDA_DRAW_PANEL_GAL::SwitchBackend().

186 {
187  VECTOR2D grid_size = m_gal->GetGridSize();
188  bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType );
191 
192  // Keep grid size and grid visibility:
193  m_gal->SetGridSize( grid_size );
194  SCH_BASE_FRAME* frame = dynamic_cast<SCH_BASE_FRAME*>( GetParent() );
195 
196  if( frame )
198 
199  Refresh();
200 
201  return rv;
202 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
virtual EDA_DRAW_FRAME * GetParent() const override
constexpr double SCH_WORLD_UNIT
Definition: sch_view.h:40
virtual bool SwitchBackend(GAL_TYPE aGalType)
Function SwitchBackend Switches method of rendering graphics.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual bool IsGridVisible() const
Definition: draw_frame.h:528
void setDefaultLayerDeps()
Sets rendering targets & dependencies for layers.
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.
const VECTOR2D & GetGridSize() const
Returns the grid size.
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
A shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME, and it brings in a common way of handling the provided virtual functions for the derived classes.
wxPoint EDA_DRAW_PANEL::ToDeviceXY ( const wxPoint pos)
inlinevirtualinherited

Function ToDeviceXY transforms logical to device coordinates.

Definition at line 266 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::GetScreen(), and EDA_DRAW_PANEL::OnEraseBackground().

266 { printf("EDA_DRAW_PANEL:Unimplemented15\n"); return wxPoint(0, 0); };;
wxPoint EDA_DRAW_PANEL::ToDeviceXY ( const wxPoint pos)
inherited

Function ToDeviceXY transforms logical to device coordinates.

wxPoint EDA_DRAW_PANEL::ToLogicalXY ( const wxPoint pos)
inlinevirtualinherited

Function ToLogicalXY transforms device to logical coordinates.

Definition at line 272 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::GetScreen(), and EDA_DRAW_PANEL::OnEraseBackground().

272 { printf("EDA_DRAW_PANEL:Unimplemented16\n"); return wxPoint(0, 0); };;
wxPoint EDA_DRAW_PANEL::ToLogicalXY ( const wxPoint pos)
inherited

Function ToLogicalXY transforms device to logical coordinates.

void SCH_DRAW_PANEL::UseColorScheme ( const COLORS_DESIGN_SETTINGS aSettings)

Function UseColorScheme Applies layer color settings.

Parameters
aSettingsare the new settings.
KIGFX::SCH_VIEW * SCH_DRAW_PANEL::view ( ) const
protected

Definition at line 255 of file sch_draw_panel.cpp.

256 {
257  return static_cast<KIGFX::SCH_VIEW*>( m_view );
258 }
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.

Member Data Documentation

bool EDA_DRAW_PANEL::m_abortRequest
protectedinherited

Flag used to abort long commands.

Definition at line 42 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::GetAbortRequest(), and EDA_DRAW_PANEL::OnKeyEvent().

int EDA_DRAW_PANEL::m_canStartBlock
protectedinherited

useful to avoid false start block in certain cases (like switch from a sheet to another sheet >= 0 (or >= n) if a block can start

Definition at line 83 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::OnActivate(), and EDA_DRAW_PANEL::OnMouseEvent().

EDA_RECT EDA_DRAW_PANEL::m_ClipBox
protectedinherited

The drawing area used to redraw the screen which is usually the visible area of the drawing in internal units.

Definition at line 40 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetGrid(), EDA_DRAW_PANEL::GetScreen(), EDA_DRAW_PANEL::OnPaint(), and EDA_DRAW_PANEL::OnScroll().

int EDA_DRAW_PANEL_GAL::m_currentCursor
protectedinherited

Current mouse cursor shape id.

Definition at line 253 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), and EDA_DRAW_PANEL_GAL::SetCurrentCursor().

int EDA_DRAW_PANEL::m_cursorLevel
protectedinherited

Index for cursor redraw in XOR mode.

Definition at line 30 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::GetScreen(), and EDA_DRAW_PANEL::OnMouseEntering().

wxPoint EDA_DRAW_PANEL::m_CursorStartPos
protectedinherited

Used for testing the cursor movement.

Definition at line 34 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnMouseEvent().

int EDA_DRAW_PANEL_GAL::m_defaultCursor
protectedinherited

The default mouse cursor shape id.

Definition at line 255 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), and EDA_DRAW_PANEL_GAL::SetDefaultCursor().

int EDA_DRAW_PANEL::m_doubleClickInterval
protectedinherited
bool EDA_DRAW_PANEL_GAL::m_drawing
protectedinherited
bool EDA_DRAW_PANEL_GAL::m_drawingEnabled
protectedinherited

Flag that determines if VIEW may use GAL for redrawing the screen.

Definition at line 273 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), EDA_DRAW_PANEL_GAL::onRefreshTimer(), and EDA_DRAW_PANEL_GAL::StopDrawing().

EDA_DRAW_FRAME* EDA_DRAW_PANEL_GAL::m_edaFrame
protectedinherited
bool EDA_DRAW_PANEL::m_enableAutoPan
protectedinherited
bool EDA_DRAW_PANEL::m_enableBlockCommands
protectedinherited

True enables block commands.

Definition at line 60 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), and EDA_DRAW_PANEL::OnMouseEvent().

bool EDA_DRAW_PANEL::m_enableMousewheelPan
protectedinherited
bool EDA_DRAW_PANEL::m_enableZoomNoCenter
protectedinherited

True to enable zooming around the crosshair instead of the center.

Definition at line 44 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::GetEnableZoomNoCenter(), EDA_DRAW_PANEL::OnMouseWheel(), and EDA_DRAW_PANEL::OnPaint().

END_MOUSE_CAPTURE_CALLBACK EDA_DRAW_PANEL::m_endMouseCaptureCallback
protectedinherited

Abort mouse capture callback function.

Definition at line 78 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::OnMouseEvent(), and EDA_DRAW_PANEL::OnPan().

TOOL_DISPATCHER* EDA_DRAW_PANEL_GAL::m_eventDispatcher
protectedinherited

Processes and forwards events to tools.

Definition at line 298 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), EDA_DRAW_PANEL_GAL::OnEvent(), and EDA_DRAW_PANEL_GAL::SetEventDispatcher().

bool EDA_DRAW_PANEL::m_ignoreMouseEvents
protectedinherited
bool EDA_DRAW_PANEL::m_ignoreNextLeftButtonRelease
protectedinherited

Ignore the next mouse left button release when true.

Definition at line 58 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), and EDA_DRAW_PANEL::OnMouseEvent().

wxLongLong EDA_DRAW_PANEL_GAL::m_lastRefresh
protectedinherited

Last timestamp when the panel was refreshed.

Definition at line 264 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::onPaint(), and EDA_DRAW_PANEL_GAL::Refresh().

bool EDA_DRAW_PANEL_GAL::m_lostFocus
protectedinherited

Flag to indicate that focus should be regained on the next mouse event.

It is a workaround for cases when the panel loses keyboard focus, so it does not react to hotkeys anymore.

Definition at line 302 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), EDA_DRAW_PANEL_GAL::OnEvent(), EDA_DRAW_PANEL_GAL::onLostFocus(), and EDA_DRAW_PANEL_GAL::SetFocus().

int EDA_DRAW_PANEL::m_minDragEventCount
protectedinherited

Count the drag events.

Used to filter mouse moves before starting a block command. A block command can be started only if MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND in order to avoid spurious block commands.

Definition at line 68 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), and EDA_DRAW_PANEL::OnMouseEvent().

MOUSE_CAPTURE_CALLBACK EDA_DRAW_PANEL::m_mouseCaptureCallback
protectedinherited

Mouse capture move callback function.

Definition at line 75 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::OnMouseLeaving(), and EDA_DRAW_PANEL::OnPan().

wxTimer EDA_DRAW_PANEL_GAL::m_onShowTimer
protectedinherited

Timer used to execute OnShow() when the window finally appears on the screen.

Definition at line 279 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), and EDA_DRAW_PANEL_GAL::onShowTimer().

KIGFX::GAL_DISPLAY_OPTIONS& EDA_DRAW_PANEL_GAL::m_options
protectedinherited

Definition at line 295 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

wxPoint EDA_DRAW_PANEL::m_PanStartCenter
protectedinherited

Initial scroll center position when pan started.

Definition at line 35 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnMouseEvent().

wxPoint EDA_DRAW_PANEL::m_PanStartEventPosition
protectedinherited

Initial position of mouse event when pan started.

Definition at line 36 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnMouseEvent().

wxWindow* SCH_DRAW_PANEL::m_parent
protected

Definition at line 104 of file sch_draw_panel.h.

bool EDA_DRAW_PANEL_GAL::m_pendingRefresh
protectedinherited
bool EDA_DRAW_PANEL::m_PrintIsMirrored
protectedinherited

True when drawing in mirror mode.

Used by the draw arc function, because arcs are oriented, and in mirror mode, orientations are reversed.

Definition at line 72 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), and EDA_DRAW_PANEL::GetPrintMirrored().

wxTimer EDA_DRAW_PANEL_GAL::m_refreshTimer
protectedinherited
bool EDA_DRAW_PANEL::m_requestAutoPan
protectedinherited

true to request an auto pan. Valid only when m_enableAutoPan = true.

Definition at line 49 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::OnMouseEvent(), EDA_DRAW_PANEL::OnMouseLeaving(), and EDA_DRAW_PANEL::OnPan().

int EDA_DRAW_PANEL::m_scrollIncrementX
protectedinherited

X axis scroll increment in pixels per unit.

Definition at line 31 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::GetGrid(), EDA_DRAW_PANEL::OnPan(), and EDA_DRAW_PANEL::OnScroll().

int EDA_DRAW_PANEL::m_scrollIncrementY
protectedinherited

Y axis scroll increment in pixels per unit.

Definition at line 32 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), EDA_DRAW_PANEL::GetGrid(), EDA_DRAW_PANEL::OnPan(), and EDA_DRAW_PANEL::OnScroll().

bool EDA_DRAW_PANEL::m_showCrossHair
protectedinherited

Indicate if cross hair is to be shown.

Definition at line 29 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::EDA_DRAW_PANEL(), and EDA_DRAW_PANEL::GetScreen().

bool EDA_DRAW_PANEL_GAL::m_stealsFocus
protectedinherited

Flag to indicate whether the panel should take focus at certain times (when moused over, and on various mouse/key events)

Definition at line 306 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), EDA_DRAW_PANEL_GAL::onEnter(), and EDA_DRAW_PANEL_GAL::OnEvent().

const int EDA_DRAW_PANEL_GAL::MinRefreshPeriod = 17
staticprotectedinherited

60 FPS.

Definition at line 250 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::Refresh().


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