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_UNKNOWN = -1, GAL_TYPE_NONE = 0, 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

◆ GAL_TYPE

Enumerator
GAL_TYPE_UNKNOWN 

not specified: a GAL engine must be set by the client

GAL_TYPE_NONE 

GAL not used (the legacy wxDC engine is 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.

60  {
61  GAL_TYPE_UNKNOWN = -1,
62  GAL_TYPE_NONE = 0,
66  };
Sentinel, do not use as a parameter.
not specified: a GAL engine must be set by the client
GAL not used (the legacy wxDC engine is used)

Constructor & Destructor Documentation

◆ SCH_DRAW_PANEL()

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.

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 
82  // Early initialization of the canvas background color,
83  // before any OnPaint event is fired for the canvas using a wrong bg color
84  auto settings = m_painter->GetSettings();
85  m_gal->SetClearColor( settings->GetBackgroundColor() );
86 
89 
91 
92  // View controls is the first in the event handler chain, so the Tool Framework operates
93  // on updated viewport data.
95 
96  const wxEventType events[] =
97  {
98  wxEVT_LEFT_UP, wxEVT_LEFT_DOWN, wxEVT_LEFT_DCLICK,
99  wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK,
100  wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK,
101  wxEVT_MOTION, wxEVT_MOUSEWHEEL,
102  };
103 
104  for( auto e : events )
105  {
106  Connect( e, wxMouseEventHandler( SCH_DRAW_PANEL::OnMouseEvent ), NULL, this );
107  }
108 
109  Connect( wxEVT_CHAR, wxKeyEventHandler( SCH_DRAW_PANEL::OnKeyEvent ), NULL, this );
110  Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( SCH_DRAW_PANEL::OnCharHook ), NULL, this );
111 
115 
116  m_canStartBlock = -1; // Command block can start if >= 0
117  m_abortRequest = false;
118  m_ignoreMouseEvents = false;
119  // Be sure a mouse release button event will be ignored when creating the canvas
120  // if the mouse click was not made inside the canvas (can happen sometimes, when
121  // launching a editor from a double click made in another frame)
123 
124  m_mouseCaptureCallback = NULL;
126 
127  m_enableBlockCommands = false;
129 
130  m_cursorLevel = 0;
131  m_PrintIsMirrored = false;
132 
133  m_doubleClickInterval = 250;
134 
135  m_viewControls->SetSnapping( true );
136 
137  SetEvtHandlerEnabled( true );
138  SetFocus();
139  Show( true );
140  Raise();
141  StartDrawing();
142 }
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...
void SetClearColor(const COLOR4D &aColor)
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:926
void SetMirror(bool aMirrorX, bool aMirrorY)
Function SetMirror() Controls the mirroring of the VIEW.
Definition: view.cpp:565
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:113
bool m_ignoreMouseEvents
Ignore mouse events when true.
KIGFX::SCH_VIEW * view() const
#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.
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:189
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.
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:519
void setDefaultLayerOrder()
Reassigns layer order to the initial settings.
int m_cursorLevel
Index for cursor redraw in XOR mode.

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.

◆ ~SCH_DRAW_PANEL()

SCH_DRAW_PANEL::~SCH_DRAW_PANEL ( )

Definition at line 145 of file sch_draw_panel.cpp.

146 {
147 }

Member Function Documentation

◆ CallEndMouseCapture()

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

570 {
571  // CallEndMouseCapture is sometimes called with m_endMouseCaptureCallback == NULL
572  // for instance after an ABORT in block paste.
574  m_endMouseCaptureCallback( this, aDC );
575 }
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
Abort mouse capture callback function.

◆ CallMouseCapture()

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

562 {
563  wxCHECK_RET( m_mouseCaptureCallback != NULL, wxT( "Mouse capture callback not set." ) );
564 
565  m_mouseCaptureCallback( this, aDC, aPosition, aErase );
566 }
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.

Referenced by LIB_EDIT_FRAME::OnRotate().

◆ CrossHairOff()

void SCH_DRAW_PANEL::CrossHairOff ( wxDC *  DC = nullptr)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 597 of file sch_draw_panel.cpp.

598 {
599  m_viewControls->ShowCursor( false );
600 }
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.)

◆ CrossHairOn()

void SCH_DRAW_PANEL::CrossHairOn ( wxDC *  DC = nullptr)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 603 of file sch_draw_panel.cpp.

604 {
605  m_viewControls->ShowCursor( true );
606 }
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.)

◆ DeviceToLogical() [1/2]

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.

204 { printf("EDA_DRAW_PANEL:Unimplemented5\n");wxASSERT(false); return wxRect(); };

◆ DeviceToLogical() [2/2]

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.

◆ DisplayComponent()

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

151 {
152  view()->Clear();
153  view()->DisplayComponent( const_cast<LIB_PART*>(aComponent) );
154 
155 }
void DisplayComponent(LIB_PART *aPart)
Definition: sch_view.cpp:116
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1110
KIGFX::SCH_VIEW * view() const

Referenced by LIB_EDIT_FRAME::RebuildView().

◆ DisplaySheet() [1/2]

void SCH_DRAW_PANEL::DisplaySheet ( const SCH_SHEET aSheet)

Definition at line 158 of file sch_draw_panel.cpp.

159 {
160  view()->Clear();
161  view()->DisplaySheet( const_cast<SCH_SHEET*>(aSheet) );
162 }
void DisplaySheet(SCH_SHEET *aSheet)
Definition: sch_view.cpp:110
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1110
KIGFX::SCH_VIEW * view() const

◆ DisplaySheet() [2/2]

void SCH_DRAW_PANEL::DisplaySheet ( const SCH_SCREEN aScreen)

Definition at line 165 of file sch_draw_panel.cpp.

166 {
167  view()->Clear();
168 
169  if( aScreen )
170  view()->DisplaySheet( const_cast<SCH_SCREEN*>( aScreen ) );
171 }
void DisplaySheet(SCH_SHEET *aSheet)
Definition: sch_view.cpp:110
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1110
KIGFX::SCH_VIEW * view() const

◆ DoPrepareDC()

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.

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
void SetClipBox(const EDA_RECT &aRect)
const int scale
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen.
Definition: base_screen.cpp:95
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:183

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

Referenced by GBR_LAYOUT::Draw().

