KiCad PCB EDA Suite
EDA_DRAW_FRAME Class Referenceabstract

The base class for create windows for drawing purpose. More...

#include <draw_frame.h>

Inheritance diagram for EDA_DRAW_FRAME:
KIWAY_PLAYER EDA_BASE_FRAME KIWAY_HOLDER GERBVIEW_FRAME PCB_BASE_FRAME PL_EDITOR_FRAME SCH_BASE_FRAME DISPLAY_FOOTPRINTS_FRAME FOOTPRINT_VIEWER_FRAME FOOTPRINT_WIZARD_FRAME PCB_BASE_EDIT_FRAME LIB_EDIT_FRAME LIB_VIEW_FRAME SCH_EDIT_FRAME FOOTPRINT_EDIT_FRAME PCB_EDIT_FRAME

Public Member Functions

 EDA_DRAW_FRAME (KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
 
 ~EDA_DRAW_FRAME ()
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
virtual void SetPageSettings (const PAGE_INFO &aPageSettings)=0
 
virtual const PAGE_INFOGetPageSettings () const =0
 
virtual const wxSize GetPageSizeIU () const =0
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
EDA_UNITS_T GetUserUnits () const override
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS_T aUnits)
 
virtual const wxPoint & GetAuxOrigin () const =0
 Return the origin of the axis used for plotting and various exports. More...
 
virtual void SetAuxOrigin (const wxPoint &aPosition)=0
 
virtual const wxPoint & GetGridOrigin () const =0
 Return the absolute coordinates of the origin of the snap grid. More...
 
virtual void SetGridOrigin (const wxPoint &aPosition)=0
 
int GetLastGridSizeId () const
 
void SetLastGridSizeId (int aId)
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Set the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Return the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Return the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Return the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPoint & GetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual const TITLE_BLOCKGetTitleBlock () const =0
 
virtual void SetTitleBlock (const TITLE_BLOCK &aTitleBlock)=0
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
virtual EDA_DRAW_PANELGetCanvas () const
 
virtual wxString GetScreenDesc () const
 
virtual BASE_SCREENGetScreen () const
 Return a pointer to a BASE_SCREEN or one of its derivatives. More...
 
virtual void ExecuteRemoteCommand (const char *cmdline)
 Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 After calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 

More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Return a structure containing currently used hotkey mapping. More...
 
virtual EDA_HOTKEYGetHotKeyDescription (int aCommand) const =0
 Search lists of hot key identifiers (HK_xxx) used in the frame to find a matching hot key descriptor. More...
 
virtual bool OnHotKey (wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL)
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
virtual const wxString GetZoomLevelIndicator () const
 Return a human readable value which can be displayed as zoom level indicator in dialogs. More...
 
double GetZoomLevelCoeff () const
 Return the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateHToolbar ()=0
 
virtual void ReCreateVToolbar ()=0
 
virtual void ReCreateMenuBar () override
 Function ReCreateMenuBar Creates recreates the menu bar. More...
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
wxAuiToolBar * GetOptionsToolBar () const
 
wxAuiToolBar * GetDrawToolBar () const
 
wxAuiToolBar * GetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
wxAuiToolBarItem * GetToolbarTool (int aToolId)
 Checks all the toolbars and returns a reference to the given tool id or nullptr if not found. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg)
 Set the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 
virtual void SetGridVisibility (bool aVisible)
 It may be overloaded by derived classes. More...
 
virtual COLOR4D GetGridColor ()
 
virtual void SetGridColor (COLOR4D aColor)
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Change the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Change the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Change the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnGridSettings (wxCommandEvent &event)
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Set the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0)
 Perform application specific control using aDC at aPosition in logical units. More...
 
virtual void OnSize (wxSizeEvent &event)
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Change the zoom to the next one available. More...
 
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. More...
 
void SetPrevZoom ()
 Change the zoom to the previous one available. More...
 
void SetPreviousZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the previous one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPresetZoom (int aIndex)
 Change zoom to one of the preset values. More...
 
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 aCenterPoint at the center of the screen. More...
 
virtual void RedrawScreen2 (const wxPoint &posBefore)
 Put the crosshair back to the screen position it had before zooming. More...
 
virtual void HardRedraw ()
 Rebuild the GAL and redraws the screen. More...
 
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. More...
 
virtual void Window_Zoom (EDA_RECT &Rect)
 
virtual double BestZoom ()=0
 Return the zoom level which displays the full page on screen. More...
 
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) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
double GetZoom ()
 
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. More...
 
void DisplayToolMsg (const wxString &msg)
 
virtual void RedrawActiveWindow (wxDC *DC, bool EraseBg)=0
 
virtual void OnLeftClick (wxDC *DC, const wxPoint &MousePos)=0
 
virtual void OnLeftDClick (wxDC *DC, const wxPoint &MousePos)
 
virtual bool OnRightClick (const wxPoint &MousePos, wxMenu *PopMenu)=0
 
virtual void ToolOnRightClick (wxCommandEvent &event)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnPageSettingsChange ()
 Called when modifying the page settings. More...
 
virtual void OnActivate (wxActivateEvent &event)
 Called when activating the frame. More...
 
virtual void UpdateStatusBar ()
 Update the status bar information. More...
 
void DisplayUnitsMsg ()
 Display current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
virtual int BlockCommand (EDA_KEY aKey)
 Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse. More...
 
virtual void HandleBlockPlace (wxDC *DC)
 Called after HandleBlockEnd, when a block command needs to be executed after the block is moved to its new place (bloc move, drag, copy . More...
 
virtual bool HandleBlockEnd (wxDC *DC)
 Handle the "end" of a block command, i.e. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Copy the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void LoadSettings (wxConfigBase *aCfg) override
 Function LoadSettings loads common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *aCfg) override
 Function SaveSettings saves common frame parameters to a configuration data file. More...
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Redraw the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Push preferences from a parent window to a child window. More...
 
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. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. More...
 
virtual void UseGalCanvas (bool aEnable)
 Use to switch between standard and GAL-based canvas. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Return the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
bool GetShowAxis () const
 
bool GetShowGridAxis () const
 
bool GetShowOriginAxis () const
 
virtual const BOX2I GetDocumentExtents () const
 
VTBL_ENTRY bool OpenProjectFiles (const std::vector< wxString > &aFileList, int aCtl=0)
 Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList. More...
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
virtual void KiwayMailIn (KIWAY_EXPRESS &aEvent)
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
bool ShowPreferences (EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys, const wxString &aHotkeysNickname)
 
void PrintMsg (const wxString &text)
 
virtual void InstallPreferences (PAGED_DIALOG *aParent)
 Function InstallPreferences allows a Frame to load its preference panels (if any) into the preferences dialog. More...
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedLanguage ()
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Member Functions

virtual void SetScreen (BASE_SCREEN *aScreen)
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
virtual void unitsChangeRefresh ()
 Called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
void CommonSettingsChanged () override
 Function CommonSettingsChanged Notification event that some of the common (suite-wide) settings have changed. More...
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool saveCanvasImageToFile (const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
 
virtual wxString GetCanvasTypeKey ()
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Function autoSaveRequired returns the auto save status of the application. More...
 
virtual bool doAutoSave ()
 Function doAutoSave should be overridden by the derived class to handle the auto save feature. More...
 
virtual wxConfigBase * config ()
 Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual const SEARCH_STACKsys_search ()
 Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual wxString help_name ()
 

Static Protected Member Functions

static wxString GetBackupSuffix ()
 Function GetBackupSuffix. More...
 
static wxString GetAutoSaveFilePrefix ()
 Function GetAutoSaveFilePrefix. More...
 

Protected Attributes

bool m_galCanvasActive
 whether to use new GAL engine More...
 
bool m_useSingleCanvasPane
 
wxSocketServer * m_socketServer
 
std::vector< wxSocketBase * > m_sockets
 interprocess communication More...
 
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
 prevents opening same file multiple times. More...
 
EDA_HOTKEY_CONFIGm_hotkeysDescrList
 
int m_LastGridSizeId
 
bool m_drawGrid
 
bool m_showPageLimits
 true to display the page limits More...
 
COLOR4D m_gridColor
 Grid color. More...
 
COLOR4D m_drawBgColor
 the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema More...
 
double m_zoomLevelCoeff
 a suitable value to convert the internal zoom scaling factor More...
 
int m_UndoRedoCountMax
 default Undo/Redo command Max depth, to be handed More...
 
EDA_UNITS_T m_UserUnits
 
EDA_DRAW_PANELm_canvas
 The area to draw on. More...
 
TOOL_MANAGERm_toolManager
 
TOOL_DISPATCHERm_toolDispatcher
 
ACTIONSm_actions
 
int m_lastDrawToolId
 Tool ID of previously active draw tool bar button. More...
 
bool m_showAxis
 True shows the X and Y axis indicators. More...
 
bool m_showGridAxis
 True shows the grid axis indicators. More...
 
bool m_showOriginAxis
 True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files. More...
 
bool m_showBorderAndTitleBlock
 True shows the drawing border and title block. More...
 
long m_firstRunDialogSetting
 Key to control whether first run dialog is shown on startup. More...
 
wxChoice * m_gridSelectBox
 
wxChoice * m_zoomSelectBox
 
wxAuiToolBar * m_auxiliaryToolBar
 Auxiliary tool bar typically shown below the main tool bar at the top of the main window. More...
 
wxAuiToolBar * m_drawToolBar
 The tool bar that contains the buttons for quick access to the application draw tools. More...
 
wxAuiToolBar * m_optionsToolBar
 The options tool bar typcially located on the left edge of the main window. More...
 
EDA_MSG_PANELm_messagePanel
 Panel used to display information at the bottom of the main window. More...
 
int m_MsgFrameHeight
 
bool m_movingCursorWithKeyboard
 One-shot to avoid a recursive mouse event during hotkey movement. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 The current canvas type. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used More...
 
wxAuiToolBar * m_mainToolBar
 Standard horizontal Toolbar. More...
 
wxString m_AboutTitle
 Name of program displayed in About. More...
 
wxAuiManager m_auimgr
 
bool m_hasAutoSave
 Flag to indicate if this frame supports auto save. More...
 
bool m_autoSaveState
 Flag to indicate the last auto save state. More...
 
int m_autoSaveInterval
 The auto save interval time in seconds. More...
 
wxTimer * m_autoSaveTimer
 The timer used to implement the auto save feature;. More...
 
wxString m_perspective
 wxAuiManager perspective. More...
 
wxString m_mruPath
 Most recently used path. More...
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private Attributes

int m_toolId
 
BASE_SCREENm_currentScreen
 current used SCREEN More...
 
bool m_snapToGrid
 Indicates if cursor should be snapped to grid. More...
 
EDA_DRAW_PANEL_GALm_galCanvas
 GAL display options - this is the frame's interface to setting GAL display options. More...
 
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
 

Friends

class EDA_DRAW_PANEL
 Let the EDA_DRAW_PANEL object have access to the protected data since it is closely tied to the EDA_DRAW_FRAME. More...
 

Detailed Description

The base class for create windows for drawing purpose.

The Eeschema, Pcbnew and GerbView main windows are just a few examples of classes derived from EDA_DRAW_FRAME.

Definition at line 81 of file draw_frame.h.

Constructor & Destructor Documentation

◆ EDA_DRAW_FRAME()

EDA_DRAW_FRAME::OnSelectGrid EDA_DRAW_FRAME::OnUpdateUnits EDA_DRAW_FRAME::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 at line 128 of file legacy_gal/eda_draw_frame.cpp.

132  :
133  KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
134 {
135  m_useSingleCanvasPane = false;
136  m_socketServer = nullptr;
137  m_drawToolBar = NULL;
138  m_optionsToolBar = NULL;
139  m_auxiliaryToolBar = NULL;
140  m_gridSelectBox = NULL;
141  m_zoomSelectBox = NULL;
142  m_hotkeysDescrList = NULL;
143 
144  m_canvas = NULL;
146  m_galCanvas = NULL;
147  m_galCanvasActive = false;
148  m_actions = NULL;
149  m_toolManager = NULL;
150  m_toolDispatcher = NULL;
151  m_messagePanel = NULL;
152  m_currentScreen = NULL;
155  m_showAxis = false; // true to draw axis.
156  m_showBorderAndTitleBlock = false; // true to display reference sheet.
157  m_showGridAxis = false; // true to draw the grid axis
158  m_showOriginAxis = false; // true to draw the grid origin
159  m_LastGridSizeId = 0;
160  m_drawGrid = true; // hide/Show grid. default = show
161  m_gridColor = COLOR4D( DARKGRAY ); // Default grid color
162  m_showPageLimits = false;
163  m_drawBgColor = COLOR4D( BLACK ); // the background color of the draw canvas:
164  // BLACK for Pcbnew, BLACK or WHITE for eeschema
165  m_snapToGrid = true;
168  m_zoomLevelCoeff = 1.0;
169 
170  m_auimgr.SetFlags(wxAUI_MGR_DEFAULT);
171 
172  CreateStatusBar( 6 );
173 
174  // set the size of the status bar subwindows:
175 
176  wxWindow* stsbar = GetStatusBar();
177 
178  int dims[] = {
179 
180  // remainder of status bar on far left is set to a default or whatever is left over.
181  -1,
182 
183  // When using GetTextSize() remember the width of character '1' is not the same
184  // as the width of '0' unless the font is fixed width, and it usually won't be.
185 
186  // zoom:
187  GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,
188 
189  // cursor coords
190  GetTextSize( wxT( "X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
191 
192  // delta distances
193  GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10,
194 
195  // units display, Inches is bigger than mm
196  GetTextSize( _( "Inches" ), stsbar ).x + 10,
197 
198  // Size for the panel used as "Current tool in play": will take longest string from
199  // void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) in pcbnew/edit.cpp
200  GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
201  };
202 
203  SetStatusWidths( arrayDim( dims ), dims );
204 
205  // Create child subwindows.
206  GetClientSize( &m_FrameSize.x, &m_FrameSize.y );
207  m_FramePos.x = m_FramePos.y = 0;
209 
210  m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ),
211  wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
212 
213  m_messagePanel->SetBackgroundColour( COLOR4D( LIGHTGRAY ).ToColour() );
214 }
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:128
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:100
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:136
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:129
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aWdoName=wxFrameNameStr)
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
Definition: draw_frame.h:179
wxAuiManager m_auimgr
class EDA_MSG_PANEL is a panel to display various information messages.
Definition: msgpanel.h:111
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
wxChoice * m_gridSelectBox
Definition: draw_frame.h:151
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:115
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
Definition: common.cpp:114
bool m_showOriginAxis
True shows the origin axis used to indicate the coordinate offset for drill, gerber,...
Definition: draw_frame.h:143
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
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:163
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:90
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:108
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:166
GAL not used (the legacy wxDC engine is used)
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:146
wxChoice * m_zoomSelectBox
Definition: draw_frame.h:152
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:139
int m_LastGridSizeId
Definition: draw_frame.h:110
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:160
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
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:99
wxSocketServer * m_socketServer
Definition: draw_frame.h:103
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:118
int m_MsgFrameHeight
Definition: draw_frame.h:168
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:114
Definition: colors.h:45
ACTIONS * m_actions
Definition: draw_frame.h:130
static int GetRequiredHeight()
Function GetRequiredHeight returns the required height (in pixels) of a EDA_MSG_PANEL.
Definition: msgpanel.cpp:71
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
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:92
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References arrayDim(), BLACK, DARKGRAY, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, EDA_MSG_PANEL::GetRequiredHeight(), GetTextSize(), ID_NO_TOOL_SELECTED, and LIGHTGRAY.

◆ ~EDA_DRAW_FRAME()

EDA_DRAW_FRAME::~EDA_DRAW_FRAME ( )

Definition at line 217 of file legacy_gal/eda_draw_frame.cpp.

218 {
219  delete m_socketServer;
220 
221  for( auto socket : m_sockets )
222  {
223  socket->Shutdown();
224  socket->Destroy();
225  }
226 
228 
229  delete m_actions;
230  delete m_toolManager;
231  delete m_toolDispatcher;
232  delete m_galCanvas;
233 
234  delete m_currentScreen;
235  m_currentScreen = NULL;
236 
237  m_auimgr.UnInit();
238 
239  ReleaseFile();
240 }
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:128
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:129
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
Definition: draw_frame.h:179
std::vector< wxSocketBase * > m_sockets
interprocess communication
Definition: draw_frame.h:104
void ReleaseFile()
Release the current file marked in use.
wxAuiManager m_auimgr
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:90
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
wxSocketServer * m_socketServer
Definition: draw_frame.h:103
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Stores the canvas type in the application settings.
ACTIONS * m_actions
Definition: draw_frame.h:130

References m_actions, EDA_BASE_FRAME::m_auimgr, m_canvasType, m_currentScreen, m_galCanvas, m_sockets, m_socketServer, m_toolDispatcher, m_toolManager, ReleaseFile(), and saveCanvasTypeSetting().

Member Function Documentation

◆ AddMenuZoomAndGrid()

void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtual

Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands.

Parameters
aMasterMenu= the menu to populate.

Definition at line 1566 of file legacy_gal/eda_draw_frame.cpp.

1567 {
1568  int maxZoomIds;
1569  double zoom;
1570  wxString msg;
1571  BASE_SCREEN* screen = m_canvas->GetScreen();
1572 
1573  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
1574  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
1575  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
1576  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
1577  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
1578  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
1579  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
1580  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
1581  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
1582  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
1583 
1584 
1585  wxMenu* zoom_choice = new wxMenu;
1586  AddMenuItem( MasterMenu, zoom_choice,
1587  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
1588  KiBitmap( zoom_selection_xpm ) );
1589 
1590  zoom = screen->GetZoom();
1592  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
1593  maxZoomIds : screen->m_ZoomList.size();
1594 
1595  // Populate zoom submenu.
1596  for( int i = 0; i < maxZoomIds; i++ )
1597  {
1598  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
1599 
1600  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
1601  wxEmptyString, wxITEM_CHECK );
1602  if( zoom == screen->m_ZoomList[i] )
1603  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
1604  }
1605 
1606  // Create grid submenu as required.
1607  if( screen->GetGridCount() )
1608  {
1609  wxMenu* gridMenu = new wxMenu;
1610  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
1611  _( "Grid" ), KiBitmap( grid_select_xpm ) );
1612 
1613  wxArrayString gridsList;
1614  int icurr = screen->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES );
1615 
1616  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
1617  {
1618  GRID_TYPE& grid = screen->GetGrid( i );
1619  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
1620 
1621  if( (int)i == icurr )
1622  gridMenu->Check( grid.m_CmdId, true );
1623  }
1624  }
1625 
1626  MasterMenu->AppendSeparator();
1627  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
1628 }
virtual BASE_SCREEN * GetScreen()=0
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:108
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
Definition: common.h:161
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:118
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value)
Class GRID_TYPE is for grid arrays.
Definition: base_screen.h:45
size_t i
Definition: json11.cpp:597
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int m_CmdId
Definition: base_screen.h:48
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219

References AddHotkeyName(), AddMenuItem(), BASE_SCREEN::BuildGridsChoiceList(), BASE_SCREEN::GetGrid(), BASE_SCREEN::GetGridCount(), EDA_DRAW_PANEL::GetScreen(), GetUserUnits(), BASE_SCREEN::GetZoom(), HK_ZOOM_AUTO, HK_ZOOM_CENTER, HK_ZOOM_IN, HK_ZOOM_OUT, HK_ZOOM_REDRAW, i, ID_POPUP_CANCEL, ID_POPUP_GRID_SELECT, ID_POPUP_ZOOM_CENTER, ID_POPUP_ZOOM_IN, ID_POPUP_ZOOM_LEVEL_END, ID_POPUP_ZOOM_LEVEL_START, ID_POPUP_ZOOM_OUT, ID_POPUP_ZOOM_PAGE, ID_POPUP_ZOOM_REDRAW, ID_POPUP_ZOOM_SELECT, INCHES, KiBitmap(), m_canvas, GRID_TYPE::m_CmdId, m_hotkeysDescrList, m_zoomLevelCoeff, and BASE_SCREEN::m_ZoomList.

Referenced by EDA_DRAW_PANEL::OnRightClick().

◆ AdjustScrollBars()

void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint &  aCenterPosition)

Definition at line 1016 of file legacy_gal/eda_draw_frame.cpp.

1017 {
1018 }

◆ AppendMsgPanel()

void EDA_DRAW_FRAME::AppendMsgPanel ( const wxString &  textUpper,
const wxString &  textLower,
COLOR4D  color,
int  pad = 6 
)

Append a message to the message panel.

This helper method checks to make sure the message panel exists in the frame and appends a message to it using the message panel AppendMessage() method.

Parameters
textUpper- The message upper text.
textLower- The message lower text.
color- A color ID from the KiCad color list (see colors.h).
pad- Number of spaces to pad between messages (default = 4).

Definition at line 877 of file legacy_gal/eda_draw_frame.cpp.

880 {
881  if( m_messagePanel == NULL )
882  return;
883 
884  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
885 }
int color
Definition: DXF_plotter.cpp:62
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:166
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, COLOR4D aColor, int aPad=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:110

References EDA_MSG_PANEL::AppendMessage(), color, and m_messagePanel.

Referenced by SCH_EDIT_FRAME::AppendSchematic(), PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), SCH_EDIT_FRAME::EditSheet(), SCH_EDIT_FRAME::importFile(), SCH_PRINTOUT::OnPrintPage(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::SaveEEFile(), LIB_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbFile(), ShowNewTrackWhenMovingCursor(), and LIB_VIEW_FRAME::updatePreviewSymbol().

◆ bestZoom()

double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protected

◆ BestZoom()

virtual double EDA_DRAW_FRAME::BestZoom ( )
pure virtual

Return the zoom level which displays the full page on screen.

Implemented in LIB_EDIT_FRAME, SCH_EDIT_FRAME, GERBVIEW_FRAME, PCB_BASE_FRAME, PL_EDITOR_FRAME, LIB_VIEW_FRAME, and FOOTPRINT_EDIT_FRAME.

◆ BlockCommand()

int EDA_DRAW_FRAME::BlockCommand ( EDA_KEY  aKey)
virtual

Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse.

Parameters
aKey= the key modifiers (Alt, Shift ...)
Returns
the block command id (BLOCK_MOVE, BLOCK_COPY...)

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, LIB_EDIT_FRAME, GERBVIEW_FRAME, FOOTPRINT_EDIT_FRAME, and PL_EDITOR_FRAME.

Definition at line 757 of file legacy_gal/eda_draw_frame.cpp.

758 {
759  return 0;
760 }

Referenced by SCH_BASE_FRAME::HandleBlockBegin(), and HandleBlockBegin().

◆ CheckForAutoSaveFile()

void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName)
inherited

Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input.

If an auto save file exists for aFileName, the user is prompted if they wish to replace file aFileName with the auto saved file. If the user chooses to replace the file, the backup file of aFileName is removed, aFileName is renamed to the backup file name, and the auto save file is renamed to aFileName. If user chooses to keep the existing version of aFileName, the auto save file is removed.

Parameters
aFileNameA wxFileName object containing the file name to check.

Definition at line 585 of file eda_base_frame.cpp.

586 {
587  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
588 
589  wxFileName autoSaveFileName = aFileName;
590 
591  // Check for auto save file.
592  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
593 
594  wxLogTrace( traceAutoSave,
595  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
596 
597  if( !autoSaveFileName.FileExists() )
598  return;
599 
600  wxString msg = wxString::Format( _(
601  "Well this is potentially embarrassing!\n"
602  "It appears that the last time you were editing the file\n"
603  "\"%s\"\n"
604  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
605  GetChars( aFileName.GetFullName() )
606  );
607 
608  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
609 
610  // Make a backup of the current file, delete the file, and rename the auto save file to
611  // the file name.
612  if( response == wxYES )
613  {
614  // Get the backup file name.
615  wxFileName backupFileName = aFileName;
616  backupFileName.SetExt( aFileName.GetExt() + GetBackupSuffix() );
617 
618  // If an old backup file exists, delete it. If an old copy of the file exists, rename
619  // it to the backup file name
620  if( aFileName.FileExists() )
621  {
622  // Rename the old file to the backup file name.
623  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath(), true ) )
624  {
625  msg.Printf( _( "Could not create backup file \"%s\"" ),
626  GetChars( backupFileName.GetFullPath() ) );
627  wxMessageBox( msg );
628  }
629  }
630 
631  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
632  {
633  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
634  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
635  }
636  }
637  else
638  {
639  wxLogTrace( traceAutoSave,
640  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
641 
642  // Remove the auto save file when using the previous file as is.
643  wxRemoveFile( autoSaveFileName.GetFullPath() );
644  }
645 }
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
static wxString GetBackupSuffix()
Function GetBackupSuffix.
static wxString GetAutoSaveFilePrefix()
Function GetAutoSaveFilePrefix.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205

References Format(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), EDA_BASE_FRAME::GetBackupSuffix(), GetChars(), Pgm(), and traceAutoSave.

Referenced by SCH_EDIT_FRAME::OpenProjectFiles(), and PCB_EDIT_FRAME::OpenProjectFiles().

◆ ClearMsgPanel()

◆ CommonSettingsChanged()

void EDA_DRAW_FRAME::CommonSettingsChanged ( )
overrideprotectedvirtual

Function CommonSettingsChanged Notification event that some of the common (suite-wide) settings have changed.

Update menus, toolbars, local variables, etc.

Reimplemented from EDA_BASE_FRAME.

Reimplemented in PCB_BASE_FRAME.

Definition at line 273 of file legacy_gal/eda_draw_frame.cpp.

274 {
276 
277  wxConfigBase* settings = Pgm().CommonSettings();
278 
279  int autosaveInterval;
280  settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval );
281  SetAutoSaveInterval( autosaveInterval );
282 
283  int historySize;
284  settings->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE );
285  Kiface().GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) );
286 
287  bool option;
288  settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option );
289  m_canvas->SetEnableMousewheelPan( option );
290 
291  settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option );
292  m_canvas->SetEnableZoomNoCenter( option );
293 
294  settings->Read( ENBL_AUTO_PAN_KEY, &option );
295  m_canvas->SetEnableAutoPan( option );
296 
297  int tmp;
300 
303 
305 }
virtual void SetEnableZoomNoCenter(bool aEnable)
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
#define ENBL_ZOOM_NO_CENTER_KEY
Definition: pgm_base.h:48
CAIRO_ANTIALIASING_MODE cairo_antialiasing_mode
#define ENBL_AUTO_PAN_KEY
Definition: pgm_base.h:51
#define DEFAULT_FILE_HISTORY_SIZE
The default file history size is 9.
Definition: pgm_base.h:60
#define ENBL_MOUSEWHEEL_PAN_KEY
Definition: pgm_base.h:49
#define FILE_HISTORY_SIZE_KEY
Definition: pgm_base.h:52
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:189
#define AUTOSAVE_INTERVAL_KEY
Definition: pgm_base.h:47
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void SetMaxFiles(size_t aMaxFiles)
Definition: pgm_base.cpp:79
#define GAL_ANTIALIASING_MODE_KEY
Definition: pgm_base.h:54
void SetAutoSaveInterval(int aInterval)
#define max(a, b)
Definition: auxiliary.h:86
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
Definition: draw_frame.h:97
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:123
virtual void SetEnableMousewheelPan(bool aEnable)
#define CAIRO_ANTIALIASING_MODE_KEY
Definition: pgm_base.h:55
virtual void CommonSettingsChanged()
Function CommonSettingsChanged Notification event that some of the common (suite-wide) settings have ...
virtual void SetEnableAutoPan(bool aEnable)

References AUTOSAVE_INTERVAL_KEY, KIGFX::GAL_DISPLAY_OPTIONS::cairo_antialiasing_mode, CAIRO_ANTIALIASING_MODE_KEY, PGM_BASE::CommonSettings(), EDA_BASE_FRAME::CommonSettingsChanged(), DEFAULT_FILE_HISTORY_SIZE, ENBL_AUTO_PAN_KEY, ENBL_MOUSEWHEEL_PAN_KEY, ENBL_ZOOM_NO_CENTER_KEY, FILE_HISTORY_SIZE_KEY, GAL_ANTIALIASING_MODE_KEY, KIFACE_I::GetFileHistory(), KIGFX::GAL_DISPLAY_OPTIONS::gl_antialiasing_mode, Kiface(), m_canvas, m_galDisplayOptions, max, KIGFX::NONE, KIGFX::GAL_DISPLAY_OPTIONS::NotifyChanged(), Pgm(), EDA_BASE_FRAME::SetAutoSaveInterval(), EDA_DRAW_PANEL::SetEnableAutoPan(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), and FILE_HISTORY::SetMaxFiles().

Referenced by PCB_BASE_FRAME::CommonSettingsChanged(), GERBVIEW_FRAME::CommonSettingsChanged(), LIB_EDIT_FRAME::CommonSettingsChanged(), and SCH_EDIT_FRAME::CommonSettingsChanged().

◆ config()

wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited

Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 360 of file eda_base_frame.cpp.

361 {
362  // KICAD_MANAGER_FRAME overrides this
363  wxConfigBase* ret = Kiface().KifaceSettings();
364  //wxASSERT( ret );
365  return ret;
366 }
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52

References Kiface(), and KIFACE_I::KifaceSettings().

Referenced by CVPCB_MAINFRAME::CVPCB_MAINFRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), PCB_EDIT_FRAME::GetSettings(), SIM_PLOT_FRAME::onClose(), FOOTPRINT_WIZARD_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::OpenProjectFiles(), PL_EDITOR_FRAME::PL_EDITOR_FRAME(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), and EDA_BASE_FRAME::windowClosing().

◆ ConfigBaseName()

wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited

Function ConfigBaseName.

Returns
a base name prefix used in Load/Save settings to build the full name of keys used in config. This is usually the name of the frame set by CTOR, unless m_configFrameName contains a base name. this is the case of frames which can be shown in normal or modal mode. This is needed because we want only one base name prefix, regardless the mode used.

Definition at line 275 of file eda_base_frame.h.

276  {
277  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
278  return baseCfgName;
279  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...

References EDA_BASE_FRAME::m_configFrameName.

Referenced by DISPLAY_FOOTPRINTS_FRAME::LoadSettings(), FOOTPRINT_VIEWER_FRAME::LoadSettings(), EDA_BASE_FRAME::LoadSettings(), LoadSettings(), DISPLAY_FOOTPRINTS_FRAME::SaveSettings(), FOOTPRINT_VIEWER_FRAME::SaveSettings(), EDA_BASE_FRAME::SaveSettings(), SaveSettings(), and EDA_BASE_FRAME::WriteHotkeyConfig().

◆ CopyToClipboard()

void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)

Copy the current page or the current block to the clipboard.

Definition at line 1670 of file legacy_gal/eda_draw_frame.cpp.

1671 {
1672  DrawPageOnClipboard( this );
1673 
1674  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
1675  {
1676  // fixme-gal
1677  //if( GetScreen()->IsBlockActive() )
1678  //m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
1679 
1681  }
1682 }
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126

References DrawPageOnClipboard(), EDA_DRAW_PANEL::EndMouseCapture(), ID_GEN_COPY_BLOCK_TO_CLIPBOARD, and m_canvas.

◆ CreateServer()

void EDA_DRAW_FRAME::CreateServer ( int  service,
bool  local = true 
)

Definition at line 49 of file eda_dde.cpp.

50 {
51  wxIPV4address addr;
52 
53  // Set the port number
54  addr.Service( service );
55 
56  // Listen on localhost only if requested
57  if( local )
58  addr.Hostname( HOSTNAME );
59 
60  delete m_socketServer;
61  m_socketServer = new wxSocketServer( addr );
62 
63  m_socketServer->SetNotify( wxSOCKET_CONNECTION_FLAG );
64  m_socketServer->SetEventHandler( *this, ID_EDA_SOCKET_EVENT_SERV );
65  m_socketServer->Notify( true );
66 }
static const wxString HOSTNAME(wxT("localhost"))
wxSocketServer * m_socketServer
Definition: draw_frame.h:103

References HOSTNAME(), ID_EDA_SOCKET_EVENT_SERV, and m_socketServer.

Referenced by SCH::IFACE::CreateWindow().

◆ Destroy()

◆ DismissModal()

void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
protectedinherited

◆ DisplayToolMsg()

◆ DisplayUnitsMsg()

void EDA_DRAW_FRAME::DisplayUnitsMsg ( )

Display current unit pane on the status bar.

Definition at line 624 of file legacy_gal/eda_draw_frame.cpp.

625 {
626  wxString msg;
627 
628  switch( m_UserUnits )
629  {
630  case INCHES: msg = _( "Inches" ); break;
631  case MILLIMETRES: msg = _( "mm" ); break;
632  default: msg = _( "Units" ); break;
633  }
634 
635  SetStatusText( msg, 4 );
636 }
Definition: common.h:161
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:123

References INCHES, m_UserUnits, and MILLIMETRES.

Referenced by OnUpdateUnits(), GERBVIEW_FRAME::updateGridSelectBox(), PCB_BASE_FRAME::UpdateGridSelectBox(), SCH_BASE_FRAME::UpdateStatusBar(), and UpdateStatusBar().

◆ doAutoSave()

bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

Function doAutoSave should be overridden by the derived class to handle the auto save feature.

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 223 of file eda_base_frame.cpp.

224 {
225  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
226 }

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

◆ DrawWorkSheet()

void EDA_DRAW_FRAME::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.

Parameters
aDCThe device context.
aScreenscreen to draw
aLineWidthThe pen width to use to draw the layout.
aScaleThe mils to Iu conversion factor.
aFilenameThe filename to display in basic inscriptions.
aSheetLayerThe layer displayed from pcbnew.

Definition at line 1819 of file legacy_gal/eda_draw_frame.cpp.

1822 {
1824  return;
1825 
1826  const PAGE_INFO& pageInfo = GetPageSettings();
1827  wxSize pageSize = pageInfo.GetSizeMils();
1828 
1829  // if not printing, draw the page limits:
1830  if( !aScreen->m_IsPrinting && m_showPageLimits )
1831  {
1832  GRSetDrawMode( aDC, GR_COPY );
1833  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
1834  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
1836  }
1837 
1838  TITLE_BLOCK t_block = GetTitleBlock();
1839  COLOR4D color = COLOR4D( RED );
1840 
1841  wxPoint origin = aDC->GetDeviceOrigin();
1842 
1843  if( aScreen->m_IsPrinting && origin.y > 0 )
1844  {
1845  aDC->SetDeviceOrigin( 0, 0 );
1846  aDC->SetAxisOrientation( true, false );
1847  }
1848 
1849  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
1850  GetScreenDesc(), aFilename, t_block,
1851  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
1852  aLineWidth, aScalar, color, color, aSheetLayer );
1853 
1854  if( aScreen->m_IsPrinting && origin.y > 0 )
1855  {
1856  aDC->SetDeviceOrigin( origin.x, origin.y );
1857  aDC->SetAxisOrientation( true, true );
1858  }
1859 }
int m_ScreenNumber
Definition: base_screen.h:216
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
virtual const TITLE_BLOCK & GetTitleBlock() const =0
int color
Definition: DXF_plotter.cpp:62
virtual EDA_RECT * GetClipBox()
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
virtual const PAGE_INFO & GetPageSettings() const =0
void DrawPageLayout(wxDC *aDC, EDA_RECT *aClipBox, const PAGE_INFO &aPageInfo, const wxString &aFullSheetName, const wxString &aFileName, TITLE_BLOCK &aTitleBlock, int aSheetCount, int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor, COLOR4D aAltColor, const wxString &aSheetLayer)
Function DrawPageLayout is a core function to draw the page layout with the frame and the basic inscr...
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1003
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
Definition: colors.h:60
const wxSize & GetSizeMils() const
Definition: page_info.h:142
bool m_IsPrinting
Definition: base_screen.h:220
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:114
Definition: colors.h:49
int m_NumberOfScreens
Definition: base_screen.h:217
virtual wxString GetScreenDesc() const
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References color, DARKDARKGRAY, DrawPageLayout(), EDA_DRAW_PANEL::GetClipBox(), GetPageSettings(), GetScreenDesc(), PAGE_INFO::GetSizeMils(), GetTitleBlock(), GR_COPY, GRRect(), GRSetDrawMode(), LIGHTGRAY, m_canvas, m_drawBgColor, BASE_SCREEN::m_IsPrinting, BASE_SCREEN::m_NumberOfScreens, BASE_SCREEN::m_ScreenNumber, m_showBorderAndTitleBlock, m_showPageLimits, RED, and WHITE.

Referenced by PLEDITOR_PRINTOUT::DrawPage(), SCH_PRINTOUT::DrawPage(), PL_EDITOR_FRAME::PrintPage(), SCH_EDIT_FRAME::PrintPage(), PL_EDITOR_FRAME::RedrawActiveWindow(), FOOTPRINT_EDIT_FRAME::RedrawActiveWindow(), GERBVIEW_FRAME::RedrawActiveWindow(), and PCB_EDIT_FRAME::RedrawActiveWindow().

◆ EraseMsgBox()

void EDA_DRAW_FRAME::EraseMsgBox ( )

Definition at line 308 of file legacy_gal/eda_draw_frame.cpp.

309 {
310  if( m_messagePanel )
312 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:166
void EraseMsgBox()
Definition: msgpanel.cpp:216

References EDA_MSG_PANEL::EraseMsgBox(), and m_messagePanel.

Referenced by GERBVIEW_FRAME::SetCurItem().

◆ ExecuteRemoteCommand()

virtual void EDA_DRAW_FRAME::ExecuteRemoteCommand ( const char *  cmdline)
inlinevirtual

Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest().

this is a virtual function becuse the actual commands depends on the application. the basic function do nothing

Parameters
cmdline= received command from socket

Reimplemented in SCH_EDIT_FRAME, and PCB_EDIT_FRAME.

Definition at line 415 of file draw_frame.h.

415 {}

Referenced by OnSockRequest().

◆ ExportHotkeyConfigToFile()

void EDA_BASE_FRAME::ExportHotkeyConfigToFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it.

Parameters
aDescList= current hotkey list descr. to initialize.
aDefaultShortname= a default short name (extention not needed) like eechema, kicad...

Definition at line 738 of file hotkeys_basic.cpp.

740 {
741  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
742  wxString mask = wxT( "*." ) + ext;
743 
744 #if 0
745  wxString path = wxPathOnly( Prj().GetProjectFullName() );
746 #else
747  wxString path = GetMruPath();
748 #endif
749  wxFileName fn( aDefaultShortname );
750  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
751 
752  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
753  path,
754  fn.GetFullPath(),
755  ext,
756  mask,
757  this,
758  wxFD_SAVE,
759  true );
760 
761  if( filename.IsEmpty() )
762  return;
763 
764  WriteHotkeyConfig( aDescList, &filename );
765  SetMruPath( wxFileName( filename ).GetPath() );
766 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:303
wxString GetMruPath() const
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), EDA_BASE_FRAME::GetMruPath(), Prj(), EDA_BASE_FRAME::SetMruPath(), and EDA_BASE_FRAME::WriteHotkeyConfig().

Referenced by PANEL_HOTKEYS_EDITOR::installButtons().

◆ FocusOnLocation()

void EDA_DRAW_FRAME::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) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested.

Parameters
aPosis the point to go to.
aWarpCursoris true if the pointer should be warped to the new position.
aCenterViewis true if the new cursor position should be centered on canvas.

Definition at line 1643 of file legacy_gal/eda_draw_frame.cpp.

1644 {
1645  if( aCenterView )
1646  {
1647  wxWindow* dialog = findDialog( GetChildren() );
1648 
1649  // If a dialog partly obscures the window, then center on the uncovered area.
1650  if( dialog )
1651  {
1652  wxRect dialogRect( GetGalCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
1653  dialog->GetSize() );
1654  GetGalCanvas()->GetView()->SetCenter( aPos, dialogRect );
1655  }
1656  else
1657  GetGalCanvas()->GetView()->SetCenter( aPos );
1658  }
1659 
1660  if( aWarpCursor )
1662  else
1664 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:601
wxWindow * findDialog(wxWindowList &aList)
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.

References findDialog(), GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), and KIGFX::VIEW_CONTROLS::SetCursorPosition().

Referenced by DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_ERC::OnLeftClickMarkersList(), DIALOG_ERC::OnLeftDblClickMarkersList(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), and DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent().

◆ GeneralControl()

virtual bool EDA_DRAW_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint &  aPosition,
EDA_KEY  aHotKey = 0 
)
inlinevirtual

Perform application specific control using aDC at aPosition in logical units.

Override this function for application specific control. This function gets called on every mouse and key event.

Parameters
aDCA device context.
aPositionThe current cursor position in logical (drawing) units.
aHotKeyA key event used for application specific control if not zero.
Returns
true if the hotkey code is handled (captured).

Reimplemented in PCB_EDIT_FRAME, GERBVIEW_FRAME, LIB_EDIT_FRAME, PL_EDITOR_FRAME, SCH_EDIT_FRAME, FOOTPRINT_EDIT_FRAME, FOOTPRINT_WIZARD_FRAME, FOOTPRINT_VIEWER_FRAME, DISPLAY_FOOTPRINTS_FRAME, and LIB_VIEW_FRAME.

Definition at line 640 of file draw_frame.h.

641  {
642  return false;
643  }

Referenced by EDA_DRAW_PANEL::OnMouseEvent().

◆ GeneralControlKeyMovement()

bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint *  aPos,
bool  aSnapToGrid 
)
protected

Handle the common part of GeneralControl dedicated to global cursor keys (i.e.

cursor movement by keyboard)

Parameters
aHotKeyis the hotkey code
aPosis the position of the cursor (initial then new)
aSnapToGrid= true to force the cursor position on grid
Returns
true if the hotkey code is handled (captured).

Definition at line 1243 of file legacy_gal/eda_draw_frame.cpp.

1245 {
1246  bool key_handled = false;
1247 
1248  // If requested snap the current position to the grid
1249  if( aSnapToGrid )
1250  *aPos = GetNearestGridPosition( *aPos );
1251 
1252  switch( aHotKey )
1253  {
1254  // All these keys have almost the same treatment
1255  case GR_KB_CTRL | WXK_NUMPAD8:
1256  case GR_KB_CTRL | WXK_UP:
1257  case GR_KB_CTRL | WXK_NUMPAD2:
1258  case GR_KB_CTRL | WXK_DOWN:
1259  case GR_KB_CTRL | WXK_NUMPAD4:
1260  case GR_KB_CTRL | WXK_LEFT:
1261  case GR_KB_CTRL | WXK_NUMPAD6:
1262  case GR_KB_CTRL | WXK_RIGHT:
1263  case WXK_NUMPAD8:
1264  case WXK_UP:
1265  case WXK_NUMPAD2:
1266  case WXK_DOWN:
1267  case WXK_NUMPAD4:
1268  case WXK_LEFT:
1269  case WXK_NUMPAD6:
1270  case WXK_RIGHT:
1271  key_handled = true;
1272  {
1273  /* Here's a tricky part: when doing cursor key movement, the
1274  * 'previous' point should be taken from memory, *not* from the
1275  * freshly computed position in the event. Otherwise you can't do
1276  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1277  * the automatic motion event generated by cursor warping */
1278  wxRealPoint gridSize = GetScreen()->GetGridSize();
1279  *aPos = GetCrossHairPosition();
1280 
1281  // Bonus: ^key moves faster (x10)
1282  switch( aHotKey )
1283  {
1284  case GR_KB_CTRL|WXK_NUMPAD8:
1285  case GR_KB_CTRL|WXK_UP:
1286  aPos->y -= KiROUND( 10 * gridSize.y );
1287  break;
1288 
1289  case GR_KB_CTRL|WXK_NUMPAD2:
1290  case GR_KB_CTRL|WXK_DOWN:
1291  aPos->y += KiROUND( 10 * gridSize.y );
1292  break;
1293 
1294  case GR_KB_CTRL|WXK_NUMPAD4:
1295  case GR_KB_CTRL|WXK_LEFT:
1296  aPos->x -= KiROUND( 10 * gridSize.x );
1297  break;
1298 
1299  case GR_KB_CTRL|WXK_NUMPAD6:
1300  case GR_KB_CTRL|WXK_RIGHT:
1301  aPos->x += KiROUND( 10 * gridSize.x );
1302  break;
1303 
1304  case WXK_NUMPAD8:
1305  case WXK_UP:
1306  aPos->y -= KiROUND( gridSize.y );
1307  break;
1308 
1309  case WXK_NUMPAD2:
1310  case WXK_DOWN:
1311  aPos->y += KiROUND( gridSize.y );
1312  break;
1313 
1314  case WXK_NUMPAD4:
1315  case WXK_LEFT:
1316  aPos->x -= KiROUND( gridSize.x );
1317  break;
1318 
1319  case WXK_NUMPAD6:
1320  case WXK_RIGHT:
1321  aPos->x += KiROUND( gridSize.x );
1322  break;
1323 
1324  default: /* Can't happen since we entered the statement */
1325  break;
1326  }
1327 
1328  m_canvas->MoveCursor( *aPos );
1330  }
1331  break;
1332 
1333  default:
1334  break;
1335  }
1336 
1337  return key_handled;
1338 }
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
#define GR_KB_CTRL
virtual void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:176
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References GetCrossHairPosition(), BASE_SCREEN::GetGridSize(), GetNearestGridPosition(), GetScreen(), GR_KB_CTRL, KiROUND(), m_canvas, m_movingCursorWithKeyboard, and EDA_DRAW_PANEL::MoveCursor().

Referenced by LIB_VIEW_FRAME::GeneralControl(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), and PCB_EDIT_FRAME::GeneralControl().

◆ GetAutoSaveFilePrefix()

static wxString EDA_BASE_FRAME::GetAutoSaveFilePrefix ( )
inlinestaticprotectedinherited

Function GetAutoSaveFilePrefix.

Returns
the string to prepend to a file name for automatic save.

Definition at line 163 of file eda_base_frame.h.

164  {
165  return wxT( "_autosave-" );
166  }

Referenced by EDA_BASE_FRAME::CheckForAutoSaveFile(), SCH_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::Files_io_from_id(), SCH_EDIT_FRAME::OnCloseWindow(), PCB_EDIT_FRAME::OnExportSTEP(), SCH_EDIT_FRAME::SaveEEFile(), and PCB_EDIT_FRAME::SavePcbFile().

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 223 of file eda_base_frame.h.

223 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.

References EDA_BASE_FRAME::m_autoSaveInterval.

◆ GetAuxiliaryToolBar()

wxAuiToolBar* EDA_DRAW_FRAME::GetAuxiliaryToolBar ( ) const
inline

Definition at line 485 of file draw_frame.h.

485 { return m_auxiliaryToolBar; }
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

References m_auxiliaryToolBar.

◆ GetAuxOrigin()

virtual const wxPoint& EDA_DRAW_FRAME::GetAuxOrigin ( ) const
pure virtual

Return the origin of the axis used for plotting and various exports.

Implemented in SCH_BASE_FRAME, PCB_BASE_FRAME, PL_EDITOR_FRAME, and GERBVIEW_FRAME.

◆ GetBackupSuffix()

static wxString EDA_BASE_FRAME::GetBackupSuffix ( )
inlinestaticprotectedinherited

Function GetBackupSuffix.

Returns
the suffix to be appended to the file extension on backup

Definition at line 154 of file eda_base_frame.h.

155  {
156  return wxT( "-bak" );
157  }

Referenced by EDA_BASE_FRAME::CheckForAutoSaveFile(), PCB_EDIT_FRAME::createBackupFile(), and PCB_EDIT_FRAME::Files_io_from_id().

◆ GetCanvas()

virtual EDA_DRAW_PANEL* EDA_DRAW_FRAME::GetCanvas ( ) const
inlinevirtual

Reimplemented in SCH_BASE_FRAME.

Definition at line 395 of file draw_frame.h.

395 { return m_canvas; }
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126

References m_canvas.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), AddNewTrace(), Autoroute_One_Track(), PCB_EDIT_FRAME::Check_All_Zones(), DIALOG_DRC_CONTROL::doSelectionMenu(), PLEDITOR_PRINTOUT::DrawPage(), DrawPageOnClipboard(), LEGACY_ARRAY_CREATOR::finalise(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), InstallBlockCmdFrame(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerSelect(), GERBER_LAYER_WIDGET::OnLayerSelect(), PCB_LAYER_WIDGET::OnLayerVisible(), GERBER_LAYER_WIDGET::OnLayerVisible(), GERBER_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), PROPERTIES_FRAME::OnSetDefaultValues(), OnToggleCrossHairStyle(), OnZoom(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PAD_PROPERTIES::prepareCanvas(), Process_PageSettings(), DIALOG_DRC_CONTROL::RedrawDrawPanel(), Refresh(), PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), PCB_BASE_FRAME::SetNextGrid(), PCB_BASE_FRAME::SetPrevGrid(), GERBVIEW_FRAME::SortLayersByX2Attributes(), PCB_EDIT_FRAME::Swap_Layers(), PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetCanvasTypeKey()

virtual wxString EDA_DRAW_FRAME::GetCanvasTypeKey ( )
inlineprotectedvirtual
Returns
the key in KifaceSettings to store the canvas type. the base version returns only CanvasTypeKeyBase. Can be overriden to return a key specific of a frame name

Definition at line 241 of file draw_frame.h.

242  {
243  return CanvasTypeKeyBase;
244  }
#define CanvasTypeKeyBase
The key to store the canvas type in config.
Definition: draw_frame.h:73

References CanvasTypeKeyBase.

Referenced by LoadCanvasTypeSetting(), and saveCanvasTypeSetting().

◆ GetCrossHairPosition()

wxPoint EDA_DRAW_FRAME::GetCrossHairPosition ( bool  aInvertY = false) const

Return the current cross hair position in logical (drawing) coordinates.

Parameters
aInvertYInverts the Y axis position.
Returns
The cross hair position in drawing coordinates.

Definition at line 1142 of file legacy_gal/eda_draw_frame.cpp.

1143 {
1145  return wxPoint( cursor.x, aInvertY ? -cursor.y : cursor.y );
1146 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References KIGFX::VIEW_CONTROLS::GetCursorPosition(), GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetViewControls(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Abort_EditEdge(), AbortSymbolTraceOn(), AddMenusForBus(), AddMenusForWire(), PCB_BASE_FRAME::AddModuleToBoard(), PCB_BASE_FRAME::AddPad(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Self(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PL_EDITOR_FRAME::Block_Move(), GERBVIEW_FRAME::Block_Move(), BuildDimension(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), LIB_EDIT_FRAME::CreateGraphicItem(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), PCB_EDIT_FRAME::createPopupMenuForTracks(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), SCH_EDIT_FRAME::DeleteConnection(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), DrawAndSizingBlockOutlines(), DrawMovePin(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawSegment(), PCB_BASE_EDIT_FRAME::duplicateItem(), PCB_EDIT_FRAME::EditDimension(), LIB_EDIT_FRAME::EndDrawGraphicItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), GeneralControlKeyMovement(), LIB_EDIT_FRAME::GraphicItemBeginDraw(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::ImportSheetPin(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), PL_EDITOR_FRAME::Locate(), Move_Segment(), Move_Texte_Pcb(), MoveDimensionText(), MoveFootprint(), moveItem(), PL_EDITOR_FRAME::MoveItem(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), LIB_VIEW_FRAME::OnHotKey(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), FOOTPRINT_WIZARD_FRAME::OnHotKey(), PL_EDITOR_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), LIB_EDIT_FRAME::OnHotKey(), GERBVIEW_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOrient(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), LIB_VIEW_FRAME::OnSetRelativeOffset(), FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset(), FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset(), OnZoom(), DIALOG_UPDATE_PCB::PerformUpdate(), LIB_EDIT_FRAME::PlaceAnchor(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_BASE_FRAME::PlaceTexteModule(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), RedrawWhileMovingCursor(), RefreshCrossHair(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), resizeSheetWithMouseCursor(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), Show_MoveTexte_Module(), Show_New_Edge_While_Move_Mouse(), Show_Pad_Move(), Show_Zone_Corner_Or_Outline_While_Move_Mouse(), ShowBoundingBoxMicroWaveInductor(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), ShowNewTrackWhenMovingCursor(), ShowTargetShapeWhileMovingMouse(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and GERBVIEW_FRAME::UpdateStatusBar().

◆ GetCrossHairScreenPosition()

wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition ( ) const

Return the cross hair position in device (display) units.b.

Returns
The current cross hair position.

Definition at line 1178 of file legacy_gal/eda_draw_frame.cpp.

1179 {
1180  BASE_SCREEN* screen = GetScreen(); // virtual call
1181  return screen->getCrossHairScreenPosition();
1182 }
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units....
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References BASE_SCREEN::getCrossHairScreenPosition(), and GetScreen().

◆ GetCursorPosition()

wxPoint EDA_DRAW_FRAME::GetCursorPosition ( bool  aOnGrid,
wxRealPoint *  aGridSize = NULL 
) const

Return the current cursor position in logical (drawing) units.

Parameters
aOnGridReturns the nearest grid position at the current cursor position.
aGridSizeCustom grid size instead of the current grid size. Only valid if aOnGrid is true.
Returns
The current cursor position.

Definition at line 1163 of file legacy_gal/eda_draw_frame.cpp.

1164 {
1165  BASE_SCREEN* screen = GetScreen(); // virtual call
1166  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1167 }
wxPoint getCursorPosition(bool aOnGrid, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getCursorPosition returns the current cursor position in logical (drawing) units.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References BASE_SCREEN::getCursorPosition(), GetGridOrigin(), and GetScreen().

◆ GetDisplayOptions()

virtual void* EDA_DRAW_FRAME::GetDisplayOptions ( )
inlinevirtual

A way to pass info to draw functions.

the base class has no knowledge about these options. It is virtual because this function must be overloaded to pass usefull info.

Reimplemented in PCB_BASE_FRAME.

Definition at line 948 of file draw_frame.h.

948 { return NULL; }

Referenced by GERBVIEW_DRAW_PANEL_GAL::OnShow(), PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL(), and PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow().

◆ GetDocumentExtents()

const BOX2I EDA_DRAW_FRAME::GetDocumentExtents ( ) const
virtual

Reimplemented in SCH_EDIT_FRAME, LIB_EDIT_FRAME, and LIB_VIEW_FRAME.

Definition at line 1353 of file legacy_gal/eda_draw_frame.cpp.

1354 {
1355  return BOX2I();
1356 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520

Referenced by SCH_BASE_FRAME::Zoom_Automatique().

◆ GetDrawBgColor()

virtual COLOR4D EDA_DRAW_FRAME::GetDrawBgColor ( ) const
inlinevirtual

◆ GetDrawToolBar()

wxAuiToolBar* EDA_DRAW_FRAME::GetDrawToolBar ( ) const
inline

Definition at line 484 of file draw_frame.h.

484 { return m_drawToolBar; }
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:160

References m_drawToolBar.

◆ GetFileFromHistory()

wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
wxFileHistory *  aFileHistory = NULL 
)
inherited

Function GetFileFromHistory fetches the file name from the file history list.

and removes the selected file, if this file does not exists Note also the menu is updated, if wxFileHistory::UseMenu was called at init time

Parameters
cmdIdThe command ID associated with the aFileHistory object.
typePlease document me!
aFileHistoryThe wxFileHistory in use. If null, the main application file history is used
Returns
a wxString containing the selected filename

Definition at line 399 of file eda_base_frame.cpp.

401 {
402  wxFileHistory* fileHistory = aFileHistory;
403 
404  if( !fileHistory )
405  fileHistory = &Kiface().GetFileHistory();
406 
407  int baseId = fileHistory->GetBaseId();
408 
409  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
410 
411  unsigned i = cmdId - baseId;
412 
413  if( i < fileHistory->GetCount() )
414  {
415  wxString fn = fileHistory->GetHistoryFile( i );
416 
417  if( wxFileName::FileExists( fn ) )
418  return fn;
419  else
420  {
421  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
422  wxMessageBox( msg );
423 
424  fileHistory->RemoveFileFromHistory( i );
425  }
426  }
427 
428  return wxEmptyString;
429 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:123
size_t i
Definition: json11.cpp:597

References Format(), KIFACE_I::GetFileHistory(), i, and Kiface().

Referenced by GERBVIEW_FRAME::OnDrlFileHistory(), KICAD_MANAGER_FRAME::OnFileHistory(), PL_EDITOR_FRAME::OnFileHistory(), PCB_EDIT_FRAME::OnFileHistory(), GERBVIEW_FRAME::OnGbrFileHistory(), GERBVIEW_FRAME::OnJobFileHistory(), SCH_EDIT_FRAME::OnLoadFile(), and GERBVIEW_FRAME::OnZipFileHistory().

◆ GetGalCanvas()

EDA_DRAW_PANEL_GAL* EDA_DRAW_FRAME::GetGalCanvas ( ) const
inline

Return a pointer to GAL-based canvas of given EDA draw frame.

Returns
Pointer to GAL-based canvas.

Definition at line 935 of file draw_frame.h.

935 { return m_galCanvas; }
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

References m_galCanvas.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), FOOTPRINT_VIEWER_FRAME::ApplyDisplaySettingsToGAL(), DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL(), GERBVIEW_FRAME::applyDisplaySettingsToGAL(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), COMMON_TOOLS::CenterContents(), SCH_BASE_FRAME::CenterScreen(), PCB_EDIT_FRAME::Check_All_Zones(), GERBVIEW_FRAME::Clear_DrawLayers(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), DIALOG_PRINT_PCBNEW::createPrintout(), DIALOG_PRINT_GERBVIEW::createPrintout(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::Edit_Zone_Params(), LIB_EDIT_FRAME::EndDrawGraphicItem(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), SELECTION_TOOL::findCallback(), FocusOnLocation(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), SCH_EDIT_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), GERBVIEW_FRAME::GERBVIEW_FRAME(), SCH_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetCollectorsGuide(), GetCrossHairPosition(), SCH_BASE_FRAME::GetRenderSettings(), GERBVIEW_FRAME::GetVisibleLayers(), GRID_HELPER::GRID_HELPER(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HighlightConnectionAtPosition(), GERBVIEW_CONTROL::HighlightControl(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), GERBVIEW_FRAME::loadListOfGerberAndDrillFiles(), FOOTPRINT_PREVIEW_PANEL::New(), SCH_EDIT_FRAME::OnCancelCurrentCommand(), STATUS_POPUP::onCharHook(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnCreateNewPart(), LIB_EDIT_FRAME::OnEditComponentProperties(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerVisible(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), LIB_EDIT_FRAME::OnSelectBodyStyle(), GERBVIEW_FRAME::OnSelectHighlightChoice(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), FOOTPRINT_EDIT_FRAME::OnSwitchCanvas(), SCH_BASE_FRAME::OnSwitchCanvas(), LIB_EDIT_FRAME::OnSwitchCanvas(), PCB_BASE_FRAME::OnToggleEdgeDrawMode(), OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), PCB_BASE_FRAME::OnToggleTextDrawMode(), GERBVIEW_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSelectZoom(), SCH_BASE_FRAME::OnUpdateSwitchCanvas(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), FOOTPRINT_TREE_PANE::onUpdateUI(), OnZoom(), DIALOG_UPDATE_PCB::PerformUpdate(), LIB_EDIT_FRAME::PlaceAnchor(), DIALOG_PAD_PROPERTIES::prepareCanvas(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), processBoardItem(), BOARD_COMMIT::Push(), GRID_HELPER::queryVisible(), PCB_EDITOR_CONTROL::ratsnestTimer(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), SCH_BASE_FRAME::RedrawScreen2(), GERBER_LAYER_WIDGET::ReFill(), Refresh(), refreshCallback(), SELECTION_TOOL::RequestSelection(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), SaveCanvasImageToFile(), LIB_EDIT_FRAME::saveLibrary(), DISPLAY_FOOTPRINTS_FRAME::SaveSettings(), FOOTPRINT_VIEWER_FRAME::SaveSettings(), ZOOM_TOOL::selectRegion(), GERBVIEW_FRAME::SetActiveLayer(), GRID_HELPER::SetAuxAxes(), PCB_BASE_EDIT_FRAME::SetBoard(), SetCrossHairPosition(), GERBVIEW_FRAME::SetElementVisibility(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), GERBVIEW_FRAME::SetGridColor(), SetNextZoomAndRedraw(), SetNoToolSelected(), GERBVIEW_FRAME::SetPageSettings(), SetPresetGrid(), SetPreviousZoomAndRedraw(), SetToolID(), FOOTPRINT_EDIT_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), GERBVIEW_FRAME::SetVisibleLayers(), GERBVIEW_FRAME::SortLayersByX2Attributes(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::Swap_Layers(), SwitchCanvas(), SCH_BASE_FRAME::SyncView(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_PCBNEW_SETTINGS::TransferDataFromWindow(), PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), GERBVIEW_FRAME::UpdateDisplayOptions(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_EDIT_FRAME::UpdateUserInterface(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::updateView(), PCB_BASE_EDIT_FRAME::UseGalCanvas(), FOOTPRINT_EDIT_FRAME::UseGalCanvas(), PCB_BASE_FRAME::UseGalCanvas(), GERBVIEW_FRAME::UseGalCanvas(), UseGalCanvas(), CVPCB_CONTROL::view(), SCH_BASE_FRAME::Window_Zoom(), SCH_BASE_FRAME::Zoom_Automatique(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME(), GERBVIEW_FRAME::~GERBVIEW_FRAME(), and PCB_BASE_FRAME::~PCB_BASE_FRAME().

◆ GetGalDisplayOptions()

◆ GetGridColor()

virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtual
Returns
the color of the grid

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 552 of file draw_frame.h.

553  {
554  return m_gridColor;
555  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:115

References m_gridColor.

Referenced by GERBVIEW_FRAME::GetVisibleElementColor(), and PCBNEW_CONTROL::Reset().

◆ GetGridOrigin()

virtual const wxPoint& EDA_DRAW_FRAME::GetGridOrigin ( ) const
pure virtual

Return the absolute coordinates of the origin of the snap grid.

This is treated as a relative offset, and snapping will occur at multiples of the grid size relative to this point.

Implemented in SCH_BASE_FRAME, PCB_BASE_FRAME, PL_EDITOR_FRAME, and GERBVIEW_FRAME.

Referenced by GetCursorPosition(), GetNearestGridPosition(), and SetCrossHairPosition().

◆ GetGridPosition()

wxPoint EDA_DRAW_FRAME::GetGridPosition ( const wxPoint &  aPosition) const

Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled.

Otherwise, the original positions is returned.

See also
m_snapToGrid and m_BaseScreen members.
Parameters
aPositionThe position to test.
Returns
The wxPoint of the appropriate cursor position.

Definition at line 683 of file legacy_gal/eda_draw_frame.cpp.

684 {
685  wxPoint pos = aPosition;
686 
687  if( m_currentScreen != NULL && m_snapToGrid )
688  pos = GetNearestGridPosition( aPosition );
689 
690  return pos;
691 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:90
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:92

References GetNearestGridPosition(), m_currentScreen, and m_snapToGrid.

Referenced by SCH_EDIT_FRAME::HighlightConnectionAtPosition(), and SCH_EDIT_FRAME::OnLeftClick().

◆ GetHotkeyConfig()

EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inline

Return a structure containing currently used hotkey mapping.

Definition at line 438 of file draw_frame.h.

438 { return m_hotkeysDescrList; }
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:108

References m_hotkeysDescrList.

Referenced by GERBVIEW_CONTROL::ShowHelp(), and PCBNEW_CONTROL::ShowHelp().

◆ GetHotKeyDescription()

virtual EDA_HOTKEY* EDA_DRAW_FRAME::GetHotKeyDescription ( int  aCommand) const
pure virtual

Search lists of hot key identifiers (HK_xxx) used in the frame to find a matching hot key descriptor.

Parameters
aCommandis the hot key identifier.
Returns
Hot key descriptor or NULL if none found.

Implemented in PCB_EDIT_FRAME, GERBVIEW_FRAME, LIB_EDIT_FRAME, SCH_EDIT_FRAME, PL_EDITOR_FRAME, FOOTPRINT_WIZARD_FRAME, FOOTPRINT_EDIT_FRAME, FOOTPRINT_VIEWER_FRAME, DISPLAY_FOOTPRINTS_FRAME, and LIB_VIEW_FRAME.

Referenced by DIALOG_SET_GRID::TransferDataToWindow().

◆ GetKicadAbout()

void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 506 of file eda_base_frame.cpp.

507 {
508  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
509  ShowAboutDialog( this );
510 }
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.

References ShowAboutDialog().

◆ GetKicadContribute()

void EDA_BASE_FRAME::GetKicadContribute ( wxCommandEvent &  event)
inherited

Definition at line 493 of file eda_base_frame.cpp.

494 {
495  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
496  {
497  wxString msg;
498  msg.Printf( _( "Could not launch the default browser.\n"
499  "For information on how to help the KiCad project, visit %s" ),
501  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
502  }
503 }
#define URL_GET_INVOLVED

References URL_GET_INVOLVED.

◆ GetKicadHelp()

void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 432 of file eda_base_frame.cpp.

433 {
434  const SEARCH_STACK& search = sys_search();
435 
436  /* We have to get document for beginners,
437  * or the full specific doc
438  * if event id is wxID_INDEX, we want the document for beginners.
439  * else the specific doc file (its name is in Kiface().GetHelpFileName())
440  * The document for beginners is the same for all KiCad utilities
441  */
442  if( event.GetId() == wxID_INDEX )
443  {
444  // List of possible names for Getting Started in KiCad
445  const wxChar* names[2] = {
446  wxT( "getting_started_in_kicad" ),
447  wxT( "Getting_Started_in_KiCad" )
448  };
449 
450  wxString helpFile;
451  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
452  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
453  for( unsigned ii = 0; ii < arrayDim( names ); ii++ )
454  {
455  helpFile = SearchHelpFileFullPath( search, names[ii] );
456 
457  if( !helpFile.IsEmpty() )
458  break;
459  }
460 
461  if( !helpFile )
462  {
463  wxString msg = wxString::Format( _(
464  "Html or pdf help file \n\"%s\"\n or\n\"%s\" could not be found." ), names[0], names[1] );
465  wxMessageBox( msg );
466  }
467  else
468  {
469  GetAssociatedDocument( this, helpFile );
470  }
471 
472  return;
473  }
474 
475  wxString base_name = help_name();
476  wxString helpFile = SearchHelpFileFullPath( search, base_name );
477 
478  if( !helpFile )
479  {
480  wxString msg = wxString::Format( _(
481  "Help file \"%s\" could not be found." ),
482  GetChars( base_name )
483  );
484  wxMessageBox( msg );
485  }
486  else
487  {
488  GetAssociatedDocument( this, helpFile );
489  }
490 }
wxString SearchHelpFileFullPath(const SEARCH_STACK &aSearchStack, const wxString &aBaseName)
Return the help file's full path.
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, const wxPathList *aPaths)
Function GetAssociatedDocument open a document (file) with the suitable browser.
Definition: eda_doc.cpp:87
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
virtual const SEARCH_STACK & sys_search()
Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_M...
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:99
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
virtual wxString help_name()

References arrayDim(), Format(), GetAssociatedDocument(), GetChars(), EDA_BASE_FRAME::help_name(), numEval::SearchHelpFileFullPath(), and EDA_BASE_FRAME::sys_search().

◆ GetLastGridSizeId()

int EDA_DRAW_FRAME::GetLastGridSizeId ( ) const
inline

Definition at line 308 of file draw_frame.h.

308 { return m_LastGridSizeId; }
int m_LastGridSizeId
Definition: draw_frame.h:110

References m_LastGridSizeId.

◆ GetMainToolBar()

wxAuiToolBar* EDA_DRAW_FRAME::GetMainToolBar ( ) const
inline

Definition at line 482 of file draw_frame.h.

482 { return m_mainToolBar; }
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.

References EDA_BASE_FRAME::m_mainToolBar.

◆ GetMruPath()

wxString EDA_BASE_FRAME::GetMruPath ( ) const
inlineinherited

◆ GetNearestGridPosition()

wxPoint EDA_DRAW_FRAME::GetNearestGridPosition ( const wxPoint &  aPosition,
wxRealPoint *  aGridSize = NULL 
) const

Return the nearest aGridSize location to aPosition.

Parameters
aPositionThe position to check.
aGridSizeThe grid size to locate to if provided. If NULL then the current grid size is used.
Returns
The nearst grid position.

Definition at line 1170 of file legacy_gal/eda_draw_frame.cpp.

1172 {
1173  BASE_SCREEN* screen = GetScreen(); // virtual call
1174  return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
1175 }
wxPoint getNearestGridPosition(const wxPoint &aPosition, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getNearestGridPosition returns the nearest aGridSize location to aPosition.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References GetGridOrigin(), BASE_SCREEN::getNearestGridPosition(), and GetScreen().

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), SCH_EDIT_FRAME::copyBlockItems(), GeneralControlKeyMovement(), GetGridPosition(), InvokeDialogImportGfxBoard(), InvokeDialogImportGfxModule(), GERBVIEW_FRAME::Locate(), SCH_EDIT_FRAME::LocateAndShowItem(), LIB_EDIT_FRAME::LocateItemUsingCursor(), LIB_EDIT_FRAME::OnOrient(), SCH_EDIT_FRAME::OnOrient(), PCB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnRotate(), resizeSheetWithMouseCursor(), and SCH_EDIT_FRAME::RotateHierarchicalSheet().

◆ GetOptionsToolBar()

wxAuiToolBar* EDA_DRAW_FRAME::GetOptionsToolBar ( ) const
inline

Definition at line 483 of file draw_frame.h.

483 { return m_optionsToolBar; }
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:163

References m_optionsToolBar.

◆ GetPageSettings()

virtual const PAGE_INFO& EDA_DRAW_FRAME::GetPageSettings ( ) const
pure virtual

◆ GetPageSizeIU()

virtual const wxSize EDA_DRAW_FRAME::GetPageSizeIU ( ) const
pure virtual

Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view.

Implemented in SCH_BASE_FRAME, PCB_BASE_FRAME, GERBVIEW_FRAME, and PL_EDITOR_FRAME.

Referenced by DrawPageOnClipboard().

◆ GetScreen()

virtual BASE_SCREEN* EDA_DRAW_FRAME::GetScreen ( ) const
inlinevirtual

Return a pointer to a BASE_SCREEN or one of its derivatives.

It is overloaded by derived classes to return SCH_SCREEN or PCB_SCREEN.

Reimplemented in SCH_EDIT_FRAME, PCB_BASE_FRAME, PL_EDITOR_FRAME, and SCH_BASE_FRAME.

Definition at line 404 of file draw_frame.h.

404 { return m_currentScreen; }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:90

References m_currentScreen.

Referenced by GERBVIEW_FRAME::Block_Move(), GERBVIEW_FRAME::Clear_DrawLayers(), COMMON_TOOLS::CursorControl(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), GeneralControlKeyMovement(), GERBVIEW_FRAME::GERBVIEW_FRAME(), GERBVIEW_FRAME::GetActiveLayer(), GetCrossHairScreenPosition(), GetCursorPosition(), GetNearestGridPosition(), SCH_BASE_FRAME::GetScreen(), EDA_DRAW_PANEL::GetScreen(), PL_EDITOR_FRAME::GetScreen(), PCB_BASE_FRAME::GetScreen(), GetScrollCenterPosition(), GetZoom(), GetZoomLevelIndicator(), GRID_MENU::GRID_MENU(), HandleBlockBegin(), GERBVIEW_FRAME::HandleBlockEnd(), GERBVIEW_FRAME::HandleBlockPlace(), InitBlockPasteInfos(), isBusy(), GERBVIEW_FRAME::OnHotKey(), GERBVIEW_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), EDA_DRAW_PANEL::OnMouseWheel(), EDA_DRAW_PANEL_GAL::onPaint(), EDA_DRAW_PANEL::OnPan(), GERBVIEW_FRAME::OnRightClick(), EDA_DRAW_PANEL::OnScroll(), OnSelectZoom(), OnUpdateRedo(), OnUpdateSelectGrid(), GERBVIEW_FRAME::OnUpdateSelectZoom(), OnUpdateUndo(), COMMON_TOOLS::PanControl(), PushTrack(), GERBVIEW_FRAME::RedrawActiveWindow(), RefPos(), GERBVIEW_CONTROL::ResetCoords(), SaveSettings(), GERBVIEW_FRAME::SetActiveLayer(), SetCrossHairPosition(), GERBVIEW_FRAME::SetCurItem(), SetMousePosition(), SetNextGrid(), SetNextZoom(), SetNextZoomAndRedraw(), GERBVIEW_FRAME::SetPageSettings(), SetPresetGrid(), SetPresetZoom(), SetPrevGrid(), SetPreviousZoomAndRedraw(), SetPrevZoom(), SetScrollCenterPosition(), GRID_MENU::update(), ZOOM_MENU::update(), COMMON_TOOLS::updateGrid(), GERBVIEW_FRAME::updateGridSelectBox(), UpdateMsgPanel(), GERBVIEW_FRAME::UpdateStatusBar(), GERBVIEW_FRAME::updateZoomSelectBox(), and ZOOM_MENU::ZOOM_MENU().

◆ GetScreenDesc()

wxString EDA_DRAW_FRAME::GetScreenDesc ( ) const
virtual

Reimplemented in SCH_EDIT_FRAME.

Definition at line 1862 of file legacy_gal/eda_draw_frame.cpp.

1863 {
1864  // Virtual function. Base class implementation returns an empty string.
1865  return wxEmptyString;
1866 }

Referenced by ConfigureDrawList(), KIGFX::SCH_VIEW::DisplaySheet(), DrawWorkSheet(), PL_EDITOR_FRAME::Locate(), and DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG().

◆ GetScrollCenterPosition()

const wxPoint & EDA_DRAW_FRAME::GetScrollCenterPosition ( ) const

Definition at line 1199 of file legacy_gal/eda_draw_frame.cpp.

1200 {
1201  BASE_SCREEN* screen = GetScreen(); // virtual call
1202  return screen->getScrollCenterPosition();
1203 }
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
const wxPoint & getScrollCenterPosition() const
Definition: base_screen.h:173
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References GetScreen(), and BASE_SCREEN::getScrollCenterPosition().

Referenced by SCH_EDIT_FRAME::DisplayCurrentSheet(), EDA_DRAW_PANEL::OnMouseEvent(), EDA_DRAW_PANEL::OnMouseWheel(), EDA_DRAW_PANEL::OnPan(), EDA_DRAW_PANEL::OnScroll(), OnSelectZoom(), and SetPresetZoom().

◆ GetShowAxis()

bool EDA_DRAW_FRAME::GetShowAxis ( ) const
inline

Definition at line 961 of file draw_frame.h.

961 { return m_showAxis; }
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:136

References m_showAxis.

◆ GetShowBorderAndTitleBlock()

bool EDA_DRAW_FRAME::GetShowBorderAndTitleBlock ( ) const
inline

Definition at line 389 of file draw_frame.h.

389 { return m_showBorderAndTitleBlock; }
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:146

References m_showBorderAndTitleBlock.

◆ GetShowGridAxis()

bool EDA_DRAW_FRAME::GetShowGridAxis ( ) const
inline

Definition at line 962 of file draw_frame.h.

962 { return m_showGridAxis; }
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:139

References m_showGridAxis.

◆ GetShowOriginAxis()

bool EDA_DRAW_FRAME::GetShowOriginAxis ( ) const
inline

Definition at line 963 of file draw_frame.h.

963 { return m_showOriginAxis; }
bool m_showOriginAxis
True shows the origin axis used to indicate the coordinate offset for drill, gerber,...
Definition: draw_frame.h:143

References m_showOriginAxis.

◆ GetTitleBlock()

virtual const TITLE_BLOCK& EDA_DRAW_FRAME::GetTitleBlock ( ) const
pure virtual

◆ GetToolbarTool()

wxAuiToolBarItem * EDA_DRAW_FRAME::GetToolbarTool ( int  aToolId)

Checks all the toolbars and returns a reference to the given tool id or nullptr if not found.

Definition at line 364 of file legacy_gal/eda_draw_frame.cpp.

365 {
366  // Checks all the toolbars and returns a reference to the given tool id
367  // (or the first tool found, but only one or 0 tool is expected, because on
368  // Windows, when different tools have the same ID, it creates issues)
369  if( m_mainToolBar && m_mainToolBar->FindTool( aToolId ) )
370  return m_mainToolBar->FindTool( aToolId );
371 
372  if( m_optionsToolBar && m_optionsToolBar->FindTool( aToolId ) )
373  return m_optionsToolBar->FindTool( aToolId );
374 
375  if( m_drawToolBar && m_drawToolBar->FindTool( aToolId ) )
376  return m_drawToolBar->FindTool( aToolId );
377 
378  if( m_auxiliaryToolBar && m_auxiliaryToolBar->FindTool( aToolId ) )
379  return m_auxiliaryToolBar->FindTool( aToolId );
380 
381  return nullptr;
382 }
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
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:163
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.

References m_auxiliaryToolBar, m_drawToolBar, EDA_BASE_FRAME::m_mainToolBar, and m_optionsToolBar.

◆ GetToolId()

int EDA_DRAW_FRAME::GetToolId ( ) const
inline
Returns
the current tool ID when there is no active tool, the ID_NO_TOOL_SELECTED is returned (the id of the default Tool (idle tool) of the right vertical toolbar)

Definition at line 526 of file draw_frame.h.

526 { return m_toolId; }

References m_toolId.

Referenced by PCB_EDIT_FRAME::Begin_Zone(), LIB_EDIT_FRAME::CreateGraphicItem(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), LIB_EDIT_FRAME::EndDrawGraphicItem(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::HandleBlockEnd(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), GERBVIEW_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockEnd(), PCB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), PL_EDITOR_FRAME::HandleBlockPlace(), FOOTPRINT_EDIT_FRAME::HandleBlockPlace(), GERBVIEW_FRAME::HandleBlockPlace(), LIB_EDIT_FRAME::HandleBlockPlace(), PCB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PAD_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), EDIT_TOOL::Init(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PCB_EDIT_FRAME::MuWaveCommand(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), LIB_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), PL_EDITOR_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), PCB_EDIT_FRAME::OnSelectTool(), DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection(), LIB_EDIT_FRAME::OnUpdateEditingPart(), PCB_EDIT_FRAME::OnUpdateMuWaveToolbar(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectTool(), PL_EDITOR_FRAME::OnUpdateSelectTool(), GERBVIEW_FRAME::OnUpdateSelectTool(), LIB_EDIT_FRAME::OnUpdateSelectTool(), SCH_EDIT_FRAME::OnUpdateSelectTool(), FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar(), PCB_EDIT_FRAME::OnUpdateVerticalToolbar(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PCB_BASE_FRAME::SetToolID(), and PCB_EDIT_FRAME::SwitchLayer().

◆ GetToolManager()

◆ GetToolToggled()

bool EDA_DRAW_FRAME::GetToolToggled ( int  aToolId)

Checks all the toolbars and returns true if the given tool id is toggled.

This is needed because GerbView and Pcbnew can put some of the same tools in different toolbars.

Definition at line 353 of file legacy_gal/eda_draw_frame.cpp.

354 {
355  // Checks all the toolbars and returns true if the given tool id is toggled.
356  return ( ( m_mainToolBar && m_mainToolBar->GetToolToggled( aToolId ) ) ||
357  ( m_optionsToolBar && m_optionsToolBar->GetToolToggled( aToolId ) ) ||
358  ( m_drawToolBar && m_drawToolBar->GetToolToggled( aToolId ) ) ||
359  ( m_auxiliaryToolBar && m_auxiliaryToolBar->GetToolToggled( aToolId ) )
360  );
361 }
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
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:163
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.

References m_auxiliaryToolBar, m_drawToolBar, EDA_BASE_FRAME::m_mainToolBar, and m_optionsToolBar.

Referenced by ZOOM_TOOL::Main().

◆ GetUserUnits()

EDA_UNITS_T EDA_DRAW_FRAME::GetUserUnits ( ) const
inlineoverride

Return the user units currently in use.

Definition at line 291 of file draw_frame.h.

291 { return m_UserUnits; }
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:123

References m_UserUnits.

Referenced by AddMenuZoomAndGrid(), PANEL_SETUP_TRACKS_AND_VIAS::AppendDiffPairs(), PANEL_SETUP_TRACKS_AND_VIAS::AppendTrackWidth(), PANEL_SETUP_TRACKS_AND_VIAS::AppendViaSize(), PCB_EDIT_FRAME::Create_MuWaveComponent(), MWAVE::CreateMicrowaveInductor(), PCB_EDIT_FRAME::createPopupMenuForTracks(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), GERBER_FILE_IMAGE::DisplayImageInfo(), MARKER_BASE::DisplayMarkerInfo(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRC::DRC(), PCB_EDIT_FRAME::Edit_Gap(), EVT_GRID_CMD_CELL_CHANGED(), PCB_EDIT_FRAME::GenFootprintsReport(), PANEL_MODEDIT_DEFAULTS::getGridValue(), PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue(), PANEL_SETUP_NETCLASSES::getNetclassValue(), GetUserUnits(), GRID_MENU::GRID_MENU(), GERBVIEW_FRAME::Liste_D_Codes(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), FOOTPRINT_WIZARD_FRAME::OnHotKey(), GERBVIEW_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnRightClick(), PANEL_PREV_3D::PANEL_PREV_3D(), CVPCB_CONTROL::SwitchUnits(), GERBVIEW_CONTROL::SwitchUnits(), PCBNEW_CONTROL::SwitchUnits(), PCB_EDIT_FRAME::SyncMenusAndToolbars(), DRC::testDrilledHoles(), DRC::testUnconnected(), PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow(), PANEL_SETUP_NETCLASSES::TransferDataFromWindow(), PANEL_EESCHEMA_SETTINGS::TransferDataToWindow(), PANEL_MODEDIT_SETTINGS::TransferDataToWindow(), PANEL_PCBNEW_SETTINGS::TransferDataToWindow(), PANEL_GERBVIEW_SETTINGS::TransferDataToWindow(), PANEL_SETUP_NETCLASSES::TransferDataToWindow(), UNIT_BINDER::UNIT_BINDER(), GRID_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), GERBVIEW_FRAME::updateDCodeSelectBox(), GERBVIEW_FRAME::updateGridSelectBox(), PCB_BASE_FRAME::UpdateGridSelectBox(), DRC::updatePointers(), PNS_TUNE_STATUS_POPUP::UpdateStatus(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), GERBVIEW_FRAME::UpdateStatusBar(), PCB_EDIT_FRAME::UpdateTrackWidthSelectBox(), PCB_EDIT_FRAME::UpdateViaSizeSelectBox(), PANEL_SETUP_TRACKS_AND_VIAS::validateData(), and PANEL_SETUP_NETCLASSES::validateData().

◆ GetZoom()

double EDA_DRAW_FRAME::GetZoom ( )
Returns
The current zoom level.

Definition at line 601 of file legacy_gal/eda_draw_frame.cpp.

602 {
603  return GetScreen()->GetZoom();
604 }
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References GetScreen(), and BASE_SCREEN::GetZoom().

Referenced by SCH_EDIT_FRAME::FindComponentAndItem(), SCH_EDIT_FRAME::OnFindDrcMarker(), OnSelectZoom(), SCH_EDIT_FRAME::updateFindReplaceView(), PCB_BASE_FRAME::updateZoomSelectBox(), and GERBVIEW_FRAME::updateZoomSelectBox().

◆ GetZoomLevelCoeff()

double EDA_DRAW_FRAME::GetZoomLevelCoeff ( ) const
inline

Return the coefficient to convert internal display scale factor to zoom level.

Definition at line 471 of file draw_frame.h.

471 { return m_zoomLevelCoeff; }
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:118

References m_zoomLevelCoeff.

Referenced by COMMON_TOOLS::doZoomToPreset(), EDA_DRAW_PANEL_GAL::GetLegacyZoom(), UseGalCanvas(), and ZOOM_MENU::ZOOM_MENU().

◆ GetZoomLevelIndicator()

const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator ( ) const
virtual

Return a human readable value which can be displayed as zoom level indicator in dialogs.

this can be a percentage or other indicator. it is virtual because it could be different for pcbnew, gerbview or eeschema (different internal units and different purposes) note also adjust m_zoomLevelCoeff is the way to adjust the displayed value

Reimplemented in GERBVIEW_FRAME, PCB_BASE_FRAME, SCH_BASE_FRAME, and PL_EDITOR_FRAME.

Definition at line 793 of file legacy_gal/eda_draw_frame.cpp.

794 {
795  wxString Line;
796  double level = 0.0;
797 
798  if( IsGalCanvasActive() )
799  {
800  level = m_galCanvas->GetGAL()->GetZoomFactor();
801  }
802  else if( BASE_SCREEN* screen = GetScreen() )
803  {
804  level = m_zoomLevelCoeff / screen->GetZoom();
805  }
806 
807  // returns a human readable value which can be displayed as zoom
808  // level indicator in dialogs.
809  Line.Printf( wxT( "Z %.2f" ), level );
810 
811  return Line;
812 }
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 BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
double GetZoomFactor() const
Get the zoom factor.
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
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:118
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References EDA_DRAW_PANEL_GAL::GetGAL(), GetScreen(), KIGFX::GAL::GetZoomFactor(), IsGalCanvasActive(), m_galCanvas, and m_zoomLevelCoeff.

Referenced by PL_EDITOR_FRAME::GetZoomLevelIndicator(), SCH_BASE_FRAME::GetZoomLevelIndicator(), PCB_BASE_FRAME::GetZoomLevelIndicator(), GERBVIEW_FRAME::GetZoomLevelIndicator(), and UpdateStatusBar().

◆ HandleBlockBegin()

bool EDA_DRAW_FRAME::HandleBlockBegin ( wxDC *  aDC,
EDA_KEY  aKey,
const wxPoint &  aPosition,
int  aExplicitCommand = 0 
)
virtual

Initialize a block command.

Parameters
aDCis the device context to perform the block command.
aKeyis the block command key press.
aPositionis the logical position of the start of the block command.
aExplicitCommand- if this is given, begin with this command, rather than looking up the command from aKey.

Reimplemented in SCH_BASE_FRAME.

Definition at line 938 of file legacy_gal/eda_draw_frame.cpp.

940 {
942 
943  if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
944  return false;
945 
946  if( aExplicitCommand == 0 )
947  block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
948  else
949  block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
950 
951  if( block->GetCommand() == 0 )
952  return false;
953 
954  switch( block->GetCommand() )
955  {
956  case BLOCK_IDLE:
957  break;
958 
959  case BLOCK_MOVE: // Move
960  case BLOCK_DRAG: // Drag (block defined)
961  case BLOCK_DRAG_ITEM: // Drag from a drag item command
962  case BLOCK_DUPLICATE: // Duplicate
963  case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references
964  case BLOCK_DELETE: // Delete
965  case BLOCK_COPY: // Copy
966  case BLOCK_FLIP: // Flip
967  case BLOCK_ZOOM: // Window Zoom
968  case BLOCK_PRESELECT_MOVE: // Move with preselection list
969  block->InitData( m_canvas, aPosition );
970  break;
971 
972  case BLOCK_PASTE:
973  block->InitData( m_canvas, aPosition );
974  block->SetLastCursorPosition( wxPoint( 0, 0 ) );
976 
977  if( block->GetCount() == 0 ) // No data to paste
978  {
979  DisplayError( this, wxT( "No block to paste" ), 20 );
982  block->SetState( STATE_NO_BLOCK );
983  block->SetMessageBlock( this );
984  return true;
985  }
986 
987  if( !m_canvas->IsMouseCaptured() )
988  {
989  block->ClearItemsList();
990  DisplayError( this,
991  wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
992  block->SetState( STATE_NO_BLOCK );
993  block->SetMessageBlock( this );
994  return true;
995  }
996 
997  block->SetState( STATE_BLOCK_MOVE );
998  m_canvas->CallMouseCapture( aDC, aPosition, false );
999  break;
1000 
1001  default:
1002  {
1003  wxString msg;
1004  msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
1005  block->GetCommand();
1006  DisplayError( this, msg );
1007  }
1008  break;
1009  }
1010 
1011  block->SetMessageBlock( this );
1012  return true;
1013 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
virtual int BlockCommand(EDA_KEY aKey)
Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT,...
BLOCK_COMMAND_T
virtual void InitBlockPasteInfos()
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
Definition: solve.cpp:178
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
void SetCommand(BLOCK_COMMAND_T aCommand)

References BLOCK_COPY, BLOCK_DELETE, BLOCK_DRAG, BLOCK_DRAG_ITEM, BLOCK_DUPLICATE, BLOCK_DUPLICATE_AND_INCREMENT, BLOCK_FLIP, BLOCK_IDLE, BLOCK_MOVE, BLOCK_PASTE, BLOCK_PRESELECT_MOVE, BLOCK_ZOOM, BlockCommand(), EDA_DRAW_PANEL::CallMouseCapture(), DisplayError(), GetScreen(), InitBlockPasteInfos(), EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, m_canvas, BLOCK_SELECTOR::SetCommand(), EDA_DRAW_PANEL::SetMouseCaptureCallback(), STATE_BLOCK_MOVE, and STATE_NO_BLOCK.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), PCB_BASE_EDIT_FRAME::duplicateItem(), InvokeDialogImportGfxBoard(), InvokeDialogImportGfxModule(), and EDA_DRAW_PANEL::OnMouseEvent().

◆ HandleBlockEnd()

bool EDA_DRAW_FRAME::HandleBlockEnd ( wxDC *  DC)
virtual

Handle the "end" of a block command, i.e.

is called at the end of the definition of the area of a block. depending on the current block command, this command is executed or parameters are initialized to prepare a call to HandleBlockPlace in GetScreen()->m_BlockLocate

Returns
false if no item selected, or command finished, true if some items found and HandleBlockPlace must be called later

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, LIB_EDIT_FRAME, GERBVIEW_FRAME, FOOTPRINT_EDIT_FRAME, and PL_EDITOR_FRAME.

Definition at line 775 of file legacy_gal/eda_draw_frame.cpp.

776 {
777  return false;
778 }

Referenced by AbortBlockCurrentCommand(), PCB_BASE_EDIT_FRAME::duplicateItem(), InvokeDialogImportGfxBoard(), InvokeDialogImportGfxModule(), and EDA_DRAW_PANEL::OnMouseEvent().

◆ HandleBlockPlace()

void EDA_DRAW_FRAME::HandleBlockPlace ( wxDC *  DC)
virtual

Called after HandleBlockEnd, when a block command needs to be executed after the block is moved to its new place (bloc move, drag, copy .

. ) Parameters must be initialized in GetScreen()->m_BlockLocate

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, LIB_EDIT_FRAME, GERBVIEW_FRAME, FOOTPRINT_EDIT_FRAME, and PL_EDITOR_FRAME.

Definition at line 770 of file legacy_gal/eda_draw_frame.cpp.

771 {
772 }

Referenced by EDA_DRAW_PANEL::OnMouseEvent().

◆ HardRedraw()

void EDA_DRAW_FRAME::HardRedraw ( )
virtual

Rebuild the GAL and redraws the screen.

Call when something went wrong.

Reimplemented in LIB_EDIT_FRAME, SCH_EDIT_FRAME, and SCH_BASE_FRAME.

Definition at line 1369 of file legacy_gal/eda_draw_frame.cpp.

1370 {
1371 }

Referenced by OnZoom().

◆ help_name()

wxString EDA_BASE_FRAME::help_name ( )
protectedvirtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 375 of file eda_base_frame.cpp.

376 {
377  return Kiface().GetHelpFileName();
378 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
const wxString & GetHelpFileName() const
Function GetHelpFileName returns just the basename portion of the current help file.
Definition: kiface_i.h:121

References KIFACE_I::GetHelpFileName(), and Kiface().

Referenced by EDA_BASE_FRAME::GetKicadHelp().

◆ ImportHotkeyConfigFromFile()

void EDA_BASE_FRAME::ImportHotkeyConfigFromFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it.

Parameters
aDescList= current hotkey list descr. to initialize.
aDefaultShortname= a default short name (extention not needed) like eechema, kicad...

Definition at line 709 of file hotkeys_basic.cpp.

711 {
712  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
713  wxString mask = wxT( "*." ) + ext;
714 
715 
716  wxString path = GetMruPath();
717  wxFileName fn( aDefaultShortname );
718  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
719 
720  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
721  path,
722  fn.GetFullPath(),
723  ext,
724  mask,
725  this,
726  wxFD_OPEN,
727  true );
728 
729  if( filename.IsEmpty() )
730  return;
731 
732  ::ReadHotkeyConfigFile( filename, aDescList, false );
733  WriteHotkeyConfig( aDescList );
734  SetMruPath( wxFileName( filename ).GetPath() );
735 }
void SetMruPath(const wxString &aPath)
int ReadHotkeyConfigFile(const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList, const bool aDefaultLocation)
Function ReadHotkeyConfig Read hotkey configuration for a given app, possibly before the frame for th...
wxString GetMruPath() const
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), EDA_BASE_FRAME::GetMruPath(), ReadHotkeyConfigFile(), EDA_BASE_FRAME::SetMruPath(), and EDA_BASE_FRAME::WriteHotkeyConfig().

Referenced by PANEL_HOTKEYS_EDITOR::installButtons().

◆ InitBlockPasteInfos()

void EDA_DRAW_FRAME::InitBlockPasteInfos ( )
virtual

Reimplemented in SCH_EDIT_FRAME, and LIB_EDIT_FRAME.

Definition at line 763 of file legacy_gal/eda_draw_frame.cpp.

764 {
767 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)

References BLOCK_SELECTOR::ClearItemsList(), GetScreen(), BASE_SCREEN::m_BlockLocate, m_canvas, and EDA_DRAW_PANEL::SetMouseCaptureCallback().

Referenced by SCH_BASE_FRAME::HandleBlockBegin(), and HandleBlockBegin().

◆ InstallPreferences()

virtual void EDA_BASE_FRAME::InstallPreferences ( PAGED_DIALOG aParent)
inlinevirtualinherited

Function InstallPreferences allows a Frame to load its preference panels (if any) into the preferences dialog.

Parameters
aParenta paged dialog into which the preference panels should be installed

Reimplemented in PCB_EDIT_FRAME, SCH_EDIT_FRAME, LIB_EDIT_FRAME, GERBVIEW_FRAME, and FOOTPRINT_EDIT_FRAME.

Definition at line 244 of file eda_base_frame.h.

244 { }

Referenced by EDA_BASE_FRAME::ShowPreferences().

◆ isAutoSaveRequired()

virtual bool EDA_BASE_FRAME::isAutoSaveRequired ( ) const
inlineprotectedvirtualinherited

Function autoSaveRequired returns the auto save status of the application.

Override this function if your derived frame supports automatic file saving.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 179 of file eda_base_frame.h.

179 { return false; }

Referenced by EDA_BASE_FRAME::ProcessEvent().

◆ isBusy()

bool EDA_DRAW_FRAME::isBusy ( ) const
protected
Returns
true if an item edit or a block operation is in progress.

Definition at line 1341 of file legacy_gal/eda_draw_frame.cpp.

1342 {
1343  const BASE_SCREEN* screen = const_cast< BASE_SCREEN* >( GetScreen() );
1344 
1345  if( !screen )
1346  return false;
1347 
1348  return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
1349  || ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
1350 }
BLOCK_STATE_T GetState() const
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
EDA_ITEM * GetCurItem() const
Definition: base_screen.h:233
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References BASE_SCREEN::GetCurItem(), EDA_ITEM::GetFlags(), GetScreen(), BLOCK_SELECTOR::GetState(), BASE_SCREEN::m_BlockLocate, and STATE_NO_BLOCK.

Referenced by SCH_EDIT_FRAME::GetSchematicFromRedoList(), and SCH_EDIT_FRAME::GetSchematicFromUndoList().

◆ IsDismissed()

bool KIWAY_PLAYER::IsDismissed ( )
protectedinherited

Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal().

IOW, it will return true if the dialog is not modal or if it is modal and has been dismissed.

Definition at line 156 of file kiway_player.cpp.

157 {
158  return !m_modal_loop;
159 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:250

References KIWAY_PLAYER::m_modal_loop.

Referenced by LIB_VIEW_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), and FOOTPRINT_WIZARD_FRAME::OnCloseWindow().

◆ IsGalCanvasActive()

bool EDA_DRAW_FRAME::IsGalCanvasActive ( ) const
inline

Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use.

Returns
True for GAL-based canvas, false for standard canvas.

Definition at line 928 of file draw_frame.h.

928 { return m_galCanvasActive; }
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:100

References m_galCanvasActive.

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), PCB_EDIT_FRAME::AppendBoardFile(), GERBER_LAYER_WIDGET::AreArbitraryColorsAllowed(), PCB_LAYER_WIDGET::AreArbitraryColorsAllowed(), PCB_EDIT_FRAME::Check_All_Zones(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), GetZoomLevelIndicator(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), FOOTPRINT_EDIT_FRAME::Import_Module(), DIALOG_PAD_PROPERTIES::OnCancel(), DIALOG_PAD_PROPERTIES::onChangePadMode(), STATUS_POPUP::onCharHook(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), PCB_BASE_FRAME::OnModify(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), GERBVIEW_FRAME::OnSelectHighlightChoice(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), OnSelectZoom(), OnToggleGridState(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), GERBVIEW_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PAD_PROPERTIES::prepareCanvas(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateOptToolbar(), DIALOG_PAD_PROPERTIES::redraw(), Refresh(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), GERBVIEW_FRAME::SetActiveLayer(), GERBVIEW_FRAME::SetGridColor(), SetNoToolSelected(), GERBVIEW_FRAME::SetPageSettings(), SetToolID(), DIALOG_SET_GRID::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_WIZARD_FRAME::updateView(), Zoom_Automatique(), and FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME().

◆ IsGridVisible()

virtual bool EDA_DRAW_FRAME::IsGridVisible ( ) const
inlinevirtual

◆ IsModal()

◆ IsType()

◆ IsWritable()

bool EDA_BASE_FRAME::IsWritable ( const wxFileName &  aFileName)
inherited

Function IsWritable checks if aFileName can be written.

The function performs a number of tests on aFileName to verify that it can be saved. If aFileName defines a path with no file name, them the path is tested for user write permission. If aFileName defines a file name that does not exist in the path, the path is tested for user write permission. If aFileName defines a file that already exits, the file name is tested for user write permissions.

Note
The file name path must be set or an assertion will be raised on debug builds and return false on release builds.
Parameters
aFileNameThe full path and/or file name of the file to test.
Returns
False if aFileName cannot be written.

Definition at line 541 of file eda_base_frame.cpp.

542 {
543  wxString msg;
544  wxFileName fn = aFileName;
545 
546  // Check for absence of a file path with a file name. Unfortunately KiCad
547  // uses paths relative to the current project path without the ./ part which
548  // confuses wxFileName. Making the file name path absolute may be less than
549  // elegant but it solves the problem.
550  if( fn.GetPath().IsEmpty() && fn.HasName() )
551  fn.MakeAbsolute();
552 
553  wxCHECK_MSG( fn.IsOk(), false,
554  wxT( "File name object is invalid. Bad programmer!" ) );
555  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
556  wxT( "File name object path <" ) + fn.GetFullPath() +
557  wxT( "> is not set. Bad programmer!" ) );
558 
559  if( fn.IsDir() && !fn.IsDirWritable() )
560  {
561  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
562  GetChars( fn.GetPath() ) );
563  }
564  else if( !fn.FileExists() && !fn.IsDirWritable() )
565  {
566  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
567  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
568  }
569  else if( fn.FileExists() && !fn.IsFileWritable() )
570  {
571  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
572  GetChars( fn.GetFullPath() ) );
573  }
574 
575  if( !msg.IsEmpty() )
576  {
577  wxMessageBox( msg );
578  return false;
579  }
580 
581  return true;
582 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92

References GetChars().

Referenced by SCH_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::SaveEEFile(), LIB_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), CVPCB_MAINFRAME::SaveProjectFile(), and SCH_EDIT_FRAME::SaveProjectSettings().

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:94

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), PCB_BASE_EDIT_FRAME::AddLibrary(), SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), SCH_EDIT_FRAME::CreateScreens(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), SCH_EDIT_FRAME::doUpdatePcb(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), KICAD_MANAGER_FRAME::OnEditFpLibTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnEditSymLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnOpenPcbModuleEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), EDA_BASE_FRAME::ShowPreferences(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ kiway_express()

void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 177 of file kiway_player.cpp.

178 {
179  // logging support
180  KiwayMailIn( aEvent ); // call the virtual, override in derived.
181 }
virtual void KiwayMailIn(KIWAY_EXPRESS &aEvent)
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.

References KIWAY_PLAYER::KiwayMailIn().

◆ KiwayMailIn()

void KIWAY_PLAYER::KiwayMailIn ( KIWAY_EXPRESS aEvent)
virtualinherited

Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.

Merely override it in derived classes.

Reimplemented in LIB_EDIT_FRAME, FOOTPRINT_EDIT_FRAME, SCH_EDIT_FRAME, PCB_EDIT_FRAME, and CVPCB_MAINFRAME.

Definition at line 71 of file kiway_player.cpp.

72 {
73  // override this in derived classes.
74 }

Referenced by KIWAY_PLAYER::kiway_express(), and KIWAY::ProcessEvent().

◆ language_change()

void KIWAY_PLAYER::language_change ( wxCommandEvent &  event)
protectedinherited

Function language_change is an event handler called on a language menu selection.

Definition at line 184 of file kiway_player.cpp.

185 {
186  int id = event.GetId();
187 
188  // tell all the KIWAY_PLAYERs about the language change.
189  Kiway().SetLanguage( id );
190 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY void SetLanguage(int aLanguage)
Function SetLanguage changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs.
Definition: kiway.cpp:395

References KIWAY_HOLDER::Kiway(), and KIWAY::SetLanguage().

◆ LibraryFileBrowser()

bool EDA_DRAW_FRAME::LibraryFileBrowser ( bool  doOpen,
wxFileName &  aFilename,
const wxString &  wildcard,
const wxString &  ext,
bool  isDirectory = false 
)
protected
Parameters
doOpenif true runs an Open Library browser, otherwise New Library
aFilenamefor New may contain a default name; in both cases return the chosen filename.
wildcarda wildcard to filter the displayed files
extthe library file extension
isDirectoryindicates the library files are directories
Returns
true for OK; false for Cancel.

Definition at line 1868 of file legacy_gal/eda_draw_frame.cpp.

1871 {
1872  wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
1873  aFilename.SetExt( ext );
1874 
1875  if( isDirectory && doOpen )
1876  {
1877  wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
1878  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
1879 
1880  if( dlg.ShowModal() == wxID_CANCEL )
1881  return false;
1882 
1883  aFilename = dlg.GetPath();
1884  aFilename.SetExt( ext );
1885  }
1886  else
1887  {
1888  wxFileDialog dlg( this, prompt, Prj().GetProjectPath(), aFilename.GetFullName() ,
1889  wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
1890  : wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
1891 
1892  if( dlg.ShowModal() == wxID_CANCEL )
1893  return false;
1894 
1895  aFilename = dlg.GetPath();
1896  aFilename.SetExt( ext );
1897  }
1898 
1899  return true;
1900 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

References KIWAY_HOLDER::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_EDIT_FRAME::addLibraryFile(), and PCB_BASE_EDIT_FRAME::CreateNewLibrary().

◆ LoadCanvasTypeSetting()

EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting ( )

Returns the canvas type stored in the application settings.

Definition at line 1066 of file legacy_gal/eda_draw_frame.cpp.

1067 {
1069  wxConfigBase* cfg = Kiface().KifaceSettings();
1070 
1071  if( cfg )
1072  {
1073  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE)
1075  }
1076 
1077  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1078  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1079  {
1080  wxASSERT( false );
1081  canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
1082  }
1083 
1084  // Coerce the value into a GAL type when Legacy is not available
1085  // Default to Cairo, and on the first, user will be prompted for OpenGL
1086  if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1087  && !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
1088  {
1089 #ifdef __WXMAC__
1090  // Cairo renderer doesn't handle Retina displays
1092 #else
1094 #endif
1095  }
1096 
1097  return canvasType;
1098 }
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
virtual wxString GetCanvasTypeKey()
Definition: draw_frame.h:241
Sentinel, do not use as a parameter.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
GAL not used (the legacy wxDC engine is used)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers of advanced config.

References EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, GetCanvasTypeKey(), ADVANCED_CFG::GetCfg(), Kiface(), and KIFACE_I::KifaceSettings().

Referenced by SCH_BASE_FRAME::createCanvas(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), and GERBVIEW_FRAME::GERBVIEW_FRAME().

◆ LoadSettings()

void EDA_DRAW_FRAME::LoadSettings ( wxConfigBase *  aCfg)
overridevirtual

Function LoadSettings loads common frame parameters from a configuration file.

Don't forget to call the base method or your frames won't remember their positions and sizes.

Reimplemented from EDA_BASE_FRAME.

Reimplemented in PCB_BASE_FRAME.

Definition at line 815 of file legacy_gal/eda_draw_frame.cpp.

816 {
818 
819  wxString baseCfgName = ConfigBaseName();
820  wxConfigBase* cmnCfg = Pgm().CommonSettings();
821 
822  // Read units used in dialogs and toolbars
823  EDA_UNITS_T unitsTmp;
824 
825  if( aCfg->Read( baseCfgName + UserUnitsEntryKeyword, (int*) &unitsTmp ) )
826  SetUserUnits( unitsTmp );
827  else
829 
830  // Read show/hide grid entry
831  bool btmp;
832  if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) )
833  SetGridVisibility( btmp );
834 
835  aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, m_LastGridSizeId );
836 
837  // m_LastGridSizeId is an offset, expected to be >= 0
838  if( m_LastGridSizeId < 0 )
839  m_LastGridSizeId = 0;
840 
841  m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
842  long( DEFAULT_MAX_UNDO_ITEMS ) );
843 
844  aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L );
845 
847 
848  int temp;
851 
854 
856 }
static const wxString FirstRunShownKeyword(wxT("FirstRunShown"))
static const wxString MaxUndoItemsEntry(wxT("DevelMaxUndoItems"))
Integer to set the maximum number of undo items on the stack.
#define LastGridSizeIdKeyword
Most recently used grid size (suffix)
Definition: draw_frame.h:69
#define DEFAULT_MAX_UNDO_ITEMS
Definition: draw_frame.h:47
wxString ConfigBaseName()
Function ConfigBaseName.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode
#define UserUnitsEntryKeyword
User units.
Definition: draw_frame.h:63
CAIRO_ANTIALIASING_MODE cairo_antialiasing_mode
#define GAL_DISPLAY_OPTIONS_KEY
Definition: pgm_base.h:53
void ReadConfig(wxConfigBase *aCfg, const wxString &aBaseName)
virtual void LoadSettings(wxConfigBase *aCfg)
Function LoadSettings loads common frame parameters from a configuration file.
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:121
int m_LastGridSizeId
Definition: draw_frame.h:110
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:189
#define GAL_ANTIALIASING_MODE_KEY
Definition: pgm_base.h:54
#define ShowGridEntryKeyword
Nonzero to show grid (suffix)
Definition: draw_frame.h:65
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
Definition: draw_frame.h:97
#define CAIRO_ANTIALIASING_MODE_KEY
Definition: pgm_base.h:55
virtual void SetGridVisibility(bool aVisible)
It may be overloaded by derived classes.
Definition: draw_frame.h:544
EDA_UNITS_T
Definition: common.h:160
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

References KIGFX::GAL_DISPLAY_OPTIONS::cairo_antialiasing_mode, CAIRO_ANTIALIASING_MODE_KEY, PGM_BASE::CommonSettings(), EDA_BASE_FRAME::ConfigBaseName(), DEFAULT_MAX_UNDO_ITEMS, FirstRunShownKeyword(), GAL_ANTIALIASING_MODE_KEY, GAL_DISPLAY_OPTIONS_KEY, KIGFX::GAL_DISPLAY_OPTIONS::gl_antialiasing_mode, LastGridSizeIdKeyword, EDA_BASE_FRAME::LoadSettings(), m_firstRunDialogSetting, m_galDisplayOptions, m_LastGridSizeId, m_UndoRedoCountMax, MaxUndoItemsEntry(), MILLIMETRES, KIGFX::NONE, KIGFX::GAL_DISPLAY_OPTIONS::NotifyChanged(), Pgm(), KIGFX::GAL_DISPLAY_OPTIONS::ReadConfig(), SetGridVisibility(), SetUserUnits(), ShowGridEntryKeyword, and UserUnitsEntryKeyword.

Referenced by LIB_VIEW_FRAME::LoadSettings(), FOOTPRINT_WIZARD_FRAME::LoadSettings(), PL_EDITOR_FRAME::LoadSettings(), SCH_EDIT_FRAME::LoadSettings(), LIB_EDIT_FRAME::LoadSettings(), GERBVIEW_FRAME::LoadSettings(), and PCB_BASE_FRAME::LoadSettings().

◆ LockFile()

bool EDA_DRAW_FRAME::LockFile ( const wxString &  aFileName)

Mark a schematic file as being in use.

Use ReleaseFile() to undo this.

Parameters
aFileName= full path to the file.
Returns
false if the file was already locked, true otherwise.

Definition at line 258 of file legacy_gal/eda_draw_frame.cpp.

259 {
260  m_file_checker = ::LockFile( aFileName );
261 
262  return bool( m_file_checker );
263 }
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:106
bool LockFile(const wxString &aFileName)
Mark a schematic file as being in use.

References m_file_checker.

Referenced by SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), and SCH_EDIT_FRAME::SaveEEFile().

◆ OnActivate()

void EDA_DRAW_FRAME::OnActivate ( wxActivateEvent &  event)
virtual

Called when activating the frame.

In derived classes with a overriding OnActivate function, do not forget to call this EDA_DRAW_FRAME::OnActivate( event ) basic function.

Reimplemented in LIB_EDIT_FRAME, FOOTPRINT_WIZARD_FRAME, LIB_VIEW_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 315 of file legacy_gal/eda_draw_frame.cpp.

316 {
317  if( m_canvas )
318  m_canvas->SetCanStartBlock( -1 );
319 
320  event.Skip(); // required under wxMAC
321 }
void SetCanStartBlock(int aStartBlock)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126

References m_canvas, and EDA_DRAW_PANEL::SetCanStartBlock().

Referenced by FOOTPRINT_VIEWER_FRAME::OnActivate(), LIB_VIEW_FRAME::OnActivate(), FOOTPRINT_WIZARD_FRAME::OnActivate(), and LIB_EDIT_FRAME::OnActivate().

◆ onAutoSaveTimer()

void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Function onAutoSaveTimer handles the auto save timer event.

Definition at line 216 of file eda_base_frame.cpp.

217 {
218  if( !doAutoSave() )
219  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
220 }
virtual bool doAutoSave()
Function doAutoSave should be overridden by the derived class to handle the auto save feature.
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
int m_autoSaveInterval
The auto save interval time in seconds.

References EDA_BASE_FRAME::doAutoSave(), EDA_BASE_FRAME::m_autoSaveInterval, and EDA_BASE_FRAME::m_autoSaveTimer.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

◆ OnCharHook()

void EDA_DRAW_FRAME::OnCharHook ( wxKeyEvent &  event)
virtual

Capture the key event before it is sent to the GUI.

the basic frame does not capture this event. editor frames should override this event function to capture and filter these keys when they are used as hotkeys, and skip it if the key is not used as hotkey (otherwise the key events will be not sent to menus)

Definition at line 243 of file legacy_gal/eda_draw_frame.cpp.

244 {
245  wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_FRAME::OnCharHook %s", dump( event ) );
246  // Key events can be filtered here.
247  // Currently no filtering is made.
248  event.Skip();
249 }
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.

References dump(), and kicadTraceKeyEvent.

◆ OnEraseBackground()

void EDA_DRAW_FRAME::OnEraseBackground ( wxEraseEvent &  SizeEvent)

◆ OnGridSettings()

virtual void EDA_DRAW_FRAME::OnGridSettings ( wxCommandEvent &  event)
inlinevirtual

Reimplemented in PCB_BASE_EDIT_FRAME, and SCH_BASE_FRAME.

Definition at line 604 of file draw_frame.h.

604 { };

Referenced by OnSelectGrid().

◆ OnHotKey()

bool EDA_DRAW_FRAME::OnHotKey ( wxDC *  aDC,
int  aHotKey,
const wxPoint &  aPosition,
EDA_ITEM aItem = NULL 
)
virtual

◆ OnLeftClick()

virtual void EDA_DRAW_FRAME::OnLeftClick ( wxDC *  DC,
const wxPoint &  MousePos 
)
pure virtual

◆ OnLeftDClick()

void EDA_DRAW_FRAME::OnLeftDClick ( wxDC *  DC,
const wxPoint &  MousePos 
)
virtual

◆ OnMenuOpen()

void EDA_DRAW_FRAME::OnMenuOpen ( wxMenuEvent &  event)

Definition at line 324 of file legacy_gal/eda_draw_frame.cpp.

325 {
326  if( m_canvas )
327  m_canvas->SetCanStartBlock( -1 );
328 
329  event.Skip();
330 }
void SetCanStartBlock(int aStartBlock)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126

References m_canvas, and EDA_DRAW_PANEL::SetCanStartBlock().

◆ OnMouseEvent()

void EDA_DRAW_FRAME::OnMouseEvent ( wxMouseEvent &  event)

Definition at line 607 of file legacy_gal/eda_draw_frame.cpp.

608 {
609  event.Skip();
610 }

◆ OnPageSettingsChange()

virtual void EDA_DRAW_FRAME::OnPageSettingsChange ( )
inlinevirtual

Called when modifying the page settings.

In derived classes it can be used to modify parameters like draw area size, and any other local parameter related to the page settings.

Reimplemented in SCH_EDIT_FRAME.

Definition at line 764 of file draw_frame.h.

764 {};

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick().

◆ OnRightClick()

virtual bool EDA_DRAW_FRAME::OnRightClick ( const wxPoint &  MousePos,
wxMenu *  PopMenu 
)
pure virtual

◆ OnSelectGrid()

void EDA_DRAW_FRAME::OnSelectGrid ( wxCommandEvent &  event)
virtual

Command event handler for selecting grid sizes.

All commands that set the grid size should eventually end up here. This is where the application setting is saved. If you override this method, make sure you call down to the base class.

Parameters
event- Command event passed by selecting grid size from the grid size combobox on the toolbar.

Definition at line 515 of file legacy_gal/eda_draw_frame.cpp.

516 {
517  int* clientData;
518  int eventId = ID_POPUP_GRID_LEVEL_100;
519 
520  if( event.GetEventType() == wxEVT_CHOICE )
521  {
522  if( m_gridSelectBox == NULL ) // Should not happen
523  return;
524 
525  /*
526  * Don't use wxCommandEvent::GetClientData() here. It always
527  * returns NULL in GTK. This solution is not as elegant but
528  * it works.
529  */
530  int index = m_gridSelectBox->GetSelection();
531  wxASSERT( index != wxNOT_FOUND );
532 
533  if( index == int( m_gridSelectBox->GetCount() - 2 ) )
534  {
535  // this is the separator
536  wxUpdateUIEvent dummy;
538  return;
539  }
540  else if( index == int( m_gridSelectBox->GetCount() - 1 ) )
541  {
542  wxUpdateUIEvent dummy;
544  wxCommandEvent dummy2;
545  OnGridSettings( dummy2 );
546  return;
547  }
548 
549  clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( index );
550 
551  if( clientData != NULL )
552  eventId = *clientData;
553  }
554  else
555  {
556  eventId = event.GetId();
557  }
558 
559  int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
560 
561  SetPresetGrid( idx );
562 }
virtual void OnGridSettings(wxCommandEvent &event)
Definition: draw_frame.h:604
wxChoice * m_gridSelectBox
Definition: draw_frame.h:151
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
void SetPresetGrid(int aIndex)
Change the grid size to one of the preset values.
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...

References dummy(), ID_POPUP_GRID_LEVEL_100, ID_POPUP_GRID_LEVEL_1000, m_gridSelectBox, OnGridSettings(), OnUpdateSelectGrid(), and SetPresetGrid().

Referenced by PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), PCB_BASE_FRAME::SetNextGrid(), and PCB_BASE_FRAME::SetPrevGrid().

◆ OnSelectUnits()

void EDA_DRAW_FRAME::OnSelectUnits ( wxCommandEvent &  aEvent)

Definition at line 385 of file legacy_gal/eda_draw_frame.cpp.

386 {
387  if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && m_UserUnits != MILLIMETRES )
388  {
391  }
392  else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && m_UserUnits != INCHES )
393  {
396  }
397 }
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: common.h:161
virtual void unitsChangeRefresh()
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:123

References ID_TB_OPTIONS_SELECT_UNIT_INCH, ID_TB_OPTIONS_SELECT_UNIT_MM, INCHES, m_UserUnits, MILLIMETRES, and unitsChangeRefresh().

◆ OnSelectZoom()

void EDA_DRAW_FRAME::OnSelectZoom ( wxCommandEvent &  event)
virtual

Set the zoom factor when selected by the zoom list box in the main tool bar.

Note
List position 0 is fit to page List position >= 1 = zoom (1 to zoom max) Last list position is custom zoom not in zoom list.

Definition at line 565 of file legacy_gal/eda_draw_frame.cpp.

566 {
567  if( m_zoomSelectBox == NULL )
568  return; // Should not happen!
569 
570  int id = m_zoomSelectBox->GetCurrentSelection();
571 
572  if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
573  return;
574 
575  if( id == 0 ) // Auto zoom (Fit in Page)
576  {
577  Zoom_Automatique( true );
578  }
579  else
580  {
581  double selectedZoom = GetScreen()->m_ZoomList[id-1];
582 
583  if( GetScreen()->GetZoom() == selectedZoom )
584  return;
585 
586  GetScreen()->SetZoom( selectedZoom );
588  }
589 
590  // Notify GAL
591  TOOL_MANAGER* mgr = GetToolManager();
592 
593  if( mgr && IsGalCanvasActive() )
594  {
595  mgr->RunAction( "common.Control.zoomPreset", true, id );
596  UpdateStatusBar();
597  }
598 }
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
TOOL_MANAGER * GetToolManager() const
Return the tool manager instance, if any.
Definition: draw_frame.h:941
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 void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
const wxPoint & GetScrollCenterPosition() const
wxChoice * m_zoomSelectBox
Definition: draw_frame.h:152
virtual bool SetZoom(double iu_per_du)
Function SetZoom adjusts the current zoom factor.
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 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
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219

References GetScreen(), GetScrollCenterPosition(), GetToolManager(), GetZoom(), IsGalCanvasActive(), BASE_SCREEN::m_ZoomList, m_zoomSelectBox, RedrawScreen(), TOOL_MANAGER::RunAction(), BASE_SCREEN::SetZoom(), UpdateStatusBar(), and Zoom_Automatique().

◆ OnSize()

void EDA_DRAW_FRAME::OnSize ( wxSizeEvent &  event)
virtual

Recalculate the size of toolbars and display panel when the frame size changes.

Reimplemented in FOOTPRINT_VIEWER_FRAME, FOOTPRINT_WIZARD_FRAME, and LIB_VIEW_FRAME.

Definition at line 640 of file legacy_gal/eda_draw_frame.cpp.

641 {
642  m_FrameSize = GetClientSize( );
643 
644  SizeEv.Skip();
645 }

References EDA_BASE_FRAME::m_FrameSize.

◆ OnSockRequest()

void EDA_DRAW_FRAME::OnSockRequest ( wxSocketEvent &  evt)

Definition at line 71 of file eda_dde.cpp.

72 {
73  size_t len;
74  wxSocketBase* sock = evt.GetSocket();
75 
76  switch( evt.GetSocketEvent() )
77  {
78  case wxSOCKET_INPUT:
79  sock->Read( client_ipc_buffer, 1 );
80 
81  if( sock->LastCount() == 0 )
82  break; // No data, occurs on opening connection
83 
84  sock->Read( client_ipc_buffer + 1, IPC_BUF_SIZE - 2 );
85  len = 1 + sock->LastCount();
86  client_ipc_buffer[len] = 0;
88  break;
89 
90  case wxSOCKET_LOST:
91  return;
92  break;
93 
94  default:
95  wxPrintf( wxT( "EDA_DRAW_FRAME::OnSockRequest() error: Invalid event !" ) );
96  break;
97  }
98 }
#define IPC_BUF_SIZE
Definition: eda_dde.cpp:39
static char client_ipc_buffer[IPC_BUF_SIZE]
Definition: eda_dde.cpp:40
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

References client_ipc_buffer, ExecuteRemoteCommand(), and IPC_BUF_SIZE.

◆ OnSockRequestServer()

void EDA_DRAW_FRAME::OnSockRequestServer ( wxSocketEvent &  evt)

Definition at line 103 of file eda_dde.cpp.

104 {
105  wxSocketBase* socket;
106  wxSocketServer* server = (wxSocketServer*) evt.GetSocket();
107 
108  socket = server->Accept();
109 
110  if( socket == NULL )
111  return;
112 
113  m_sockets.push_back( socket );
114 
115  socket->Notify( true );
116  socket->SetEventHandler( *this, ID_EDA_SOCKET_EVENT );
117  socket->SetNotify( wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG );
118 }
std::vector< wxSocketBase * > m_sockets
interprocess communication
Definition: draw_frame.h:104

References ID_EDA_SOCKET_EVENT, and m_sockets.

◆ OnToggleCrossHairStyle()

void EDA_DRAW_FRAME::OnToggleCrossHairStyle ( wxCommandEvent &  aEvent)

Definition at line 400 of file legacy_gal/eda_draw_frame.cpp.

401 {
402  auto& galOpts = GetGalDisplayOptions();
403  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
404 
405  galOpts.NotifyChanged();
406 
407  // make sure the cursor is redrawn
408  GetCanvas()->Refresh();
409 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:953
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:395
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)

References GetCanvas(), GetGalDisplayOptions(), and EDA_DRAW_PANEL::Refresh().

◆ OnToggleGridState()

void EDA_DRAW_FRAME::OnToggleGridState ( wxCommandEvent &  aEvent)

Definition at line 339 of file legacy_gal/eda_draw_frame.cpp.

340 {
342 
343  if( IsGalCanvasActive() )
344  {
347  }
348 
349  m_canvas->Refresh();
350 }
virtual bool IsGridVisible() const
Definition: draw_frame.h:535
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
Auxiliary rendering target (noncached)
Definition: definitions.h:49
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use.
Definition: draw_frame.h:928
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:596
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
virtual void SetGridVisibility(bool aVisible)
It may be overloaded by derived classes.
Definition: draw_frame.h:544
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)

References EDA_DRAW_PANEL_GAL::GetGAL(), GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetView(), IsGalCanvasActive(), IsGridVisible(), m_canvas, KIGFX::VIEW::MarkTargetDirty(), EDA_DRAW_PANEL::Refresh(), SetGridVisibility(), KIGFX::GAL::SetGridVisibility(), and KIGFX::TARGET_NONCACHED.

◆ OnUpdateCrossHairStyle()

void EDA_DRAW_FRAME::OnUpdateCrossHairStyle ( wxUpdateUIEvent &  aEvent)

Definition at line 470 of file legacy_gal/eda_draw_frame.cpp.

471 {
472  aEvent.Check( GetGalDisplayOptions().m_fullscreenCursor );
473 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:953

References GetGalDisplayOptions().

◆ OnUpdateGrid()

void EDA_DRAW_FRAME::OnUpdateGrid ( wxUpdateUIEvent &  aEvent)

Definition at line 438 of file legacy_gal/eda_draw_frame.cpp.

439 {
440  wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
441 
442  aEvent.Check( IsGridVisible() );
443  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
444 }
virtual bool IsGridVisible() const
Definition: draw_frame.h:535
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:163

References ID_TB_OPTIONS_SHOW_GRID, IsGridVisible(), and m_optionsToolBar.

◆ OnUpdateRedo()

void EDA_DRAW_FRAME::OnUpdateRedo ( wxUpdateUIEvent &  aEvent)

Definition at line 419 of file legacy_gal/eda_draw_frame.cpp.

420 {
421  if( GetScreen() )
422  aEvent.Enable( GetScreen()->GetRedoCommandCount() > 0 );
423 }
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References GetScreen().

◆ OnUpdateSelectGrid()

void EDA_DRAW_FRAME::OnUpdateSelectGrid ( wxUpdateUIEvent &  aEvent)

Definition at line 447 of file legacy_gal/eda_draw_frame.cpp.

448 {
449  // No need to update the grid select box if it doesn't exist or the grid setting change
450  // was made using the select box.
451  if( m_gridSelectBox == NULL || m_auxiliaryToolBar == NULL )
452  return;
453 
454  int select = wxNOT_FOUND;
455 
456  for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
457  {
458  if( GetScreen()->GetGridCmdId() == GetScreen()->GetGrid( i ).m_CmdId )
459  {
460  select = (int) i;
461  break;
462  }
463  }
464 
465  if( select != m_gridSelectBox->GetSelection() )
466  m_gridSelectBox->SetSelection( select );
467 }
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
wxChoice * m_gridSelectBox
Definition: draw_frame.h:151
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
size_t i
Definition: json11.cpp:597
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int m_CmdId
Definition: base_screen.h:48
int GetGridCmdId() const
Return the command ID of the currently selected grid.
Definition: base_screen.h:403
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References BASE_SCREEN::GetGrid(), BASE_SCREEN::GetGridCmdId(), BASE_SCREEN::GetGridCount(), GetScreen(), i, m_auxiliaryToolBar, GRID_TYPE::m_CmdId, and m_gridSelectBox.

Referenced by OnSelectGrid().

◆ OnUpdateUndo()

void EDA_DRAW_FRAME::OnUpdateUndo ( wxUpdateUIEvent &  aEvent)

Definition at line 412 of file legacy_gal/eda_draw_frame.cpp.

413 {
414  if( GetScreen() )
415  aEvent.Enable( GetScreen()->GetUndoCommandCount() > 0 );
416 }
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References GetScreen().

◆ OnUpdateUnits()

void EDA_DRAW_FRAME::OnUpdateUnits ( wxUpdateUIEvent &  aEvent)

Definition at line 426 of file legacy_gal/eda_draw_frame.cpp.

427 {
428  bool enable;
429 
430  enable = ( ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM) && (m_UserUnits == MILLIMETRES))
431  || ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH) && (m_UserUnits == INCHES)) );
432 
433  aEvent.Check( enable );
434  DisplayUnitsMsg();
435 }
void DisplayUnitsMsg()
Display current unit pane on the status bar.
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: common.h:161
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:123

References DisplayUnitsMsg(), ID_TB_OPTIONS_SELECT_UNIT_INCH, ID_TB_OPTIONS_SELECT_UNIT_MM, INCHES, m_UserUnits, and MILLIMETRES.

◆ OnZoom()

void EDA_DRAW_FRAME::OnZoom ( wxCommandEvent &  event)
virtual

Definition at line 1401 of file legacy_gal/eda_draw_frame.cpp.

1402 {
1403  if( m_canvas == NULL )
1404  return;
1405 
1406  int id = event.GetId();
1407  bool warp_cursor = false;
1408  VECTOR2D cpos = GetCrossHairPosition();//GetGalCanvas()->GetViewControls()->GetCursorPosition();
1409  wxPoint zoom_center( (int)cpos.x, (int)cpos.y );
1410 
1411  if ( id == ID_KEY_ZOOM_IN )
1412  {
1413  id = GetCanvas()->GetEnableZoomNoCenter() ?
1415  }
1416  else if ( id == ID_KEY_ZOOM_OUT )
1417  {
1418  id = GetCanvas()->GetEnableZoomNoCenter() ?
1420  }
1421 
1422  switch( id )
1423  {
1424  case ID_OFFCENTER_ZOOM_IN:
1425  SetPreviousZoomAndRedraw( zoom_center,warp_cursor );
1426  break;
1427 
1428  case ID_POPUP_ZOOM_IN:
1429  warp_cursor = true;
1430  // fall thru
1431  case ID_VIEWER_ZOOM_IN:
1432  case ID_ZOOM_IN:
1433  SetPreviousZoomAndRedraw( zoom_center,warp_cursor );
1434  break;
1435 
1436  case ID_OFFCENTER_ZOOM_OUT:
1437  SetNextZoomAndRedraw( zoom_center, warp_cursor );
1438  break;
1439 
1440  case ID_POPUP_ZOOM_OUT:
1441  warp_cursor = true;
1442  // fall thru
1443  case ID_VIEWER_ZOOM_OUT:
1444  case ID_ZOOM_OUT:
1445  SetNextZoomAndRedraw( zoom_center, warp_cursor );
1446  break;
1447 
1448  case ID_VIEWER_ZOOM_REDRAW:
1449  case ID_POPUP_ZOOM_REDRAW:
1450  case ID_ZOOM_REDRAW:
1451  // This usually means something went wrong. Do a hard refresh.
1452  HardRedraw();
1453  break;
1454 
1455  case ID_POPUP_ZOOM_CENTER:
1456  GetGalCanvas()->GetView()->SetScale( GetGalCanvas()->GetView()->GetScale(), zoom_center );
1458  break;
1459 
1460  case ID_POPUP_ZOOM_PAGE:
1461  case ID_VIEWER_ZOOM_PAGE:
1462  case ID_ZOOM_PAGE:
1463  Zoom_Automatique( false );
1464  break;
1465 
1466  case ID_POPUP_ZOOM_SELECT:
1467  break;
1468 
1469  case ID_POPUP_CANCEL:
1471  break;
1472 
1473  default:
1475  }
1476 
1477  UpdateStatusBar();
1478 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
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...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
Definition: id.h:241
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
void SetScale(double aScale)
Function SetScale() Sets the scaling factor.
Definition: view.h:250
virtual void CenterOnCursor() const =0
Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the curso...
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.
bool GetEnableZoomNoCenter() const
void SetPresetZoom(int aIndex)
Change zoom to one of the preset values.
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:395
virtual void HardRedraw()
Rebuild the GAL and redraws the screen.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void UpdateStatusBar()
Update the status bar information.
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.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References KIGFX::VIEW_CONTROLS::CenterOnCursor(), GetCanvas(), GetCrossHairPosition(), EDA_DRAW_PANEL::GetEnableZoomNoCenter(), GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), HardRedraw(), ID_KEY_ZOOM_IN, ID_KEY_ZOOM_OUT, ID_OFFCENTER_ZOOM_IN, ID_OFFCENTER_ZOOM_OUT, ID_POPUP_CANCEL, ID_POPUP_ZOOM_CENTER, ID_POPUP_ZOOM_IN, ID_POPUP_ZOOM_LEVEL_START, ID_POPUP_ZOOM_OUT, ID_POPUP_ZOOM_PAGE, ID_POPUP_ZOOM_REDRAW, ID_POPUP_ZOOM_SELECT, ID_VIEWER_ZOOM_IN, ID_VIEWER_ZOOM_OUT, ID_VIEWER_ZOOM_PAGE, ID_VIEWER_ZOOM_REDRAW, ID_ZOOM_IN, ID_ZOOM_OUT, ID_ZOOM_PAGE, ID_ZOOM_REDRAW, m_canvas, EDA_DRAW_PANEL::MoveCursorToCrossHair(), SetNextZoomAndRedraw(), SetPresetZoom(), SetPreviousZoomAndRedraw(), KIGFX::VIEW::SetScale(), UpdateStatusBar(), VECTOR2< T >::x, VECTOR2< T >::y, and Zoom_Automatique().

