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>
35 class wxSingleInstanceChecker;
36 class EDA_HOTKEY;
38 using KIGFX::COLOR4D;
40 namespace KIGFX
41 {
43 }
46 #define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
54 {
57  friend class EDA_DRAW_PANEL;
60  int m_toolId;
64  bool m_snapToGrid;
70  std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_galDisplayOptions;
72 protected:
74  std::unique_ptr<wxSingleInstanceChecker> m_file_checker;
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
115  wxChoice* m_gridSelectBox;
118  wxChoice* m_zoomSelectBox;
122  wxAuiToolBar* m_drawToolBar;
125  wxAuiToolBar* m_optionsToolBar;
132 #ifdef USE_WX_OVERLAY
133  // MAC Uses overlay to workaround the wxINVERT and wxXOR miss
134  wxOverlay m_overlay;
135 #endif
140  void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
149  virtual void unitsChangeRefresh();
155  void GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid );
160  void RefreshCrossHair( const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC* aDC );
165  bool isBusy() const;
167 public:
168  EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
169  FRAME_T aFrameType,
170  const wxString& aTitle,
171  const wxPoint& aPos, const wxSize& aSize,
172  long aStyle,
173  const wxString& aFrameName );
183  bool LockFile( const wxString& aFileName );
189  void ReleaseFile();
191  virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0;
192  virtual const PAGE_INFO& GetPageSettings() const = 0;
199  virtual const wxSize GetPageSizeIU() const = 0;
205  virtual const wxPoint& GetAuxOrigin() const = 0;
206  virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
214  virtual const wxPoint& GetGridOrigin() const = 0;
215  virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
217  //-----<BASE_SCREEN API moved here>------------------------------------------
224  wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
234  void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
244  wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
254  wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
263  void SetMousePosition( const wxPoint& aPosition );
275  wxPoint RefPos( bool useMouse ) const;
277  const wxPoint& GetScrollCenterPosition() const;
278  void SetScrollCenterPosition( const wxPoint& aPoint );
280  //-----</BASE_SCREEN API moved here>-----------------------------------------
283  virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
284  virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
286  // the background color of the draw canvas:
287  // Virtual because some frames can have a specific way to get/set the bg color
291  virtual COLOR4D GetDrawBgColor() const { return m_drawBgColor; }
296  virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; }
300  void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
301  bool ShowPageLimits() const { return m_showPageLimits; }
302  void SetShowPageLimits( bool aShow ) { m_showPageLimits = aShow; }
306  virtual wxString GetScreenDesc() const;
314  virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
325  virtual void ExecuteRemoteCommand( const char* cmdline ){}
327  void OnMenuOpen( wxMenuEvent& event );
328  void OnMouseEvent( wxMouseEvent& event );
344  int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
359  virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
361  virtual bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
362  EDA_ITEM* aItem = NULL );
370  virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
381  virtual const wxString GetZoomLevelIndicator() const;
387  inline double GetZoomLevelCoeff() const { return m_zoomLevelCoeff; }
389  void EraseMsgBox();
390  void Process_PageSettings( wxCommandEvent& event );
392  virtual void ReCreateHToolbar() = 0;
393  virtual void ReCreateVToolbar() = 0;
394  virtual void ReCreateMenuBar() override;
395  virtual void ReCreateAuxiliaryToolbar();
397  // Toolbar accessors
398  wxAuiToolBar* GetMainToolBar() const { return m_mainToolBar; }
407  bool GetToolToggled( int aToolId )
408  {
409  return ( m_mainToolBar->GetToolToggled( aToolId ) ||
410  m_optionsToolBar->GetToolToggled( aToolId ) ||
411  m_drawToolBar->GetToolToggled( aToolId ) );
412  }
426  virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
431  virtual void SetNoToolSelected();
438  int GetToolId() const { return m_toolId; }
440  /* These 4 functions provide a basic way to show/hide grid
441  * and /get/set grid color.
442  * These parameters are saved in KiCad config for each main frame
443  */
448  virtual bool IsGridVisible() const
449  {
450  return m_drawGrid;
451  }
458  virtual void SetGridVisibility( bool aVisible )
459  {
460  m_drawGrid = aVisible;
461  }
468  {
469  return m_gridColor;
470  }
476  virtual void SetGridColor( COLOR4D aColor )
477  {
478  m_gridColor = aColor;
479  }
489  wxPoint GetGridPosition( const wxPoint& aPosition ) const;
495  virtual void SetNextGrid();
501  virtual void SetPrevGrid();
508  void SetPresetGrid( int aIndex );
520  virtual void OnSelectGrid( wxCommandEvent& event );
529  virtual void OnSelectZoom( wxCommandEvent& event );
531  // Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
532  void OnToggleGridState( wxCommandEvent& aEvent );
533  void OnSelectUnits( wxCommandEvent& aEvent );
534  void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
536  // Update user interface event handlers shared by all applications derived from
538  void OnUpdateUndo( wxUpdateUIEvent& aEvent );
539  void OnUpdateRedo( wxUpdateUIEvent& aEvent );
540  void OnUpdateGrid( wxUpdateUIEvent& aEvent );
541  void OnUpdateUnits( wxUpdateUIEvent& aEvent );
542  void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
555  virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 )
556  {
557  return false;
558  }
564  virtual void OnSize( wxSizeEvent& event );
566  void OnEraseBackground( wxEraseEvent& SizeEvent );
568  virtual void OnZoom( wxCommandEvent& event );
574  void SetNextZoom();
580  void SetPrevZoom();
587  void SetPresetZoom( int aIndex );
596  void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
603  void RedrawScreen2( const wxPoint& posBefore );
610  void Zoom_Automatique( bool aWarpPointer );
612  /* Set the zoom level to show the area Rect */
613  void Window_Zoom( EDA_RECT& Rect );
616  virtual double BestZoom() = 0;
622  double GetZoom();
634  void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
635  double aScale, const wxString &aFilename,
636  const wxString &aSheetLayer = wxEmptyString );
638  void DisplayToolMsg( const wxString& msg );
639  virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
640  virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
641  virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
642  virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
643  virtual void ToolOnRightClick( wxCommandEvent& event );
644  void AdjustScrollBars( const wxPoint& aCenterPosition );
652  virtual void OnActivate( wxActivateEvent& event );
667  virtual void UpdateStatusBar();
673  void DisplayUnitsMsg();
675  /* Handlers for block commands */
676  virtual void InitBlockPasteInfos();
687  virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
688  int aExplicitCommand = 0 );
699  virtual int BlockCommand( EDA_KEY aKey );
708  virtual void HandleBlockPlace( wxDC* DC );
720  virtual bool HandleBlockEnd( wxDC* DC );
726  void CopyToClipboard( wxCommandEvent& event );
728  /* interprocess communication */
729  void OnSockRequest( wxSocketEvent& evt );
730  void OnSockRequestServer( wxSocketEvent& evt );
732  void LoadSettings( wxConfigBase* aCfg ) override;
734  void SaveSettings( wxConfigBase* aCfg ) override;
748  void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
749  COLOR4D color, int pad = 6 );
754  void ClearMsgPanel( void );
762  void SetMsgPanel( const std::vector< MSG_PANEL_ITEM >& aList );
764  void SetMsgPanel( EDA_ITEM* aItem );
770  virtual void UpdateMsgPanel();
779  void PushPreferences( const EDA_DRAW_PANEL* aParentCanvas );
790  virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
801  wxString CoordinateToString( int aValue, bool aConvertToMils = false ) const;
812  wxString LengthDoubleToString( double aValue, bool aConvertToMils = false ) const;
820  virtual void UseGalCanvas( bool aEnable );
828  bool IsGalCanvasActive() const { return m_galCanvasActive; }
837  void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
851  virtual void* GetDisplayOptions() { return NULL; }
860 };
862 #endif // DRAW_FRAME_H_
bool ShowPageLimits() const
Definition: draw_frame.h:301
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:398
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:857
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:304
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: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:296
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping.
Definition: draw_frame.h:350
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:298
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:837
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:476
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:387
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:448
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:325
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...
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:314
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:291
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)
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: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:828
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
virtual COLOR4D GetGridColor()
Function GetGridColor() , virtual.
Definition: draw_frame.h:467
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:140
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
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:843
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:438
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: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
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:555
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:836
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:458
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:302
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
bool GetToolToggled(int aToolId)
Checks all the toolbars and returns true if the given tool id is toggled.
Definition: draw_frame.h:407
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
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: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:300
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:851
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