KiCad PCB EDA Suite
EDA_DRAW_PANEL Class Referenceabstract

#include <class_drawpanel.h>

Inheritance diagram for EDA_DRAW_PANEL:
SCH_DRAW_PANEL

Public Member Functions

 EDA_DRAW_PANEL ()
 
virtual ~EDA_DRAW_PANEL ()
 
virtual void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
virtual BASE_SCREENGetScreen ()=0
 
virtual EDA_DRAW_FRAMEGetParent () const =0
 
virtual EDA_RECTGetClipBox ()
 
void SetClipBox (const EDA_RECT &aRect)
 
bool GetAbortRequest () const
 
void SetAbortRequest (bool aAbortRequest)
 
bool GetEnableMousewheelPan () const
 
virtual void SetEnableMousewheelPan (bool aEnable)
 
bool GetEnableZoomNoCenter () const
 
virtual void SetEnableZoomNoCenter (bool aEnable)
 
bool GetEnableAutoPan () const
 
virtual void SetEnableAutoPan (bool aEnable)
 
void SetAutoPanRequest (bool aEnable)
 
void SetIgnoreMouseEvents (bool aIgnore)
 
void SetIgnoreLeftButtonReleaseEvent (bool aIgnore)
 
void SetEnableBlockCommands (bool aEnable)
 
bool GetPrintMirrored () const
 
void SetPrintMirrored (bool aMirror)
 
void SetCanStartBlock (int aStartBlock)
 
virtual void DrawBackGround (wxDC *DC)
 Function DrawBackGround. More...
 
virtual 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...
 
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...
 
virtual 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...
 
virtual void SetZoom (double mode)
 
virtual double GetZoom ()
 
virtual bool IsPointOnDisplay (const wxPoint &aPosition)
 Function IsPointOnDisplay. More...
 
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...
 
virtual 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...
 
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...
 
virtual void MoveCursorToCrossHair ()
 Function MoveCursorToCrossHair warps the cursor to the current cross hair position. More...
 
virtual 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...
 
virtual 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...
 
virtual void CrossHairOff (wxDC *DC=nullptr)
 
virtual void CrossHairOn (wxDC *DC=nullptr)
 
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...
 
virtual void SetMouseCaptureCallback (MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
 
virtual void EndMouseCapture (int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
 Function EndMouseCapture ends mouse a capture. More...
 
bool IsMouseCaptured () const
 
virtual void CallMouseCapture (wxDC *aDC, const wxPoint &aPosition, bool aErase)
 Function CallMouseCapture calls the mouse capture callback. More...
 
virtual void CallEndMouseCapture (wxDC *aDC)
 Function CallEndMouseCapture calls the end mouse capture callback. More...
 
virtual void Refresh (bool eraseBackground=true, const wxRect *rect=NULL)
 
virtual wxWindow * GetWindow ()=0
 
 EDA_DRAW_PANEL (EDA_DRAW_FRAME *parent, int id, const wxPoint &pos, const wxSize &size)
 
 ~EDA_DRAW_PANEL ()
 
void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
BASE_SCREENGetScreen ()
 
EDA_DRAW_FRAMEGetParent () const
 
void OnPaint (wxPaintEvent &event)
 
EDA_RECTGetClipBox ()
 
void SetClipBox (const EDA_RECT &aRect)
 
bool GetAbortRequest () const
 
void SetAbortRequest (bool aAbortRequest)
 
bool GetEnableMousewheelPan () const
 
void SetEnableMousewheelPan (bool aEnable)
 
bool GetEnableZoomNoCenter () const
 
void SetEnableZoomNoCenter (bool aEnable)
 
bool GetEnableAutoPan () const
 
void SetEnableAutoPan (bool aEnable)
 
void SetAutoPanRequest (bool aEnable)
 
void SetIgnoreMouseEvents (bool aIgnore)
 
void SetIgnoreLeftButtonReleaseEvent (bool aIgnore)
 
void SetEnableBlockCommands (bool aEnable)
 
bool GetPrintMirrored () const
 
void SetPrintMirrored (bool aMirror)
 
void SetCanStartBlock (int aStartBlock)
 
void DrawBackGround (wxDC *DC)
 Function DrawBackGround. More...
 
void DrawGrid (wxDC *aDC)
 Function DrawGrid draws a grid to aDC. 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...
 
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 OnEraseBackground (wxEraseEvent &event)
 
void OnActivate (wxActivateEvent &event)
 Function OnActivate handles window activation events. More...
 
void OnTimer (wxTimerEvent &event)
 Function OnTimer handle timer events. More...
 
virtual void DoPrepareDC (wxDC &aDC) override
 Function DoPrepareDC sets up the device context aDC for drawing. More...
 
wxRect DeviceToLogical (const wxRect &aRect, wxDC &aDC)
 Function DeviceToLogical converts aRect from device to drawing (logical) coordinates. More...
 
void OnMouseWheel (wxMouseEvent &event)
 Function OnMouseWheel handles mouse wheel events. More...
 
void OnMouseEvent (wxMouseEvent &event)
 
void OnMouseEntering (wxMouseEvent &aEvent)
 
void OnMouseLeaving (wxMouseEvent &event)
 
void OnKeyEvent (wxKeyEvent &event)
 
void OnCharHook (wxKeyEvent &event)
 
void OnPan (wxCommandEvent &event)
 
void EraseScreen (wxDC *DC)
 
void OnScrollWin (wxCommandEvent &event)
 
void OnScroll (wxScrollWinEvent &event)
 
void SetZoom (double mode)
 
double GetZoom ()
 
void SetGrid (const wxRealPoint &size)
 
wxRealPoint GetGrid ()
 
bool OnRightClick (wxMouseEvent &event)
 Function OnRightClick builds and displays a context menu on a right mouse button click. More...
 
bool IsPointOnDisplay (const wxPoint &aPosition)
 Function IsPointOnDisplay. More...
 
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 ReDraw (wxDC *aDC, bool aEraseBackground=true)
 
void RefreshDrawingRect (const EDA_RECT &aRect, bool aEraseBackground=true)
 Function RefreshDrawingRect redraws the contents of aRect in drawing units. More...
 
virtual void Refresh (bool eraseBackground=true, const wxRect *rect=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...
 
wxPoint GetScreenCenterLogicalPosition ()
 Function GetScreenCenterLogicalPosition. More...
 
void MoveCursorToCrossHair ()
 Function MoveCursorToCrossHair warps the cursor to the current cross hair position. More...
 
wxPoint ToDeviceXY (const wxPoint &pos)
 Function ToDeviceXY transforms logical to device coordinates. More...
 
wxPoint ToLogicalXY (const wxPoint &pos)
 Function ToLogicalXY transforms device to logical coordinates. More...
 
void MoveCursor (const wxPoint &aPosition)
 Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units. More...
 
void DrawCrossHair (wxDC *aDC, COLOR4D aColor=COLOR4D::WHITE)
 Function DrawCrossHair draws the user cross hair. More...
 
void CrossHairOff (wxDC *DC)
 
void CrossHairOn (wxDC *DC)
 
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 SetMouseCaptureCallback (MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
 
void EndMouseCapture (int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
 Function EndMouseCapture ends mouse a capture. More...
 
bool IsMouseCaptured () const
 
void CallMouseCapture (wxDC *aDC, const wxPoint &aPosition, bool aErase)
 Function CallMouseCapture calls the mouse capture callback. More...
 
void CallEndMouseCapture (wxDC *aDC)
 Function CallEndMouseCapture calls the end mouse capture callback. More...
 
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...
 

Protected Attributes

bool m_showCrossHair
 Indicate if cross hair is to be shown. More...
 
int m_cursorLevel
 Index for cursor redraw in XOR mode. More...
 
int m_scrollIncrementX
 X axis scroll increment in pixels per unit. More...
 
int m_scrollIncrementY
 Y axis scroll increment in pixels per unit. More...
 
wxPoint m_CursorStartPos
 Used for testing the cursor movement. More...
 
wxPoint m_PanStartCenter
 Initial scroll center position when pan started. More...
 
wxPoint m_PanStartEventPosition
 Initial position of mouse event when pan started. More...
 
EDA_RECT m_ClipBox
 The drawing area used to redraw the screen which is usually the visible area of the drawing in internal units. More...
 
bool m_abortRequest
 Flag used to abort long commands. More...
 
bool m_enableZoomNoCenter
 True to enable zooming around the crosshair instead of the center. More...
 
bool m_enableMousewheelPan
 True to enable mousewheel panning by default. More...
 
bool m_enableAutoPan
 True to enable automatic panning. More...
 
bool m_requestAutoPan
 true to request an auto pan. Valid only when m_enableAutoPan = true. More...
 
bool m_ignoreMouseEvents
 Ignore mouse events when true. More...
 
bool m_ignoreNextLeftButtonRelease
 Ignore the next mouse left button release when true. More...
 
bool m_enableBlockCommands
 True enables block commands. More...
 
int m_minDragEventCount
 Count the drag events. More...
 
bool m_PrintIsMirrored
 True when drawing in mirror mode. More...
 
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
 Mouse capture move callback function. More...
 
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
 Abort mouse capture callback function. More...
 
int m_canStartBlock
 useful to avoid false start block in certain cases (like switch from a sheet to another sheet >= 0 (or >= n) if a block can start More...
 
int m_doubleClickInterval
 

Private Attributes

int m_currentCursor
 Current mouse cursor shape id. More...
 
int m_defaultCursor
 The default mouse cursor shape id. More...
 
wxPoint m_CursorClickPos
 Used for maintaining click position. More...
 
wxTimer * m_ClickTimer
 

Detailed Description

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

Constructor & Destructor Documentation

EDA_DRAW_PANEL::EDA_DRAW_PANEL ( )
inline

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

89 {};
EDA_DRAW_PANEL::~EDA_DRAW_PANEL ( )
inlinevirtual

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

Referenced by EDA_DRAW_PANEL().

90 {};
EDA_DRAW_PANEL::EDA_DRAW_PANEL ( EDA_DRAW_FRAME parent,
int  id,
const wxPoint pos,
const wxSize &  size 
)

Definition at line 87 of file eda_draw_panel.cpp.

References PGM_BASE::CommonSettings(), ENBL_AUTO_PAN_KEY, ENBL_MOUSEWHEEL_PAN_KEY, ENBL_ZOOM_NO_CENTER_KEY, EDA_DRAW_FRAME::GetDrawBgColor(), Kiface(), KIFACE_I::KifaceSettings(), m_abortRequest, m_canStartBlock, m_ClickTimer, m_ClipBox, m_currentCursor, m_cursorLevel, m_defaultCursor, m_doubleClickInterval, m_enableAutoPan, m_enableBlockCommands, m_enableMousewheelPan, m_enableZoomNoCenter, m_endMouseCaptureCallback, m_ignoreMouseEvents, m_ignoreNextLeftButtonRelease, m_minDragEventCount, m_mouseCaptureCallback, m_PrintIsMirrored, m_requestAutoPan, m_scrollIncrementX, m_scrollIncrementY, m_showCrossHair, min, Pgm(), EDA_RECT::SetSize(), EDA_RECT::SetX(), EDA_RECT::SetY(), and ~EDA_DRAW_PANEL().

88  :
89  wxScrolledWindow( parent, id, pos, size, drawPanelStyle )
90 {
91  wxASSERT( parent );
92 
93  ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
94  DisableKeyboardScrolling();
95 
96  m_scrollIncrementX = std::min( size.x / 8, 10 );
97  m_scrollIncrementY = std::min( size.y / 8, 10 );
98 
99  SetLayoutDirection( wxLayout_LeftToRight );
100 
101  SetBackgroundColour( parent->GetDrawBgColor().ToColour() );
102 
103 #if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC
104  SetBackgroundStyle( wxBG_STYLE_CUSTOM );
105 #endif
106 
107  m_ClipBox.SetSize( size );
108  m_ClipBox.SetX( 0 );
109  m_ClipBox.SetY( 0 );
110  m_canStartBlock = -1; // Command block can start if >= 0
111  m_abortRequest = false;
112  m_enableMousewheelPan = false;
113  m_enableZoomNoCenter = false;
114  m_enableAutoPan = true;
115  m_ignoreMouseEvents = false;
116  // Be sure a mouse release button event will be ignored when creating the canvas
117  // if the mouse click was not made inside the canvas (can happen sometimes, when
118  // launching a editor from a double click made in another frame)
120 
121  m_mouseCaptureCallback = NULL;
123 
127 
128  m_requestAutoPan = false;
129  m_enableBlockCommands = false;
131 
132 #ifdef __WXMAC__
133  m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
134  m_showCrossHair = false;
135 #else
136  m_defaultCursor = m_currentCursor = wxCURSOR_ARROW;
137  m_showCrossHair = true;
138 #endif
139 
140  m_cursorLevel = 0;
141  m_PrintIsMirrored = false;
142 
143  m_ClickTimer = (wxTimer*) NULL;
144  m_doubleClickInterval = 250;
145 }
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...
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
int m_scrollIncrementX
X axis scroll increment in pixels per unit.
bool m_requestAutoPan
true to request an auto pan. Valid only when m_enableAutoPan = true.
EDA_RECT m_ClipBox
The drawing area used to redraw the screen which is usually the visible area of the drawing in intern...
bool m_PrintIsMirrored
True when drawing in mirror mode.
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
Abort mouse capture callback function.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
bool m_enableBlockCommands
True enables block commands.
#define ENBL_ZOOM_NO_CENTER_KEY
Definition: pgm_base.h:47
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback
Mouse capture move callback function.
#define ENBL_AUTO_PAN_KEY
Definition: pgm_base.h:50
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:375
bool m_ignoreMouseEvents
Ignore mouse events when true.
#define ENBL_MOUSEWHEEL_PAN_KEY
Definition: pgm_base.h:48
void SetX(int val)
Definition: eda_rect.h:130
bool m_ignoreNextLeftButtonRelease
Ignore the next mouse left button release when true.
void SetY(int val)
Definition: eda_rect.h:131
const int drawPanelStyle
bool m_showCrossHair
Indicate if cross hair is to be shown.
void SetSize(const wxSize &size)
Definition: eda_rect.h:126
bool m_enableMousewheelPan
True to enable mousewheel panning by default.
int m_currentCursor
Current mouse cursor shape id.
int m_defaultCursor
The default mouse cursor shape id.
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:187
int m_minDragEventCount
Count the drag events.
bool m_enableAutoPan
True to enable automatic panning.
int m_cursorLevel
Index for cursor redraw in XOR mode.
int m_scrollIncrementY
Y axis scroll increment in pixels per unit.
#define min(a, b)
Definition: auxiliary.h:85
EDA_DRAW_PANEL::~EDA_DRAW_PANEL ( )

Member Function Documentation

void EDA_DRAW_PANEL::CallEndMouseCapture ( wxDC *  aDC)
inlinevirtual

Function CallEndMouseCapture calls the end mouse capture callback.

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

Reimplemented in SCH_DRAW_PANEL.

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

Referenced by LIB_EDIT_FRAME::deleteItem(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), IsMouseCaptured(), OnPan(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), and PCB_EDIT_FRAME::Process_Special_Functions().

357 { printf("EDA_DRAW_PANEL:Unimplemented23\n"); wxASSERT(false); };;
void EDA_DRAW_PANEL::CallEndMouseCapture ( wxDC *  aDC)

Function CallEndMouseCapture calls the end mouse capture callback.

Parameters
aDCA point to a wxDC object to perform any drawing upon.
void EDA_DRAW_PANEL::CallMouseCapture ( wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 
)
inlinevirtual

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

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

Referenced by Abort_EditEdge(), AbortBlockCurrentCommand(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Self(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), SCH_EDIT_FRAME::BeginSegment(), LIB_EDIT_FRAME::CreateGraphicItem(), SCH_EDIT_FRAME::CreateSheet(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment(), 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(), GERBVIEW_FRAME::HandleBlockPlace(), PCB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), IsMouseCaptured(), PCB_EDIT_FRAME::OnHotKey(), LIB_EDIT_FRAME::OnOrient(), SCH_EDIT_FRAME::OnOrient(), OnPan(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Other_Layer_Route(), SCH_EDIT_FRAME::PrepareMoveItem(), 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(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMoveTexteModule(), and PCB_EDIT_FRAME::StartMoveTextePcb().

349 { printf("EDA_DRAW_PANEL:Unimplemented22\n"); wxASSERT(false); };;
void EDA_DRAW_PANEL::CallMouseCapture ( wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 
)

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.
void EDA_DRAW_PANEL::CrossHairOff ( wxDC *  DC)
void EDA_DRAW_PANEL::CrossHairOn ( wxDC *  DC)
virtual wxRect EDA_DRAW_PANEL::DeviceToLogical ( const wxRect &  aRect,
wxDC &  aDC 
)
inlinevirtual

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

aRect must be in scrolled device units.

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

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

Referenced by OnEraseBackground().

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

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

aRect must be in scrolled device units.

Parameters
aRectThe rectangle to convert.
aDCThe device context used for the conversion.
Returns
A rectangle converted to drawing units.
void EDA_DRAW_PANEL::DoPrepareDC ( wxDC &  aDC)
overridevirtual

Function DoPrepareDC sets up the device context aDC for drawing.

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

Parameters
aDCThe device context to prepare.

Definition at line 576 of file eda_draw_panel.cpp.

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

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

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

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

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

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

Referenced by OnPaint(), and SetCanStartBlock().

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

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

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

Function DrawBackGround.

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

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

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

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

Function DrawBackGround.

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

Function DrawCrossHair draws the user cross hair.

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

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

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

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

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

Function DrawCrossHair draws the user cross hair.

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

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

Function DrawGrid draws a grid to aDC.

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

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

Referenced by OnPaint(), and SetCanStartBlock().

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

Function DrawGrid draws a grid to aDC.

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

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

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

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

Referenced by OnPaint(), and SetCanStartBlock().

175 { printf("EDA_DRAW_PANEL:Unimplemented4\n"); };
void EDA_DRAW_PANEL::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)

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

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

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

Referenced by EDA_DRAW_FRAME::CopyToClipboard(), LIB_EDIT_FRAME::CreateGraphicItem(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::Files_io_from_id(), 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(), LIB_EDIT_FRAME::OnCreateNewPart(), LIB_EDIT_FRAME::OnEditComponentProperties(), LIB_EDIT_FRAME::OnEditPin(), PL_EDITOR_FRAME::OnFileHistory(), PCB_EDIT_FRAME::OnFileHistory(), OnKeyEvent(), OnPan(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), LIB_EDIT_FRAME::OnSelectBodyStyle(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), PCB_EDIT_FRAME::OnSelectTool(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::ProcessMuWaveFunctions(), LIB_EDIT_FRAME::saveLibrary(), and SetMouseCaptureCallback().

335  { printf("EDA_DRAW_PANEL:Unimplemented21\n"); wxASSERT(false); };;
void EDA_DRAW_PANEL::EndMouseCapture ( int  aId = -1,
int  aCursorId = -1,
const wxString &  aTitle = wxEmptyString,
bool  aCallEndFunc = true 
)

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.
void EDA_DRAW_PANEL::EraseScreen ( wxDC *  DC)
inlinevirtual

Function OnMouseWheel handles mouse wheel events.

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

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

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

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

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

References m_abortRequest.

143 { return m_abortRequest; }
bool m_abortRequest
Flag used to abort long commands.
virtual EDA_RECT* EDA_DRAW_PANEL::GetClipBox ( )
inlinevirtual

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

References m_ClipBox.

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

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

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

References m_ClipBox.

139 { return &m_ClipBox; }
EDA_RECT m_ClipBox
The drawing area used to redraw the screen which is usually the visible area of the drawing in intern...
int EDA_DRAW_PANEL::GetCurrentCursor ( ) const
inline
int EDA_DRAW_PANEL::GetDefaultCursor ( ) const
inline
void * EDA_DRAW_PANEL::GetDisplayOptions ( )
inlinevirtual

Function GetDisplayOptions A way to pass info to draw functions.

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

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

References GetParent(), and GetScreen().

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

97 { printf("EDA_DRAW_PANEL:Unimplemented\n"); wxASSERT(false); return nullptr; };
void* EDA_DRAW_PANEL::GetDisplayOptions ( )

Function GetDisplayOptions A way to pass info to draw functions.

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

bool EDA_DRAW_PANEL::GetEnableAutoPan ( ) const
inline

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

References m_enableAutoPan.

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

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

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

References m_enableAutoPan, and SetEnableAutoPan().

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

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

References m_enableMousewheelPan.

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

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

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

References m_enableMousewheelPan, and SetEnableMousewheelPan().

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

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

References m_enableZoomNoCenter.

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

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

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

References m_enableZoomNoCenter, and SetEnableZoomNoCenter().

151 { return m_enableZoomNoCenter; }
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
EDA_DRAW_FRAME * EDA_DRAW_PANEL::GetParent ( void  ) const
pure virtual

Implemented in SCH_DRAW_PANEL.

Definition at line 163 of file eda_draw_panel.cpp.

References GetDisplayOptions(), and EDA_DRAW_FRAME::GetDisplayOptions().

Referenced by Abort_Create_Track(), Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortBlockCurrentCommand(), AbortBuildDimension(), AbortCreateNewLine(), AbortMoveAndEditTarget(), AbortMoveDimensionText(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), BuildDimension(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), GBR_LAYOUT::Draw(), EDGE_MODULE::Draw(), ZONE_CONTAINER::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DIMENSION::Draw(), DRAWSEGMENT::Draw(), SEGZONE::Draw(), VIA::Draw(), D_PAD::Draw(), MODULE::DrawAncre(), DrawAndSizingBlockOutlines(), ZONE_CONTAINER::DrawFilledArea(), LIB_PIN::drawGraphic(), DrawMovePin(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawMovingItems(), MODULE::DrawOutlinesWhenMoving(), drawPickedItems(), DrawSegment(), ZONE_CONTAINER::DrawWhileCreateOutline(), ExitSheet(), GetDisplayOptions(), GetGrid(), GetScreen(), Move_Segment(), Move_Texte_Pcb(), MoveDimensionText(), MoveFootprint(), moveItem(), moveItemWithMouseCursor(), OnKeyEvent(), OnMouseEvent(), OnMouseLeaving(), OnMouseWheel(), OnPaint(), OnPan(), OnRightClick(), OnScroll(), OnTimer(), PushTrack(), RedrawWhileMovingCursor(), resizeSheetWithMouseCursor(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), Show_MoveTexte_Module(), Show_New_Edge_While_Move_Mouse(), Show_Pad_Move(), Show_Zone_Corner_Or_Outline_While_Move_Mouse(), ShowBoundingBoxMicroWaveInductor(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), ShowNewTrackWhenMovingCursor(), and ShowTargetShapeWhileMovingMouse().

164 {
165  wxWindow* mom = wxScrolledWindow::GetParent();
166  return (EDA_DRAW_FRAME*) mom;
167 }
The base class for create windows for drawing purpose.
Definition: draw_frame.h:78
EDA_DRAW_FRAME* EDA_DRAW_PANEL::GetParent ( ) const
bool EDA_DRAW_PANEL::GetPrintMirrored ( ) const
inline

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

References m_PrintIsMirrored.

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

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

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

References m_PrintIsMirrored.

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

Implemented in SCH_DRAW_PANEL.

Definition at line 176 of file eda_draw_panel.cpp.

References CrossHairOff(), CrossHairOn(), CURSOR_SIZE, DrawCrossHair(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetParent(), EDA_DRAW_FRAME::GetScreen(), GetZoom(), BASE_SCREEN::GetZoom(), GR_XOR, GRLine(), GRSetDrawMode(), INSTALL_UNBUFFERED_DC, KIGFX::COLOR4D::Invert(), m_ClipBox, m_cursorLevel, m_showCrossHair, SetZoom(), BASE_SCREEN::SetZoom(), ToDeviceXY(), ToLogicalXY(), wxPoint::x, and wxPoint::y.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), AbortBlockCurrentCommand(), AbortBuildDimension(), AbortCreateNewLine(), AbortMoveAndEditTarget(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), EDA_DRAW_FRAME::AddMenuZoomAndGrid(), BuildDimension(), DoPrepareDC(), TEXTE_PCB::Draw(), SCH_BUS_ENTRY_BASE::Draw(), EDGE_MODULE::Draw(), ZONE_CONTAINER::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), SEGZONE::Draw(), VIA::Draw(), LIB_PART::Draw(), SCH_COMPONENT::Draw(), DrawAndSizingBlockOutlines(), DrawDanglingSymbol(), ZONE_CONTAINER::DrawFilledArea(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawMovingItems(), DrawPageOnClipboard(), drawPickedItems(), LIB_PIN::DrawPinSymbol(), DrawSegment(), TRACK::DrawShortNetname(), ZONE_CONTAINER::DrawWhileCreateOutline(), ExitSheet(), GetDisplayOptions(), GetGrid(), Move_Segment(), Move_Texte_Pcb(), MoveDimensionText(), MoveFootprint(), moveItem(), moveItemWithMouseCursor(), OnMouseEvent(), OnPaint(), OnScroll(), resizeSheetWithMouseCursor(), Show_MoveTexte_Module(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), ShowNewTrackWhenMovingCursor(), and ShowTargetShapeWhileMovingMouse().

177 {
178  EDA_DRAW_FRAME* parentFrame = GetParent();
179 
180  return parentFrame->GetScreen();
181 }
The base class for create windows for drawing purpose.
Definition: draw_frame.h:78
virtual EDA_DRAW_FRAME * GetParent() const =0
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
BASE_SCREEN* EDA_DRAW_PANEL::GetScreen ( )
wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition ( )
inlinevirtual

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

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

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

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

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

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

Function GetScreenCenterLogicalPosition.

Returns
The current screen center position in logical (drawing) units.
virtual wxWindow* EDA_DRAW_PANEL::GetWindow ( )
pure virtual

Implemented in SCH_DRAW_PANEL.

Referenced by Refresh().

double EDA_DRAW_PANEL::GetZoom ( )
inlinevirtual

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

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

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

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

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

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

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

References CallEndMouseCapture(), and CallMouseCapture().

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

Function IsPointOnDisplay.

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

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

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

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

Function IsPointOnDisplay.

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

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

Parameters
aPositionThe position in logical units to move the cursor.

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

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

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

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

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

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

Reimplemented in SCH_DRAW_PANEL.

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

Referenced by PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PL_EDITOR_FRAME::Block_Move(), GERBVIEW_FRAME::Block_Move(), PCB_EDIT_FRAME::Create_MuWaveComponent(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), LIB_EDIT_FRAME::CreateGraphicItem(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), PCB_BASE_EDIT_FRAME::duplicateItem(), PCB_EDIT_FRAME::Edit_Zone_Params(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::End_Zone(), PCB_BASE_FRAME::FocusOnLocation(), GetGrid(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), LIB_EDIT_FRAME::LoadOneSymbol(), PL_EDITOR_FRAME::Locate(), LIB_EDIT_FRAME::locateItem(), SCH_EDIT_FRAME::LocateItem(), PCB_EDIT_FRAME::moveExact(), PL_EDITOR_FRAME::MoveItem(), PCB_EDIT_FRAME::MuWaveCommand(), SCH_EDIT_FRAME::OnDragItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), OnEraseBackground(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnRotate(), EDA_DRAW_FRAME::OnZoom(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::PlacePin(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), and PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event().

260 { printf("EDA_DRAW_PANEL:Unimplemented14\n"); };;
void EDA_DRAW_PANEL::MoveCursorToCrossHair ( )

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

void EDA_DRAW_PANEL::OnActivate ( wxActivateEvent &  event)

Function OnActivate handles window activation events.

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

Definition at line 396 of file eda_draw_panel.cpp.

References m_canStartBlock.

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

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

Definition at line 1366 of file eda_draw_panel.cpp.

References dump(), and kicadTraceKeyEvent.

Referenced by OnEraseBackground().

1367 {
1368  wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnCharHook %s", dump( event ) );
1369  event.Skip();
1370 }
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.
void EDA_DRAW_PANEL::OnKeyEvent ( wxKeyEvent &  event)

Definition at line 1373 of file eda_draw_panel.cpp.

References dump(), EndMouseCapture(), GetParent(), GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, ID_NO_TOOL_SELECTED, INSTALL_UNBUFFERED_DC, IsMouseCaptured(), kicadTraceKeyEvent, m_abortRequest, m_defaultCursor, EDA_DRAW_FRAME::SetMousePosition(), wxPoint::x, and wxPoint::y.

Referenced by OnEraseBackground().

1374 {
1375  int localkey;
1376  wxPoint pos;
1377 
1378  wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnKeyEvent %s", dump( event ) );
1379 
1380  localkey = event.GetKeyCode();
1381  bool keyWasHandled = false;
1382 
1383  switch( localkey )
1384  {
1385  default:
1386  break;
1387 
1388  case WXK_ESCAPE:
1389  m_abortRequest = true;
1390 
1391  if( IsMouseCaptured() )
1392  EndMouseCapture();
1393  else
1395 
1396  keyWasHandled = true; // The key is captured: the key event must not be skipped
1397  break;
1398  }
1399 
1400  /* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
1401  * They have an ascii code from 1 to 27 remapped
1402  * to GR_KB_CTRL + 'A' to GR_KB_CTRL + 'Z'
1403  */
1404  if( event.ControlDown() && localkey >= WXK_CONTROL_A && localkey <= WXK_CONTROL_Z )
1405  localkey += 'A' - 1;
1406 
1407  /* Disallow shift for keys that have two keycodes on them (e.g. number and
1408  * punctuation keys) leaving only the "letter keys" of A-Z.
1409  * Then, you can have, e.g. Ctrl-5 and Ctrl-% (GB layout)
1410  * and Ctrl-( and Ctrl-5 (FR layout).
1411  * Otherwise, you'd have to have to say Ctrl-Shift-5 on a FR layout
1412  */
1413  bool keyIsLetter = ( localkey >= 'A' && localkey <= 'Z' ) ||
1414  ( localkey >= 'a' && localkey <= 'z' );
1415 
1416  if( event.ShiftDown() && ( keyIsLetter || localkey > 256 ) )
1417  localkey |= GR_KB_SHIFT;
1418 
1419  if( event.ControlDown() )
1420  localkey |= GR_KB_CTRL;
1421 
1422  if( event.AltDown() )
1423  localkey |= GR_KB_ALT;
1424 
1425  INSTALL_UNBUFFERED_DC( DC, this );
1426 
1427  // Some key commands use the current mouse position: refresh it.
1428  pos = wxGetMousePosition() - GetScreenPosition();
1429 
1430  // Compute the cursor position in drawing units. Also known as logical units to wxDC.
1431  pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
1432 
1433  GetParent()->SetMousePosition( pos );
1434 
1435  if( !GetParent()->GeneralControl( &DC, pos, localkey ) && !keyWasHandled )
1436  event.Skip(); // Skip this event only when the key was not handled
1437 }
#define GR_KB_ALT
bool m_abortRequest
Flag used to abort long commands.
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
#define GR_KB_CTRL
virtual EDA_DRAW_FRAME * GetParent() const =0
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
#define GR_KB_SHIFT
void SetMousePosition(const wxPoint &aPosition)
#define INSTALL_UNBUFFERED_DC(name, parent)
int m_defaultCursor
The default mouse cursor shape id.
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.
void EDA_DRAW_PANEL::OnMouseEntering ( wxMouseEvent &  aEvent)

Definition at line 909 of file eda_draw_panel.cpp.

References m_cursorLevel.

Referenced by OnEraseBackground().

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

Definition at line 1080 of file eda_draw_panel.cpp.

References abs, BLOCK_MINSIZE_LIMIT, BLOCK_ZOOM, CrossHairOff(), CrossHairOn(), EDA_DRAW_FRAME::DisplayToolMsg(), EDA_DRAW_FRAME::GeneralControl(), EDA_DRAW_FRAME::GetCrossHairPosition(), BASE_SCREEN::GetCurItem(), EDA_ITEM::GetFlags(), EDA_RECT::GetHeight(), GetParent(), BASE_SCREEN::GetScalingFactor(), GetScreen(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), BLOCK_SELECTOR::GetState(), EDA_DRAW_FRAME::GetToolId(), EDA_RECT::GetWidth(), GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, GR_M_DCLICK, GR_M_LEFT_DOWN, GR_M_MIDDLE_DOWN, EDA_DRAW_FRAME::HandleBlockBegin(), EDA_DRAW_FRAME::HandleBlockEnd(), EDA_DRAW_FRAME::HandleBlockPlace(), ID_NO_TOOL_SELECTED, ID_ZOOM_SELECTION, INSTALL_UNBUFFERED_DC, BASE_SCREEN::IsBlockActive(), IsMouseCaptured(), KiROUND(), BASE_SCREEN::m_BlockLocate, m_canStartBlock, m_ClickTimer, m_currentCursor, m_CursorClickPos, m_CursorStartPos, m_doubleClickInterval, m_enableBlockCommands, m_endMouseCaptureCallback, m_ignoreMouseEvents, m_ignoreNextLeftButtonRelease, m_minDragEventCount, m_PanStartCenter, m_PanStartEventPosition, m_requestAutoPan, MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND, EDA_DRAW_FRAME::OnLeftClick(), EDA_DRAW_FRAME::OnLeftDClick(), OnRightClick(), EDA_DRAW_FRAME::RedrawScreen(), EDA_DRAW_FRAME::RefPos(), Refresh(), scale, EDA_DRAW_FRAME::SetMousePosition(), EDA_RECT::SetOrigin(), STATE_BLOCK_END, STATE_BLOCK_MOVE, STATE_NO_BLOCK, wxPoint::x, and wxPoint::y.

Referenced by EDA_DRAW_FRAME::ExecuteRemoteCommand(), and OnEraseBackground().

1081 {
1082  int localbutt = 0;
1083  BASE_SCREEN* screen = GetScreen();
1084 
1085  if( !screen )
1086  return;
1087 
1088  /* Adjust value to filter mouse displacement before consider the drag
1089  * mouse is really a drag command, not just a movement while click
1090  */
1091 #define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
1092 
1093  if( event.Leaving() )
1094  m_canStartBlock = -1;
1095 
1096  if( !IsMouseCaptured() ) // No mouse capture in progress.
1097  m_requestAutoPan = false;
1098 
1099  if( GetParent()->IsActive() )
1100  SetFocus();
1101  else
1102  return;
1103 
1104  if( !event.IsButton() && !event.Moving() && !event.Dragging() )
1105  return;
1106 
1107  if( event.RightDown() )
1108  {
1109  OnRightClick( event );
1110  return;
1111  }
1112 
1113  if( m_ignoreMouseEvents )
1114  return;
1115 
1116  if( event.LeftDown() )
1117  localbutt = GR_M_LEFT_DOWN;
1118 
1119  if( event.ButtonDClick( 1 ) )
1120  localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK;
1121 
1122  if( event.MiddleDown() )
1123  localbutt = GR_M_MIDDLE_DOWN;
1124 
1125  INSTALL_UNBUFFERED_DC( DC, this );
1126  DC.SetBackground( *wxBLACK_BRUSH );
1127 
1128  // Compute the cursor position in drawing (logical) units.
1129  GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
1130 
1131  int kbstat = 0;
1132 
1133  if( event.ShiftDown() )
1134  kbstat |= GR_KB_SHIFT;
1135 
1136  if( event.ControlDown() )
1137  kbstat |= GR_KB_CTRL;
1138 
1139  if( event.AltDown() )
1140  kbstat |= GR_KB_ALT;
1141 
1142  // Calling Double Click and Click functions :
1143  if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
1144  {
1145  if( m_ClickTimer )
1146  {
1147  m_ClickTimer->Stop();
1148  wxDELETE( m_ClickTimer );
1149  }
1150  GetParent()->OnLeftDClick( &DC, GetParent()->RefPos( true ) );
1151 
1152  // inhibit a response to the mouse left button release,
1153  // because we have a double click, and we do not want a new
1154  // OnLeftClick command at end of this Double Click
1156  }
1157  else if( event.LeftUp() )
1158  {
1159  // A block command is in progress: a left up is the end of block
1160  // or this is the end of a double click, already seen
1161  // Note also m_ignoreNextLeftButtonRelease can be set by
1162  // the call to OnLeftClick(), so do not change it after calling OnLeftClick
1163  bool ignoreEvt = m_ignoreNextLeftButtonRelease;
1165 
1166  if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
1167  {
1168  EDA_ITEM* item = screen->GetCurItem();
1169  m_CursorClickPos = GetParent()->RefPos( true );
1170 
1171  // If we have an item already selected, or we are using a tool,
1172  // we won't use the disambiguation menu so process the click immediately
1173  if( ( item && item->GetFlags() ) || GetParent()->GetToolId() != ID_NO_TOOL_SELECTED )
1175  else
1176  {
1177  wxDELETE( m_ClickTimer );
1178  m_ClickTimer = new wxTimer(this, ID_MOUSE_DOUBLECLICK);
1179  m_ClickTimer->StartOnce( m_doubleClickInterval );
1180  }
1181  }
1182 
1183  }
1184  else if( !event.LeftIsDown() )
1185  {
1186  /* be sure there is a response to a left button release command
1187  * even when a LeftUp event is not seen. This happens when a
1188  * double click opens a dialog box, and the release mouse button
1189  * is made when the dialog box is opened.
1190  */
1192  }
1193 
1194  if( event.ButtonDown( wxMOUSE_BTN_MIDDLE ) )
1195  {
1197  m_PanStartEventPosition = event.GetPosition();
1198 
1199  INSTALL_UNBUFFERED_DC( dc, this );
1200  CrossHairOff( &dc );
1201  SetCursor( wxCURSOR_SIZING );
1202  }
1203 
1204  if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) )
1205  {
1206  INSTALL_UNBUFFERED_DC( dc, this );
1207  CrossHairOn( &dc );
1208  SetCursor( (wxStockCursor) m_currentCursor );
1209  }
1210 
1211  if( event.MiddleIsDown() )
1212  {
1213  wxPoint currentPosition = event.GetPosition();
1214 
1215  double scale = GetParent()->GetScreen()->GetScalingFactor();
1216  int x = m_PanStartCenter.x +
1217  KiROUND( (double) ( m_PanStartEventPosition.x - currentPosition.x ) / scale );
1218  int y = m_PanStartCenter.y +
1219  KiROUND( (double) ( m_PanStartEventPosition.y - currentPosition.y ) / scale );
1220 
1221  GetParent()->RedrawScreen( wxPoint( x, y ), false );
1222  }
1223 
1224  // Calling the general function on mouse changes (and pseudo key commands)
1225  GetParent()->GeneralControl( &DC, event.GetLogicalPosition( DC ), 0 );
1226 
1227  /*******************************/
1228  /* Control of block commands : */
1229  /*******************************/
1230 
1231  // Command block can't start if mouse is dragging a new panel
1232  static EDA_DRAW_PANEL* lastPanel;
1233  if( lastPanel != this )
1234  {
1235  m_minDragEventCount = 0;
1236  m_canStartBlock = -1;
1237  }
1238 
1239  /* A new command block can start after a release buttons
1240  * and if the drag is enough
1241  * This is to avoid a false start block when a dialog box is dismissed,
1242  * or when changing panels in hierarchy navigation
1243  * or when clicking while and moving mouse
1244  */
1245  if( !event.LeftIsDown() && !event.MiddleIsDown() )
1246  {
1247  m_minDragEventCount = 0;
1248  m_canStartBlock = 0;
1249 
1250  /* Remember the last cursor position when a drag mouse starts
1251  * this is the last position ** before ** clicking a button
1252  * this is useful to start a block command from the point where the
1253  * mouse was clicked first
1254  * (a filter creates a delay for the real block command start, and
1255  * we must remember this point)
1256  */
1258  }
1259 
1260  if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) )
1261  {
1262  if( !screen->IsBlockActive() )
1263  {
1265  }
1266 
1267  if( event.LeftDown() )
1268  {
1269  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
1270  {
1271  m_requestAutoPan = false;
1272  GetParent()->HandleBlockPlace( &DC );
1274  }
1275  }
1276  else if( ( m_canStartBlock >= 0 ) && event.LeftIsDown() && !IsMouseCaptured() )
1277  {
1278  // Mouse is dragging: if no block in progress, start a block command.
1279  if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
1280  {
1281  // Start a block command
1282  int cmd_type = kbstat;
1283 
1284  // A block command is started if the drag is enough. A small
1285  // drag is ignored (it is certainly a little mouse move when
1286  // clicking) not really a drag mouse
1289  else
1290  {
1291  auto cmd = (GetParent()->GetToolId() == ID_ZOOM_SELECTION) ? BLOCK_ZOOM : 0;
1292 
1293  if( !GetParent()->HandleBlockBegin( &DC, cmd_type, m_CursorStartPos, cmd ) )
1294  {
1295  // should not occur: error
1297  wxT( "EDA_DRAW_PANEL::OnMouseEvent() Block Error" ) );
1298  }
1299  else
1300  {
1301  m_requestAutoPan = true;
1302  SetCursor( wxCURSOR_SIZING );
1303  }
1304  }
1305  }
1306  }
1307 
1308  if( event.ButtonUp( wxMOUSE_BTN_LEFT ) )
1309  {
1310  /* Release the mouse button: end of block.
1311  * The command can finish (DELETE) or have a next command (MOVE,
1312  * COPY). However the block command is canceled if the block
1313  * size is small because a block command filtering is already
1314  * made, this case happens, but only when the on grid cursor has
1315  * not moved.
1316  */
1317  #define BLOCK_MINSIZE_LIMIT 1
1318  bool BlockIsSmall =
1320  && ( std::abs( screen->m_BlockLocate.GetHeight() ) < BLOCK_MINSIZE_LIMIT );
1321 
1322  if( (screen->m_BlockLocate.GetState() != STATE_NO_BLOCK) && BlockIsSmall )
1323  {
1325  {
1326  m_endMouseCaptureCallback( this, &DC );
1327  m_requestAutoPan = false;
1328  }
1329 
1330  SetCursor( (wxStockCursor) m_currentCursor );
1331  }
1332  else if( screen->m_BlockLocate.GetState() == STATE_BLOCK_END )
1333  {
1334  m_requestAutoPan = false;
1335  GetParent()->HandleBlockEnd( &DC );
1336  SetCursor( (wxStockCursor) m_currentCursor );
1337  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
1338  {
1339  m_requestAutoPan = true;
1340  SetCursor( wxCURSOR_HAND );
1341  }
1342  }
1343  }
1344  }
1345 
1346  // End of block command on a double click
1347  // To avoid an unwanted block move command if the mouse is moved while double clicking
1348  if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
1349  {
1350  if( !screen->IsBlockActive() && IsMouseCaptured() )
1351  {
1352  m_endMouseCaptureCallback( this, &DC );
1353  }
1354  }
1355 
1356  lastPanel = this;
1357 
1358 #ifdef WXGTK3
1359  // Screen has to be updated on every operation, otherwise the cursor leaves a trail (when xor
1360  // operation is changed to copy) or is not updated at all.
1361  Refresh();
1362 #endif
1363 }
virtual BASE_SCREEN * GetScreen()=0
#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...
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
#define GR_M_MIDDLE_DOWN
Definition: gr_basic.h:76
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
EDA_ITEM * GetCurItem() const
Definition: base_screen.h:233
virtual void HandleBlockPlace(wxDC *DC)
Called after HandleBlockEnd, when a block command needs to be executed after the block is moved to it...
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:95
bool m_requestAutoPan
true to request an auto pan. Valid only when m_enableAutoPan = true.
int GetHeight() const
Definition: eda_rect.h:118
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback
Abort mouse capture callback function.
#define GR_KB_CTRL
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
const wxPoint & GetScrollCenterPosition() const
wxPoint m_PanStartEventPosition
Initial position of mouse event when pan started.
bool m_enableBlockCommands
True enables block commands.
#define abs(a)
Definition: auxiliary.h:84
virtual EDA_DRAW_FRAME * GetParent() const =0
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Initialize a block command.
bool IsBlockActive() const
Definition: base_screen.h:499
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
virtual void OnLeftClick(wxDC *DC, const wxPoint &MousePos)=0
virtual void CrossHairOn(wxDC *DC=nullptr)
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 CrossHairOff(wxDC *DC=nullptr)
#define GR_KB_SHIFT
bool m_ignoreNextLeftButtonRelease
Ignore the next mouse left button release when true.
virtual bool HandleBlockEnd(wxDC *DC)
Handle the "end" of a block command, i.e.
wxPoint m_PanStartCenter
Initial scroll center position when pan started.
wxPoint RefPos(bool useMouse) const
Return the reference position, coming from either the mouse position or the cursor position...
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...
#define GR_M_LEFT_DOWN
Definition: gr_basic.h:74
wxPoint m_CursorClickPos
Used for maintaining click position.
const int scale
void DisplayToolMsg(const wxString &msg)
void SetMousePosition(const wxPoint &aPosition)
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
BLOCK_STATE_T GetState() const
#define INSTALL_UNBUFFERED_DC(name, parent)
int m_currentCursor
Current mouse cursor shape id.
int GetToolId() const
Definition: draw_frame.h:519
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
int GetWidth() const
Definition: eda_rect.h:117
bool OnRightClick(wxMouseEvent &event)
Function OnRightClick builds and displays a context menu on a right mouse button click.
int m_minDragEventCount
Count the drag events.
wxPoint m_CursorStartPos
Used for testing the cursor movement.
virtual bool GeneralControl(wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0)
Perform application specific control using aDC at aPosition in logical units.
Definition: draw_frame.h:630
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
#define BLOCK_MINSIZE_LIMIT
virtual void OnLeftDClick(wxDC *DC, const wxPoint &MousePos)
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
void EDA_DRAW_PANEL::OnMouseLeaving ( wxMouseEvent &  event)

Definition at line 920 of file eda_draw_panel.cpp.

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

Referenced by OnEraseBackground().

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

Function OnMouseWheel handles mouse wheel events.

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

Definition at line 954 of file eda_draw_panel.cpp.

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

Referenced by OnEraseBackground().

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

Definition at line 595 of file eda_draw_panel.cpp.

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

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

Definition at line 1440 of file eda_draw_panel.cpp.

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

Referenced by OnEraseBackground().

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

Function OnRightClick builds and displays a context menu on a right mouse button click.

Returns
true if the context menu is shown, or false

Definition at line 882 of file eda_draw_panel.cpp.

References EDA_DRAW_FRAME::AddMenuZoomAndGrid(), GetParent(), INSTALL_UNBUFFERED_DC, and m_ignoreMouseEvents.

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

883 {
884  wxPoint pos;
885  wxMenu MasterMenu;
886 
887  INSTALL_UNBUFFERED_DC( dc, this );
888 
889  pos = event.GetLogicalPosition( dc );
890 
891  if( !GetParent()->OnRightClick( pos, &MasterMenu ) )
892  return false;
893 
894  GetParent()->AddMenuZoomAndGrid( &MasterMenu );
895 
896  pos = event.GetPosition();
897  m_ignoreMouseEvents = true;
898  PopupMenu( &MasterMenu, pos );
899 
900  // The ZoomAndGrid menu is only invoked over empty space so there's no point in warping
901  // the cursor back to the crosshair, and it's very annoying if one clicked out of the menu.
902 
903  m_ignoreMouseEvents = false;
904 
905  return true;
906 }
virtual EDA_DRAW_FRAME * GetParent() const =0
bool m_ignoreMouseEvents
Ignore mouse events when true.
#define INSTALL_UNBUFFERED_DC(name, parent)
bool OnRightClick(wxMouseEvent &event)
Function OnRightClick builds and displays a context menu on a right mouse button click.
virtual void AddMenuZoomAndGrid(wxMenu *aMasterMenu)
Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info...
void EDA_DRAW_PANEL::OnScroll ( wxScrollWinEvent &  event)

Definition at line 411 of file eda_draw_panel.cpp.

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

Referenced by OnEraseBackground().

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

Referenced by OnEraseBackground().

void EDA_DRAW_PANEL::OnTimer ( wxTimerEvent &  event)

Function OnTimer handle timer events.

The class will start a timer when a mouse-up event is handled. If a double-click event is not handled inside of a specified interval, the timer event will fire, causing the single-click event to be handled. Otherwise, the system will process the double-click.

Definition at line 403 of file eda_draw_panel.cpp.

References GetParent(), INSTALL_UNBUFFERED_DC, m_CursorClickPos, and EDA_DRAW_FRAME::OnLeftClick().

Referenced by OnEraseBackground().

404 {
405  INSTALL_UNBUFFERED_DC( DC, this );
406  DC.SetBackground( *wxBLACK_BRUSH );
408 }
virtual EDA_DRAW_FRAME * GetParent() const =0
virtual void OnLeftClick(wxDC *DC, const wxPoint &MousePos)=0
wxPoint m_CursorClickPos
Used for maintaining click position.
#define INSTALL_UNBUFFERED_DC(name, parent)
void EDA_DRAW_PANEL::ReDraw ( wxDC *  aDC,
bool  aEraseBackground = true 
)
inlinevirtual

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

Referenced by OnEraseBackground(), and OnPaint().

236 { printf("EDA_DRAW_PANEL:Unimplemented11\n"); };;
void EDA_DRAW_PANEL::ReDraw ( wxDC *  aDC,
bool  aEraseBackground = true 
)
virtual void EDA_DRAW_PANEL::Refresh ( bool  eraseBackground = true,
const wxRect *  rect = 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 in SCH_DRAW_PANEL.

void EDA_DRAW_PANEL::Refresh ( bool  eraseBackground = true,
const wxRect *  rect = NULL 
)
inlinevirtual

Reimplemented in SCH_DRAW_PANEL.

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

References GetWindow().

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Move_Corner_Or_Outlines(), abortMoveItem(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Duplicate(), PCB_EDIT_FRAME::Block_Flip(), PL_EDITOR_FRAME::Block_Move(), GERBVIEW_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), PCB_EDIT_FRAME::Check_All_Zones(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_WIZARD_FRAME::ClickOnPageList(), PCB_EDIT_FRAME::Delete_Module(), PCB_EDIT_FRAME::Delete_OldZone_Fill(), DIALOG_DRC_CONTROL::doSelectionMenu(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), SCH_EDIT_FRAME::EndSegment(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), PL_EDITOR_FRAME::Files_io(), GERBVIEW_FRAME::Files_io(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::FlipTextePcb(), GERBVIEW_FRAME::GERBVIEW_FRAME(), GetGrid(), SCH_BASE_FRAME::HandleBlockBegin(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), FOOTPRINT_EDIT_FRAME::HandleBlockPlace(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), PCB_EDIT_FRAME::moveExact(), moveItem(), PL_EDITOR_FRAME::MoveItem(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked(), SCH_EDIT_FRAME::OnEditItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), OnEraseBackground(), FOOTPRINT_EDIT_FRAME::OnHotKey(), GERBVIEW_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerSelect(), GERBER_LAYER_WIDGET::OnLayerSelect(), PCB_LAYER_WIDGET::OnLayerVisible(), GERBER_LAYER_WIDGET::OnLayerVisible(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PL_EDITOR_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), OnMouseEvent(), PL_EDITOR_FRAME::OnNewPageLayout(), GERBER_LAYER_WIDGET::onPopupSelection(), LIB_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::OnPreferencesOptions(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), PL_EDITOR_FRAME::OnRightClick(), GERBVIEW_FRAME::OnSelectActiveDCode(), PL_EDITOR_FRAME::OnSelectCoordOriginCorner(), GERBVIEW_FRAME::OnSelectDisplayMode(), GERBVIEW_FRAME::OnSelectHighlightChoice(), FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar(), GERBVIEW_FRAME::OnSelectOptionToolbar(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode(), PROPERTIES_FRAME::OnSetDefaultValues(), EDA_DRAW_FRAME::OnToggleCrossHairStyle(), PCB_BASE_FRAME::OnToggleEdgeDrawMode(), PCB_BASE_FRAME::OnToggleGraphicDrawMode(), EDA_DRAW_FRAME::OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), PCB_BASE_FRAME::OnToggleTextDrawMode(), PL_EDITOR_FRAME::OnTreeSelection(), DIALOG_UPDATE_PCB::PerformUpdate(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), SCH_EDIT_FRAME::PrepareMoveItem(), PL_EDITOR_FRAME::Process_Config(), EDA_DRAW_FRAME::Process_PageSettings(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListLib(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), DIALOG_DRC_CONTROL::RedrawDrawPanel(), Refresh(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), PCB_BASE_FRAME::ResetTextSize(), FOOTPRINT_EDIT_FRAME::RevertFootprint(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), PCB_BASE_FRAME::SetNextGrid(), PCB_BASE_FRAME::SetPrevGrid(), LIB_VIEW_FRAME::SetSelectedLibrary(), PCB_BASE_FRAME::SetToolID(), PCB_EDIT_FRAME::Show_1_Ratsnest(), GERBVIEW_FRAME::SortLayersByX2Attributes(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_BASE_FRAME::SwitchLayer(), PCB_EDIT_FRAME::SwitchLayer(), PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event(), PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow(), GERBVIEW_FRAME::UpdateDisplayOptions(), and GERBVIEW_FRAME::UseGalCanvas().

359 {}
void EDA_DRAW_PANEL::RefreshDrawingRect ( const EDA_RECT aRect,
bool  aEraseBackground = true 
)
inlinevirtual
void EDA_DRAW_PANEL::RefreshDrawingRect ( const EDA_RECT aRect,
bool  aEraseBackground = true 
)

Function RefreshDrawingRect redraws the contents of aRect in drawing units.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Function SetCurrentCursor Set the current cursor shape for drawpanel.

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

457  {
458  m_currentCursor = aCursor;
459  SetCursor( (wxStockCursor) m_currentCursor );
460  }
int m_currentCursor
Current mouse cursor shape id.
void EDA_DRAW_PANEL::SetEnableAutoPan ( bool  aEnable)
inlinevirtual

Reimplemented in SCH_DRAW_PANEL.

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

Referenced by EDA_DRAW_FRAME::CommonSettingsChanged(), GetEnableAutoPan(), OnPaint(), and EDA_DRAW_FRAME::PushPreferences().

123 { m_enableAutoPan = aEnable; };
bool m_enableAutoPan
True to enable automatic panning.
void EDA_DRAW_PANEL::SetEnableAutoPan ( bool  aEnable)
void EDA_DRAW_PANEL::SetEnableBlockCommands ( bool  aEnable)
inline

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

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

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

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

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

Reimplemented in SCH_DRAW_PANEL.

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

Referenced by EDA_DRAW_FRAME::CommonSettingsChanged(), GetEnableMousewheelPan(), and OnPaint().

115 { m_enableMousewheelPan = aEnable; };
bool m_enableMousewheelPan
True to enable mousewheel panning by default.
void EDA_DRAW_PANEL::SetEnableMousewheelPan ( bool  aEnable)
void EDA_DRAW_PANEL::SetEnableZoomNoCenter ( bool  aEnable)
inlinevirtual

Reimplemented in SCH_DRAW_PANEL.

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

Referenced by EDA_DRAW_FRAME::CommonSettingsChanged(), GetEnableZoomNoCenter(), OnPaint(), and EDA_DRAW_FRAME::PushPreferences().

119 { m_enableZoomNoCenter = aEnable; };
bool m_enableZoomNoCenter
True to enable zooming around the crosshair instead of the center.
void EDA_DRAW_PANEL::SetEnableZoomNoCenter ( bool  aEnable)
void EDA_DRAW_PANEL::SetGrid ( const wxRealPoint &  size)

Referenced by OnEraseBackground().

void EDA_DRAW_PANEL::SetIgnoreLeftButtonReleaseEvent ( bool  aIgnore)
inline

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

Referenced by EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent().

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

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

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

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

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

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

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

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

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

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

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

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

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

References EndMouseCapture().

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

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

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

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

168 { m_PrintIsMirrored = aMirror; }
bool m_PrintIsMirrored
True when drawing in mirror mode.
void EDA_DRAW_PANEL::SetZoom ( double  mode)
inlinevirtual

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

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

203 { printf("EDA_DRAW_PANEL:Unimplemented7\n"); };;
void EDA_DRAW_PANEL::SetZoom ( double  mode)
wxPoint EDA_DRAW_PANEL::ToDeviceXY ( const wxPoint pos)
inlinevirtual

Function ToDeviceXY transforms logical to device coordinates.

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

Referenced by GetScreen(), and OnEraseBackground().

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

Function ToDeviceXY transforms logical to device coordinates.

wxPoint EDA_DRAW_PANEL::ToLogicalXY ( const wxPoint pos)
inlinevirtual

Function ToLogicalXY transforms device to logical coordinates.

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

Referenced by GetScreen(), and OnEraseBackground().

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

Function ToLogicalXY transforms device to logical coordinates.

Member Data Documentation

bool EDA_DRAW_PANEL::m_abortRequest
protected

Flag used to abort long commands.

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

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

int EDA_DRAW_PANEL::m_canStartBlock
protected

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

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

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

wxTimer* EDA_DRAW_PANEL::m_ClickTimer
private

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

Referenced by EDA_DRAW_PANEL(), and OnMouseEvent().

EDA_RECT EDA_DRAW_PANEL::m_ClipBox
protected

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(), GetClipBox(), GetGrid(), GetScreen(), OnPaint(), and OnScroll().

int EDA_DRAW_PANEL::m_currentCursor
private

Current mouse cursor shape id.

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

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

wxPoint EDA_DRAW_PANEL::m_CursorClickPos
private

Used for maintaining click position.

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

Referenced by OnMouseEvent(), and OnTimer().

int EDA_DRAW_PANEL::m_cursorLevel
protected

Index for cursor redraw in XOR mode.

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

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

wxPoint EDA_DRAW_PANEL::m_CursorStartPos
protected

Used for testing the cursor movement.

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

Referenced by OnMouseEvent().

int EDA_DRAW_PANEL::m_defaultCursor
private

The default mouse cursor shape id.

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

Referenced by EDA_DRAW_PANEL(), GetDefaultCursor(), and OnKeyEvent().

int EDA_DRAW_PANEL::m_doubleClickInterval
protected

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

Referenced by EDA_DRAW_PANEL(), and OnMouseEvent().

bool EDA_DRAW_PANEL::m_enableAutoPan
protected

True to enable automatic panning.

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

Referenced by EDA_DRAW_PANEL(), GetEnableAutoPan(), OnMouseLeaving(), and OnPaint().

bool EDA_DRAW_PANEL::m_enableBlockCommands
protected

True enables block commands.

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

Referenced by EDA_DRAW_PANEL(), and OnMouseEvent().

bool EDA_DRAW_PANEL::m_enableMousewheelPan
protected

True to enable mousewheel panning by default.

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

Referenced by EDA_DRAW_PANEL(), GetEnableMousewheelPan(), OnMouseWheel(), and OnPaint().

bool EDA_DRAW_PANEL::m_enableZoomNoCenter
protected

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(), GetEnableZoomNoCenter(), OnMouseWheel(), and OnPaint().

END_MOUSE_CAPTURE_CALLBACK EDA_DRAW_PANEL::m_endMouseCaptureCallback
protected

Abort mouse capture callback function.

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

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

bool EDA_DRAW_PANEL::m_ignoreMouseEvents
protected

Ignore mouse events when true.

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

Referenced by EDA_DRAW_PANEL(), OnMouseEvent(), OnMouseLeaving(), OnMouseWheel(), and OnRightClick().

bool EDA_DRAW_PANEL::m_ignoreNextLeftButtonRelease
protected

Ignore the next mouse left button release when true.

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

Referenced by EDA_DRAW_PANEL(), and OnMouseEvent().

int EDA_DRAW_PANEL::m_minDragEventCount
protected

Count the drag events.

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

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

Referenced by EDA_DRAW_PANEL(), and OnMouseEvent().

MOUSE_CAPTURE_CALLBACK EDA_DRAW_PANEL::m_mouseCaptureCallback
protected

Mouse capture move callback function.

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

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

wxPoint EDA_DRAW_PANEL::m_PanStartCenter
protected

Initial scroll center position when pan started.

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

Referenced by OnMouseEvent().

wxPoint EDA_DRAW_PANEL::m_PanStartEventPosition
protected

Initial position of mouse event when pan started.

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

Referenced by OnMouseEvent().

bool EDA_DRAW_PANEL::m_PrintIsMirrored
protected

True when drawing in mirror mode.

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

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

Referenced by EDA_DRAW_PANEL(), and GetPrintMirrored().

bool EDA_DRAW_PANEL::m_requestAutoPan
protected

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

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

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

int EDA_DRAW_PANEL::m_scrollIncrementX
protected

X axis scroll increment in pixels per unit.

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

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

int EDA_DRAW_PANEL::m_scrollIncrementY
protected

Y axis scroll increment in pixels per unit.

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

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

bool EDA_DRAW_PANEL::m_showCrossHair
protected

Indicate if cross hair is to be shown.

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

Referenced by EDA_DRAW_PANEL(), and GetScreen().


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