◆ OpenProjectFiles()

VTBL_ENTRY bool KIWAY_PLAYER::OpenProjectFiles ( const std::vector< wxString > &  aFileList,
int  aCtl = 0 
)
inlineinherited

Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList.

This is generalized in the direction of worst case. In a typical case aFileList will only hold a single file, like "myboard.kicad_pcb", because any KIWAY_PLAYER is only in one KIWAY and the KIWAY owns the PROJECT. Therefore opening files from multiple projects into the same KIWAY_PLAYER is precluded.

Each derived class should handle this in a way specific to its needs. No filename prompting is done inside here for any file or project. There should be no need to call this with aFileList which is empty. However, calling it with a single filename which does not exist should indicate to the implementor that a new session is being started and that the given name is the desired name for the data file at time of save.

This function does not support "appending". Use a different function for that. Any prior project data tree should be cleared before loading the new stuff.

Therefore, one of the first things an implementation should do is test for existence of the first file in the list, and if it does not exist, treat it as a new session, possibly with a UI notification to that effect.

After loading the window should update its Title as part of this operation. If the KIWAY_PLAYER needs to, it can load the *.pro file as part of this operation.

If the KIWAY_PLAYER cannot load any of the file(s) in the list, then it should say why through some GUI interface, and return false.

Parameters
aFileListincludes files that this frame should open according to the knowledge in the derived wxFrame. In almost every case, the list will have only a single file in it.
aCtlis a set of bit flags ORed together from the set of KICTL_* #defined above.
Returns
bool - true if all requested files were opened OK, else false.

Definition at line 179 of file kiway_player.h.

180  {
181  // overload me for your wxFrame type.
182 
183  // Any overload should probably do this also:
184  // Prj().MaybeLoadProjectSettings();
185 
186  // Then update the window title.
187 
188  return false;
189  }

Referenced by SCH_EDIT_FRAME::doUpdatePcb(), PGM_SINGLE_TOP::MacOpenFile(), SCH_EDIT_FRAME::OnOpenPcbnew(), PGM_SINGLE_TOP::OnPgmInit(), PCB_EDIT_FRAME::OnRunEeschema(), PCB_EDIT_FRAME::OnUpdatePCBFromSch(), KICAD_MANAGER_FRAME::RunEeschema(), and KICAD_MANAGER_FRAME::RunPcbNew().

◆ PostCommandMenuEvent()

bool EDA_BASE_FRAME::PostCommandMenuEvent ( int  evt_type)
inherited

Function PostCommandMenuEvent.

Post a menu event to the frame, which can be used to trigger actions bound to menu items.

Definition at line 648 of file eda_base_frame.cpp.

649 {
650  if( evt_type != 0 )
651  {
652  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
653  evt.SetEventObject( this );
654  evt.SetId( evt_type );
655  wxPostEvent( this, evt );
656  return true;
657  }
658 
659  return false;
660 }

Referenced by FOOTPRINT_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact(), and FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem().

◆ PrintMsg()

void EDA_BASE_FRAME::PrintMsg ( const wxString &  text)
inherited

Definition at line 381 of file eda_base_frame.cpp.

382 {
383  SetStatusText( text );
384 }

◆ PrintPage()

void EDA_DRAW_FRAME::PrintPage ( wxDC *  aDC,
LSET  aPrintMask,
bool  aPrintMirrorMode,
void *  aData = NULL 
)
virtual

Print the page pointed by current screen, set by the calling print function.

Parameters
aDC= wxDC given by the calling print function
aPrintMask= not used here
aPrintMirrorMode= not used here (Set when printing in mirror mode)
aData= a pointer on an auxiliary data (not always used, NULL if not used)

Reimplemented in SCH_EDIT_FRAME, LIB_EDIT_FRAME, and PL_EDITOR_FRAME.

Definition at line 509 of file legacy_gal/eda_draw_frame.cpp.

510 {
511  wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
512 }

Referenced by DrawPageOnClipboard().

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::doUpdatePcb(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), LIB_EDIT_FRAME::KiwayMailIn(), LibraryFileBrowser(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), SCH_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnConfigurePaths(), FOOTPRINT_EDIT_FRAME::OnConfigurePaths(), KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLoadProject(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbModuleEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), SCH_EDIT_FRAME::OnPrint(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), KICAD_MANAGER_FRAME::OnRunGerbview(), DIALOG_BOM::OnRunPlugin(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), KICAD_MANAGER_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::PrintPage(), SCH_EDIT_FRAME::Process_Config(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::saveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), KICAD_MANAGER_FRAME::SetProjectFileName(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::UpdateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ Process_PageSettings()

void EDA_DRAW_FRAME::Process_PageSettings ( wxCommandEvent &  event)

Definition at line 82 of file dialog_page_settings.cpp.

83 {
84  FRAME_T smallSizeFrames[] =
85  {
90  };
91 
92  // Fix the max page size: it is MAX_PAGE_SIZE_EDITORS
93  // or MAX_PAGE_SIZE_PCBNEW for Pcbnew draw frames, due to the small internal
94  // units that do not allow too large draw areas
96 
97  for( unsigned ii = 0; ii < arrayDim( smallSizeFrames ); ii++ )
98  {
99  if( IsType( smallSizeFrames[ii] ) )
100  {
101  maxPageSize.x = maxPageSize.y = MAX_PAGE_SIZE_PCBNEW_MILS;
102  break;
103  }
104  }
105 
106  DIALOG_PAGES_SETTINGS dlg( this, maxPageSize );
107  dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName );
108 
109  if( dlg.ShowModal() == wxID_OK )
110  {
111 #ifdef EESCHEMA
112  RedrawScreen( wxPoint( 0, 0 ), false );
113 #else
114  GetCanvas()->Refresh();
115 #endif
116  }
117 }
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
static wxString m_PageLayoutDescrFileName
the name of the page layout descr file, or emty to used the default pagelayout
Definition: base_screen.h:180
#define MAX_PAGE_SIZE_PCBNEW_MILS
Definition: page_info.h:40
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:395
#define MAX_PAGE_SIZE_EDITORS_MILS
Definition: page_info.h:41
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:99
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...
bool IsType(FRAME_T aType) const
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)

References arrayDim(), FRAME_CVPCB_DISPLAY, FRAME_PCB, FRAME_PCB_FOOTPRINT_PREVIEW, FRAME_PCB_FOOTPRINT_WIZARD, FRAME_PCB_MODULE_EDITOR, FRAME_PCB_MODULE_VIEWER, FRAME_PCB_MODULE_VIEWER_MODAL, GetCanvas(), EDA_BASE_FRAME::IsType(), BASE_SCREEN::m_PageLayoutDescrFileName, MAX_PAGE_SIZE_EDITORS_MILS, MAX_PAGE_SIZE_PCBNEW_MILS, RedrawScreen(), EDA_DRAW_PANEL::Refresh(), and DIALOG_PAGES_SETTINGS::SetWksFileName().

◆ ProcessEvent()

bool EDA_BASE_FRAME::ProcessEvent ( wxEvent &  aEvent)
overrideinherited

Function ProcessEvent overrides the default process event handler to implement the auto save feature.

Warning
If you override this function in a derived class, make sure you call down to this or the auto save feature will be disabled.

Definition at line 158 of file eda_base_frame.cpp.

159 {
160 #ifdef __WXMAC__
161  // Apple in its infinite wisdom will raise a disabled window before even passing
162  // us the event, so we have no way to stop it. Instead, we have to catch an
163  // improperly ordered disabled window and quasi-modal dialog here and reorder
164  // them.
165  if( !IsEnabled() && IsActive() )
166  {
167  wxWindow* dlg = findQuasiModalDialog();
168  if( dlg )
169  dlg->Raise();
170  }
171 #endif
172 
173  if( !wxFrame::ProcessEvent( aEvent ) )
174  return false;
175 
176  if( IsShown() && m_hasAutoSave && IsActive() &&
178  {
179  if( !m_autoSaveState )
180  {
181  wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
182  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
183  m_autoSaveState = true;
184  }
185  else if( m_autoSaveTimer->IsRunning() )
186  {
187  wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
188  m_autoSaveTimer->Stop();
189  m_autoSaveState = false;
190  }
191  }
192 
193  return true;
194 }
bool m_autoSaveState
Flag to indicate the last auto save state.
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
virtual bool isAutoSaveRequired() const
Function autoSaveRequired returns the auto save status of the application.
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
wxWindow * findQuasiModalDialog()
bool m_hasAutoSave
Flag to indicate if this frame supports auto save.
int m_autoSaveInterval
The auto save interval time in seconds.

References EDA_BASE_FRAME::findQuasiModalDialog(), EDA_BASE_FRAME::isAutoSaveRequired(), EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_autoSaveState, EDA_BASE_FRAME::m_autoSaveTimer, EDA_BASE_FRAME::m_hasAutoSave, and traceAutoSave.

Referenced by STATUS_POPUP::onCharHook(), LIB_VIEW_FRAME::onSelectNextSymbol(), LIB_VIEW_FRAME::onSelectPreviousSymbol(), KIWAY::ProcessEvent(), LIB_VIEW_FRAME::ReCreateListCmp(), CVPCB_CONTROL::SwitchUnits(), GERBVIEW_CONTROL::SwitchUnits(), and PCBNEW_CONTROL::SwitchUnits().

◆ PushPreferences()

void EDA_DRAW_FRAME::PushPreferences ( const EDA_DRAW_PANEL aParentCanvas)

Push preferences from a parent window to a child window.

(i.e. from eeschema to schematic symbol editor)

Parameters
aParentCanvasis the parent canvas to push preferences from.

Definition at line 931 of file legacy_gal/eda_draw_frame.cpp.

932 {
934  m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
935 }
virtual void SetEnableZoomNoCenter(bool aEnable)
bool GetEnableZoomNoCenter() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
virtual void SetEnableAutoPan(bool aEnable)

References EDA_DRAW_PANEL::GetEnableAutoPan(), EDA_DRAW_PANEL::GetEnableZoomNoCenter(), m_canvas, EDA_DRAW_PANEL::SetEnableAutoPan(), and EDA_DRAW_PANEL::SetEnableZoomNoCenter().

Referenced by SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_BASE_FRAME::OnOpenLibraryViewer(), and PCB_EDIT_FRAME::Process_Special_Functions().

◆ ReCreateAuxiliaryToolbar()

void EDA_DRAW_FRAME::ReCreateAuxiliaryToolbar ( )
virtual

◆ ReCreateHToolbar()

◆ ReCreateMenuBar()

void EDA_DRAW_FRAME::ReCreateMenuBar ( void  )
overridevirtual

Function ReCreateMenuBar Creates recreates the menu bar.

Needed when the language is changed

Reimplemented from EDA_BASE_FRAME.

Reimplemented in PCB_EDIT_FRAME, SCH_EDIT_FRAME, GERBVIEW_FRAME, LIB_EDIT_FRAME, PCB_BASE_FRAME, PL_EDITOR_FRAME, FOOTPRINT_EDIT_FRAME, FOOTPRINT_VIEWER_FRAME, and LIB_VIEW_FRAME.

Definition at line 481 of file legacy_gal/eda_draw_frame.cpp.

482 {
483 }

◆ ReCreateVToolbar()

◆ RedrawActiveWindow()

virtual void EDA_DRAW_FRAME::RedrawActiveWindow ( wxDC *  DC,
bool  EraseBg 
)
pure virtual

◆ RedrawScreen()

void EDA_DRAW_FRAME::RedrawScreen ( const wxPoint &  aCenterPoint,
bool  aWarpPointer 
)
virtual

Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen.

Parameters
aCenterPointThe position in logical units to center the scroll bars.
aWarpPointerMoves the mouse cursor to aCenterPoint if true.

Reimplemented in SCH_BASE_FRAME.

Definition at line 1359 of file legacy_gal/eda_draw_frame.cpp.

1360 {
1361 }

Referenced by CVPCB_MAINFRAME::DisplayModule(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PL_EDITOR_FRAME::MoveItem(), EDA_DRAW_PANEL::OnMouseEvent(), EDA_DRAW_PANEL::OnMouseWheel(), OnSelectZoom(), Process_PageSettings(), SetNextZoomAndRedraw(), SetPresetZoom(), and SetPreviousZoomAndRedraw().

◆ RedrawScreen2()

void EDA_DRAW_FRAME::RedrawScreen2 ( const wxPoint &  posBefore)
virtual

Put the crosshair back to the screen position it had before zooming.

Parameters
posBeforescreen position of the crosshair before zooming

Reimplemented in SCH_BASE_FRAME.

Definition at line 1364 of file legacy_gal/eda_draw_frame.cpp.

1365 {
1366 }

◆ RefPos()

wxPoint EDA_DRAW_FRAME::RefPos ( bool  useMouse) const

Return the reference position, coming from either the mouse position or the cursor position.

Parameters
useMouseIf true, return mouse position, else cursor's.
Returns
wxPoint - The reference point, either the mouse position or the cursor position.

Definition at line 1192 of file legacy_gal/eda_draw_frame.cpp.

1193 {
1194  BASE_SCREEN* screen = GetScreen(); // virtual call
1195  return screen->refPos( useMouse );
1196 }
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
wxPoint refPos(bool useMouse) const
Function RefPos Return the reference position, coming from either the mouse position or the cursor po...
Definition: base_screen.h:168
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References GetScreen(), and BASE_SCREEN::refPos().

Referenced by PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::GeneralControl(), Magnetize(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), EDA_DRAW_PANEL::OnMouseEvent(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), PushTrack(), PCB_EDIT_FRAME::SelectHighLight(), and SetPresetGrid().

◆ RefreshCrossHair()

void EDA_DRAW_FRAME::RefreshCrossHair ( const wxPoint &  aOldPos,
const wxPoint &  aEvtPos,
wxDC *  aDC 
)
protected

Move and refresh the crosshair after movement and call the mouse capture function.

Definition at line 1214 of file legacy_gal/eda_draw_frame.cpp.

1217 {
1218  wxFAIL_MSG( "shouldn't be using RefreshCrossHair() anymore; use CallMouseCapture() directly" );
1219 
1220  // CrossHair is no longer XORed; no need for most of this
1221 #if 0
1222  wxPoint newpos = GetCrossHairPosition();
1223 
1224 
1225  // Redraw the crosshair if it moved
1226  if( aOldPos != newpos )
1227  {
1228  SetCrossHairPosition( aOldPos, false );
1229  m_canvas->CrossHairOff( aDC );
1230  SetCrossHairPosition( newpos, false );
1231  m_canvas->CrossHairOn( aDC );
1232 #endif
1233  if( m_canvas->IsMouseCaptured() )
1234  {
1235  m_canvas->CallMouseCapture( aDC, aEvtPos, true );
1236  }
1237 #if 0
1238  }
1239 #endif
1240 }
virtual void CrossHairOn(wxDC *DC=nullptr)
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
virtual void CrossHairOff(wxDC *DC=nullptr)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References EDA_DRAW_PANEL::CallMouseCapture(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), GetCrossHairPosition(), EDA_DRAW_PANEL::IsMouseCaptured(), m_canvas, and SetCrossHairPosition().

Referenced by DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), and PCB_EDIT_FRAME::GeneralControl().

◆ ReleaseFile()

void EDA_DRAW_FRAME::ReleaseFile ( )

Release the current file marked in use.

See m_file_checker.

Definition at line 252 of file legacy_gal/eda_draw_frame.cpp.

253 {
254  m_file_checker = nullptr;
255 }
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:106

References m_file_checker.

Referenced by ~EDA_DRAW_FRAME().

◆ saveCanvasImageToFile()

bool EDA_DRAW_FRAME::saveCanvasImageToFile ( const wxString &  aFileName,
wxBitmapType  aBitmapType = wxBITMAP_TYPE_PNG 
)
protected

Definition at line 1903 of file legacy_gal/eda_draw_frame.cpp.

1904 {
1905  return SaveCanvasImageToFile( this, aFileName, aBitmapType );
1906 }
bool SaveCanvasImageToFile(EDA_DRAW_FRAME *aFrame, const wxString &aFileName, wxBitmapType aBitmapType)
Save the current view as an image file.
Definition: bitmap.cpp:195

References SaveCanvasImageToFile().

Referenced by LIB_EDIT_FRAME::CreateImageFile(), and FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng().

◆ saveCanvasTypeSetting()

bool EDA_DRAW_FRAME::saveCanvasTypeSetting ( EDA_DRAW_PANEL_GAL::GAL_TYPE  aCanvasType)
protected

Stores the canvas type in the application settings.

Definition at line 1101 of file legacy_gal/eda_draw_frame.cpp.

1102 {
1103  // Not all classes derived from EDA_DRAW_FRAME can save the canvas type, because some
1104  // have a fixed type, or do not have a option to set the canvas type (they inherit from
1105  // a parent frame)
1106  FRAME_T allowed_frames[] =
1107  {
1109  };
1110 
1111  bool allow_save = false;
1112 
1113  for( int ii = 0; ii < 3; ii++ )
1114  {
1115  if( m_Ident == allowed_frames[ii] )
1116  {
1117  allow_save = true;
1118  break;
1119  }
1120  }
1121 
1122  if( !allow_save )
1123  return false;
1124 
1125  if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1126  || aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1127  {
1128  wxASSERT( false );
1129  return false;
1130  }
1131 
1132  wxConfigBase* cfg = Kiface().KifaceSettings();
1133 
1134  if( cfg )
1135  return cfg->Write( GetCanvasTypeKey(), (long) aCanvasType );
1136 
1137  return false;
1138 }
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
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
virtual wxString GetCanvasTypeKey()
Definition: draw_frame.h:241
Sentinel, do not use as a parameter.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
GAL not used (the legacy wxDC engine is used)
FRAME_T m_Ident
Id Type (pcb, schematic, library..)

References FRAME_PCB, FRAME_PCB_MODULE_EDITOR, FRAME_SCH, EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, GetCanvasTypeKey(), Kiface(), KIFACE_I::KifaceSettings(), and EDA_BASE_FRAME::m_Ident.

Referenced by GERBVIEW_FRAME::GERBVIEW_FRAME(), and ~EDA_DRAW_FRAME().

◆ SaveProjectSettings()

virtual void EDA_BASE_FRAME::SaveProjectSettings ( bool  aAskForSave)
inlinevirtualinherited

Function SaveProjectSettings saves changes to the project settings to the project (.pro) file.

The method is virtual so you can override it to call the suitable save method. The base method do nothing

Parameters
aAskForSave= true to open a dialog before saving the settings

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 289 of file eda_base_frame.h.

289 {};

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick().

◆ SaveSettings()

void EDA_DRAW_FRAME::SaveSettings ( wxConfigBase *  aCfg)
overridevirtual

Function SaveSettings saves common frame parameters to a configuration data file.

Don't forget to call the base class's SaveSettings() from your derived SaveSettings() otherwise the frames won't remember their positions and sizes.

Reimplemented from EDA_BASE_FRAME.

Reimplemented in PCB_BASE_FRAME.

Definition at line 859 of file legacy_gal/eda_draw_frame.cpp.

860 {
862 
863  wxString baseCfgName = ConfigBaseName();
864 
865  aCfg->Write( baseCfgName + UserUnitsEntryKeyword, (int) m_UserUnits );
866  aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
867  aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
868  aCfg->Write( baseCfgName + FirstRunShownKeyword, m_firstRunDialogSetting );
869 
870  if( GetScreen() )
871  aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) );
872 
874 }
static const wxString FirstRunShownKeyword(wxT("FirstRunShown"))
static const wxString MaxUndoItemsEntry(wxT("DevelMaxUndoItems"))
Integer to set the maximum number of undo items on the stack.
#define LastGridSizeIdKeyword
Most recently used grid size (suffix)
Definition: draw_frame.h:69
virtual bool IsGridVisible() const
Definition: draw_frame.h:535
virtual void SaveSettings(wxConfigBase *aCfg)
Function SaveSettings saves common frame parameters to a configuration data file.
wxString ConfigBaseName()
Function ConfigBaseName.
#define UserUnitsEntryKeyword
User units.
Definition: draw_frame.h:63
#define GAL_DISPLAY_OPTIONS_KEY
Definition: pgm_base.h:53
int m_LastGridSizeId
Definition: draw_frame.h:110