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
 
void SetAutoPanRequest (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 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_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, dynamic_cast<SCH_BASE_FRAME*>( aParentWindow ) );
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_enableBlockCommands = false;
124 
125  m_cursorLevel = 0;
126  m_PrintIsMirrored = false;
127 
128  m_doubleClickInterval = 250;
129 
130  m_viewControls->SetSnapping( true );
131 
132  SetEvtHandlerEnabled( true );
133  SetFocus();
134  Show( true );
135  Raise();
136  StartDrawing();
137 }
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:42
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:925
void SetMirror(bool aMirrorX, bool aMirrorY)
Function SetMirror() Controls the mirroring of the VIEW.
Definition: view.cpp:564
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:48
void OnMouseEvent(wxMouseEvent &event)
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
#define ENBL_AUTO_PAN_KEY
Definition: pgm_base.h:51
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:49
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:189
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:518
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 140 of file sch_draw_panel.cpp.

141 {
142 }

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 565 of file sch_draw_panel.cpp.

566 {
567  // CallEndMouseCapture is sometimes called with m_endMouseCaptureCallback == NULL
568  // for instance after an ABORT in block paste.
570  m_endMouseCaptureCallback( this, aDC );
571 }
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 557 of file sch_draw_panel.cpp.

Referenced by LIB_EDIT_FRAME::OnRotate().

558 {
559  wxCHECK_RET( m_mouseCaptureCallback != NULL, wxT( "Mouse capture callback not set." ) );
560 
561  m_mouseCaptureCallback( this, aDC, aPosition, aErase );
562 }
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 593 of file sch_draw_panel.cpp.

594 {
595  m_viewControls->ShowCursor( false );
596 }
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 599 of file sch_draw_panel.cpp.

600 {
601  m_viewControls->ShowCursor( true );
602 }
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 204 of file legacy_gal/class_drawpanel.h.

Referenced by EDA_DRAW_PANEL::OnEraseBackground().