◆ DrawAuxiliaryAxis() [1/2]

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.

182 { printf("EDA_DRAW_PANEL:Unimplemented2\n");};

◆ DrawAuxiliaryAxis() [2/2]

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 ..)

◆ DrawBackGround() [1/2]

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.

163 { printf("EDA_DRAW_PANEL:Unimplemented1\n"); };

Referenced by 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().

◆ DrawBackGround() [2/2]

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

◆ DrawCrossHair() [1/2]

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.

311 { printf("EDA_DRAW_PANEL:Unimplemented18\n"); };;

Referenced by 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().

◆ DrawCrossHair() [2/2]

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

◆ DrawGrid() [1/2]

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.

173 { printf("EDA_DRAW_PANEL:Unimplemented2\n"); };

◆ DrawGrid() [2/2]

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.

◆ DrawGridAxis() [1/2]

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.

192 { printf("EDA_DRAW_PANEL:Unimplemented4\n"); };

◆ DrawGridAxis() [2/2]

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.

◆ EndMouseCapture()

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

580 {
581  if( m_mouseCaptureCallback && m_endMouseCaptureCallback && aCallEndFunc )
582  {
583  m_endMouseCaptureCallback( this, nullptr );
584  }
585 
586  m_mouseCaptureCallback = NULL;
588  SetAutoPanRequest( false );
589 
590  if( id != -1 && cursor != -1 )
591  {
592  //wxASSERT( cursor > wxCURSOR_NONE && cursor < wxCURSOR_MAX );
593  GetParent()->SetToolID( id, cursor, title );
594  }
595 }
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

◆ EraseScreen() [1/2]

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.

218 { printf("EDA_DRAW_PANEL:Unimplemented6\n"); };;

Referenced by DrawPageOnClipboard(), and PL_EDITOR_FRAME::RedrawActiveWindow().

◆ EraseScreen() [2/2]

void EDA_DRAW_PANEL::EraseScreen ( wxDC *  DC)
inherited

◆ ForceRefresh()

◆ GetAbortRequest() [1/2]

◆ GetAbortRequest() [2/2]

bool EDA_DRAW_PANEL::GetAbortRequest ( ) const
inlineinherited

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

143 { return m_abortRequest; }
bool m_abortRequest
Flag used to abort long commands.

References EDA_DRAW_PANEL::m_abortRequest.

◆ GetBackend()

GAL_TYPE EDA_DRAW_PANEL_GAL::GetBackend ( ) const
inlineinherited

◆ GetClipBox() [1/2]

virtual EDA_RECT* EDA_DRAW_PANEL::GetClipBox ( )
inlinevirtualinherited

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

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...

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(), ZONE_CONTAINER::Draw(), SCH_BITMAP::Draw(), SCH_LINE::Draw(), GBR_LAYOUT::Draw(), EDGE_MODULE::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(), 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().

◆ GetClipBox() [2/2]

EDA_RECT* EDA_DRAW_PANEL::GetClipBox ( )
inlineinherited

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

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...

References EDA_DRAW_PANEL::m_ClipBox.

◆ GetCurrentCursor() [1/2]

int EDA_DRAW_PANEL_GAL::GetCurrentCursor ( ) const
inlineinherited

Function GetCurrentCursor.

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

Definition at line 225 of file class_draw_panel_gal.h.

225 { return m_currentCursor; }
int m_currentCursor
Current mouse cursor shape id.

References EDA_DRAW_PANEL_GAL::m_currentCursor.

◆ GetCurrentCursor() [2/2]

int EDA_DRAW_PANEL::GetCurrentCursor ( ) const
inlineinherited

◆ GetDefaultCursor() [1/2]

virtual int EDA_DRAW_PANEL_GAL::GetDefaultCursor ( ) const
inlinevirtualinherited

Function GetDefaultCursor.

Returns
the default cursor shape

Definition at line 219 of file class_draw_panel_gal.h.

219 { return m_defaultCursor; }
int m_defaultCursor
The default mouse cursor shape id.

References EDA_DRAW_PANEL_GAL::m_defaultCursor.

Referenced by EDA_DRAW_FRAME::SetNoToolSelected().

◆ GetDefaultCursor() [2/2]

int EDA_DRAW_PANEL::GetDefaultCursor ( ) const
inlineinherited

◆ GetDefaultViewBBox()

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 233 of file class_draw_panel_gal.h.

234  {
235  return BOX2I();
236  }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520

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

◆ GetDisplayOptions() [1/2]

void * EDA_DRAW_PANEL::GetDisplayOptions ( )
inlinevirtualinherited

Function GetDisplayOptions A way to pass info to draw functions.

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

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

114 { printf("EDA_DRAW_PANEL:Unimplemented\n"); wxASSERT(false); return nullptr; };

Referenced by TEXTE_PCB::Draw(), PCB_TARGET::Draw(), ZONE_CONTAINER::Draw(), EDGE_MODULE::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DIMENSION::Draw(), DRAWSEGMENT::Draw(), SEGZONE::Draw(), ZONE_CONTAINER::DrawFilledArea(), drawMovingBlock(), MODULE::DrawOutlinesWhenMoving(), DrawSegment(), TRACK::DrawShortNetname(), ZONE_CONTAINER::DrawWhileCreateOutline(), Show_MoveNode(), and Trace_Pads_Only().

◆ GetDisplayOptions() [2/2]

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.

◆ GetEnableAutoPan() [1/2]

bool EDA_DRAW_PANEL::GetEnableAutoPan ( ) const
inlineinherited

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

138 { return m_enableAutoPan; }
bool m_enableAutoPan
True to enable automatic panning.

References EDA_DRAW_PANEL::m_enableAutoPan.

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

◆ GetEnableAutoPan() [2/2]

bool EDA_DRAW_PANEL::GetEnableAutoPan ( ) const
inlineinherited

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

155 { return m_enableAutoPan; }
bool m_enableAutoPan
True to enable automatic panning.

References EDA_DRAW_PANEL::m_enableAutoPan.

◆ GetEnableMousewheelPan() [1/2]

bool EDA_DRAW_PANEL::GetEnableMousewheelPan ( ) const
inlineinherited

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

130 { return m_enableMousewheelPan; }
bool m_enableMousewheelPan
True to enable mousewheel panning by default.

References EDA_DRAW_PANEL::m_enableMousewheelPan.

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

◆ GetEnableMousewheelPan() [2/2]

bool EDA_DRAW_PANEL::GetEnableMousewheelPan ( ) const
inlineinherited

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

147 { return m_enableMousewheelPan; }
bool m_enableMousewheelPan
True to enable mousewheel panning by default.

References EDA_DRAW_PANEL::m_enableMousewheelPan.

◆ GetEnableZoomNoCenter() [1/2]

bool EDA_DRAW_PANEL::GetEnableZoomNoCenter ( ) const
inlineinherited

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

134 { return m_enableZoomNoCenter; }
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.

References EDA_DRAW_PANEL::m_enableZoomNoCenter.

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

◆ GetEnableZoomNoCenter() [2/2]

bool EDA_DRAW_PANEL::GetEnableZoomNoCenter ( ) const
inlineinherited

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

151 { return m_enableZoomNoCenter; }
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.

References EDA_DRAW_PANEL::m_enableZoomNoCenter.

◆ GetGAL()

◆ GetGrid()

wxRealPoint EDA_DRAW_PANEL::GetGrid ( )
inherited

Definition at line 277 of file eda_draw_panel.cpp.

278 {
279  return GetScreen()->GetGridSize();
280 }
virtual BASE_SCREEN * GetScreen()=0
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410

References BASE_SCREEN::GetGridSize(), and EDA_DRAW_PANEL::GetScreen().

◆ GetLegacyZoom()

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 356 of file draw_panel_gal.cpp.

357 {
359 }
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:471
double GetZoomFactor() const
Get the zoom factor.
EDA_DRAW_FRAME * m_edaFrame
Parent EDA_DRAW_FRAME (if available)

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().

◆ GetMsgPanelInfo()

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

165  {
166  wxASSERT( false );
167  }

Referenced by PCB_BASE_FRAME::UpdateMsgPanel().

◆ GetParent()

EDA_DRAW_FRAME * SCH_DRAW_PANEL::GetParent ( ) const
overridevirtual

Implements EDA_DRAW_PANEL.

Definition at line 279 of file sch_draw_panel.cpp.

280 {
281  return static_cast<EDA_DRAW_FRAME*>(m_parent); // static_cast<SCH_EDIT_FRAME*> (m_parent);
282 }
wxWindow * m_parent

Referenced by DrawMovingBlockOutlines().

◆ GetParentEDAFrame()

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 179 of file class_draw_panel_gal.h.

180  {
181  return m_edaFrame;
182  }
EDA_DRAW_FRAME * m_edaFrame
Parent EDA_DRAW_FRAME (if available)

References EDA_DRAW_PANEL_GAL::m_edaFrame.

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

◆ GetPrintMirrored() [1/2]

bool EDA_DRAW_PANEL::GetPrintMirrored ( ) const
inlineinherited

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

150 { return m_PrintIsMirrored; }
bool m_PrintIsMirrored
True when drawing in mirror mode.

References EDA_DRAW_PANEL::m_PrintIsMirrored.

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

◆ GetPrintMirrored() [2/2]

bool EDA_DRAW_PANEL::GetPrintMirrored ( ) const
inlineinherited

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

167 { return m_PrintIsMirrored; }
bool m_PrintIsMirrored
True when drawing in mirror mode.

References EDA_DRAW_PANEL::m_PrintIsMirrored.

◆ GetScreen()

BASE_SCREEN * SCH_DRAW_PANEL::GetScreen ( )
overridevirtual

Implements EDA_DRAW_PANEL.

Definition at line 274 of file sch_draw_panel.cpp.

275 {
276  return GetParent()->GetScreen();
277 }
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:404

◆ GetScreenCenterLogicalPosition() [1/2]

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.

271 { return wxPoint(0, 0); };;

Referenced by EDA_DRAW_FRAME::UseGalCanvas().

◆ GetScreenCenterLogicalPosition() [2/2]

wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition ( )
inherited

Function GetScreenCenterLogicalPosition.

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

◆ GetStealsFocus()

bool EDA_DRAW_PANEL_GAL::GetStealsFocus ( ) const
inlineinherited

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

Definition at line 203 of file class_draw_panel_gal.h.

204  {
205  return m_stealsFocus;
206  }
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over,...

References EDA_DRAW_PANEL_GAL::m_stealsFocus.

◆ GetView()

KIGFX::SCH_VIEW* SCH_DRAW_PANEL::GetView ( ) const
inline

Definition at line 87 of file sch_draw_panel.h.

87 { return view(); }
KIGFX::SCH_VIEW * view() const

References view().

Referenced by SCH_EDIT_FRAME::AddJunction(), SCH_EDIT_FRAME::AddNoConnect(), SCH_BASE_FRAME::AddToScreen(), SCH_BASE_FRAME::CenterScreen(), 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(), SCH_EDIT_FRAME::FindComponentAndItem(), SCH_BASE_FRAME::HandleBlockBegin(), LIB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::MirrorSheet(), SCH_EDIT_FRAME::OnCancelCurrentCommand(), SCH_EDIT_FRAME::OnEditItem(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnFindReplace(), SCH_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnOrient(), SCH_EDIT_FRAME::OnOrient(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotate(), SCH_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(), 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().

◆ GetViewControls()

KIGFX::VIEW_CONTROLS* EDA_DRAW_PANEL_GAL::GetViewControls ( ) const
inlineinherited

◆ GetWindow()

virtual wxWindow* SCH_DRAW_PANEL::GetWindow ( )
inlineoverridevirtual

Implements EDA_DRAW_PANEL.

Definition at line 38 of file sch_draw_panel.h.

38 { return this; }

◆ GetZoom() [1/2]

double EDA_DRAW_PANEL::GetZoom ( )
inlinevirtualinherited

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

221 { return 1.0; };;

Referenced by EDA_DRAW_FRAME::UseGalCanvas().

◆ GetZoom() [2/2]

double EDA_DRAW_PANEL::GetZoom ( )
inherited

◆ IsMouseCaptured() [1/2]

bool EDA_DRAW_PANEL::IsMouseCaptured ( ) const
inlineinherited

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

354 { return m_mouseCaptureCallback != NULL; }
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.

References EDA_DRAW_PANEL::m_mouseCaptureCallback.

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().

◆ IsMouseCaptured() [2/2]

bool EDA_DRAW_PANEL::IsMouseCaptured ( ) const
inlineinherited

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

430 { return m_mouseCaptureCallback != NULL; }
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.

References EDA_DRAW_PANEL::m_mouseCaptureCallback.

◆ IsPointOnDisplay() [1/2]

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.

233 { printf("EDA_DRAW_PANEL:Unimplemented9\n"); return false; };;

Referenced by PL_EDITOR_FRAME::MoveItem().

◆ IsPointOnDisplay() [2/2]

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.

◆ MoveCursor() [1/2]

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.

296 { printf("EDA_DRAW_PANEL:Unimplemented17\n"); };;

Referenced by EDA_DRAW_FRAME::GeneralControlKeyMovement().

◆ MoveCursor() [2/2]

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.

◆ MoveCursorToCrossHair()

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

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

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

◆ OnActivate()

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.

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...

References EDA_DRAW_PANEL::m_canStartBlock.

◆ OnCharHook()

void SCH_DRAW_PANEL::OnCharHook ( wxKeyEvent &  event)

Definition at line 621 of file sch_draw_panel.cpp.

622 {
623  event.Skip();
624 }

Referenced by SCH_DRAW_PANEL().

◆ onEnter()

void EDA_DRAW_PANEL_GAL::onEnter ( wxEvent &  aEvent)
protectedinherited

Definition at line 461 of file draw_panel_gal.cpp.

462 {
463  // Getting focus is necessary in order to receive key events properly
464  if( m_stealsFocus )
465  SetFocus();
466 
467  aEvent.Skip();
468 }
virtual void SetFocus() override
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over,...

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

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ OnEraseBackground()

void EDA_DRAW_PANEL::OnEraseBackground ( wxEraseEvent &  event)
inlineinherited

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

211 { }

◆ OnEvent()

void EDA_DRAW_PANEL_GAL::OnEvent ( wxEvent &  aEvent)
inherited

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

Definition at line 447 of file draw_panel_gal.cpp.

448 {
449  if( m_lostFocus && m_stealsFocus )
450  SetFocus();
451 
452  if( !m_eventDispatcher )
453  aEvent.Skip();
454  else
456 
457  Refresh();
458 }
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,...

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().

◆ OnKeyEvent()

void SCH_DRAW_PANEL::OnKeyEvent ( wxKeyEvent &  event)

Definition at line 627 of file sch_draw_panel.cpp.

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

References GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, and ID_NO_TOOL_SELECTED.

Referenced by SCH_DRAW_PANEL().

◆ onLostFocus()

void EDA_DRAW_PANEL_GAL::onLostFocus ( wxFocusEvent &  aEvent)
protectedinherited

Definition at line 471 of file draw_panel_gal.cpp.

472 {
473  m_lostFocus = true;
474 
475  aEvent.Skip();
476 }
bool m_lostFocus
Flag to indicate that focus should be regained on the next mouse event.

References EDA_DRAW_PANEL_GAL::m_lostFocus.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ OnMouseEntering()

void EDA_DRAW_PANEL::OnMouseEntering ( wxMouseEvent &  aEvent)
inherited

Definition at line 909 of file eda_draw_panel.cpp.

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.

References EDA_DRAW_PANEL::m_cursorLevel.

◆ OnMouseEvent()

void SCH_DRAW_PANEL::OnMouseEvent ( wxMouseEvent &  event)

Definition at line 285 of file sch_draw_panel.cpp.

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

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().

◆ OnMouseLeaving()

void EDA_DRAW_PANEL::OnMouseLeaving ( wxMouseEvent &  event)
inherited

Definition at line 920 of file eda_draw_panel.cpp.

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.

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().

◆ OnMouseWheel()

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.

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
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
void SetScrollCenterPosition(const wxPoint &aPoint)
virtual EDA_DRAW_FRAME * GetParent() const =0
const wxPoint & GetScrollCenterPosition() const
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)
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen.
Definition: base_screen.cpp:95
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.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References EDA_DRAW_PANEL::GetParent(), BASE_SCREEN::GetScalingFactor(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), ID_OFFCENTER_ZOOM_IN, ID_OFFCENTER_ZOOM_OUT, ID_PAN_DOWN, ID_PAN_LEFT, ID_PAN_RIGHT, ID_PAN_UP, 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(), and EDA_DRAW_FRAME::SetScrollCenterPosition().

◆ onPaint()

void SCH_DRAW_PANEL::onPaint ( wxPaintEvent &  WXUNUSEDaEvent)
overrideprotectedvirtual

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 691 of file sch_draw_panel.cpp.

692 {
693  if( !m_gal->IsInitialized() || !m_gal->IsVisible() )
694  // The first wxPaintEvent can be fired at startup before the GAL engine is fully initialized
695  // (depending on platforms). Do nothing in this case
696  return;
697 
698  if( m_painter )
699  static_cast<KIGFX::SCH_PAINTER*>(m_painter.get())->GetSettings()->ImportLegacyColors( nullptr );
700 
701  EDA_DRAW_PANEL_GAL::onPaint( aEvent );
702 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
virtual void onPaint(wxPaintEvent &WXUNUSED(aEvent))
std::unique_ptr< KIGFX::PAINTER > m_painter
Contains information about how to draw items using GAL.
virtual bool IsVisible() const
Returns true if the GAL canvas is visible on the screen.
virtual bool IsInitialized() const
Returns the initalization status for the canvas.

References EDA_DRAW_PANEL_GAL::onPaint().

◆ OnPaint()

void EDA_DRAW_PANEL::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 595 of file eda_draw_panel.cpp.

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)

References EDA_DRAW_PANEL::GetScreen(), INSTALL_PAINTDC, EDA_DRAW_PANEL::ReDraw(), and EDA_DRAW_PANEL::SetClipBox().

◆ OnPan()

void EDA_DRAW_PANEL::OnPan ( wxCommandEvent &  event)
inherited

Definition at line 1440 of file eda_draw_panel.cpp.

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
int m_scrollIncrementX
X axis scroll increment in pixels per unit.
void SetScrollCenterPosition(const wxPoint &aPoint)
virtual EDA_DRAW_FRAME * GetParent() const =0
const wxPoint & GetScrollCenterPosition() const
const int scale
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen.
Definition: base_screen.cpp:95
Definition: id.h:255
const wxChar *const kicadTraceCoords
Flag to enable draw panel coordinate debug tracing.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404
int m_scrollIncrementY
Y axis scroll increment in pixels per unit.

References EDA_DRAW_PANEL::GetParent(), BASE_SCREEN::GetScalingFactor(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), ID_PAN_DOWN, ID_PAN_LEFT, ID_PAN_RIGHT, ID_PAN_UP, kicadTraceCoords, KiROUND(), EDA_DRAW_PANEL::m_scrollIncrementX, EDA_DRAW_PANEL::m_scrollIncrementY, scale, and EDA_DRAW_FRAME::SetScrollCenterPosition().

◆ onRefreshTimer()

void EDA_DRAW_PANEL_GAL::onRefreshTimer ( wxTimerEvent &  aEvent)
protectedinherited

Definition at line 479 of file draw_panel_gal.cpp.

480 {
481  if( !m_drawingEnabled )
482  {
483  if( m_gal && m_gal->IsInitialized() )
484  {
485  m_drawing = false;
486  m_pendingRefresh = true;
487  Connect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
488  m_drawingEnabled = true;
489  }
490  else
491  {
492  // Try again soon
493  m_refreshTimer.StartOnce( 100 );
494  return;
495  }
496  }
497 
498  wxPaintEvent redrawEvent;
499  wxPostEvent( this, redrawEvent );
500 }
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.
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.
virtual bool IsInitialized() const
Returns the initalization status for the canvas.

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().

◆ OnRightClick()

bool SCH_DRAW_PANEL::OnRightClick ( wxMouseEvent &  event)

Definition at line 541 of file sch_draw_panel.cpp.

542 {
543  auto controls = GetViewControls();
544  auto vmp = controls->GetMousePosition();
545  wxPoint mouseWorldPos ( (int) vmp.x, (int) vmp.y );
546 
547  wxMenu MasterMenu;
548 
549  if( !GetParent()->OnRightClick( mouseWorldPos, &MasterMenu ) )
550  return false;
551 
552  GetParent()->AddMenuZoomAndGrid( &MasterMenu );
553 
554  m_ignoreMouseEvents = true;
555  PopupMenu( &MasterMenu, event.GetPosition() );
556  m_ignoreMouseEvents = false;
557 
558  return true;
559 }
bool OnRightClick(wxMouseEvent &event)
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual EDA_DRAW_FRAME * GetParent() const override
bool m_ignoreMouseEvents
Ignore mouse events when true.
virtual void AddMenuZoomAndGrid(wxMenu *aMasterMenu)
Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info...

◆ OnScroll()

void EDA_DRAW_PANEL::OnScroll ( wxScrollWinEvent &  event)
inherited

Definition at line 411 of file eda_draw_panel.cpp.

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
int m_scrollIncrementX
X axis scroll increment in pixels per unit.
void SetScrollCenterPosition(const wxPoint &aPoint)
virtual EDA_DRAW_FRAME * GetParent() const =0
const wxPoint & GetScrollCenterPosition() const
const int scale
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen.
Definition: base_screen.cpp:95
const wxChar *const kicadTraceCoords
Flag to enable draw panel coordinate debug tracing.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404
int m_scrollIncrementY
Y axis scroll increment in pixels per unit.

References EDA_DRAW_PANEL::GetParent(), BASE_SCREEN::GetScalingFactor(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), kicadTraceCoords, KiROUND(), EDA_DRAW_PANEL::m_scrollIncrementX, EDA_DRAW_PANEL::m_scrollIncrementY, scale, and EDA_DRAW_FRAME::SetScrollCenterPosition().

◆ OnScrollWin()

void EDA_DRAW_PANEL::OnScrollWin ( wxCommandEvent &  event)
inherited

◆ OnShow()

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

175 {
176  //m_view->RecacheAllItems();
177 }

◆ onShowTimer()

void EDA_DRAW_PANEL_GAL::onShowTimer ( wxTimerEvent &  aEvent)
protectedinherited

Definition at line 503 of file draw_panel_gal.cpp.

504 {
505  if( m_gal && m_gal->IsVisible() )
506  {
507  m_onShowTimer.Stop();
508  OnShow();
509  }
510 }
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.
wxTimer m_onShowTimer
Timer used to execute OnShow() when the window finally appears on the screen.
virtual bool IsVisible() const
Returns true if the GAL canvas is visible on the screen.

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().

◆ onSize()

void EDA_DRAW_PANEL_GAL::onSize ( wxSizeEvent &  aEvent)
protectedinherited

Definition at line 242 of file draw_panel_gal.cpp.

243 {
245  wxSize clientSize = GetClientSize();
246  m_gal->ResizeScreen( clientSize.x, clientSize.y );
247 
248  if( m_view )
249  {
252  }
253 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:596
virtual void ResizeScreen(int aWidth, int aHeight)
Resizes the canvas.
Main rendering target (cached)
Definition: definitions.h:48
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.

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().

◆ OnTimer()

void SCH_DRAW_PANEL::OnTimer ( wxTimerEvent &  event)

◆ ReDraw() [1/2]

void EDA_DRAW_PANEL::ReDraw ( wxDC *  aDC,
bool  aEraseBackground = true 
)
inlinevirtualinherited

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

253 { printf("EDA_DRAW_PANEL:Unimplemented11\n"); };;

Referenced by EDA_DRAW_PANEL::OnPaint().

◆ ReDraw() [2/2]

void EDA_DRAW_PANEL::ReDraw ( wxDC *  aDC,
bool  aEraseBackground = true 
)
inherited

◆ Refresh()

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

616 {
617  EDA_DRAW_PANEL_GAL::Refresh( aEraseBackground, aRect );
618 }
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...

References EDA_DRAW_PANEL_GAL::Refresh().

Referenced by SCH_EDIT_FRAME::addCurrentItemToScreen(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::backAnnotateFootprints(), SCH_EDIT_FRAME::DeleteAnnotation(), LIB_EDIT_FRAME::deleteItem(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_EDIT_FRAME::EditComponent(), LIB_EDIT_FRAME::EditField(), LIB_EDIT_FRAME::EditGraphicSymbol(), LIB_EDIT_FRAME::EditSymbolText(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), 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(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectOptionToolbar(), LIB_VIEW_FRAME::OnShowElectricalType(), LIB_EDIT_FRAME::OnShowElectricalType(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), 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(), SCH_EDIT_FRAME::rescueProject(), 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().

◆ RefreshDrawingRect() [1/2]

void EDA_DRAW_PANEL::RefreshDrawingRect ( const EDA_RECT aRect,
bool  aEraseBackground = true 
)
inlinevirtualinherited

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.

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

262 { printf("EDA_DRAW_PANEL:Unimplemented12\n"); };;

Referenced by AbortMoveTextModule(), PCB_BASE_FRAME::AddPad(), PCB_EDIT_FRAME::Change_Side_Module(), PCB_EDIT_FRAME::Delete_net(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Zone_Contour(), PCB_BASE_FRAME::DeletePad(), PCB_BASE_FRAME::DeleteTextModule(), PCB_BASE_FRAME::DoPushPadProperties(), PCB_BASE_FRAME::Import_Pad_Settings(), PCB_BASE_FRAME::PlaceTexteModule(), PCB_EDIT_FRAME::Remove_One_Track(), PCB_EDIT_FRAME::Remove_Zone_Corner(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::StartMoveModule(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ RefreshDrawingRect() [2/2]

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.

◆ SetAbortRequest() [1/2]

◆ SetAbortRequest() [2/2]

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.

References EDA_DRAW_PANEL::m_abortRequest.

◆ SetAutoPanRequest()

void SCH_DRAW_PANEL::SetAutoPanRequest ( bool  aEnable)
overridevirtual

Implements EDA_DRAW_PANEL.

Definition at line 230 of file sch_draw_panel.cpp.

231 {
232  wxCHECK( GetParent()->IsGalCanvasActive(), /*void*/ );
233  GetParent()->GetGalCanvas()->GetViewControls()->SetAutoPan( aEnable );
234 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual EDA_DRAW_FRAME * GetParent() const override
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.

Referenced by SCH_EDIT_FRAME::OnHotKey(), and LIB_EDIT_FRAME::OnHotKey().

◆ SetCanStartBlock() [1/2]

void EDA_DRAW_PANEL::SetCanStartBlock ( int  aStartBlock)
inlineinherited

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

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...

References EDA_DRAW_PANEL::m_canStartBlock.

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

◆ SetCanStartBlock() [2/2]

void EDA_DRAW_PANEL::SetCanStartBlock ( int  aStartBlock)
inlineinherited

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

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...

References EDA_DRAW_PANEL::m_canStartBlock.

◆ SetClipBox() [1/4]

void EDA_DRAW_PANEL::SetClipBox ( const EDA_RECT aRect)
inlineinherited

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

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...

References EDA_DRAW_PANEL::m_ClipBox.

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

◆ SetClipBox() [2/4]

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...

References EDA_DRAW_PANEL::m_ClipBox.

◆ SetClipBox() [3/4]

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"); };;

◆ SetClipBox() [4/4]

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.

◆ SetCurrentCursor() [1/2]

void EDA_DRAW_PANEL_GAL::SetCurrentCursor ( int  aCursor)
virtualinherited

Function SetCurrentCursor Set the current cursor shape for this panel.

Definition at line 511 of file draw_panel_gal.cpp.

512 {
513  if ( aCursor > wxCURSOR_NONE && aCursor < wxCURSOR_MAX )
514  {
515  m_currentCursor = aCursor;
516  }
517  else
518  {
519  m_currentCursor = wxCURSOR_ARROW;
520  }
521 
522  SetCursor( (wxStockCursor) m_currentCursor );
523 }
int m_currentCursor
Current mouse cursor shape id.

References EDA_DRAW_PANEL_GAL::m_currentCursor.

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

◆ SetCurrentCursor() [2/2]

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.

References EDA_DRAW_PANEL::m_currentCursor.

◆ SetDefaultCursor()

void EDA_DRAW_PANEL_GAL::SetDefaultCursor ( )
virtualinherited

Definition at line 525 of file draw_panel_gal.cpp.

526 {
528 }
int m_defaultCursor
The default mouse cursor shape id.
virtual void SetCurrentCursor(int aCursor)
Function SetCurrentCursor Set the current cursor shape for this panel.

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

◆ setDefaultLayerDeps()

void SCH_DRAW_PANEL::setDefaultLayerDeps ( )
protected

Sets rendering targets & dependencies for layers.

Definition at line 246 of file sch_draw_panel.cpp.

247 {
248  // caching makes no sense for Cairo and other software renderers
250 
251  for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
252  m_view->SetLayerTarget( i, target );
253 
254  // Bitmaps are draw on a non cached GAL layer:
256 
257  // Some draw layers need specific settings
260 
263 
266 }
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:49
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:50
Main rendering target (cached)
Definition: definitions.h:48
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

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.

◆ setDefaultLayerOrder()

void SCH_DRAW_PANEL::setDefaultLayerOrder ( )
protected

Reassigns layer order to the initial settings.

Definition at line 180 of file sch_draw_panel.cpp.

181 {
182  for( LAYER_NUM i = 0; (unsigned) i < sizeof( SCH_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
183  {
184  LAYER_NUM layer = SCH_LAYER_ORDER[i];
185  wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
186 
187  m_view->SetLayerOrder( layer, i );
188  }
189 }
void SetLayerOrder(int aLayer, int aRenderingOrder)
Function SetLayerOrder() Sets rendering order of a particular layer.
Definition: view.cpp:663
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

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

◆ SetEnableAutoPan()

void SCH_DRAW_PANEL::SetEnableAutoPan ( bool  aEnable)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 221 of file sch_draw_panel.cpp.

222 {
224 
225  if( GetParent()->IsGalCanvasActive() )
227 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual EDA_DRAW_FRAME * GetParent() const override
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
virtual void EnableAutoPan(bool aEnabled)
Function EnableAutoPan Turns on/off auto panning (user setting to disable it entirely).
virtual void SetEnableAutoPan(bool aEnable)

References EDA_DRAW_PANEL::SetEnableAutoPan().

◆ SetEnableBlockCommands() [1/2]

void EDA_DRAW_PANEL::SetEnableBlockCommands ( bool  aEnable)
inlineinherited

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

148 { m_enableBlockCommands = aEnable; }
bool m_enableBlockCommands
True enables block commands.

References EDA_DRAW_PANEL::m_enableBlockCommands.

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

◆ SetEnableBlockCommands() [2/2]

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.

References EDA_DRAW_PANEL::m_enableBlockCommands.

◆ SetEnableMousewheelPan()

void SCH_DRAW_PANEL::SetEnableMousewheelPan ( bool  aEnable)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 212 of file sch_draw_panel.cpp.

213 {
214  m_enableMousewheelPan = aEnable;
215 
216  if( GetParent()->IsGalCanvasActive() )
218 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual EDA_DRAW_FRAME * GetParent() const override
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
virtual void EnableMousewheelPan(bool aEnable)
Function EnableMousewheelPan() Enables or disables mousewheel panning.
bool m_enableMousewheelPan
True to enable mousewheel panning by default.

◆ SetEnableZoomNoCenter()

void SCH_DRAW_PANEL::SetEnableZoomNoCenter ( bool  aEnable)
overridevirtual

Reimplemented from EDA_DRAW_PANEL.

Definition at line 237 of file sch_draw_panel.cpp.

238 {
239  m_enableZoomNoCenter = aEnable;
240 
241  if( GetParent()->IsGalCanvasActive() )
243 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual EDA_DRAW_FRAME * GetParent() const override
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
void EnableCursorWarping(bool aEnable)
Function EnableCursorWarping() Enables or disables warping the cursor.

◆ SetEventDispatcher()

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 292 of file draw_panel_gal.cpp.

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

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().

◆ SetFocus()

void EDA_DRAW_PANEL_GAL::SetFocus ( )
overridevirtualinherited

Definition at line 133 of file draw_panel_gal.cpp.

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

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().

◆ SetGrid()

void EDA_DRAW_PANEL::SetGrid ( const wxRealPoint &  size)
inherited

◆ SetHighContrastLayer()

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 334 of file draw_panel_gal.cpp.

335 {
336  // Set display settings for high contrast mode
338 
339  SetTopLayer( aLayer );
340 
341  rSettings->ClearActiveLayers();
342  rSettings->SetActiveLayer( aLayer );
343 
345 }
Class RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output ...
Definition: painter.h:56
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
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.
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:797

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().

◆ SetIgnoreLeftButtonReleaseEvent() [1/2]

void EDA_DRAW_PANEL::SetIgnoreLeftButtonReleaseEvent ( bool  aIgnore)
inlineinherited

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

146 { m_ignoreNextLeftButtonRelease = aIgnore; }
bool m_ignoreNextLeftButtonRelease
Ignore the next mouse left button release when true.

References EDA_DRAW_PANEL::m_ignoreNextLeftButtonRelease.

Referenced by EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent().

◆ SetIgnoreLeftButtonReleaseEvent() [2/2]

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.

References EDA_DRAW_PANEL::m_ignoreNextLeftButtonRelease.

◆ SetIgnoreMouseEvents() [1/2]

◆ SetIgnoreMouseEvents() [2/2]

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.

References EDA_DRAW_PANEL::m_ignoreMouseEvents.

◆ SetMouseCapture() [1/2]

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.

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.

References EDA_DRAW_PANEL::m_endMouseCaptureCallback, and EDA_DRAW_PANEL::m_mouseCaptureCallback.

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(), SCH_EDIT_FRAME::addCurrentItemToScreen(), 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(), PCB_EDIT_FRAME::BeginMoveTarget(), 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_EDIT_FRAME::PlaceTarget(), 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().

◆ SetMouseCapture() [2/2]

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.

References EDA_DRAW_PANEL::m_endMouseCaptureCallback, and EDA_DRAW_PANEL::m_mouseCaptureCallback.

◆ SetMouseCaptureCallback() [1/2]

◆ SetMouseCaptureCallback() [2/2]

void EDA_DRAW_PANEL::SetMouseCaptureCallback ( MOUSE_CAPTURE_CALLBACK  aMouseCaptureCallback)
inlineinherited

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

409  {
410  m_mouseCaptureCallback = aMouseCaptureCallback;
411  }
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.

References EDA_DRAW_PANEL::m_mouseCaptureCallback.

◆ SetPrintMirrored() [1/2]

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.

References EDA_DRAW_PANEL::m_PrintIsMirrored.

◆ SetPrintMirrored() [2/2]

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.

References EDA_DRAW_PANEL::m_PrintIsMirrored.

◆ SetStealsFocus()

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 195 of file class_draw_panel_gal.h.

196  {
197  m_stealsFocus = aStealsFocus;
198  }
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over,...

References EDA_DRAW_PANEL_GAL::m_stealsFocus.

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

◆ SetTopLayer()

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 348 of file draw_panel_gal.cpp.

349 {
351  m_view->SetTopLayer( aLayer );
353 }
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:859
void UpdateAllLayersOrder()
Function UpdateLayerOrder() Does everything that is needed to apply the rendering order of layers.
Definition: view.cpp:926
void ClearTopLayers()
Function ClearTopLayers() Removes all layers from the on-the-top set (they are no longer displayed ov...
Definition: view.cpp:911
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.

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

Referenced by EDA_DRAW_PANEL_GAL::SetHighContrastLayer().

◆ SetZoom() [1/2]

void EDA_DRAW_PANEL::SetZoom ( double  mode)
inlinevirtualinherited

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

220 { printf("EDA_DRAW_PANEL:Unimplemented7\n"); };;

◆ SetZoom() [2/2]

void EDA_DRAW_PANEL::SetZoom ( double  mode)
inherited

◆ StartDrawing()

void EDA_DRAW_PANEL_GAL::StartDrawing ( )
inherited

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

Definition at line 318 of file draw_panel_gal.cpp.

319 {
320  // Start querying GAL if it is ready
321  m_refreshTimer.StartOnce( 100 );
322 }
wxTimer m_refreshTimer
Timer responsible for preventing too frequent refresh.

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().

◆ StopDrawing()

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 325 of file draw_panel_gal.cpp.

326 {
327  m_drawingEnabled = false;
328  Disconnect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
329  m_pendingRefresh = false;
330  m_refreshTimer.Stop();
331 }
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.

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().

◆ SwitchBackend()

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

193 {
194  VECTOR2D grid_size = m_gal->GetGridSize();
195  bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType );
198 
199  // Keep grid size and grid visibility:
200  m_gal->SetGridSize( grid_size );
201  SCH_BASE_FRAME* frame = dynamic_cast<SCH_BASE_FRAME*>( GetParent() );
202 
203  if( frame )
205 
206  Refresh();
207 
208  return rv;
209 }
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.
virtual bool IsGridVisible() const
Definition: draw_frame.h:535
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 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,...

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

◆ ToDeviceXY() [1/2]

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.

283 { printf("EDA_DRAW_PANEL:Unimplemented15\n"); return wxPoint(0, 0); };;

◆ ToDeviceXY() [2/2]

wxPoint EDA_DRAW_PANEL::ToDeviceXY ( const wxPoint &  pos)
inherited

Function ToDeviceXY transforms logical to device coordinates.

◆ ToLogicalXY() [1/2]

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.

289 { printf("EDA_DRAW_PANEL:Unimplemented16\n"); return wxPoint(0, 0); };;

◆ ToLogicalXY() [2/2]

wxPoint EDA_DRAW_PANEL::ToLogicalXY ( const wxPoint &  pos)
inherited

Function ToLogicalXY transforms device to logical coordinates.

◆ UseColorScheme()

void SCH_DRAW_PANEL::UseColorScheme ( const COLORS_DESIGN_SETTINGS aSettings)

Function UseColorScheme Applies layer color settings.

Parameters
aSettingsare the new settings.

◆ view()

KIGFX::SCH_VIEW * SCH_DRAW_PANEL::view ( ) const
protected

Definition at line 269 of file sch_draw_panel.cpp.

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

Referenced by GetView().

Member Data Documentation

◆ m_abortRequest

bool EDA_DRAW_PANEL::m_abortRequest
protectedinherited

◆ m_backend

◆ m_canStartBlock

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(), EDA_DRAW_PANEL::OnMouseEvent(), and EDA_DRAW_PANEL::SetCanStartBlock().

◆ m_ClipBox

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(), and EDA_DRAW_PANEL::SetClipBox().

◆ m_currentCursor

int EDA_DRAW_PANEL_GAL::m_currentCursor
protectedinherited

◆ m_cursorLevel

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(), and EDA_DRAW_PANEL::OnMouseEntering().

◆ m_CursorStartPos

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().

◆ m_defaultCursor

int EDA_DRAW_PANEL_GAL::m_defaultCursor
protectedinherited

◆ m_doubleClickInterval

int EDA_DRAW_PANEL::m_doubleClickInterval
protectedinherited

◆ m_drawing

bool EDA_DRAW_PANEL_GAL::m_drawing
protectedinherited

◆ m_drawingEnabled

bool EDA_DRAW_PANEL_GAL::m_drawingEnabled
protectedinherited

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

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

◆ m_edaFrame

EDA_DRAW_FRAME* EDA_DRAW_PANEL_GAL::m_edaFrame
protectedinherited

◆ m_enableAutoPan

bool EDA_DRAW_PANEL::m_enableAutoPan
protectedinherited

◆ m_enableBlockCommands

bool EDA_DRAW_PANEL::m_enableBlockCommands
protectedinherited

◆ m_enableMousewheelPan

bool EDA_DRAW_PANEL::m_enableMousewheelPan
protectedinherited

◆ m_enableZoomNoCenter

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::SetEnableZoomNoCenter().

◆ m_endMouseCaptureCallback

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::SetMouseCapture().

◆ m_eventDispatcher

TOOL_DISPATCHER* EDA_DRAW_PANEL_GAL::m_eventDispatcher
protectedinherited

Processes and forwards events to tools.

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

◆ m_gal

◆ m_ignoreMouseEvents

bool EDA_DRAW_PANEL::m_ignoreMouseEvents
protectedinherited

◆ m_ignoreNextLeftButtonRelease

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(), EDA_DRAW_PANEL::OnMouseEvent(), and EDA_DRAW_PANEL::SetIgnoreLeftButtonReleaseEvent().

◆ m_lastRefresh

wxLongLong EDA_DRAW_PANEL_GAL::m_lastRefresh
protectedinherited

Last timestamp when the panel was refreshed.

Definition at line 265 of file class_draw_panel_gal.h.

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

◆ m_lostFocus

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 303 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().

◆ m_minDragEventCount

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().

◆ m_mouseCaptureCallback

MOUSE_CAPTURE_CALLBACK EDA_DRAW_PANEL::m_mouseCaptureCallback
protectedinherited

◆ m_onShowTimer

wxTimer EDA_DRAW_PANEL_GAL::m_onShowTimer
protectedinherited

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

Definition at line 280 of file class_draw_panel_gal.h.

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

◆ m_options

KIGFX::GAL_DISPLAY_OPTIONS& EDA_DRAW_PANEL_GAL::m_options
protectedinherited

Definition at line 296 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ m_painter

◆ m_PanStartCenter

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().

◆ m_PanStartEventPosition

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().

◆ m_parent

wxWindow* SCH_DRAW_PANEL::m_parent
protected

Definition at line 105 of file sch_draw_panel.h.

◆ m_pendingRefresh

bool EDA_DRAW_PANEL_GAL::m_pendingRefresh
protectedinherited

◆ m_PrintIsMirrored

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(), EDA_DRAW_PANEL::GetPrintMirrored(), and EDA_DRAW_PANEL::SetPrintMirrored().

◆ m_refreshTimer

wxTimer EDA_DRAW_PANEL_GAL::m_refreshTimer
protectedinherited

◆ m_scrollIncrementX

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::OnPan(), and EDA_DRAW_PANEL::OnScroll().

◆ m_scrollIncrementY

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::OnPan(), and EDA_DRAW_PANEL::OnScroll().

◆ m_showCrossHair

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().

◆ m_stealsFocus

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 307 of file class_draw_panel_gal.h.

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

◆ m_view

◆ m_viewControls

◆ MinRefreshPeriod

const int EDA_DRAW_PANEL_GAL::MinRefreshPeriod = 17
staticprotectedinherited

60 FPS.

Definition at line 251 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: