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 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 1992-2016 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 
404  virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
405 
406  int GetToolId() const { return m_toolId; }
407 
408  /* These 4 functions provide a basic way to show/hide grid
409  * and /get/set grid color.
410  * These parameters are saved in KiCad config for each main frame
411  */
416  virtual bool IsGridVisible() const
417  {
418  return m_drawGrid;
419  }
420 
426  virtual void SetGridVisibility( bool aVisible )
427  {
428  m_drawGrid = aVisible;
429  }
430 
435  virtual COLOR4D GetGridColor() const
436  {
437  return m_gridColor;
438  }
439 
444  virtual void SetGridColor( COLOR4D aColor )
445  {
446  m_gridColor = aColor;
447  }
448 
457  wxPoint GetGridPosition( const wxPoint& aPosition ) const;
458 
463  virtual void SetNextGrid();
464 
469  virtual void SetPrevGrid();
470 
476  void SetPresetGrid( int aIndex );
477 
488  virtual void OnSelectGrid( wxCommandEvent& event );
489 
497  virtual void OnSelectZoom( wxCommandEvent& event );
498 
499  // Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
500  void OnToggleGridState( wxCommandEvent& aEvent );
501  void OnSelectUnits( wxCommandEvent& aEvent );
502  void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
503 
504  // Update user interface event handlers shared by all applications derived from
505  // EDA_DRAW_FRAME.
506  void OnUpdateUndo( wxUpdateUIEvent& aEvent );
507  void OnUpdateRedo( wxUpdateUIEvent& aEvent );
508  void OnUpdateGrid( wxUpdateUIEvent& aEvent );
509  void OnUpdateUnits( wxUpdateUIEvent& aEvent );
510  void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
511 
523  virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 )
524  {
525  return false;
526  }
527 
532  virtual void OnSize( wxSizeEvent& event );
533 
534  void OnEraseBackground( wxEraseEvent& SizeEvent );
535 
536  virtual void OnZoom( wxCommandEvent& event );
537 
542  void SetNextZoom();
543 
548  void SetPrevZoom();
549 
555  void SetPresetZoom( int aIndex );
556 
564  void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
565 
571  void RedrawScreen2( const wxPoint& posBefore );
572 
578  void Zoom_Automatique( bool aWarpPointer );
579 
580  /* Set the zoom level to show the area Rect */
581  void Window_Zoom( EDA_RECT& Rect );
582 
584  virtual double BestZoom() = 0;
585 
590  double GetZoom();
591 
602  void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
603  double aScale, const wxString &aFilename,
604  const wxString &aSheetLayer = wxEmptyString );
605 
606  void DisplayToolMsg( const wxString& msg );
607  virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
608  virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
609  virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
610  virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
611  virtual void ToolOnRightClick( wxCommandEvent& event );
612  void AdjustScrollBars( const wxPoint& aCenterPosition );
613 
620  virtual void OnActivate( wxActivateEvent& event );
621 
635  virtual void UpdateStatusBar();
636 
641  void DisplayUnitsMsg();
642 
643  /* Handlers for block commands */
644  virtual void InitBlockPasteInfos();
645 
654  virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
655  int aExplicitCommand = 0 );
656 
666  virtual int BlockCommand( EDA_KEY aKey );
667 
675  virtual void HandleBlockPlace( wxDC* DC );
676 
687  virtual bool HandleBlockEnd( wxDC* DC );
688 
693  void CopyToClipboard( wxCommandEvent& event );
694 
695  /* interprocess communication */
696  void OnSockRequest( wxSocketEvent& evt );
697  void OnSockRequestServer( wxSocketEvent& evt );
698 
699  void LoadSettings( wxConfigBase* aCfg ) override;
700 
701  void SaveSettings( wxConfigBase* aCfg ) override;
702 
715  void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
716  COLOR4D color, int pad = 6 );
717 
721  void ClearMsgPanel( void );
722 
729  void SetMsgPanel( const std::vector< MSG_PANEL_ITEM >& aList );
730 
731  void SetMsgPanel( EDA_ITEM* aItem );
732 
737  virtual void UpdateMsgPanel();
738 
746  void PushPreferences( const EDA_DRAW_PANEL* aParentCanvas );
747 
757  virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
758 
768  wxString CoordinateToString( int aValue, bool aConvertToMils = false ) const;
769 
779  wxString LengthDoubleToString( double aValue, bool aConvertToMils = false ) const;
780 
787  virtual void UseGalCanvas( bool aEnable );
788 
795  bool IsGalCanvasActive() const { return m_galCanvasActive; }
796 
804  void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
805 
811 
818  virtual void* GetDisplayOptions() { return NULL; }
819 
825 
826  DECLARE_EVENT_TABLE()
827 };
828 
829 #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:885
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
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:824
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:56
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:661
virtual void HandleBlockPlace(wxDC *DC)
Function HandleBlockPlace( ) Called after HandleBlockEnd, when a block command needs to be executed a...
Definition: draw_frame.cpp:639
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:556
virtual int BlockCommand(EDA_KEY aKey)
Function BlockCommand Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the...
Definition: draw_frame.cpp:626
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:804
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:444
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:581
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:784
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:713
virtual void InitBlockPasteInfos()
Definition: draw_frame.cpp:632
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:416
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)
Function HandleBlockBegin initializes the block command including the command type, initial position, and other variables.
Definition: draw_frame.cpp:801
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 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:751
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:795
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:795
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:595
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
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:686
Class TOOL_DISPATCHER.
virtual void SetNextGrid()
Function SetNextGrid() changes the grid size settings to the next one available.
Definition: draw_frame.cpp:567
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:644
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
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:731
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:810
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:406
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:435
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:523
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:803
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:426
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:790
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:650
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:742
virtual void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_frame.h:818
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:773
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39