204 { 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 145 of file sch_draw_panel.cpp.

Referenced by LIB_EDIT_FRAME::RebuildView().

146 {
147  view()->Clear();
148  view()->DisplayComponent( const_cast<LIB_PART*>(aComponent) );
149 
150 }
KIGFX::SCH_VIEW * view() const
void DisplayComponent(LIB_PART *aPart)
Definition: sch_view.cpp:116
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1109
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:110
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1109
void SCH_DRAW_PANEL::DisplaySheet ( const SCH_SCREEN aScreen)

Definition at line 160 of file sch_draw_panel.cpp.

161 {
162  view()->Clear();
163 
164  if( aScreen )
165  view()->DisplaySheet( const_cast<SCH_SCREEN*>( aScreen ) );
166 }
KIGFX::SCH_VIEW * view() const
void DisplaySheet(SCH_SHEET *aSheet)
Definition: sch_view.cpp:110
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1109
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, and EDA_DRAW_PANEL::SetClipBox().

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 182 of file legacy_gal/class_drawpanel.h.

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

182 { 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 163 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().

163 { 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 311 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().

311 { 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 173 of file legacy_gal/class_drawpanel.h.

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

173 { 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 192 of file legacy_gal/class_drawpanel.h.

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

192 { 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 574 of file sch_draw_panel.cpp.

576 {
577  if( m_mouseCaptureCallback && m_endMouseCaptureCallback && aCallEndFunc )
578  {
579  m_endMouseCaptureCallback( this, nullptr );
580  }
581 
582  m_mouseCaptureCallback = NULL;
584  SetAutoPanRequest( false );
585 
586  if( id != -1 && cursor != -1 )
587  {
588  //wxASSERT( cursor > wxCURSOR_NONE && cursor < wxCURSOR_MAX );
589  GetParent()->SetToolID( id, cursor, title );
590  }
591 }
virtual EDA_DRAW_FRAME * GetParent() const override
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 SetAutoPanRequest(bool aEnable) override
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 218 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().

218 { 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 122 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().

122 { 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 138 of file legacy_gal/class_drawpanel.h.

References EDA_DRAW_PANEL::m_enableAutoPan.

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

138 { 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 130 of file legacy_gal/class_drawpanel.h.

References EDA_DRAW_PANEL::m_enableMousewheelPan.

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

130 { 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 134 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().

134 { 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 362 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().

363 {
365 }
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:461
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 274 of file sch_draw_panel.cpp.

Referenced by DrawMovingBlockOutlines().

275 {
276  return static_cast<EDA_DRAW_FRAME*>(m_parent); // static_cast<SCH_EDIT_FRAME*> (m_parent);
277 }
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 150 of file legacy_gal/class_drawpanel.h.

References EDA_DRAW_PANEL::m_PrintIsMirrored.

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

150 { 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 269 of file sch_draw_panel.cpp.

270 {
271  return GetParent()->GetScreen();
272 }
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:394
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 271 of file legacy_gal/class_drawpanel.h.

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

271 { 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 87 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(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), ExitSheet(), SCH_EDIT_FRAME::FindComponentAndItem(), 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(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectOptionToolbar(), LIB_VIEW_FRAME::OnShowElectricalType(), LIB_EDIT_FRAME::OnShowElectricalType(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), 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(), DIALOG_FIELDS_EDITOR_GLOBAL::~DIALOG_FIELDS_EDITOR_GLOBAL(), and LIB_VIEW_FRAME::~LIB_VIEW_FRAME().

87 { return view(); }
KIGFX::SCH_VIEW * view() const
KIGFX::VIEW_CONTROLS* EDA_DRAW_PANEL_GAL::GetViewControls ( ) const
inlineinherited
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 221 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().

221 { 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 354 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().

354 { 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 233 of file legacy_gal/class_drawpanel.h.

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

233 { 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 296 of file legacy_gal/class_drawpanel.h.

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

296 { 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 605 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().

606 {
607  GetViewControls()->WarpCursor( GetParent()->GetCrossHairPosition(), true );
608 }
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_PANEL::OnEraseBackground(), and EDA_DRAW_FRAME::OnPageSettingsChange().

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 617 of file sch_draw_panel.cpp.

Referenced by SCH_DRAW_PANEL().

618 {
619  event.Skip();
620 }
void EDA_DRAW_PANEL_GAL::onEnter ( wxEvent &  aEvent)
protectedinherited

Definition at line 467 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().

468 {
469  // Getting focus is necessary in order to receive key events properly
470  if( m_stealsFocus )
471  SetFocus();
472 
473  aEvent.Skip();
474 }
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 453 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().

454 {
455  if( m_lostFocus && m_stealsFocus )
456  SetFocus();
457 
458  if( !m_eventDispatcher )
459  aEvent.Skip();
460  else
462 
463  Refresh();
464 }
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 623 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().

624 {
625  int localkey;
626 
627  localkey = event.GetKeyCode();
628 
629  switch( localkey )
630  {
631  default:
632  break;
633 
634  case WXK_ESCAPE:
635  m_abortRequest = true;
636 
637  if( IsMouseCaptured() )
638  EndMouseCapture();
639  else
640  EndMouseCapture( ID_NO_TOOL_SELECTED, 0 /*m_defaultCursor*/, wxEmptyString );
641  break;
642  }
643 
644  /* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
645  * They have an ascii code from 1 to 27 remapped
646  * to GR_KB_CTRL + 'A' to GR_KB_CTRL + 'Z'
647  */
648  if( event.ControlDown() && localkey >= WXK_CONTROL_A && localkey <= WXK_CONTROL_Z )
649  localkey += 'A' - 1;
650 
651  /* Disallow shift for keys that have two keycodes on them (e.g. number and
652  * punctuation keys) leaving only the "letter keys" of A-Z.
653  * Then, you can have, e.g. Ctrl-5 and Ctrl-% (GB layout)
654  * and Ctrl-( and Ctrl-5 (FR layout).
655  * Otherwise, you'd have to have to say Ctrl-Shift-5 on a FR layout
656  */
657  bool keyIsLetter = ( localkey >= 'A' && localkey <= 'Z' ) ||
658  ( localkey >= 'a' && localkey <= 'z' );
659 
660  if( event.ShiftDown() && ( keyIsLetter || localkey > 256 ) )
661  localkey |= GR_KB_SHIFT;
662 
663  if( event.ControlDown() )
664  localkey |= GR_KB_CTRL;
665 
666  if( event.AltDown() )
667  localkey |= GR_KB_ALT;
668 
669 
670  // Some key commands use the current mouse position: refresh it.
671  //pos = wxGetMousePosition() - GetScreenPosition();
672 
673  // Compute the cursor position in drawing units. Also known as logical units to wxDC.
674  //pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
675 
676  auto p = GetViewControls()->GetCursorPosition( false );
677 
678  wxPoint pos ((int)p.x, (int)p.y);
679 
680  GetParent()->SetMousePosition( pos );
681 
682  if( !GetParent()->GeneralControl( nullptr, pos, localkey ) )
683  event.Skip();
684 }
#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 477 of file draw_panel_gal.cpp.

References EDA_DRAW_PANEL_GAL::m_lostFocus.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

478 {
479  m_lostFocus = true;
480 
481  aEvent.Skip();
482 }
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 280 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().

281 {
282  int localbutt = 0;
283  BASE_SCREEN* screen = GetScreen();
284  auto controls = GetViewControls();
285  auto vmp = VECTOR2I( controls->GetMousePosition() );
286  wxPoint mousePos ( vmp.x, vmp.y );
287 
288  event.Skip();
289 
290  if( !screen )
291  return;
292 
293  /* Adjust value to filter mouse displacement before consider the drag
294  * mouse is really a drag command, not just a movement while click
295  */
296 #define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
297 
298  if( event.Leaving() )
299  m_canStartBlock = -1;
300 
301  if( !IsMouseCaptured() ) // No mouse capture in progress.
302  SetAutoPanRequest( false );
303 
304  if( GetParent()->IsActive() )
305  SetFocus();
306  else
307  return;
308 
309  if( !event.IsButton() && !event.Moving() && !event.Dragging() )
310  return;
311 
312  if( event.RightUp() )
313  {
314  OnRightClick( event );
315  return;
316  }
317 
318  if( m_ignoreMouseEvents )
319  return;
320 
321  if( event.LeftDown() )
322  localbutt = GR_M_LEFT_DOWN;
323 
324  if( event.ButtonDClick( 1 ) )
325  localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK;
326 
327  if( event.MiddleDown() )
328  localbutt = GR_M_MIDDLE_DOWN;
329 
330  // Compute the cursor position in drawing (logical) units.
331  //GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
332 
333  int kbstat = 0;
334 
335  if( event.ShiftDown() )
336  kbstat |= GR_KB_SHIFT;
337 
338  if( event.ControlDown() )
339  kbstat |= GR_KB_CTRL;
340 
341  if( event.AltDown() )
342  kbstat |= GR_KB_ALT;
343 
344  // Calling Double Click and Click functions :
345  if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
346  {
347  GetParent()->OnLeftDClick( nullptr, mousePos );
348 
349  // inhibit a response to the mouse left button release,
350  // because we have a double click, and we do not want a new
351  // OnLeftClick command at end of this Double Click
353  }
354  else if( event.LeftUp() )
355  {
356  // A block command is in progress: a left up is the end of block
357  // or this is the end of a double click, already seen
358  // Note also m_ignoreNextLeftButtonRelease can be set by
359  // the call to OnLeftClick(), so do not change it after calling OnLeftClick
360  bool ignoreEvt = m_ignoreNextLeftButtonRelease;
362 
363  if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
364  GetParent()->OnLeftClick( nullptr, mousePos );
365 
366  }
367  else if( !event.LeftIsDown() )
368  {
369  /* be sure there is a response to a left button release command
370  * even when a LeftUp event is not seen. This happens when a
371  * double click opens a dialog box, and the release mouse button
372  * is made when the dialog box is opened.
373  */
375  }
376 
377  if( event.ButtonDown( wxMOUSE_BTN_MIDDLE ) )
378  {
380  m_PanStartEventPosition = event.GetPosition();
381 
382  CrossHairOff( );
383  SetCurrentCursor( wxCURSOR_SIZING );
384  }
385 
386  if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) )
387  {
388  CrossHairOn();
390  }
391 
392  if( event.MiddleIsDown() )
393  {
394  // already managed by EDA_DRAW_PANEL_GAL mouse event handler.
395  return;
396  }
397 
398  // Calling the general function on mouse changes (and pseudo key commands)
399  GetParent()->GeneralControl( nullptr, mousePos );
400 
401  /*******************************/
402  /* Control of block commands : */
403  /*******************************/
404 
405  // Command block can't start if mouse is dragging a new panel
406  static SCH_DRAW_PANEL* lastPanel;
407  if( lastPanel != this )
408  {
410  m_canStartBlock = -1;
411  }
412 
413  /* A new command block can start after a release buttons
414  * and if the drag is enough
415  * This is to avoid a false start block when a dialog box is dismissed,
416  * or when changing panels in hierarchy navigation
417  * or when clicking while and moving mouse
418  */
419  if( !event.LeftIsDown() && !event.MiddleIsDown() )
420  {
422  m_canStartBlock = 0;
423 
424  /* Remember the last cursor position when a drag mouse starts
425  * this is the last position ** before ** clicking a button
426  * this is useful to start a block command from the point where the
427  * mouse was clicked first
428  * (a filter creates a delay for the real block command start, and
429  * we must remember this point)
430  */
432  }
433 
434  if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) )
435  {
436  if( !screen->IsBlockActive() )
437  {
439  }
440 
441  if( event.LeftDown() )
442  {
443  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
444  {
445  SetAutoPanRequest( false );
446  GetParent()->HandleBlockPlace( nullptr );
448  }
449  }
450  else if( ( m_canStartBlock >= 0 ) && event.LeftIsDown() && !IsMouseCaptured() )
451  {
452  // Mouse is dragging: if no block in progress, start a block command.
453  if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
454  {
455  // Start a block command
456  int cmd_type = kbstat;
457 
458  // A block command is started if the drag is enough. A small
459  // drag is ignored (it is certainly a little mouse move when
460  // clicking) not really a drag mouse
463  else
464  {
465  auto cmd = (GetParent()->GetToolId() == ID_ZOOM_SELECTION) ? BLOCK_ZOOM : 0;
466 
467  DBG(printf("start block\n");)
468 
469  if( !GetParent()->HandleBlockBegin( nullptr, cmd_type, m_CursorStartPos, cmd ) )
470  {
471  // should not occur: error
473  wxT( "EDA_DRAW_PANEL::OnMouseEvent() Block Error" ) );
474  }
475  else
476  {
477  SetAutoPanRequest( true );
478  SetCursor( wxCURSOR_SIZING );
479  }
480  }
481  }
482  }
483 
484  if( event.ButtonUp( wxMOUSE_BTN_LEFT ) )
485  {
486  /* Release the mouse button: end of block.
487  * The command can finish (DELETE) or have a next command (MOVE,
488  * COPY). However the block command is canceled if the block
489  * size is small because a block command filtering is already
490  * made, this case happens, but only when the on grid cursor has
491  * not moved.
492  */
493  #define BLOCK_MINSIZE_LIMIT 1
494  bool BlockIsSmall =
496  && ( std::abs( screen->m_BlockLocate.GetHeight() ) < BLOCK_MINSIZE_LIMIT );
497 
498  if( (screen->m_BlockLocate.GetState() != STATE_NO_BLOCK) && BlockIsSmall )
499  {
501  {
502  m_endMouseCaptureCallback( this, nullptr );
503  SetAutoPanRequest( false );
504  }
505 
506  //SetCursor( (wxStockCursor) m_currentCursor );
507  }
508  else if( screen->m_BlockLocate.GetState() == STATE_BLOCK_END )
509  {
510  SetAutoPanRequest( false );
511  GetParent()->HandleBlockEnd( nullptr );
512  //SetCursor( (wxStockCursor) m_currentCursor );
513  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
514  {
515  SetAutoPanRequest( true );
516  SetCursor( wxCURSOR_HAND );
517  }
518  }
519  }
520  }
521 
522  // End of block command on a double click
523  // To avoid an unwanted block move command if the mouse is moved while double clicking
524  if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
525  {
526  if( !screen->IsBlockActive() && IsMouseCaptured() )
527  {
528  m_endMouseCaptureCallback( this, nullptr );
529  }
530  }
531 
532  lastPanel = this;
533 
534 }
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
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.
void SetAutoPanRequest(bool aEnable) override
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:516
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_PANEL::SetAutoPanRequest(), and EDA_DRAW_FRAME::SetCrossHairPosition().

Referenced by EDA_DRAW_PANEL::OnEraseBackground().

921 {
922  if( m_mouseCaptureCallback == NULL ) // No command in progress.
923  SetAutoPanRequest( 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.
virtual void SetAutoPanRequest(bool aEnable)=0
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(), and EDA_DRAW_PANEL::SetZoom().

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();
1003  wxPoint center = GetParent()->GetScrollCenterPosition();
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:121
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:394
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 687 of file sch_draw_panel.cpp.

References EDA_DRAW_PANEL_GAL::onPaint().

688 {
689  if( !m_gal->IsInitialized() )
690  // The first wxPaintEvent can be fired at startup before the GAL engine is fully initialized
691  // (depending on platforms). Do nothing in this case
692  return;
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.
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
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(), and WHITE.

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_scrollIncrementX, EDA_DRAW_PANEL::m_scrollIncrementY, scale, EDA_DRAW_PANEL::SetAutoPanRequest(), EDA_DRAW_FRAME::SetScrollCenterPosition(), and EDA_DRAW_FRAME::SetToolID().

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 
1514  wxPoint center = GetParent()->GetScrollCenterPosition();
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:121
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:394
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 485 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().

486 {
487  if( !m_drawingEnabled )
488  {
489  if( m_gal && m_gal->IsInitialized() )
490  {
491  m_drawing = false;
492  m_pendingRefresh = true;
493  Connect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
494  m_drawingEnabled = true;
495  }
496  else
497  {
498  // Try again soon
499  m_refreshTimer.StartOnce( 100 );
500  return;
501  }
502  }
503 
504  wxPaintEvent redrawEvent;
505  wxPostEvent( this, redrawEvent );
506 }
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 537 of file sch_draw_panel.cpp.

538 {
539  auto controls = GetViewControls();
540  auto vmp = controls->GetMousePosition();
541  wxPoint mouseWorldPos ( (int) vmp.x, (int) vmp.y );
542 
543  wxMenu MasterMenu;
544 
545  if( !GetParent()->OnRightClick( mouseWorldPos, &MasterMenu ) )
546  return false;
547 
548  GetParent()->AddMenuZoomAndGrid( &MasterMenu );
549 
550  m_ignoreMouseEvents = true;
551  PopupMenu( &MasterMenu, event.GetPosition() );
552  m_ignoreMouseEvents = false;
553 
554  return true;
555 }
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(), and EDA_RECT::SetSize().

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 
500  wxPoint center = GetParent()->GetScrollCenterPosition();
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:121
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:394
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 169 of file sch_draw_panel.cpp.

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

Definition at line 509 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().

510 {
511  if( m_gal && m_gal->IsVisible() )
512  {
513  m_onShowTimer.Stop();
514  OnShow();
515  }
516 }
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 248 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().

249 {
251  wxSize clientSize = GetClientSize();
252  m_gal->ResizeScreen( clientSize.x, clientSize.y );
253 
254  if( m_view )
255  {
258  }
259 }
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 253 of file legacy_gal/class_drawpanel.h.

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

253 { 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 611 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(), SCH_EDIT_FRAME::FindComponentAndItem(), 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(), DIALOG_ERC::RedrawDrawPanel(), 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(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FIELDS_EDITOR_GLOBAL::~DIALOG_FIELDS_EDITOR_GLOBAL().

612 {
613  EDA_DRAW_PANEL_GAL::Refresh( aEraseBackground, aRect );
614 }
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 SCH_DRAW_PANEL::SetAutoPanRequest ( bool  aEnable)
overridevirtual

Implements EDA_DRAW_PANEL.

Definition at line 225 of file sch_draw_panel.cpp.

Referenced by SCH_EDIT_FRAME::OnHotKey().

226 {
227  wxCHECK( GetParent()->IsGalCanvasActive(), /*void*/ );
228  GetParent()->GetGalCanvas()->GetViewControls()->SetAutoPan( aEnable );
229 }
virtual EDA_DRAW_FRAME * GetParent() const override
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
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:925
void EDA_DRAW_PANEL::SetCanStartBlock ( int  aStartBlock)
inlineinherited

Definition at line 153 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().

153 { 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 124 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().

124 { 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 251 of file legacy_gal/class_drawpanel.h.

251 { 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 517 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().

518 {
519  if ( aCursor > wxCURSOR_NONE && aCursor < wxCURSOR_MAX )
520  {
521  m_currentCursor = aCursor;
522  }
523  else
524  {
525  m_currentCursor = wxCURSOR_ARROW;
526  }
527 
528  SetCursor( (wxStockCursor) m_currentCursor );
529 }
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 531 of file draw_panel_gal.cpp.

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

Referenced by AbortBlockCurrentCommand().

532 {
534 }
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 241 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.

242 {
243  // caching makes no sense for Cairo and other software renderers
245 
246  for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
247  m_view->SetLayerTarget( i, target );
248 
249  // Bitmaps are draw on a non cached GAL layer:
251 
252  // Some draw layers need specific settings
255 
258 
261 }
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:712
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 175 of file sch_draw_panel.cpp.

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

176 {
177  for( LAYER_NUM i = 0; (unsigned) i < sizeof( SCH_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
178  {
179  LAYER_NUM layer = SCH_LAYER_ORDER[i];
180  wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
181 
182  m_view->SetLayerOrder( layer, i );
183  }
184 }
void SetLayerOrder(int aLayer, int aRenderingOrder)
Function SetLayerOrder() Sets rendering order of a particular layer.
Definition: view.cpp:662
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:712
static const LAYER_NUM SCH_LAYER_ORDER[]
Definition: sch_view.h:44
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 216 of file sch_draw_panel.cpp.

References EDA_DRAW_PANEL::SetEnableAutoPan().

217 {
219 
220  if( GetParent()->IsGalCanvasActive() )
222 }
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:925
virtual void SetEnableAutoPan(bool aEnable)
void EDA_DRAW_PANEL::SetEnableBlockCommands ( bool  aEnable)
inlineinherited

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

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

148 { 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 207 of file sch_draw_panel.cpp.

208 {
209  m_enableMousewheelPan = aEnable;
210 
211  if( GetParent()->IsGalCanvasActive() )
213 }
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:925
void SCH_DRAW_PANEL::SetEnableZoomNoCenter ( bool  aEnable)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 232 of file sch_draw_panel.cpp.

233 {
234  m_enableZoomNoCenter = aEnable;
235 
236  if( GetParent()->IsGalCanvasActive() )
238 }
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:925
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 298 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().

299 {
300  m_eventDispatcher = aEventDispatcher;
301  const wxEventType eventTypes[] = { wxEVT_TOOL };
302 
303  if( m_eventDispatcher )
304  {
305  for( wxEventType type : eventTypes )
306  {
307  m_parent->Connect( type, wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
308  NULL, m_eventDispatcher );
309  }
310  }
311  else
312  {
313  for( wxEventType type : eventTypes )
314  {
315  // While loop is used to be sure that all event handlers are removed.
316  while( m_parent->Disconnect( type,
317  wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
318  NULL, m_eventDispatcher ) );
319  }
320  }
321 }
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 139 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().

140 {
141 // Windows has a strange manner on bringing up and activating windows
142 // containing a GAL canvas just after moving the mouse cursor into its area.
143 // Feel free to uncomment or extend the following #ifdef if you experience
144 // similar problems on your platform.
145 #ifdef __WINDOWS__
146  if( !GetParent()->IsDescendant( wxWindow::FindFocus() ) )
147  return;
148 #endif
149 
150  wxScrolledCanvas::SetFocus();
151  m_lostFocus = false;
152 }
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 340 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().

341 {
342  // Set display settings for high contrast mode
344 
345  SetTopLayer( aLayer );
346 
347  rSettings->ClearActiveLayers();
348  rSettings->SetActiveLayer( aLayer );
349 
351 }
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:796
void EDA_DRAW_PANEL::SetIgnoreLeftButtonReleaseEvent ( bool  aIgnore)
inlineinherited

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

Referenced by EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent().

146 { 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 324 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().

326  {
327  m_mouseCaptureCallback = aMouseCaptureCallback;
328  m_endMouseCaptureCallback = aEndMouseCaptureCallback;
329  }
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 151 of file legacy_gal/class_drawpanel.h.

151 { 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 354 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().

355 {
357  m_view->SetTopLayer( aLayer );
359 }
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:858
void UpdateAllLayersOrder()
Function UpdateLayerOrder() Does everything that is needed to apply the rendering order of layers...
Definition: view.cpp:925
void ClearTopLayers()
Function ClearTopLayers() Removes all layers from the on-the-top set (they are no longer displayed ov...
Definition: view.cpp:910
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 220 of file legacy_gal/class_drawpanel.h.

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

220 { 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 324 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().

325 {
326  // Start querying GAL if it is ready
327  m_refreshTimer.StartOnce( 100 );
328 }
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 331 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().

332 {
333  m_drawingEnabled = false;
334  Disconnect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
335  m_pendingRefresh = false;
336  m_refreshTimer.Stop();
337 }
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 187 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().

188 {
189  VECTOR2D grid_size = m_gal->GetGridSize();
190  bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType );
193 
194  // Keep grid size and grid visibility:
195  m_gal->SetGridSize( grid_size );
196  SCH_BASE_FRAME* frame = dynamic_cast<SCH_BASE_FRAME*>( GetParent() );
197 
198  if( frame )
200 
201  Refresh();
202 
203  return rv;
204 }
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:42
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:525
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 283 of file legacy_gal/class_drawpanel.h.

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

283 { 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 289 of file legacy_gal/class_drawpanel.h.

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

289 { 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 264 of file sch_draw_panel.cpp.

265 {
266  return static_cast<KIGFX::SCH_VIEW*>( m_view );
267 }
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 81 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 58 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 76 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 56 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 66 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 73 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 105 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 70 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
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: