KiCad PCB EDA Suite
draw_frame.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 2011-2017 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #ifndef DRAW_FRAME_H_
27 #define DRAW_FRAME_H_
28 
29 #include <wxstruct.h>
30 #include <kiway_player.h>
31 #include <climits>
33 #include <gal/color4d.h>
34 
35 class wxSingleInstanceChecker;
36 class EDA_HOTKEY;
37 
38 using KIGFX::COLOR4D;
39 
40 namespace KIGFX
41 {
42  class GAL_DISPLAY_OPTIONS;
43 }
44 
45 #define DEFAULT_MAX_UNDO_ITEMS 0
46 #define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
47 
54 {
57  friend class EDA_DRAW_PANEL;
58 
60  int m_toolId;
61 
63 
64  bool m_snapToGrid;
66 
68 
70  std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_galDisplayOptions;
71 
72 protected:
73 
74  std::unique_ptr<wxSingleInstanceChecker> m_file_checker;
75 
77  int m_LastGridSizeId; // the command id offset (>= 0) of the last selected grid
78  // 0 is for the grid corresponding to
79  // a wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
80  bool m_drawGrid; // hide/Show grid
84  double m_zoomLevelCoeff;
86  // to a zoom level value which rougly gives 1.0 when the board/schematic
87  // is at scale = 1
89  // to screens
90 
93 
97 
100 
103 
106 
110 
113 
115  wxChoice* m_gridSelectBox;
116 
118  wxChoice* m_zoomSelectBox;
119 
122  wxAuiToolBar* m_drawToolBar;
123 
125  wxAuiToolBar* m_optionsToolBar;
126 
129 
131 
132 #ifdef USE_WX_OVERLAY
133  // MAC Uses overlay to workaround the wxINVERT and wxXOR miss
134  wxOverlay m_overlay;
135 #endif
136 
139 
140  void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
141 
149  virtual void unitsChangeRefresh();
150 
155  void GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid );
156 
157  /* Function RefreshCrosshair
158  * Move and refresh the crosshair after movement; also call the
159  * mouse capture function, if active.
160  */
161  void RefreshCrossHair( const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC* aDC );
162 public:
163  EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
164  FRAME_T aFrameType,
165  const wxString& aTitle,
166  const wxPoint& aPos, const wxSize& aSize,
167  long aStyle,
168  const wxString& aFrameName );
169 
170  ~EDA_DRAW_FRAME();
171 
178  bool LockFile( const wxString& aFileName );
179 
184  void ReleaseFile();
185 
186  virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0;
187  virtual const PAGE_INFO& GetPageSettings() const = 0;
188 
194  virtual const wxSize GetPageSizeIU() const = 0;
195 
200  virtual const wxPoint& GetAuxOrigin() const = 0;
201  virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
202 
209  virtual const wxPoint& GetGridOrigin() const = 0;
210  virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
211 
212  //-----<BASE_SCREEN API moved here>------------------------------------------
219  wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
220 
229  void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
230 
239  wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
240 
249  wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
250 
257 
258  void SetMousePosition( const wxPoint& aPosition );
259 
270  wxPoint RefPos( bool useMouse ) const;
271 
272  const wxPoint& GetScrollCenterPosition() const;
273  void SetScrollCenterPosition( const wxPoint& aPoint );
274 
275  //-----</BASE_SCREEN API moved here>-----------------------------------------
276 
277 
278  virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
279  virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
280 
281  // the background color of the draw canvas:
282  // Virtual because some frames can have a specific way to get/set the bg color
286  virtual COLOR4D GetDrawBgColor() const { return m_drawBgColor; }
287 
291  virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; }
292 
294 
295  void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
296  bool ShowPageLimits() const { return m_showPageLimits; }
297  void SetShowPageLimits( bool aShow ) { m_showPageLimits = aShow; }
298 
300 
301  virtual wxString GetScreenDesc() const;
302 
309  virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
310 
320  virtual void ExecuteRemoteCommand( const char* cmdline ){}
321 
322  void OnMenuOpen( wxMenuEvent& event );
323  void OnMouseEvent( wxMouseEvent& event );
324 
337 
339  int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
340 
346 
354  virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
355 
356  virtual bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
357  EDA_ITEM* aItem = NULL );
358 
365  virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
366 
376  virtual const wxString GetZoomLevelIndicator() const;
377 
382  inline double GetZoomLevelCoeff() const { return m_zoomLevelCoeff; }
383 
384  void EraseMsgBox();
385  void Process_PageSettings( wxCommandEvent& event );
386 
387  virtual void ReCreateHToolbar() = 0;
388  virtual void ReCreateVToolbar() = 0;
389  virtual void ReCreateMenuBar() override;
390  virtual void ReCreateAuxiliaryToolbar();
391 
392  // Toolbar accessors
393  wxAuiToolBar* GetMainToolBar() const { return m_mainToolBar; }
394 
407  virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
408 
412  virtual void SetNoToolSelected();
413 
419  int GetToolId() const { return m_toolId; }
420 
421  /* These 4 functions provide a basic way to show/hide grid
422  * and /get/set grid color.
423  * These parameters are saved in KiCad config for each main frame
424  */
429  virtual bool IsGridVisible() const
430  {
431  return m_drawGrid;
432  }
433 
439  virtual void SetGridVisibility( bool aVisible )
440  {
441  m_drawGrid = aVisible;
442  }
443 
448  virtual COLOR4D GetGridColor() const
449  {
450  return m_gridColor;
451  }
452 
457  virtual void SetGridColor( COLOR4D aColor )
458  {
459  m_gridColor = aColor;
460  }
461 
470  wxPoint GetGridPosition( const wxPoint& aPosition ) const;
471 
476  virtual void SetNextGrid();
477 
482  virtual void SetPrevGrid();
483 
489  void SetPresetGrid( int aIndex );
490 
501  virtual void OnSelectGrid( wxCommandEvent& event );
502 
510  virtual void OnSelectZoom( wxCommandEvent& event );
511 
512  // Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
513  void OnToggleGridState( wxCommandEvent& aEvent );
514  void OnSelectUnits( wxCommandEvent& aEvent );
515  void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
516 
517  // Update user interface event handlers shared by all applications derived from
518  // EDA_DRAW_FRAME.
519  void OnUpdateUndo( wxUpdateUIEvent& aEvent );
520  void OnUpdateRedo( wxUpdateUIEvent& aEvent );
521  void OnUpdateGrid( wxUpdateUIEvent& aEvent );
522  void OnUpdateUnits( wxUpdateUIEvent& aEvent );
523  void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
524 
536  virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 )
537  {
538  return false;
539  }
540 
545  virtual void OnSize( wxSizeEvent& event );
546 
547  void OnEraseBackground( wxEraseEvent& SizeEvent );
548 
549  virtual void OnZoom( wxCommandEvent& event );
550 
555  void SetNextZoom();
556 
561  void SetPrevZoom();
562 
568  void SetPresetZoom( int aIndex );
569 
577  void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
578 
584  void RedrawScreen2( const wxPoint& posBefore );
585 
591  void Zoom_Automatique( bool aWarpPointer );
592 
593  /* Set the zoom level to show the area Rect */
594  void Window_Zoom( EDA_RECT& Rect );
595 
597  virtual double BestZoom() = 0;
598 
603  double GetZoom();
604 
615  void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
616  double aScale, const wxString &aFilename,
617  const wxString &aSheetLayer = wxEmptyString );
618 
619  void DisplayToolMsg( const wxString& msg );
620  virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
621  virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
622  virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
623  virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
624  virtual void ToolOnRightClick( wxCommandEvent& event );
625  void AdjustScrollBars( const wxPoint& aCenterPosition );
626 
633  virtual void OnActivate( wxActivateEvent& event );
634 
648  virtual void UpdateStatusBar();
649 
654  void DisplayUnitsMsg();
655 
656  /* Handlers for block commands */
657  virtual void InitBlockPasteInfos();
658 
668  virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
669  int aExplicitCommand = 0 );
670 
680  virtual int BlockCommand( EDA_KEY aKey );
681 
689  virtual void HandleBlockPlace( wxDC* DC );
690 
701  virtual bool HandleBlockEnd( wxDC* DC );
702 
707  void CopyToClipboard( wxCommandEvent& event );
708 
709  /* interprocess communication */
710  void OnSockRequest( wxSocketEvent& evt );
711  void OnSockRequestServer( wxSocketEvent& evt );
712 
713  void LoadSettings( wxConfigBase* aCfg ) override;
714 
715  void SaveSettings( wxConfigBase* aCfg ) override;
716 
729  void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
730  COLOR4D color, int pad = 6 );
731 
735  void ClearMsgPanel( void );
736 
743  void SetMsgPanel( const std::vector< MSG_PANEL_ITEM >& aList );
744 
745  void SetMsgPanel( EDA_ITEM* aItem );
746 
751  virtual void UpdateMsgPanel();
752 
760  void PushPreferences( const EDA_DRAW_PANEL* aParentCanvas );
761 
771  virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
772 
782  wxString CoordinateToString( int aValue, bool aConvertToMils = false ) const;
783 
793  wxString LengthDoubleToString( double aValue, bool aConvertToMils = false ) const;
794 
801  virtual void UseGalCanvas( bool aEnable );
802 
809  bool IsGalCanvasActive() const { return m_galCanvasActive; }
810 
818  void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
819 
825 
832  virtual void* GetDisplayOptions() { return NULL; }
833 
839 
840  DECLARE_EVENT_TABLE()
841 };
842 
843 #endif // DRAW_FRAME_H_
bool ShowPageLimits() const
Definition: draw_frame.h:296
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:94
virtual void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
Definition: draw_frame.cpp:369
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)=0
virtual void ReCreateVToolbar()=0
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:111
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_galDisplayOptions
Definition: draw_frame.h:70
void AdjustScrollBars(const wxPoint &aCenterPosition)
Definition: draw_frame.cpp:911
void OnToggleCrossHairStyle(wxCommandEvent &aEvent)
Definition: draw_frame.cpp:310
Structure EDA_HOTKEY_CONFIG contains the information required to save hot key information to a config...
Definition: hotkeys_basic.h:87
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:65
wxAuiToolBar * GetMainToolBar() const
Definition: draw_frame.h:393
virtual const TITLE_BLOCK & GetTitleBlock() const =0
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:838
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:102
virtual const wxString GetZoomLevelIndicator() const
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
Definition: draw_frame.cpp:680
virtual void HandleBlockPlace(wxDC *DC)
Function HandleBlockPlace( ) Called after HandleBlockEnd, when a block command needs to be executed a...
Definition: draw_frame.cpp:658
wxPoint GetGridPosition(const wxPoint &aPosition) const
Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and sn...
Definition: draw_frame.cpp:575
virtual int BlockCommand(EDA_KEY aKey)
Function BlockCommand Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the...
Definition: draw_frame.cpp:645
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:95
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
virtual void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)=0
void OnSockRequestServer(wxSocketEvent &evt)
Definition: eda_dde.cpp:107
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:140
virtual double BestZoom()=0
Return the zoom level which displays the full page on screen.
void SetScrollCenterPosition(const wxPoint &aPoint)
void OnEraseBackground(wxEraseEvent &SizeEvent)
void OnMouseEvent(wxMouseEvent &event)
Definition: draw_frame.cpp:486
virtual bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL)
Definition: draw_frame.cpp:374
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:291
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping.
Definition: draw_frame.h:345
wxPoint GetCursorPosition(bool aOnGrid, wxRealPoint *aGridSize=NULL) const
Function GetCursorPosition returns the current cursor position in logical (drawing) units...
void ReleaseFile()
Function ReleaseFile Release the current file marked in use.
Definition: draw_frame.cpp:229
const wxPoint & GetScrollCenterPosition() const
virtual void ToolOnRightClick(wxCommandEvent &event)
Definition: draw_frame.cpp:389
bool GetShowBorderAndTitleBlock() const
Definition: draw_frame.h:293
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:818
virtual void OnZoom(wxCommandEvent &event)
Function OnZoom Called from any zoom event (toolbar , hotkey or popup )
Definition: zoom.cpp:125
void OnMenuOpen(wxMenuEvent &event)
Definition: draw_frame.cpp:266
void SkipNextLeftButtonReleaseEvent()
function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down...
Definition: draw_frame.cpp:275
virtual void SetGridColor(COLOR4D aColor)
Function SetGridColor() , virtual.
Definition: draw_frame.h:457
void CopyToClipboard(wxCommandEvent &event)
Function CopyToClipboard copies the current page or the current block to the clipboard.
class EDA_MSG_PANEL is a panel to display various information messages.
Definition: msgpanel.h:111
virtual void SetPrevGrid()
Function SetPrevGrid() changes the grid size settings to the previous one available.
Definition: draw_frame.cpp:600
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
void PushPreferences(const EDA_DRAW_PANEL *aParentCanvas)
Function PushPreferences Pushes a few preferences from a parent window to a child window...
Definition: draw_frame.cpp:806
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:83
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
wxChoice * m_gridSelectBox
Choice box to choose the grid size.
Definition: draw_frame.h:115
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:82
virtual void UseGalCanvas(bool aEnable)
Function UseGalCanvas used to switch between standard and GAL-based canvas.
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:74
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
Definition: draw_frame.cpp:735
virtual void InitBlockPasteInfos()
Definition: draw_frame.cpp:651
virtual const wxSize GetPageSizeIU() const =0
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
double GetZoomLevelCoeff() const
Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom l...
Definition: draw_frame.h:382
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:429
virtual void ExecuteRemoteCommand(const char *cmdline)
Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (cu...
Definition: draw_frame.h:320
void DisplayUnitsMsg()
Function DisplayUnitsMsg displays current unit pane on the status bar.
Definition: draw_frame.cpp:503
void OnUpdateUndo(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:323
virtual EDA_HOTKEY * GetHotKeyDescription(int aCommand) const =0
Function GetHotKeyDescription Searches lists of hot key identifiers (HK_xxx) used in the frame to fin...
Class TOOL_MANAGER.
Definition: tool_manager.h:49
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Initialize a block command.
Definition: draw_frame.cpp:823
bool m_showOriginAxis
True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files.
Definition: draw_frame.h:109
virtual const PAGE_INFO & GetPageSettings() const =0
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:77
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
Class LSET is a set of PCB_LAYER_IDs.
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:125
void OnUpdateRedo(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:330
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:62
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:286
virtual void PrintPage(wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL)
Function PrintPage used to print a page Print the page pointed by current screen, set by the calling ...
Definition: draw_frame.cpp:394
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:76
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
virtual wxString GetScreenDesc() const
Definition: worksheet.cpp:120
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:773
void EraseMsgBox()
Definition: draw_frame.cpp:250
wxString LengthDoubleToString(double aValue, bool aConvertToMils=false) const
Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or...
Definition: draw_frame.cpp:817
virtual void OnLeftClick(wxDC *DC, const wxPoint &MousePos)=0
Base window classes and related definitions.
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:112
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
wxChoice * m_zoomSelectBox
Choice box to choose the zoom value.
Definition: draw_frame.h:118
double GetZoom()
Function GetZoom.
Definition: draw_frame.cpp:480
virtual void ReCreateAuxiliaryToolbar()
Definition: draw_frame.cpp:364
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:105
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:257
uint32_t EDA_KEY
Definition: common.h:52
void OnUpdateUnits(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:337
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:809
virtual void OnSize(wxSizeEvent &event)
Function OnSize recalculates the size of toolbars and display panel when the frame size changes...
Definition: draw_frame.cpp:527
void OnToggleGridState(wxCommandEvent &aEvent)
Definition: draw_frame.cpp:281
void SetPresetZoom(int aIndex)
Function SetPresetZoom() changes zoom to one of the preset values.
Definition: zoom.cpp:215
void SetPresetGrid(int aIndex)
Function SetPresetGrid() changes the grid size to one of the preset values.
Definition: draw_frame.cpp:614
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:88
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
Definition: draw_frame.cpp:535
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
int m_LastGridSizeId
Definition: draw_frame.h:77
void RedrawScreen2(const wxPoint &posBefore)
Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming...
Definition: zoom.cpp:61
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:122
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:136
EDA_DRAW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
Definition: draw_frame.cpp:126
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Definition: draw_frame.cpp:705
Class TOOL_DISPATCHER.
virtual void SetNextGrid()
Function SetNextGrid() changes the grid size settings to the next one available.
Definition: draw_frame.cpp:586
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:67
virtual const wxPoint & GetAuxOrigin() const =0
Function GetAuxOrigin returns the origin of the axis used for plotting and various exports...
virtual bool HandleBlockEnd(wxDC *DC)
Function HandleBlockEnd( ) Handle the "end" of a block command, i.e.
Definition: draw_frame.cpp:663
wxPoint RefPos(bool useMouse) const
Function RefPos Return the reference position, coming from either the mouse position or the cursor po...
virtual void RedrawActiveWindow(wxDC *DC, bool EraseBg)=0
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
Definition: draw_frame.cpp:560
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
virtual bool OnRightClick(const wxPoint &MousePos, wxMenu *PopMenu)=0
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
Definition: draw_frame.cpp:753
void OnSockRequest(wxSocketEvent &evt)
Definition: eda_dde.cpp:75
void OnUpdateCrossHairStyle(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:358
virtual void SetAuxOrigin(const wxPoint &aPosition)=0
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
TOOL_MANAGER * GetToolManager() const
Function GetToolManager returns the tool manager instance, if any.
Definition: draw_frame.h:824
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:85
virtual void ReCreateHToolbar()=0
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
void DisplayToolMsg(const wxString &msg)
Definition: draw_frame.cpp:497
virtual void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
Definition: draw_frame.cpp:400
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:57
void OnUpdateGrid(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:349
void GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
void SetMousePosition(const wxPoint &aPosition)
int m_MsgFrameHeight
Definition: draw_frame.h:130
int GetToolId() const
Definition: draw_frame.h:419
Class EDA_RECT handles the component boundary box.
void SetNextZoom()
Function SetNextZoom() changes the zoom to the next one available.
Definition: zoom.cpp:203
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
virtual COLOR4D GetGridColor() const
Function GetGridColor() , virtual.
Definition: draw_frame.h:448
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:81
void Process_PageSettings(wxCommandEvent &event)
int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
>
Definition: draw_frame.cpp:379
void Window_Zoom(EDA_RECT &Rect)
Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window scree...
Definition: zoom.cpp:103
Class ACTIONS.
Definition: actions.h:41
virtual bool GeneralControl(wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0)
Function GeneralControl performs application specific control using aDC at aPosition in logical units...
Definition: draw_frame.h:536
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:817
virtual void AddMenuZoomAndGrid(wxMenu *aMasterMenu)
Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection ...
Definition: zoom.cpp:239
virtual void SetGridVisibility(bool aVisible)
Function SetGridVisibility() , virtual It may be overloaded by derived classes.
Definition: draw_frame.h:439
void DrawWorkSheet(wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions...
Definition: worksheet.cpp:77
void SetShowPageLimits(bool aShow)
Definition: draw_frame.h:297
void OnSelectUnits(wxCommandEvent &aEvent)
Definition: draw_frame.cpp:295
virtual void unitsChangeRefresh()
Function unitsChangeRefresh is called when when the units setting has changed to allow for any derive...
Definition: draw_frame.cpp:243
wxString CoordinateToString(int aValue, bool aConvertToMils=false) const
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: draw_frame.cpp:812
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
virtual void SetGridOrigin(const wxPoint &aPosition)=0
wxPoint GetCrossHairScreenPosition() const
Function GetCursorScreenPosition returns the cross hair position in device (display) units...
ACTIONS * m_actions
Definition: draw_frame.h:96
virtual void OnLeftDClick(wxDC *DC, const wxPoint &MousePos)
Definition: draw_frame.cpp:492
void SetPrevZoom()
Function SetPrevZoom() changes the zoom to the previous one available.
Definition: zoom.cpp:209
virtual void UpdateStatusBar()
Function UpdateStatusBar updates the status bar information.
Definition: draw_frame.cpp:669
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
virtual void OnActivate(wxActivateEvent &event)
Function OnActivate (virtual) is called when activating the frame.
Definition: draw_frame.cpp:257
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:138
int m_lastDrawToolId
Tool ID of previously active draw tool bar button.
Definition: draw_frame.h:99
void SetShowBorderAndTitleBlock(bool aShow)
Definition: draw_frame.h:295
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:764
virtual void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_frame.h:832
virtual void OnSelectZoom(wxCommandEvent &event)
Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar...
Definition: draw_frame.cpp:443
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:64
bool LockFile(const wxString &aFileName)
Function LockFile marks a schematic file as being in use.
Definition: draw_frame.cpp:235
virtual void UpdateMsgPanel()
Function UpdateMsgPanel redraws the message panel.
Definition: draw_frame.cpp:795
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39