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@gmail.com>
6  * Copyright (C) 1992-2018 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 <eda_base_frame.h>
30 #include <kiway_player.h>
31 #include <climits>
33 #include <gal/color4d.h>
34 #include <class_draw_panel_gal.h>
35 #include "hotkeys_basic.h"
36 
37 class wxSingleInstanceChecker;
38 class EDA_HOTKEY;
39 
40 using KIGFX::COLOR4D;
41 
42 namespace KIGFX
43 {
44  class GAL_DISPLAY_OPTIONS;
45 }
46 
47 #define DEFAULT_MAX_UNDO_ITEMS 0
48 #define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
49 #define LIB_EDIT_FRAME_NAME wxT( "LibeditFrame" )
50 #define SCH_EDIT_FRAME_NAME wxT( "SchematicFrame" )
51 #define PL_EDITOR_FRAME_NAME wxT( "PlEditorFrame" )
52 #define FOOTPRINT_WIZARD_FRAME_NAME wxT( "FootprintWizard" )
53 #define FOOTPRINT_EDIT_FRAME_NAME wxT( "ModEditFrame" )
54 #define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" )
55 #define FOOTPRINT_VIEWER_FRAME_NAME_MODAL wxT( "ModViewFrameModal" )
56 #define PCB_EDIT_FRAME_NAME wxT( "PcbFrame" )
57 
58 
61 
63 #define UserUnitsEntryKeyword "Units"
64 #define ShowGridEntryKeyword "ShowGrid"
66 #define GridColorEntryKeyword "GridColor"
68 #define LastGridSizeIdKeyword "_LastGridSize"
70 
73 #define CanvasTypeKeyBase "canvas_type"
74 
76 
82 {
85  friend class EDA_DRAW_PANEL;
86 
88  int m_toolId;
89 
91 
92  bool m_snapToGrid;
93 
95 
98 
99 protected:
102 
103  wxSocketServer* m_socketServer;
104  std::vector<wxSocketBase*> m_sockets;
105 
106  std::unique_ptr<wxSingleInstanceChecker> m_file_checker;
107 
109 
110  int m_LastGridSizeId; // the command id offset (>= 0) of the last selected grid
111  // 0 is for the grid corresponding to
112  // a wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
113  bool m_drawGrid; // hide/Show grid
117  double m_zoomLevelCoeff;
119  // to a zoom level value which rougly gives 1.0 when the board/schematic
120  // is at scale = 1
122  // to screens
124 
127 
131 
134 
137 
140 
144 
147 
150 
151  wxChoice* m_gridSelectBox;
152  wxChoice* m_zoomSelectBox;
153 
156  wxAuiToolBar* m_auxiliaryToolBar;
157 
160  wxAuiToolBar* m_drawToolBar;
161 
163  wxAuiToolBar* m_optionsToolBar;
164 
167 
169 
170 #ifdef USE_WX_OVERLAY
171  // MAC Uses overlay to workaround the wxINVERT and wxXOR miss
172  wxOverlay m_overlay;
173 #endif
174 
177 
180 
181  virtual void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
182 
183  double bestZoom( double sizeX, double sizeY, double scaleFactor, wxPoint centre );
184 
191  virtual void unitsChangeRefresh();
192 
193  void CommonSettingsChanged() override;
194 
204  bool LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
205  const wxString& wildcard, const wxString& ext,
206  bool isDirectory = false );
207 
217  bool GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid );
218 
222  void RefreshCrossHair( const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC* aDC );
223 
227  bool isBusy() const;
228 
233 
234  bool saveCanvasImageToFile( const wxString& aFileName,
235  wxBitmapType aBitmapType = wxBITMAP_TYPE_PNG );
236 
241  virtual wxString GetCanvasTypeKey()
242  {
243  return CanvasTypeKeyBase;
244  }
245 
246 public:
247  EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
248  FRAME_T aFrameType,
249  const wxString& aTitle,
250  const wxPoint& aPos, const wxSize& aSize,
251  long aStyle,
252  const wxString& aFrameName );
253 
254  ~EDA_DRAW_FRAME();
255 
264  virtual void OnCharHook( wxKeyEvent& event );
265 
272  bool LockFile( const wxString& aFileName );
273 
277  void ReleaseFile();
278 
279  virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0;
280  virtual const PAGE_INFO& GetPageSettings() const = 0;
281 
286  virtual const wxSize GetPageSizeIU() const = 0;
287 
291  EDA_UNITS_T GetUserUnits() const override { return m_UserUnits; }
292  void SetUserUnits( EDA_UNITS_T aUnits ) { m_UserUnits = aUnits; }
293 
297  virtual const wxPoint& GetAuxOrigin() const = 0;
298  virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
299 
305  virtual const wxPoint& GetGridOrigin() const = 0;
306  virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
307 
308  int GetLastGridSizeId() const { return m_LastGridSizeId; }
309  void SetLastGridSizeId( int aId ) { m_LastGridSizeId = aId; }
310 
311  //-----<BASE_SCREEN API moved here>------------------------------------------
318  wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
319 
327  void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
328 
337  wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
338 
347  wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
348 
354  wxPoint GetCrossHairScreenPosition() const;
355 
356  void SetMousePosition( const wxPoint& aPosition );
357 
367  wxPoint RefPos( bool useMouse ) const;
368 
369  const wxPoint& GetScrollCenterPosition() const;
370  void SetScrollCenterPosition( const wxPoint& aPoint );
371 
372  //-----</BASE_SCREEN API moved here>-----------------------------------------
373 
374  virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
375  virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
376 
377  // the background color of the draw canvas:
378  // Virtual because some frames can have a specific way to get/set the bg color
382  virtual COLOR4D GetDrawBgColor() const { return m_drawBgColor; }
383 
387  virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; }
388 
390 
392  bool ShowPageLimits() const { return m_showPageLimits; }
393  void SetShowPageLimits( bool aShow ) { m_showPageLimits = aShow; }
394 
395  virtual EDA_DRAW_PANEL* GetCanvas() const { return m_canvas; }
396 
397  virtual wxString GetScreenDesc() const;
398 
404  virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
405 
415  virtual void ExecuteRemoteCommand( const char* cmdline ){}
416 
417  void OnMenuOpen( wxMenuEvent& event );
418  void OnMouseEvent( wxMouseEvent& event );
419 
431 
433  int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
434 
439 
446  virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
447 
448  virtual bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
449  EDA_ITEM* aItem = NULL );
450 
456  virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
457 
466  virtual const wxString GetZoomLevelIndicator() const;
467 
471  inline double GetZoomLevelCoeff() const { return m_zoomLevelCoeff; }
472 
473  void EraseMsgBox();
474  void Process_PageSettings( wxCommandEvent& event );
475 
476  virtual void ReCreateHToolbar() = 0;
477  virtual void ReCreateVToolbar() = 0;
478  virtual void ReCreateMenuBar() override;
479  virtual void ReCreateAuxiliaryToolbar();
480 
481  // Toolbar accessors
482  wxAuiToolBar* GetMainToolBar() const { return m_mainToolBar; }
483  wxAuiToolBar* GetOptionsToolBar() const { return m_optionsToolBar; }
484  wxAuiToolBar* GetDrawToolBar() const { return m_drawToolBar; }
485  wxAuiToolBar* GetAuxiliaryToolBar() const { return m_auxiliaryToolBar; }
486 
493  bool GetToolToggled( int aToolId );
494 
499  wxAuiToolBarItem* GetToolbarTool( int aToolId );
500 
514  virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
515 
519  virtual void SetNoToolSelected();
520 
526  int GetToolId() const { return m_toolId; }
527 
528  /* These 4 functions provide a basic way to show/hide grid
529  * and /get/set grid color.
530  * These parameters are saved in KiCad config for each main frame
531  */
535  virtual bool IsGridVisible() const
536  {
537  return m_drawGrid;
538  }
539 
544  virtual void SetGridVisibility( bool aVisible )
545  {
546  m_drawGrid = aVisible;
547  }
548 
553  {
554  return m_gridColor;
555  }
556 
560  virtual void SetGridColor( COLOR4D aColor )
561  {
562  m_gridColor = aColor;
563  }
564 
573  wxPoint GetGridPosition( const wxPoint& aPosition ) const;
574 
578  virtual void SetNextGrid();
579 
583  virtual void SetPrevGrid();
584 
590  void SetPresetGrid( int aIndex );
591 
602  virtual void OnSelectGrid( wxCommandEvent& event );
603 
604  virtual void OnGridSettings( wxCommandEvent& event ) { };
605 
613  virtual void OnSelectZoom( wxCommandEvent& event );
614 
615  // Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
616  void OnToggleGridState( wxCommandEvent& aEvent );
617  void OnSelectUnits( wxCommandEvent& aEvent );
618  void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
619 
620  // Update user interface event handlers shared by all applications derived from
621  // EDA_DRAW_FRAME.
622  void OnUpdateUndo( wxUpdateUIEvent& aEvent );
623  void OnUpdateRedo( wxUpdateUIEvent& aEvent );
624  void OnUpdateGrid( wxUpdateUIEvent& aEvent );
625  void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
626  void OnUpdateUnits( wxUpdateUIEvent& aEvent );
627  void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
628 
640  virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 )
641  {
642  return false;
643  }
644 
648  virtual void OnSize( wxSizeEvent& event );
649 
650  void OnEraseBackground( wxEraseEvent& SizeEvent );
651 
652  virtual void OnZoom( wxCommandEvent& event );
653 
657  void SetNextZoom();
658 
666  void SetNextZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
667 
671  void SetPrevZoom();
672 
680  void SetPreviousZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
681 
687  void SetPresetZoom( int aIndex );
688 
696  virtual void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
697 
703  virtual void RedrawScreen2( const wxPoint& posBefore );
704 
708  virtual void HardRedraw();
709 
714  virtual void Zoom_Automatique( bool aWarpPointer );
715 
716  /* Set the zoom level to show the area Rect */
717  virtual void Window_Zoom( EDA_RECT& Rect );
718 
720  virtual double BestZoom() = 0;
721 
730  void FocusOnLocation( const wxPoint& aPos, bool aWarpCursor = true, bool aCenterView = false );
731 
735  double GetZoom();
736 
747  void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
748  double aScale, const wxString &aFilename,
749  const wxString &aSheetLayer = wxEmptyString );
750 
751  void DisplayToolMsg( const wxString& msg );
752  virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
753  virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
754  virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
755  virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
756  virtual void ToolOnRightClick( wxCommandEvent& event );
757  void AdjustScrollBars( const wxPoint& aCenterPosition );
758 
764  virtual void OnPageSettingsChange() {};
765 
772  virtual void OnActivate( wxActivateEvent& event );
773 
786  virtual void UpdateStatusBar();
787 
791  void DisplayUnitsMsg();
792 
793  /* Handlers for block commands */
794  virtual void InitBlockPasteInfos();
795 
805  virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
806  int aExplicitCommand = 0 );
807 
816  virtual int BlockCommand( EDA_KEY aKey );
817 
824  virtual void HandleBlockPlace( wxDC* DC );
825 
835  virtual bool HandleBlockEnd( wxDC* DC );
836 
840  void CopyToClipboard( wxCommandEvent& event );
841 
842  /* interprocess communication */
843  void CreateServer( int service, bool local = true );
844  void OnSockRequest( wxSocketEvent& evt );
845  void OnSockRequestServer( wxSocketEvent& evt );
846 
847  void LoadSettings( wxConfigBase* aCfg ) override;
848 
849  void SaveSettings( wxConfigBase* aCfg ) override;
850 
863  void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
864  COLOR4D color, int pad = 6 );
865 
869  void ClearMsgPanel( void );
870 
876  void SetMsgPanel( const std::vector< MSG_PANEL_ITEM >& aList );
877 
878  void SetMsgPanel( EDA_ITEM* aItem );
879 
883  virtual void UpdateMsgPanel();
884 
891  void PushPreferences( const EDA_DRAW_PANEL* aParentCanvas );
892 
901  virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
902 
907 
913  virtual void UseGalCanvas( bool aEnable );
914 
920  virtual bool SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
921 
928  bool IsGalCanvasActive() const { return m_galCanvasActive; }
929 
936  void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
937 
942 
948  virtual void* GetDisplayOptions() { return NULL; }
949 
954 
959  virtual void SyncMenusAndToolbars( wxEvent& aEvent ) {};
960 
961  bool GetShowAxis() const { return m_showAxis; }
962  bool GetShowGridAxis() const { return m_showGridAxis; }
963  bool GetShowOriginAxis() const { return m_showOriginAxis; }
964 
965  virtual const BOX2I GetDocumentExtents() const;
966 
967  DECLARE_EVENT_TABLE()
968 };
969 
970 #endif // DRAW_FRAME_H_
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:128
virtual void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)=0
virtual void ReCreateVToolbar()=0
void CommonSettingsChanged() override
Function CommonSettingsChanged Notification event that some of the common (suite-wide) settings have ...
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:120
void AdjustScrollBars(const wxPoint &aCenterPosition)
void OnToggleCrossHairStyle(wxCommandEvent &aEvent)
Structure EDA_HOTKEY_CONFIG contains the information required to save hot key information to a config...
Definition: hotkeys_basic.h:94
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:100
void SetPreviousZoomAndRedraw(const wxPoint &aCenterPoint, bool aWarpPointer)
Change the zoom to the previous one available redraws the screen and warp the mouse pointer on reques...
virtual const TITLE_BLOCK & GetTitleBlock() const =0
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:953
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:136
virtual void HandleBlockPlace(wxDC *DC)
Called after HandleBlockEnd, when a block command needs to be executed after the block is moved to it...
int GetLastGridSizeId() const
Definition: draw_frame.h:308
virtual int BlockCommand(EDA_KEY aKey)
Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT,...
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:129
virtual void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)=0
void OnSockRequestServer(wxSocketEvent &evt)
Definition: eda_dde.cpp:103
virtual void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:181
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
bool GetShowBorderAndTitleBlock() const
Definition: draw_frame.h:389
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
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
Definition: draw_frame.h:179
virtual double BestZoom()=0
Return the zoom level which displays the full page on screen.
wxAuiToolBar * GetAuxiliaryToolBar() const
Definition: draw_frame.h:485
virtual void OnGridSettings(wxCommandEvent &event)
Definition: draw_frame.h:604
void SetScrollCenterPosition(const wxPoint &aPoint)
virtual bool IsGridVisible() const
Definition: draw_frame.h:535
wxPoint GetCrossHairScreenPosition() const
Return the cross hair position in device (display) units.b.
void OnEraseBackground(wxEraseEvent &SizeEvent)
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
void OnMouseEvent(wxMouseEvent &event)
int color
Definition: DXF_plotter.cpp:62
virtual void SyncMenusAndToolbars(wxEvent &aEvent)
Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller ...
Definition: draw_frame.h:959
virtual bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL)
wxAuiToolBar * GetMainToolBar() const
Definition: draw_frame.h:482
std::vector< wxSocketBase * > m_sockets
interprocess communication
Definition: draw_frame.h:104
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:387
void ReleaseFile()
Release the current file marked in use.
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
virtual void ToolOnRightClick(wxCommandEvent &event)
virtual wxString GetCanvasTypeKey()
Definition: draw_frame.h:241
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:936
virtual void OnZoom(wxCommandEvent &event)
void OnMenuOpen(wxMenuEvent &event)
void SkipNextLeftButtonReleaseEvent()
After calling this function, if the left mouse button is down, the next left mouse button release eve...
virtual void SetGridColor(COLOR4D aColor)
Definition: draw_frame.h:560
void CopyToClipboard(wxCommandEvent &event)
Copy 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()
Change the grid size settings to the previous one available.
#define CanvasTypeKeyBase
The key to store the canvas type in config.
Definition: draw_frame.h:73
The base class for create windows for drawing purpose.
Definition: draw_frame.h:81
void PushPreferences(const EDA_DRAW_PANEL *aParentCanvas)
Push preferences from a parent window to a child window.
void FocusOnLocation(const wxPoint &aPos, bool aWarpCursor=true, bool aCenterView=false)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
bool m_useSingleCanvasPane
Definition: draw_frame.h:101
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema
Definition: draw_frame.h:116
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot,...
Definition: title_block.h:40
wxChoice * m_gridSelectBox
Definition: draw_frame.h:151
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:115
virtual void UseGalCanvas(bool aEnable)
Use 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:106
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file.
virtual void InitBlockPasteInfos()
virtual const wxSize GetPageSizeIU() const =0
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
bool ShowPageLimits() const
Definition: draw_frame.h:392
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:415
void DisplayUnitsMsg()
Display current unit pane on the status bar.
bool saveCanvasImageToFile(const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
void OnUpdateUndo(wxUpdateUIEvent &aEvent)
TOOL_MANAGER * GetToolManager() const
Return the tool manager instance, if any.
Definition: draw_frame.h:941
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Handle the common part of GeneralControl dedicated to global cursor keys (i.e.
virtual EDA_HOTKEY * GetHotKeyDescription(int aCommand) const =0
Search lists of hot key identifiers (HK_xxx) used in the frame to find a matching hot key descriptor.
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use.
Definition: draw_frame.h:928
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.
bool m_showOriginAxis
True shows the origin axis used to indicate the coordinate offset for drill, gerber,...
Definition: draw_frame.h:143
virtual const PAGE_INFO & GetPageSettings() const =0
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
wxAuiToolBar * GetDrawToolBar() const
Definition: draw_frame.h:484
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window.
Definition: draw_frame.h:156
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:163
void OnUpdateRedo(wxUpdateUIEvent &aEvent)
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:90
const wxPoint & GetScrollCenterPosition() const
double GetZoomLevelCoeff() const
Return the coefficient to convert internal display scale factor to zoom level.
Definition: draw_frame.h:471
virtual void PrintPage(wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL)
Print the page pointed by current screen, set by the calling print function.
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:108
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
Move and refresh the crosshair after movement and call the mouse capture function.
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Return a structure containing currently used hotkey mapping.
Definition: draw_frame.h:438
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void OnLeftClick(wxDC *DC, const wxPoint &MousePos)=0
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:166
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:146
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:291
wxChoice * m_zoomSelectBox
Definition: draw_frame.h:152
wxAuiToolBar * GetOptionsToolBar() const
Definition: draw_frame.h:483
wxPoint GetGridPosition(const wxPoint &aPosition) const
Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled.
Base window classes and related definitions.
virtual void ReCreateAuxiliaryToolbar()
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:139
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
uint32_t EDA_KEY
Definition: common.h:74
wxAuiToolBarItem * GetToolbarTool(int aToolId)
Checks all the toolbars and returns a reference to the given tool id or nullptr if not found.
void OnUpdateUnits(wxUpdateUIEvent &aEvent)
virtual void OnSize(wxSizeEvent &event)
Recalculate the size of toolbars and display panel when the frame size changes.
void OnToggleGridState(wxCommandEvent &aEvent)
virtual bool SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
void SetPresetZoom(int aIndex)
Change zoom to one of the preset values.
void SetPresetGrid(int aIndex)
Change the grid size to one of the preset values.
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:121
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:395
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
int m_LastGridSizeId
Definition: draw_frame.h:110
virtual COLOR4D GetGridColor()
Definition: draw_frame.h:552
virtual void RedrawScreen2(const wxPoint &posBefore)
Put the crosshair back to the screen position it had before zooming.
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:160
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
EDA_DRAW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
virtual void HardRedraw()
Rebuild the GAL and redraws the screen.
Class TOOL_DISPATCHER.
virtual void SetNextGrid()
Change the grid size settings to the next one available.
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:94
virtual const wxString GetZoomLevelIndicator() const
Return a human readable value which can be displayed as zoom level indicator in dialogs.
virtual const wxPoint & GetAuxOrigin() const =0
Return the origin of the axis used for plotting and various exports.
virtual bool HandleBlockEnd(wxDC *DC)
Handle the "end" of a block command, i.e.
wxSocketServer * m_socketServer
Definition: draw_frame.h:103
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
virtual void RedrawActiveWindow(wxDC *DC, bool EraseBg)=0
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
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.
void OnSockRequest(wxSocketEvent &evt)
Definition: eda_dde.cpp:71
void OnUpdateCrossHairStyle(wxUpdateUIEvent &aEvent)
virtual void SetAuxOrigin(const wxPoint &aPosition)=0
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterP...
virtual void OnPageSettingsChange()
Called when modifying the page settings.
Definition: draw_frame.h:764
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:118
virtual void ReCreateHToolbar()=0
void DisplayToolMsg(const wxString &msg)
virtual void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
bool GetShowOriginAxis() const
Definition: draw_frame.h:963
void OnUpdateGrid(wxUpdateUIEvent &aEvent)
void SetMousePosition(const wxPoint &aPosition)
bool GetShowGridAxis() const
Definition: draw_frame.h:962
int m_MsgFrameHeight
Definition: draw_frame.h:168
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
Definition: draw_frame.h:97
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void SetLastGridSizeId(int aId)
Definition: draw_frame.h:309
void SetNextZoom()
Change the zoom to the next one available.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
wxPoint RefPos(bool useMouse) const
Return the reference position, coming from either the mouse position or the cursor position.
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:114
void Process_PageSettings(wxCommandEvent &event)
int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
virtual void Window_Zoom(EDA_RECT &Rect)
Class ACTIONS.
Definition: actions.h:41
virtual bool GeneralControl(wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0)
Perform application specific control using aDC at aPosition in logical units.
Definition: draw_frame.h:640
virtual void AddMenuZoomAndGrid(wxMenu *aMasterMenu)
Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info...
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:382
virtual void SetGridVisibility(bool aVisible)
It may be overloaded by derived classes.
Definition: draw_frame.h:544
Some functions to handle hotkeys in KiCad.
void DrawWorkSheet(wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
Draws on screen the page layout with the frame and the basic inscriptions.
void CreateServer(int service, bool local=true)
Definition: eda_dde.cpp:49
virtual void OnCharHook(wxKeyEvent &event)
Capture the key event before it is sent to the GUI.
void SetShowPageLimits(bool aShow)
Definition: draw_frame.h:393
void OnSelectUnits(wxCommandEvent &aEvent)
virtual void unitsChangeRefresh()
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
bool GetToolToggled(int aToolId)
Checks all the toolbars and returns true if the given tool id is toggled.
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Stores the canvas type in the application settings.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
virtual void SetGridOrigin(const wxPoint &aPosition)=0
bool GetShowAxis() const
Definition: draw_frame.h:961
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:123
ACTIONS * m_actions
Definition: draw_frame.h:130
virtual void OnLeftDClick(wxDC *DC, const wxPoint &MousePos)
void SetPrevZoom()
Change the zoom to the previous one available.
virtual void UpdateStatusBar()
Update the status bar information.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404
virtual void OnActivate(wxActivateEvent &event)
Called when activating the frame.
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:176
int m_lastDrawToolId
Tool ID of previously active draw tool bar button.
Definition: draw_frame.h:133
void SetShowBorderAndTitleBlock(bool aShow)
Definition: draw_frame.h:391
void ClearMsgPanel(void)
Clear all messages from the message panel.
wxPoint GetCursorPosition(bool aOnGrid, wxRealPoint *aGridSize=NULL) const
Return the current cursor position in logical (drawing) units.
EDA_UNITS_T
Definition: common.h:160
virtual void * GetDisplayOptions()
A way to pass info to draw functions.
Definition: draw_frame.h:948
void SetNextZoomAndRedraw(const wxPoint &aCenterPoint, bool aWarpPointer)
Change the zoom to the next one available redraws the screen and warp the mouse pointer on request.
long m_firstRunDialogSetting
Key to control whether first run dialog is shown on startup.
Definition: draw_frame.h:149
void SetUserUnits(EDA_UNITS_T aUnits)
Definition: draw_frame.h:292
int GetToolId() const
Definition: draw_frame.h:526
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:92
bool LockFile(const wxString &aFileName)
Mark a schematic file as being in use.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
virtual void UpdateMsgPanel()
Redraw the message panel.
virtual wxString GetScreenDesc() const
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
virtual const BOX2I GetDocumentExtents() const