KiCad PCB EDA Suite
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,
5  * Copyright (C) 2011 Wayne Stambaugh <>
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
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  *
21  * or you may search the 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  */
26 #ifndef DRAW_FRAME_H_
27 #define DRAW_FRAME_H_
29 #include <wxstruct.h>
30 #include <kiway_player.h>
31 #include <climits>
33 #include <gal/color4d.h>
34 #include <class_draw_panel_gal.h>
36 class wxSingleInstanceChecker;
37 class EDA_HOTKEY;
39 using KIGFX::COLOR4D;
41 namespace KIGFX
42 {
44 }
47 #define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
55 {
58  friend class EDA_DRAW_PANEL;
61  int m_toolId;
65  bool m_snapToGrid;
71  std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_galDisplayOptions;
73 protected:
75  std::unique_ptr<wxSingleInstanceChecker> m_file_checker;
78  int m_LastGridSizeId; // the command id offset (>= 0) of the last selected grid
79  // 0 is for the grid corresponding to
80  // a wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
81  bool m_drawGrid; // hide/Show grid
85  double m_zoomLevelCoeff;
87  // to a zoom level value which rougly gives 1.0 when the board/schematic
88  // is at scale = 1
90  // to screens
116  wxChoice* m_gridSelectBox;
119  wxChoice* m_zoomSelectBox;
123  wxAuiToolBar* m_drawToolBar;
126  wxAuiToolBar* m_optionsToolBar;
133 #ifdef USE_WX_OVERLAY
134  // MAC Uses overlay to workaround the wxINVERT and wxXOR miss
135  wxOverlay m_overlay;
136 #endif
141  void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
150  virtual void unitsChangeRefresh();
156  virtual void forceColorsToLegacy() {}
167  bool GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid );
172  void RefreshCrossHair( const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC* aDC );
177  bool isBusy() const;
190  static const wxChar CANVAS_TYPE_KEY[];
192 public:
193  EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
194  FRAME_T aFrameType,
195  const wxString& aTitle,
196  const wxPoint& aPos, const wxSize& aSize,
197  long aStyle,
198  const wxString& aFrameName );
208  virtual void OnCharHook( wxKeyEvent& event );
216  bool LockFile( const wxString& aFileName );
222  void ReleaseFile();
224  virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0;
225  virtual const PAGE_INFO& GetPageSettings() const = 0;
232  virtual const wxSize GetPageSizeIU() const = 0;
238  virtual const wxPoint& GetAuxOrigin() const = 0;
239  virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
247  virtual const wxPoint& GetGridOrigin() const = 0;
248  virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
250  //-----<BASE_SCREEN API moved here>------------------------------------------
257  wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
267  void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
277  wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
287  wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
296  void SetMousePosition( const wxPoint& aPosition );
308  wxPoint RefPos( bool useMouse ) const;
310  const wxPoint& GetScrollCenterPosition() const;
311  void SetScrollCenterPosition( const wxPoint& aPoint );
313  //-----</BASE_SCREEN API moved here>-----------------------------------------
316  virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
317  virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
319  // the background color of the draw canvas:
320  // Virtual because some frames can have a specific way to get/set the bg color
324  virtual COLOR4D GetDrawBgColor() const { return m_drawBgColor; }
329  virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; }
333  void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
334  bool ShowPageLimits() const { return m_showPageLimits; }
335  void SetShowPageLimits( bool aShow ) { m_showPageLimits = aShow; }
339  virtual wxString GetScreenDesc() const;
347  virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
358  virtual void ExecuteRemoteCommand( const char* cmdline ){}
360  void OnMenuOpen( wxMenuEvent& event );
361  void OnMouseEvent( wxMouseEvent& event );
377  int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
392  virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
394  virtual bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
395  EDA_ITEM* aItem = NULL );
403  virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
414  virtual const wxString GetZoomLevelIndicator() const;
420  inline double GetZoomLevelCoeff() const { return m_zoomLevelCoeff; }
422  void EraseMsgBox();
423  void Process_PageSettings( wxCommandEvent& event );
425  virtual void ReCreateHToolbar() = 0;
426  virtual void ReCreateVToolbar() = 0;
427  virtual void ReCreateMenuBar() override;
428  virtual void ReCreateAuxiliaryToolbar();
430  // Toolbar accessors
431  wxAuiToolBar* GetMainToolBar() const { return m_mainToolBar; }
440  bool GetToolToggled( int aToolId )
441  {
442  return ( m_mainToolBar->GetToolToggled( aToolId ) ||
443  m_optionsToolBar->GetToolToggled( aToolId ) ||
444  m_drawToolBar->GetToolToggled( aToolId ) );
445  }
459  virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
464  virtual void SetNoToolSelected();
471  int GetToolId() const { return m_toolId; }
473  /* These 4 functions provide a basic way to show/hide grid
474  * and /get/set grid color.
475  * These parameters are saved in KiCad config for each main frame
476  */
481  virtual bool IsGridVisible() const
482  {
483  return m_drawGrid;
484  }
491  virtual void SetGridVisibility( bool aVisible )
492  {
493  m_drawGrid = aVisible;
494  }
501  {
502  return m_gridColor;
503  }
509  virtual void SetGridColor( COLOR4D aColor )
510  {
511  m_gridColor = aColor;
512  }
522  wxPoint GetGridPosition( const wxPoint& aPosition ) const;
528  virtual void SetNextGrid();
534  virtual void SetPrevGrid();
541  void SetPresetGrid( int aIndex );
553  virtual void OnSelectGrid( wxCommandEvent& event );
562  virtual void OnSelectZoom( wxCommandEvent& event );
564  // Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
565  void OnToggleGridState( wxCommandEvent& aEvent );
566  void OnSelectUnits( wxCommandEvent& aEvent );
567  void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
569  // Update user interface event handlers shared by all applications derived from
571  void OnUpdateUndo( wxUpdateUIEvent& aEvent );
572  void OnUpdateRedo( wxUpdateUIEvent& aEvent );
573  void OnUpdateGrid( wxUpdateUIEvent& aEvent );
574  void OnUpdateUnits( wxUpdateUIEvent& aEvent );
575  void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
589  virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 )
590  {
591  return false;
592  }
598  virtual void OnSize( wxSizeEvent& event );
600  void OnEraseBackground( wxEraseEvent& SizeEvent );
602  virtual void OnZoom( wxCommandEvent& event );
608  void SetNextZoom();
614  void SetPrevZoom();
621  void SetPresetZoom( int aIndex );
630  void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
637  void RedrawScreen2( const wxPoint& posBefore );
644  void Zoom_Automatique( bool aWarpPointer );
646  /* Set the zoom level to show the area Rect */
647  void Window_Zoom( EDA_RECT& Rect );
650  virtual double BestZoom() = 0;
656  double GetZoom();
668  void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
669  double aScale, const wxString &aFilename,
670  const wxString &aSheetLayer = wxEmptyString );
672  void DisplayToolMsg( const wxString& msg );
673  virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
674  virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
675  virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
676  virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
677  virtual void ToolOnRightClick( wxCommandEvent& event );
678  void AdjustScrollBars( const wxPoint& aCenterPosition );
686  virtual void OnActivate( wxActivateEvent& event );
701  virtual void UpdateStatusBar();
707  void DisplayUnitsMsg();
709  /* Handlers for block commands */
710  virtual void InitBlockPasteInfos();
721  virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
722  int aExplicitCommand = 0 );
733  virtual int BlockCommand( EDA_KEY aKey );
742  virtual void HandleBlockPlace( wxDC* DC );
754  virtual bool HandleBlockEnd( wxDC* DC );
760  void CopyToClipboard( wxCommandEvent& event );
762  /* interprocess communication */
763  void OnSockRequest( wxSocketEvent& evt );
764  void OnSockRequestServer( wxSocketEvent& evt );
766  void LoadSettings( wxConfigBase* aCfg ) override;
768  void SaveSettings( wxConfigBase* aCfg ) override;
782  void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
783  COLOR4D color, int pad = 6 );
788  void ClearMsgPanel( void );
796  void SetMsgPanel( const std::vector< MSG_PANEL_ITEM >& aList );
798  void SetMsgPanel( EDA_ITEM* aItem );
804  virtual void UpdateMsgPanel();
813  void PushPreferences( const EDA_DRAW_PANEL* aParentCanvas );
824  virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
835  wxString CoordinateToString( int aValue, bool aConvertToMils = false ) const;
846  wxString LengthDoubleToString( double aValue, bool aConvertToMils = false ) const;
854  virtual void UseGalCanvas( bool aEnable );
862  bool IsGalCanvasActive() const { return m_galCanvasActive; }
871  void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
885  virtual void* GetDisplayOptions() { return NULL; }
894 };
896 #endif // DRAW_FRAME_H_
bool ShowPageLimits() const
Definition: draw_frame.h:334
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:95
virtual void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
Definition: draw_frame.cpp:380
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:71
void AdjustScrollBars(const wxPoint &aCenterPosition)
Definition: draw_frame.cpp:922
void OnToggleCrossHairStyle(wxCommandEvent &aEvent)
Definition: draw_frame.cpp:321
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:66
wxAuiToolBar * GetMainToolBar() const
Definition: draw_frame.h:431
virtual const TITLE_BLOCK & GetTitleBlock() const =0
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:891
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:57
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:103
virtual const wxString GetZoomLevelIndicator() const
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
Definition: draw_frame.cpp:691
virtual void HandleBlockPlace(wxDC *DC)
Function HandleBlockPlace( ) Called after HandleBlockEnd, when a block command needs to be executed a...
Definition: draw_frame.cpp:669
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:586
virtual int BlockCommand(EDA_KEY aKey)
Function BlockCommand Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the...
Definition: draw_frame.cpp:656
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:96
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:337
virtual void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)=0
void OnSockRequestServer(wxSocketEvent &evt)
Definition: eda_dde.cpp:107
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:141
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:497
virtual bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL)
Definition: draw_frame.cpp:385
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:329
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping.
Definition: draw_frame.h:383
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:240
const wxPoint & GetScrollCenterPosition() const
virtual void ToolOnRightClick(wxCommandEvent &event)
Definition: draw_frame.cpp:400
bool GetShowBorderAndTitleBlock() const
Definition: draw_frame.h:331
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:871
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:277
void SkipNextLeftButtonReleaseEvent()
function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down...
Definition: draw_frame.cpp:286
virtual void SetGridColor(COLOR4D aColor)
Function SetGridColor() , virtual.
Definition: draw_frame.h:509
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:611
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:54
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:817
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:84
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:116
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:83
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:75
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
Definition: draw_frame.cpp:746
virtual void InitBlockPasteInfos()
Definition: draw_frame.cpp:662
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:420
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:481
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:358
void DisplayUnitsMsg()
Function DisplayUnitsMsg displays current unit pane on the status bar.
Definition: draw_frame.cpp:514
void OnUpdateUndo(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:334
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
virtual EDA_HOTKEY * GetHotKeyDescription(int aCommand) const =0
Function GetHotKeyDescription Searches lists of hot key identifiers (HK_xxx) used in the frame to fin...
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:834
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:110
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:347
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:126
void OnUpdateRedo(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:341
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:63
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:324
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:405
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
Move and refresh the crosshair after movement and call the mouse capture function.
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:784
void EraseMsgBox()
Definition: draw_frame.cpp:261
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:828
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:129
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:113
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:119
double GetZoom()
Function GetZoom.
Definition: draw_frame.cpp:491
virtual void ReCreateAuxiliaryToolbar()
Definition: draw_frame.cpp:375
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:106
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:51
void OnUpdateUnits(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:348
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:862
virtual void OnSize(wxSizeEvent &event)
Function OnSize recalculates the size of toolbars and display panel when the frame size changes...
Definition: draw_frame.cpp:538
void OnToggleGridState(wxCommandEvent &aEvent)
Definition: draw_frame.cpp:292
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:625
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:89
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:546
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:78
virtual COLOR4D GetGridColor()
Function GetGridColor() , virtual.
Definition: draw_frame.h:500
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:123
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:145
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:129
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Definition: draw_frame.cpp:716
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting() const
Returns the canvas type stored in the application settings.
virtual void SetNextGrid()
Function SetNextGrid() changes the grid size settings to the next one available.
Definition: draw_frame.cpp:597
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:68
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:674
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:571
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
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:764
void OnSockRequest(wxSocketEvent &evt)
Definition: eda_dde.cpp:75
void OnUpdateCrossHairStyle(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:369
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:877
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
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:508
virtual void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
Definition: draw_frame.cpp:411
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:57
void OnUpdateGrid(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:360
void SetMousePosition(const wxPoint &aPosition)
int m_MsgFrameHeight
Definition: draw_frame.h:131
int GetToolId() const
Definition: draw_frame.h:471
virtual void forceColorsToLegacy()
Helper function to coerce all colors to legacy-compatible when switching from GAL to legacy canvas...
Definition: draw_frame.h:156
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:165
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:82
void Process_PageSettings(wxCommandEvent &event)
int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
Definition: draw_frame.cpp:390
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
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:589
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
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:491
static const wxChar CANVAS_TYPE_KEY[]
Key in KifaceSettings to store the canvas type.
Definition: draw_frame.h:190
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
virtual void OnCharHook(wxKeyEvent &event)
this function capture the key event before it is sent to the GUI.
Definition: draw_frame.cpp:232
void SetShowPageLimits(bool aShow)
Definition: draw_frame.h:335
void OnSelectUnits(wxCommandEvent &aEvent)
Definition: draw_frame.cpp:306
virtual void unitsChangeRefresh()
Function unitsChangeRefresh is called when when the units setting has changed to allow for any derive...
Definition: draw_frame.cpp:254
bool GetToolToggled(int aToolId)
Checks all the toolbars and returns true if the given tool id is toggled.
Definition: draw_frame.h:440
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Stores the canvas type in the application settings.
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:823
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:97
virtual void OnLeftDClick(wxDC *DC, const wxPoint &MousePos)
Definition: draw_frame.cpp:503
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:680
bool isBusy() const
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:268
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:139
int m_lastDrawToolId
Tool ID of previously active draw tool bar button.
Definition: draw_frame.h:100
void SetShowBorderAndTitleBlock(bool aShow)
Definition: draw_frame.h:333
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:775
virtual void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_frame.h:885
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:454
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:65
bool LockFile(const wxString &aFileName)
Function LockFile marks a schematic file as being in use.
Definition: draw_frame.cpp:246
virtual void UpdateMsgPanel()
Function UpdateMsgPanel redraws the message panel.
Definition: draw_frame.cpp:806
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39