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 class ACTION_TOOLBAR;
40 
41 using KIGFX::COLOR4D;
42 
43 namespace KIGFX
44 {
45  class GAL_DISPLAY_OPTIONS;
46 }
47 
48 #define DEFAULT_MAX_UNDO_ITEMS 0
49 #define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
50 #define LIB_EDIT_FRAME_NAME wxT( "LibeditFrame" )
51 #define SCH_EDIT_FRAME_NAME wxT( "SchematicFrame" )
52 #define PL_EDITOR_FRAME_NAME wxT( "PlEditorFrame" )
53 #define FOOTPRINT_WIZARD_FRAME_NAME wxT( "FootprintWizard" )
54 #define FOOTPRINT_EDIT_FRAME_NAME wxT( "ModEditFrame" )
55 #define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" )
56 #define FOOTPRINT_VIEWER_FRAME_NAME_MODAL wxT( "ModViewFrameModal" )
57 #define PCB_EDIT_FRAME_NAME wxT( "PcbFrame" )
58 
59 
62 
64 #define UserUnitsEntryKeyword "Units"
65 #define ShowGridEntryKeyword "ShowGrid"
67 #define GridColorEntryKeyword "GridColor"
69 #define LastGridSizeIdKeyword "_LastGridSize"
71 
74 #define CanvasTypeKeyBase "canvas_type"
75 
77 
83 {
86  friend class EDA_DRAW_PANEL;
87 
89  int m_toolId;
90  wxString m_toolMsg;
91 
93 
94  bool m_snapToGrid;
95 
97 
100 
101 protected:
104 
105  wxSocketServer* m_socketServer;
106  std::vector<wxSocketBase*> m_sockets;
107 
108  std::unique_ptr<wxSingleInstanceChecker> m_file_checker;
109 
111 
112  int m_LastGridSizeId; // the command id offset (>= 0) of the last selected grid
113  // 0 is for the grid corresponding to
114  // a wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
115  bool m_drawGrid; // hide/Show grid
119  double m_zoomLevelCoeff;
121  // to a zoom level value which rougly gives 1.0 when the board/schematic
122  // is at scale = 1
124  // to screens
126 
129 
133 
136 
139 
142 
146 
149 
152 
153  wxChoice* m_gridSelectBox;
154  wxChoice* m_zoomSelectBox;
155 
160 
164 
167 
170 
172 
173 #ifdef USE_WX_OVERLAY
174  // MAC Uses overlay to workaround the wxINVERT and wxXOR miss
175  wxOverlay m_overlay;
176 #endif
177 
180 
183 
184  virtual void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
185 
186  double bestZoom( double sizeX, double sizeY, double scaleFactor, wxPoint centre );
187 
194  virtual void unitsChangeRefresh();
195 
196  void CommonSettingsChanged() override;
197 
207  bool LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
208  const wxString& wildcard, const wxString& ext,
209  bool isDirectory = false );
210 
220  bool GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid );
221 
225  void RefreshCrossHair( const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC* aDC );
226 
231 
232  bool saveCanvasImageToFile( const wxString& aFileName,
233  wxBitmapType aBitmapType = wxBITMAP_TYPE_PNG );
234 
239  virtual wxString GetCanvasTypeKey()
240  {
241  return CanvasTypeKeyBase;
242  }
243 
244 public:
245  EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
246  FRAME_T aFrameType,
247  const wxString& aTitle,
248  const wxPoint& aPos, const wxSize& aSize,
249  long aStyle,
250  const wxString& aFrameName );
251 
252  ~EDA_DRAW_FRAME();
253 
262  virtual void OnCharHook( wxKeyEvent& event );
263 
270  bool LockFile( const wxString& aFileName );
271 
275  void ReleaseFile();
276 
277  virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0;
278  virtual const PAGE_INFO& GetPageSettings() const = 0;
279 
284  virtual const wxSize GetPageSizeIU() const = 0;
285 
289  EDA_UNITS_T GetUserUnits() const override { return m_UserUnits; }
290  void SetUserUnits( EDA_UNITS_T aUnits ) { m_UserUnits = aUnits; }
291 
293  {
294  SetUserUnits( aUnits );
296  }
297 
301  virtual const wxPoint& GetAuxOrigin() const = 0;
302  virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
303 
309  virtual const wxPoint& GetGridOrigin() const = 0;
310  virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
311 
312  int GetLastGridSizeId() const { return m_LastGridSizeId; }
313  void SetLastGridSizeId( int aId ) { m_LastGridSizeId = aId; }
314 
315  //-----<BASE_SCREEN API moved here>------------------------------------------
322  wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
323 
331  void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
332 
341  wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
342 
351  wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
352 
358  wxPoint GetCrossHairScreenPosition() const;
359 
360  void SetMousePosition( const wxPoint& aPosition );
361 
371  wxPoint RefPos( bool useMouse ) const;
372 
373  const wxPoint& GetScrollCenterPosition() const;
374  void SetScrollCenterPosition( const wxPoint& aPoint );
375 
376  //-----</BASE_SCREEN API moved here>-----------------------------------------
377 
378  virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
379  virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
380 
381  // the background color of the draw canvas:
382  // Virtual because some frames can have a specific way to get/set the bg color
386  virtual COLOR4D GetDrawBgColor() const { return m_drawBgColor; }
387 
391  virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; }
392 
394 
396  bool ShowPageLimits() const { return m_showPageLimits; }
397  void SetShowPageLimits( bool aShow ) { m_showPageLimits = aShow; }
398 
399  virtual EDA_DRAW_PANEL* GetCanvas() const { return m_canvas; }
400 
401  virtual wxString GetScreenDesc() const;
402 
408  virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
409 
419  virtual void ExecuteRemoteCommand( const char* cmdline ){}
420 
421  void OnMenuOpen( wxMenuEvent& event );
422  void OnMouseEvent( wxMouseEvent& event );
423 
435 
437  int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
438 
443 
450  virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
451 
452  virtual bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
453  EDA_ITEM* aItem = NULL );
454 
460  virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
461 
470  virtual const wxString GetZoomLevelIndicator() const;
471 
475  inline double GetZoomLevelCoeff() const { return m_zoomLevelCoeff; }
476 
477  void EraseMsgBox();
478  void Process_PageSettings( wxCommandEvent& event );
479 
480  virtual void ReCreateHToolbar() = 0;
481  virtual void ReCreateVToolbar() = 0;
482  virtual void ReCreateMenuBar() override;
483  virtual void ReCreateAuxiliaryToolbar();
484 
485  // Toolbar accessors
490 
497  bool GetToolToggled( int aToolId );
498 
512  virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
513 
517  virtual void SetNoToolSelected();
518 
524  int GetToolId() const { return m_toolId; }
525 
526  /* These 4 functions provide a basic way to show/hide grid
527  * and /get/set grid color.
528  * These parameters are saved in KiCad config for each main frame
529  */
533  virtual bool IsGridVisible() const
534  {
535  return m_drawGrid;
536  }
537 
542  virtual void SetGridVisibility( bool aVisible )
543  {
544  m_drawGrid = aVisible;
545  }
546 
551  {
552  return m_gridColor;
553  }
554 
558  virtual void SetGridColor( COLOR4D aColor )
559  {
560  m_gridColor = aColor;
561  }
562 
571  wxPoint GetGridPosition( const wxPoint& aPosition ) const;
572 
576  virtual void SetNextGrid();
577 
581  virtual void SetPrevGrid();
582 
588  void SetPresetGrid( int aIndex );
589 
600  virtual void OnSelectGrid( wxCommandEvent& event );
601 
602  virtual void OnGridSettings( wxCommandEvent& event ) { };
603 
611  virtual void OnSelectZoom( wxCommandEvent& event );
612 
613  // Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
614  void OnToggleGridState( wxCommandEvent& aEvent );
615  void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
616 
617  // Update user interface event handlers shared by all applications derived from
618  // EDA_DRAW_FRAME.
619  void OnUpdateUndo( wxUpdateUIEvent& aEvent );
620  void OnUpdateRedo( wxUpdateUIEvent& aEvent );
621  void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
622  void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
623 
635  virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 )
636  {
637  return false;
638  }
639 
643  virtual void OnSize( wxSizeEvent& event );
644 
645  void OnEraseBackground( wxEraseEvent& SizeEvent );
646 
647  virtual void OnZoom( wxCommandEvent& event );
648 
652  void SetNextZoom();
653 
661  void SetNextZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
662 
666  void SetPrevZoom();
667 
675  void SetPreviousZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
676 
682  void SetPresetZoom( int aIndex );
683 
691  virtual void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
692 
698  virtual void RedrawScreen2( const wxPoint& posBefore );
699 
703  virtual void HardRedraw();
704 
709  virtual void Zoom_Automatique( bool aWarpPointer );
710 
711  /* Set the zoom level to show the area Rect */
712  virtual void Window_Zoom( EDA_RECT& Rect );
713 
715  virtual double BestZoom() = 0;
716 
725  void FocusOnLocation( const wxPoint& aPos, bool aWarpCursor = true, bool aCenterView = false );
726 
730  double GetZoom();
731 
742  void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
743  double aScale, const wxString &aFilename,
744  const wxString &aSheetLayer = wxEmptyString );
745 
746  void DisplayToolMsg( const wxString& msg );
747  wxString GetToolMsg() { return m_toolMsg; }
748  virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
749  virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) {}
750  virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) {}
751  virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
752  virtual void ToolOnRightClick( wxCommandEvent& event );
753  void AdjustScrollBars( const wxPoint& aCenterPosition );
754 
760  virtual void OnPageSettingsChange() {}
761 
768  virtual void OnActivate( wxActivateEvent& event );
769 
782  virtual void UpdateStatusBar();
783 
787  void DisplayUnitsMsg();
788 
789  /* Handlers for block commands */
790  virtual void InitBlockPasteInfos();
791 
801  virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
802  int aExplicitCommand = 0 );
803 
812  virtual int BlockCommand( EDA_KEY aKey );
813 
820  virtual void HandleBlockPlace( wxDC* DC );
821 
831  virtual bool HandleBlockEnd( wxDC* DC );
832 
836  void CopyToClipboard( wxCommandEvent& event );
837 
838  /* interprocess communication */
839  void CreateServer( int service, bool local = true );
840  void OnSockRequest( wxSocketEvent& evt );
841  void OnSockRequestServer( wxSocketEvent& evt );
842 
843  void LoadSettings( wxConfigBase* aCfg ) override;
844 
845  void SaveSettings( wxConfigBase* aCfg ) override;
846 
859  void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
860  COLOR4D color, int pad = 6 );
861 
865  virtual void ClearMsgPanel();
866 
872  void SetMsgPanel( const std::vector< MSG_PANEL_ITEM >& aList );
873 
874  void SetMsgPanel( EDA_ITEM* aItem );
875 
879  virtual void UpdateMsgPanel();
880 
887  void PushPreferences( const EDA_DRAW_PANEL* aParentCanvas );
888 
897  virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
898 
903 
909  virtual void UseGalCanvas( bool aEnable );
910 
916  virtual bool SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
917 
924  bool IsGalCanvasActive() const { return m_galCanvasActive; }
925 
932  void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
933 
937  TOOL_MANAGER* GetToolManager() const override { return m_toolManager; }
938 
944  virtual void* GetDisplayOptions() { return NULL; }
945 
950 
955  virtual void SyncMenusAndToolbars() {};
956 
957  bool GetShowAxis() const { return m_showAxis; }
958  bool GetShowGridAxis() const { return m_showGridAxis; }
959  bool GetShowOriginAxis() const { return m_showOriginAxis; }
960 
961  virtual const BOX2I GetDocumentExtents() const;
962 
963  DECLARE_EVENT_TABLE()
964 };
965 
966 #endif // DRAW_FRAME_H_
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:130
virtual void ReCreateMenuBar() override
Recreates the menu bar.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)=0
virtual void ReCreateVToolbar()=0
void CommonSettingsChanged() override
Notification event that some of the common (suite-wide) settings have changed.
Class ACTION_TOOLBAR.
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:127
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:102
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:949
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:138
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:312
ACTION_TOOLBAR * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window.
Definition: draw_frame.h:159
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:131
virtual void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)=0
ACTION_TOOLBAR * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:166
void OnSockRequestServer(wxSocketEvent &evt)
Definition: eda_dde.cpp:103
virtual void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:184
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
bool GetShowBorderAndTitleBlock() const
Definition: draw_frame.h:393
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:182
virtual double BestZoom()=0
Return the zoom level which displays the full page on screen.
virtual void OnGridSettings(wxCommandEvent &event)
Definition: draw_frame.h:602
void SetScrollCenterPosition(const wxPoint &aPoint)
virtual bool IsGridVisible() const
Definition: draw_frame.h:533
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:931
void OnMouseEvent(wxMouseEvent &event)
int color
Definition: DXF_plotter.cpp:62
virtual bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL)
std::vector< wxSocketBase * > m_sockets
interprocess communication
Definition: draw_frame.h:106
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:391
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:239
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:932
ACTION_TOOLBAR * m_mainToolBar
Definition: draw_frame.h:156
virtual void OnZoom(wxCommandEvent &event)
ACTION_TOOLBAR * GetOptionsToolBar() const
Definition: draw_frame.h:487
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:558
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:74
The base class for create windows for drawing purpose.
Definition: draw_frame.h:82
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:103
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema
Definition: draw_frame.h:118
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:153
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:117
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:108
void SaveSettings(wxConfigBase *aCfg) override
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:396
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:419
void DisplayUnitsMsg()
Display current unit pane on the status bar.
bool saveCanvasImageToFile(const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
void OnUpdateUndo(wxUpdateUIEvent &aEvent)
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:924
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:145
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.
void ChangeUserUnits(EDA_UNITS_T aUnits)
Definition: draw_frame.h:292
Class LSET is a set of PCB_LAYER_IDs.
void OnUpdateRedo(wxUpdateUIEvent &aEvent)
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:92
const wxPoint & GetScrollCenterPosition() const
double GetZoomLevelCoeff() const
Return the coefficient to convert internal display scale factor to zoom level.
Definition: draw_frame.h:475
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:110
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:442
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:169
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:148
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:289
wxChoice * m_zoomSelectBox
Definition: draw_frame.h:154
TOOL_MANAGER * GetToolManager() const override
Return the tool manager instance, if any.
Definition: draw_frame.h:937
virtual void SyncMenusAndToolbars()
Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller ...
Definition: draw_frame.h:955
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:141
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:71
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:123
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:399
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.
EDA_DRAW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
int m_LastGridSizeId
Definition: draw_frame.h:112
virtual COLOR4D GetGridColor()
Definition: draw_frame.h:550
virtual void ClearMsgPanel()
Clear all messages from the message panel.
virtual void RedrawScreen2(const wxPoint &posBefore)
Put the crosshair back to the screen position it had before zooming.
ACTION_TOOLBAR * GetAuxiliaryToolBar() const
Definition: draw_frame.h:489
void LoadSettings(wxConfigBase *aCfg) override
Load 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:96
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:105
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:128
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:760
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:120
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:959
void SetMousePosition(const wxPoint &aPosition)
bool GetShowGridAxis() const
Definition: draw_frame.h:958
int m_MsgFrameHeight
Definition: draw_frame.h:171
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
Definition: draw_frame.h:99
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void SetLastGridSizeId(int aId)
Definition: draw_frame.h:313
void SetNextZoom()
Change the zoom to the next one available.
ACTION_TOOLBAR * GetMainToolBar() const
Definition: draw_frame.h:486
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
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:116
wxString m_toolMsg
Definition: draw_frame.h:90
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:635
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:386
virtual void SetGridVisibility(bool aVisible)
It may be overloaded by derived classes.
Definition: draw_frame.h:542
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.
virtual void OnLeftClick(wxDC *DC, const wxPoint &MousePos)
Definition: draw_frame.h:749
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:397
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.
ACTION_TOOLBAR * GetDrawToolBar() const
Definition: draw_frame.h:488
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:957
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:125
ACTIONS * m_actions
Definition: draw_frame.h:132
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:408
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:179
int m_lastDrawToolId
Tool ID of previously active draw tool bar button.
Definition: draw_frame.h:135
void SetShowBorderAndTitleBlock(bool aShow)
Definition: draw_frame.h:395
wxPoint GetCursorPosition(bool aOnGrid, wxRealPoint *aGridSize=NULL) const
Return the current cursor position in logical (drawing) units.
EDA_UNITS_T
Definition: common.h:157
virtual void * GetDisplayOptions()
A way to pass info to draw functions.
Definition: draw_frame.h:944
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:151
void SetUserUnits(EDA_UNITS_T aUnits)
Definition: draw_frame.h:290
int GetToolId() const
Definition: draw_frame.h:524
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:94
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 OnLeftDClick(wxDC *DC, const wxPoint &MousePos)
Definition: draw_frame.h:750
wxString GetToolMsg()
Definition: draw_frame.h:747
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
ACTION_TOOLBAR * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:163
virtual const BOX2I GetDocumentExtents() const