KiCad PCB EDA Suite
EDA_DRAW_FRAME Class Referenceabstract

Class EDA_DRAW_FRAME is 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 ()
 
bool LockFile (const wxString &aFileName)
 Function LockFile marks a schematic file as being in use. More...
 
void ReleaseFile ()
 Function 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
 Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
virtual const wxPointGetAuxOrigin () const =0
 Function GetAuxOrigin returns the origin of the axis used for plotting and various exports. More...
 
virtual void SetAuxOrigin (const wxPoint &aPosition)=0
 
virtual const wxPointGetGridOrigin () const =0
 Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid. More...
 
virtual void SetGridOrigin (const wxPoint &aPosition)=0
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Function GetCursorPosition returns the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Function GetNearestGridPosition returns the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Function GetCursorScreenPosition returns the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Function RefPos Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () 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)
 
EDA_DRAW_PANELGetCanvas ()
 
virtual wxString GetScreenDesc () const
 
virtual BASE_SCREENGetScreen () const
 Function GetScreen returns 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 ()
 function 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
 Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping. More...
 
virtual EDA_HOTKEYGetHotKeyDescription (int aCommand) const =0
 Function GetHotKeyDescription Searches 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)
 Function AddMenuZoomAndGrid (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. More...
 
virtual const wxString GetZoomLevelIndicator () const
 Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs. More...
 
double GetZoomLevelCoeff () const
 Function GetZoomLevelCoeff returns 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
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg)
 Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 Function IsGridVisible() , virtual. More...
 
virtual void SetGridVisibility (bool aVisible)
 Function SetGridVisibility() , virtual It may be overloaded by derived classes. More...
 
virtual COLOR4D GetGridColor ()
 Function GetGridColor() , virtual. More...
 
virtual void SetGridColor (COLOR4D aColor)
 Function SetGridColor() , virtual. More...
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Function SetNextGrid() changes the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Function SetPresetGrid() changes 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 OnSelectZoom (wxCommandEvent &event)
 Functions OnSelectZoom sets 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 OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0)
 Function GeneralControl performs application specific control using aDC at aPosition in logical units. More...
 
virtual void OnSize (wxSizeEvent &event)
 Function OnSize recalculates the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 Function OnZoom Called from any zoom event (toolbar , hotkey or popup ) More...
 
void SetNextZoom ()
 Function SetNextZoom() changes the zoom to the next one available. More...
 
void SetPrevZoom ()
 Function SetPrevZoom() changes the zoom to the previous one available. More...
 
void SetPresetZoom (int aIndex)
 Function SetPresetZoom() changes zoom to one of the preset values. More...
 
void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
void RedrawScreen2 (const wxPoint &posBefore)
 Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming. More...
 
void Zoom_Automatique (bool aWarpPointer)
 Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void Window_Zoom (EDA_RECT &Rect)
 Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window screen. More...
 
virtual double BestZoom ()=0
 Return the zoom level which displays the full page on screen. More...
 
double GetZoom ()
 Function GetZoom. More...
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions. 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 OnActivate (wxActivateEvent &event)
 Function OnActivate (virtual) is called when activating the frame. More...
 
virtual void UpdateStatusBar ()
 Function UpdateStatusBar updates the status bar information. More...
 
void DisplayUnitsMsg ()
 Function DisplayUnitsMsg displays 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)
 Function BlockCommand Returns 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)
 Function HandleBlockPlace( ) 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)
 Function HandleBlockEnd( ) Handle the "end" of a block command, i.e. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Function CopyToClipboard copies the current page or the current block to the clipboard. More...
 
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)
 Function SetMsgPanel clears the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Function UpdateMsgPanel redraws the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Function PushPreferences Pushes a few preferences from a parent window to a child window. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL)
 Function PrintPage used to print a page Print the page pointed by current screen, set by the calling print function. More...
 
wxString CoordinateToString (int aValue, bool aConvertToMils=false) const
 Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting. More...
 
wxString LengthDoubleToString (double aValue, bool aConvertToMils=false) const
 Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting. More...
 
virtual void UseGalCanvas (bool aEnable)
 Function UseGalCanvas used to switch between standard and GAL-based canvas. 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
 Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Function GetToolManager returns the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering. More...
 
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...
 
bool Enable (bool enable) override
 
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)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
int ReadHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys. More...
 
int ReadHotkeyConfigFile (const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys. 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, const wxString &aBackupFileExtension)
 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...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. 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

void SetScreen (BASE_SCREEN *aScreen)
 
virtual void unitsChangeRefresh ()
 Function unitsChangeRefresh is 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...
 
virtual void forceColorsToLegacy ()
 Helper function to coerce all colors to legacy-compatible when switching from GAL to legacy canvas. More...
 
void GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Function GeneralControlKeyMovement 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
 
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting () const
 Returns the canvas type stored in the application settings. More...
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
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 OnChangeIconsOptions (wxCommandEvent &event) override
 Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars 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 ()
 

Protected Attributes

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_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...
 
wxChoice * m_gridSelectBox
 Choice box to choose the grid size. More...
 
wxChoice * m_zoomSelectBox
 Choice box to choose the zoom value. 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...
 
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 const wxChar CANVAS_TYPE_KEY [] = wxT( "canvas_type" )
 

Key in KifaceSettings to store the canvas type.

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...
 
bool m_galCanvasActive
 whether to use new GAL engine More...
 
EDA_DRAW_PANEL_GALm_galCanvas
 GAL display options - this is the frame's interface to setting GAL display options. More...
 
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONSm_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

Class EDA_DRAW_FRAME is 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 54 of file draw_frame.h.

Constructor & Destructor Documentation

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 127 of file draw_frame.cpp.

References BLACK, DARKGRAY, DIM, EDA_MSG_PANEL::GetRequiredHeight(), GetTextSize(), ID_NO_TOOL_SELECTED, and LIGHTGRAY.

131  :
132  KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
133  m_galDisplayOptions( std::make_unique<KIGFX::GAL_DISPLAY_OPTIONS>() )
134 {
135  m_drawToolBar = NULL;
136  m_optionsToolBar = NULL;
137  m_gridSelectBox = NULL;
138  m_zoomSelectBox = NULL;
139  m_hotkeysDescrList = NULL;
140 
141  m_canvas = NULL;
142  m_galCanvas = NULL;
143  m_galCanvasActive = false;
144  m_actions = NULL;
145  m_toolManager = NULL;
146  m_toolDispatcher = NULL;
147  m_messagePanel = NULL;
148  m_currentScreen = NULL;
151  m_showAxis = false; // true to draw axis.
152  m_showBorderAndTitleBlock = false; // true to display reference sheet.
153  m_showGridAxis = false; // true to draw the grid axis
154  m_showOriginAxis = false; // true to draw the grid origin
155  m_LastGridSizeId = 0;
156  m_drawGrid = true; // hide/Show grid. default = show
157  m_gridColor = COLOR4D( DARKGRAY ); // Default grid color
158  m_showPageLimits = false;
159  m_drawBgColor = COLOR4D( BLACK ); // the background color of the draw canvas:
160  // BLACK for Pcbnew, BLACK or WHITE for eeschema
161  m_snapToGrid = true;
164  m_zoomLevelCoeff = 1.0;
165 
166  m_auimgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE);
167 
168  CreateStatusBar( 6 );
169 
170  // set the size of the status bar subwindows:
171 
172  wxWindow* stsbar = GetStatusBar();
173 
174  int dims[] = {
175 
176  // remainder of status bar on far left is set to a default or whatever is left over.
177  -1,
178 
179  // When using GetTextSize() remember the width of character '1' is not the same
180  // as the width of '0' unless the font is fixed width, and it usually won't be.
181 
182  // zoom:
183  GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,
184 
185  // cursor coords
186  GetTextSize( wxT( "X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
187 
188  // delta distances
189  GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10,
190 
191  // units display, Inches is bigger than mm
192  GetTextSize( _( "Inches" ), stsbar ).x + 10,
193 
194  // Size for the panel used as "Current tool in play": will take longest string from
195  // void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) in pcbnew/edit.cpp
196  GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
197  };
198 
199  SetStatusWidths( DIM( dims ), dims );
200 
201  // Create child subwindows.
202  GetClientSize( &m_FrameSize.x, &m_FrameSize.y );
203  m_FramePos.x = m_FramePos.y = 0;
205 
206  m_canvas = new EDA_DRAW_PANEL( this, -1, wxPoint( 0, 0 ), m_FrameSize );
207  m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ),
208  wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
209 
210  m_messagePanel->SetBackgroundColour( COLOR4D( LIGHTGRAY ).ToColour() );
211 }
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:95
#define DIM(x)
of elements in an array
Definition: macros.h:98
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_galDisplayOptions
Definition: draw_frame.h:71
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:66
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:103
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:96
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aWdoName=wxFrameNameStr)
wxAuiManager m_auimgr
Definition: wxstruct.h:144
class EDA_MSG_PANEL is a panel to display various information messages.
Definition: msgpanel.h:111
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:84
wxChoice * m_gridSelectBox
Choice box to choose the grid size.
Definition: draw_frame.h:116
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:83
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Function GetTextSize returns the size of aSingleLine of text when it is rendered in aWindow using wha...
Definition: common.cpp:93
bool m_showOriginAxis
True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files.
Definition: draw_frame.h:110
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:126
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:63
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:129
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:113
wxChoice * m_zoomSelectBox
Choice box to choose the zoom value.
Definition: draw_frame.h:119
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:106
wxPoint m_FramePos
Definition: wxstruct.h:134
int m_LastGridSizeId
Definition: draw_frame.h:78
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:123
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:68
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
int m_MsgFrameHeight
Definition: draw_frame.h:131
friend class EDA_DRAW_PANEL
Let the EDA_DRAW_PANEL object have access to the protected data since it is closely tied to the EDA_D...
Definition: draw_frame.h:58
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:82
wxSize m_FrameSize
Definition: wxstruct.h:135
Definition: colors.h:45
ACTIONS * m_actions
Definition: draw_frame.h:97
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:139
int m_lastDrawToolId
Tool ID of previously active draw tool bar button.
Definition: draw_frame.h:100
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:65
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
EDA_DRAW_FRAME::~EDA_DRAW_FRAME ( )

Definition at line 214 of file draw_frame.cpp.

References m_actions, EDA_BASE_FRAME::m_auimgr, m_currentScreen, m_galCanvas, m_toolDispatcher, m_toolManager, and ReleaseFile().

215 {
216  delete m_actions;
217  delete m_toolManager;
218  delete m_toolDispatcher;
219  delete m_galCanvas;
220 
221  delete m_currentScreen;
222  m_currentScreen = NULL;
223 
224  m_auimgr.UnInit();
225 
226  ReleaseFile();
227 }
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:95
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:96
void ReleaseFile()
Function ReleaseFile Release the current file marked in use.
Definition: draw_frame.cpp:230
wxAuiManager m_auimgr
Definition: wxstruct.h:144
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:63
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:68
ACTIONS * m_actions
Definition: draw_frame.h:97

Member Function Documentation

void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu.

Parameters
MasterMenuThe main menu. The sub menu list will be accessible from the menu item with id ID_KICAD_SELECT_ICONS_OPTIONS

Definition at line 673 of file basicframe.cpp.

References AddMenuItem(), ID_KICAD_SELECT_ICONS_IN_MENUS, ID_KICAD_SELECT_ICONS_OPTIONS, KiBitmap(), and Pgm().

Referenced by preparePreferencesMenu(), PL_EDITOR_FRAME::ReCreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), and GERBVIEW_FRAME::ReCreateMenuBar().

674 {
675  wxMenu* menu = NULL;
676  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
677 
678  if( item ) // This menu exists, do nothing
679  return;
680 
681  menu = new wxMenu;
682 
683  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
684  _( "Icons in Menus" ), wxEmptyString,
685  wxITEM_CHECK ) );
686  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
687 
688  AddMenuItem( MasterMenu, menu,
690  _( "Icons Options" ),
691  _( "Select show icons in menus and icons sizes" ),
692  KiBitmap( icon_xpm ) );
693 }
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:55
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtual

Function AddMenuZoomAndGrid (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 239 of file zoom.cpp.

References AddHotkeyName(), AddMenuItem(), BASE_SCREEN::BuildGridsChoiceList(), g_UserUnit, BASE_SCREEN::GetGrid(), BASE_SCREEN::GetGridCount(), EDA_DRAW_PANEL::GetScreen(), BASE_SCREEN::GetZoom(), HK_ZOOM_AUTO, HK_ZOOM_CENTER, HK_ZOOM_IN, HK_ZOOM_OUT, HK_ZOOM_REDRAW, 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().

240 {
241  int maxZoomIds;
242  double zoom;
243  wxString msg;
244  BASE_SCREEN* screen = m_canvas->GetScreen();
245 
246  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
247  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
248  msg = AddHotkeyName( _( "Zoom in" ), m_hotkeysDescrList, HK_ZOOM_IN );
249  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
250  msg = AddHotkeyName( _( "Zoom out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
251  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
252  msg = AddHotkeyName( _( "Redraw view" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
253  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
254  msg = AddHotkeyName( _( "Zoom auto" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
255  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
256 
257 
258  wxMenu* zoom_choice = new wxMenu;
259  AddMenuItem( MasterMenu, zoom_choice,
260  ID_POPUP_ZOOM_SELECT, _( "Zoom Select" ),
261  KiBitmap( zoom_selection_xpm ) );
262 
263  zoom = screen->GetZoom();
265  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
266  maxZoomIds : screen->m_ZoomList.size();
267 
268  // Populate zoom submenu.
269  for( int i = 0; i < maxZoomIds; i++ )
270  {
271  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
272 
273  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
274  wxEmptyString, wxITEM_CHECK );
275  if( zoom == screen->m_ZoomList[i] )
276  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
277  }
278 
279  // Create grid submenu as required.
280  if( screen->GetGridCount() )
281  {
282  wxMenu* gridMenu = new wxMenu;
283  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
284  _( "Grid Select" ), KiBitmap( grid_select_xpm ) );
285 
286  wxArrayString gridsList;
287  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
288 
289  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
290  {
291  GRID_TYPE& grid = screen->GetGrid( i );
292  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
293 
294  if( (int)i == icurr )
295  gridMenu->Check( grid.m_CmdId, true );
296  }
297  }
298 
299  MasterMenu->AppendSeparator();
300  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
301 }
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:55
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
size_t GetGridCount() const
Function GetGridCount().
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
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.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:187
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)

Definition at line 912 of file draw_frame.cpp.

References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetLeft(), GetPageSizeIU(), BOX2< Vec >::GetRight(), BASE_SCREEN::GetScalingFactor(), GetScreen(), BOX2< Vec >::GetSize(), BOX2< Vec >::GetTop(), BOX2< Vec >::GetWidth(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), KiROUND(), m_canvas, BASE_SCREEN::m_Center, BASE_SCREEN::m_DrawOrg, BASE_SCREEN::m_ScrollbarNumber, BASE_SCREEN::m_ScrollbarPos, BASE_SCREEN::m_ScrollPixelsPerUnitX, BASE_SCREEN::m_ScrollPixelsPerUnitY, min, BOX2< Vec >::MoveBottomTo(), BOX2< Vec >::MoveLeftTo(), BOX2< Vec >::MoveRightTo(), BOX2< Vec >::MoveTopTo(), scale, SetScrollCenterPosition(), traceScrollSettings(), VIRT_MAX, VIRT_MIN, wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by RedrawScreen(), RedrawScreen2(), and UseGalCanvas().

913 {
914  BASE_SCREEN* screen = GetScreen();
915 
916  if( !screen || !m_canvas )
917  return;
918 
919  double scale = screen->GetScalingFactor();
920 
921  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
922  aCenterPositionIU.x, aCenterPositionIU.y, scale );
923 
924  // Calculate the portion of the drawing that can be displayed in the
925  // client area at the current zoom level.
926 
927  // visible viewport in device units ~ pixels
928  wxSize clientSizeDU = m_canvas->GetClientSize();
929 
930  // Size of the client window in IU
931  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
932 
933  // Full drawing or "page" rectangle in internal units
934  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
935 
936  // Account for scrollbars
937  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
938  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
939  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
940 
941  // The upper left corner of the client rectangle in internal units.
942  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
943  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
944 
945  // If drawn around the center, adjust the client rectangle accordingly.
946  if( screen->m_Center )
947  {
948  // half page offset.
949  xIU += pageRectIU.GetWidth() / 2.0;
950  yIU += pageRectIU.GetHeight() / 2.0;
951  }
952 
953  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
954  wxPoint centerPositionIU;
955 
956  // put "int" limits on the clientRect
957  if( clientRectIU.GetLeft() < VIRT_MIN )
958  clientRectIU.MoveLeftTo( VIRT_MIN );
959  if( clientRectIU.GetTop() < VIRT_MIN )
960  clientRectIU.MoveTopTo( VIRT_MIN );
961  if( clientRectIU.GetRight() > VIRT_MAX )
962  clientRectIU.MoveRightTo( VIRT_MAX );
963  if( clientRectIU.GetBottom() > VIRT_MAX )
964  clientRectIU.MoveBottomTo( VIRT_MAX );
965 
966  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
967  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
968 
969  if( screen->m_Center )
970  {
971  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
972  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
973  }
974 
975  DSIZE virtualSizeIU;
976 
977  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
978  {
979  virtualSizeIU.x = pageRectIU.GetSize().x;
980  }
981  else
982  {
983  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
984  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
985 
986  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
987  {
988  if( pageCenterX > clientCenterX )
989  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
990  else if( pageCenterX < clientCenterX )
991  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
992  else
993  virtualSizeIU.x = clientRectIU.GetWidth();
994  }
995  else
996  {
997  if( pageCenterX > clientCenterX )
998  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
999  else if( pageCenterX < clientCenterX )
1000  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
1001  else
1002  virtualSizeIU.x = pageRectIU.GetWidth();
1003  }
1004  }
1005 
1006  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
1007  {
1008  virtualSizeIU.y = pageRectIU.GetSize().y;
1009  }
1010  else
1011  {
1012  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
1013  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
1014 
1015  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
1016  {
1017  if( pageCenterY > clientCenterY )
1018  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
1019  else if( pageCenterY < clientCenterY )
1020  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
1021  else
1022  virtualSizeIU.y = clientRectIU.GetHeight();
1023  }
1024  else
1025  {
1026  if( pageCenterY > clientCenterY )
1027  virtualSizeIU.y = pageRectIU.GetHeight() +
1028  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1029  else if( pageCenterY < clientCenterY )
1030  virtualSizeIU.y = pageRectIU.GetHeight() +
1031  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1032  else
1033  virtualSizeIU.y = pageRectIU.GetHeight();
1034  }
1035  }
1036 
1037  // put "int" limits on the virtualSizeIU
1038  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1039  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1040 
1041  if( screen->m_Center )
1042  {
1043  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1044  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1045  }
1046  else
1047  {
1048  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1049  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1050  }
1051 
1052  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1053  * around cursor to jump around. This reported problem occurs when the
1054  * zoom point is not on a pixel per unit increment. If you set the
1055  * pixels per unit to 10, you have potential for the zoom point to
1056  * jump around +/-5 pixels from the nearest grid point.
1057  */
1058  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1059 
1060  // Number of scroll bar units for the given zoom level in device units.
1061  double unitsX = virtualSizeIU.x * scale;
1062  double unitsY = virtualSizeIU.y * scale;
1063 
1064  // Store the requested center position for later use
1065  SetScrollCenterPosition( aCenterPositionIU );
1066 
1067  // Calculate the scroll bar position in internal units to place the
1068  // center position at the center of client rectangle.
1069  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1070  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1071 
1072  // Convert scroll bar position to device units.
1073  posX = KiROUND( posX * scale );
1074  posY = KiROUND( posY * scale );
1075 
1076  if( posX < 0 )
1077  {
1078  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1079  posX = 0;
1080  }
1081 
1082  if( posX > unitsX )
1083  {
1084  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1085  posX = unitsX;
1086  }
1087 
1088  if( posY < 0 )
1089  {
1090  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1091  posY = 0;
1092  }
1093 
1094  if( posY > unitsY )
1095  {
1096  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1097  posY = unitsY;
1098  }
1099 
1100  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1101  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1102 
1103  wxLogTrace( traceScrollSettings,
1104  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1105  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1106  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1108  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1109  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1110 
1111  bool noRefresh = true;
1112 
1113  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1114  screen->m_ScrollPixelsPerUnitY,
1115  screen->m_ScrollbarNumber.x,
1116  screen->m_ScrollbarNumber.y,
1117  screen->m_ScrollbarPos.x,
1118  screen->m_ScrollbarPos.y, noRefresh );
1119 }
wxSize m_ScrollbarNumber
Current virtual draw area size in scroll units.
#define VIRT_MAX
max X or Y coordinate in virtual space
Definition: draw_frame.cpp:909
int m_ScrollPixelsPerUnitY
Pixels per scroll unit in the vertical direction.
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:92
#define VIRT_MIN
min X or Y coordinate in virtual space
Definition: draw_frame.cpp:908
void SetScrollCenterPosition(const wxPoint &aPoint)
Class BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated class Vec.
Definition: box2.h:41
virtual const wxSize GetPageSizeIU() const =0
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
bool m_Center
Center on screen.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
int m_ScrollPixelsPerUnitX
Pixels per scroll unit in the horizontal direction.
wxPoint m_ScrollbarPos
Current scroll bar position in scroll units.
static const wxString traceScrollSettings(wxT("KicadScrollSettings"))
Definition for enabling and disabling scroll bar setting trace output.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static const double MAX_AXIS
Definition: draw_frame.cpp:906
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
#define min(a, b)
Definition: auxiliary.h:85
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 754 of file draw_frame.cpp.

References EDA_MSG_PANEL::AppendMessage(), and m_messagePanel.

Referenced by PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), PCB_EDIT_FRAME::Fill_Zone(), SCH_PRINTOUT::OnPrintPage(), SCH_EDIT_FRAME::OpenProjectFiles(), LIB_VIEW_FRAME::RedrawActiveWindow(), LIB_EDIT_FRAME::SaveActiveLibrary(), SCH_EDIT_FRAME::SaveEEFile(), PCB_EDIT_FRAME::SavePcbFile(), ShowNewTrackWhenMovingCursor(), and PCB_EDIT_FRAME::Solve().

757 {
758  if( m_messagePanel == NULL )
759  return;
760 
761  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
762 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:129
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
virtual double EDA_DRAW_FRAME::BestZoom ( )
pure virtual

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

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

Referenced by Zoom_Automatique().

int EDA_DRAW_FRAME::BlockCommand ( EDA_KEY  aKey)
virtual

Function BlockCommand Returns 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 646 of file draw_frame.cpp.

Referenced by HandleBlockBegin().

647 {
648  return 0;
649 }
void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName,
const wxString &  aBackupFileExtension 
)
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.
aBackupFileExtensionA wxString object containing the backup file extension used to create the backup file name.

Definition at line 578 of file basicframe.cpp.

References AUTOSAVE_PREFIX_FILENAME, Format(), GetChars(), Pgm(), and traceAutoSave.

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

580 {
581  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
582  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
583 
584  wxFileName autoSaveFileName = aFileName;
585 
586  // Check for auto save file.
587  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
588 
589  wxLogTrace( traceAutoSave,
590  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
591 
592  if( !autoSaveFileName.FileExists() )
593  return;
594 
595  wxString msg = wxString::Format( _(
596  "Well this is potentially embarrassing!\n"
597  "It appears that the last time you were editing the file\n"
598  "'%s'\n"
599  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
600  GetChars( aFileName.GetFullName() )
601  );
602 
603  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
604 
605  // Make a backup of the current file, delete the file, and rename the auto save file to
606  // the file name.
607  if( response == wxYES )
608  {
609  // Get the backup file name.
610  wxFileName backupFileName = aFileName;
611  backupFileName.SetExt( aBackupFileExtension );
612 
613  // If an old backup file exists, delete it. If an old copy of the file exists, rename
614  // it to the backup file name
615  if( aFileName.FileExists() )
616  {
617  // Remove the old file backup file.
618  if( backupFileName.FileExists() )
619  wxRemoveFile( backupFileName.GetFullPath() );
620 
621  // Rename the old file to the backup file name.
622  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
623  {
624  msg.Printf( _( "Could not create backup file <%s>" ),
625  GetChars( backupFileName.GetFullPath() ) );
626  wxMessageBox( msg );
627  }
628  }
629 
630  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
631  {
632  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
633  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
634  }
635  }
636  else
637  {
638  wxLogTrace( traceAutoSave,
639  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
640 
641  // Remove the auto save file when using the previous file as is.
642  wxRemoveFile( autoSaveFileName.GetFullPath() );
643  }
644 }
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
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
#define AUTOSAVE_PREFIX_FILENAME
Prefix to create filenames for schematic files or other difile when auto-saved to retrieve a crash...
Definition: wxstruct.h:71
const wxChar traceAutoSave[]
Flag to enable auto save feature debug tracing.
Definition: basicframe.cpp:53
wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited
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 260 of file wxstruct.h.

References EDA_BASE_FRAME::m_configFrameName.

Referenced by EDA_BASE_FRAME::LoadSettings(), LoadSettings(), EDA_BASE_FRAME::SaveSettings(), and SaveSettings().

261  {
262  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
263  return baseCfgName;
264  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
Definition: wxstruct.h:137
wxString EDA_DRAW_FRAME::CoordinateToString ( int  aValue,
bool  aConvertToMils = false 
) const

Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting.

Parameters
aValueThe coordinate to convert.
aConvertToMilsConvert inch values to mils if true. This setting has no effect if the current user unit is millimeters.
Returns
The converted string for display in user interface elements.

Definition at line 813 of file draw_frame.cpp.

References CoordinateToString().

814 {
815  return ::CoordinateToString( aValue, aConvertToMils );
816 }
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:117
void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)

Function CopyToClipboard copies the current page or the current block to the clipboard.

Definition at line 43 of file copy_to_clipboard.cpp.

References DrawPageOnClipboard(), EDA_DRAW_PANEL::EndMouseCapture(), EDA_DRAW_PANEL::GetDefaultCursor(), GetScreen(), ID_GEN_COPY_BLOCK_TO_CLIPBOARD, BASE_SCREEN::IsBlockActive(), and m_canvas.

44 {
45  DrawPageOnClipboard( this );
46 
47  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
48  {
49  if( GetScreen()->IsBlockActive() )
50  m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
51 
53  }
54 }
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
bool IsBlockActive() const
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
int GetDefaultCursor() const
Function GetDefaultCursor.
void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
protectedinherited
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )

Function DisplayUnitsMsg displays current unit pane on the status bar.

Definition at line 504 of file draw_frame.cpp.

References g_UserUnit, INCHES, and MILLIMETRES.

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

505 {
506  wxString msg;
507 
508  switch( g_UserUnit )
509  {
510  case INCHES:
511  msg = _( "Inches" );
512  break;
513 
514  case MILLIMETRES:
515  msg = _( "mm" );
516  break;
517 
518  default:
519  msg = _( "Units" );
520  break;
521  }
522 
523  SetStatusText( msg, 4 );
524 }
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
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 231 of file basicframe.cpp.

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

232 {
233  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
234 }
void EDA_DRAW_FRAME::DrawWorkSheet ( wxDC *  aDC,
BASE_SCREEN aScreen,
int  aLineWidth,
double  aScale,
const wxString &  aFilename,
const wxString &  aSheetLayer = wxEmptyString 
)

Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions.

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 77 of file worksheet.cpp.

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, WHITE, wxPoint::x, and wxPoint::y.

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

80 {
82  return;
83 
84  const PAGE_INFO& pageInfo = GetPageSettings();
85  wxSize pageSize = pageInfo.GetSizeMils();
86 
87  // if not printing, draw the page limits:
88  if( !aScreen->m_IsPrinting && m_showPageLimits )
89  {
90  GRSetDrawMode( aDC, GR_COPY );
91  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
92  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
94  }
95 
96  TITLE_BLOCK t_block = GetTitleBlock();
97  COLOR4D color = COLOR4D( RED );
98 
99  wxPoint origin = aDC->GetDeviceOrigin();
100 
101  if( aScreen->m_IsPrinting && origin.y > 0 )
102  {
103  aDC->SetDeviceOrigin( 0, 0 );
104  aDC->SetAxisOrientation( true, false );
105  }
106 
107  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
108  GetScreenDesc(), aFilename, t_block,
109  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
110  aLineWidth, aScalar, color, color, aSheetLayer );
111 
112  if( aScreen->m_IsPrinting && origin.y > 0 )
113  {
114  aDC->SetDeviceOrigin( origin.x, origin.y );
115  aDC->SetAxisOrientation( true, true );
116  }
117 }
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
virtual const TITLE_BLOCK & GetTitleBlock() const =0
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:84
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
const wxSize & GetSizeMils() const
virtual const PAGE_INFO & GetPageSettings() const =0
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1077
virtual wxString GetScreenDesc() const
Definition: worksheet.cpp:120
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:113
EDA_RECT * GetClipBox()
Definition: colors.h:60
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
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...
Definition: worksheet.cpp:49
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:82
Definition: colors.h:49
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
bool EDA_BASE_FRAME::Enable ( bool  enable)
overrideinherited

Definition at line 192 of file basicframe.cpp.

Referenced by FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), and KIWAY_PLAYER::ShowModal().

193 {
194  // so we can do logging of this state change:
195 
196 #if defined(DEBUG)
197  const char* type_id = typeid( *this ).name();
198  printf( "wxFrame %-28s: %s\n", type_id, enable ? "enabled" : "disabled" );
199 #endif
200 
201  return wxFrame::Enable( enable );
202 }
void EDA_DRAW_FRAME::EraseMsgBox ( )

Definition at line 251 of file draw_frame.cpp.

References EDA_MSG_PANEL::EraseMsgBox(), and m_messagePanel.

Referenced by GERBVIEW_FRAME::SetCurItem(), and PCB_EDIT_FRAME::Solve().

252 {
253  if( m_messagePanel )
255 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:129
void EraseMsgBox()
Definition: msgpanel.cpp:215
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 345 of file draw_frame.h.

Referenced by OnSockRequest().

345 {}
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 768 of file hotkeys_basic.cpp.

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

Referenced by KICAD_MANAGER_FRAME::Process_Config(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), and FOOTPRINT_EDIT_FRAME::ProcessPreferences().

770 {
771  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
772  wxString mask = wxT( "*." ) + ext;
773 
774 #if 0
775  wxString path = wxPathOnly( Prj().GetProjectFullName() );
776 #else
777  wxString path = GetMruPath();
778 #endif
779  wxFileName fn( aDefaultShortname );
780  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
781 
782  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
783  path,
784  fn.GetFullPath(),
785  ext,
786  mask,
787  this,
788  wxFD_SAVE,
789  true );
790 
791  if( filename.IsEmpty() )
792  return;
793 
794  WriteHotkeyConfig( aDescList, &filename );
795  SetMruPath( wxFileName( filename ).GetPath() );
796 }
void SetMruPath(const wxString &aPath)
Definition: wxstruct.h:361
PROJECT & Prj()
Definition: kicad.cpp:270
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
wxString GetMruPath() const
Definition: wxstruct.h:363
virtual void EDA_DRAW_FRAME::forceColorsToLegacy ( )
inlineprotectedvirtual

Helper function to coerce all colors to legacy-compatible when switching from GAL to legacy canvas.

Reimplemented in GERBVIEW_FRAME, and PCB_EDIT_FRAME.

Definition at line 156 of file draw_frame.h.

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

Function GeneralControl performs 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.

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

Definition at line 575 of file draw_frame.h.

Referenced by EDA_DRAW_PANEL::OnMouseEvent().

576  {
577  return false;
578  }
void EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint aPos,
bool  aSnapToGrid 
)
protected

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

cursor movement by keyboard)

Definition at line 1320 of file draw_frame.cpp.

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

Referenced by DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_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(), PCB_EDIT_FRAME::GeneralControl(), and GERBVIEW_FRAME::GeneralControl().

1322 {
1323 
1324  // If requested snap the current position to the grid
1325  if( aSnapToGrid )
1326  *aPos = GetNearestGridPosition( *aPos );
1327 
1328  switch( aHotKey )
1329  {
1330  // All these keys have almost the same treatment
1331  case GR_KB_CTRL | WXK_NUMPAD8:
1332  case GR_KB_CTRL | WXK_UP:
1333  case GR_KB_CTRL | WXK_NUMPAD2:
1334  case GR_KB_CTRL | WXK_DOWN:
1335  case GR_KB_CTRL | WXK_NUMPAD4:
1336  case GR_KB_CTRL | WXK_LEFT:
1337  case GR_KB_CTRL | WXK_NUMPAD6:
1338  case GR_KB_CTRL | WXK_RIGHT:
1339  case WXK_NUMPAD8:
1340  case WXK_UP:
1341  case WXK_NUMPAD2:
1342  case WXK_DOWN:
1343  case WXK_NUMPAD4:
1344  case WXK_LEFT:
1345  case WXK_NUMPAD6:
1346  case WXK_RIGHT:
1347  {
1348  /* Here's a tricky part: when doing cursor key movement, the
1349  * 'previous' point should be taken from memory, *not* from the
1350  * freshly computed position in the event. Otherwise you can't do
1351  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1352  * the automatic motion event generated by cursor warping */
1353  wxRealPoint gridSize = GetScreen()->GetGridSize();
1354  *aPos = GetCrossHairPosition();
1355 
1356  // Bonus: ^key moves faster (x10)
1357  switch( aHotKey )
1358  {
1359  case GR_KB_CTRL|WXK_NUMPAD8:
1360  case GR_KB_CTRL|WXK_UP:
1361  aPos->y -= KiROUND( 10 * gridSize.y );
1362  break;
1363 
1364  case GR_KB_CTRL|WXK_NUMPAD2:
1365  case GR_KB_CTRL|WXK_DOWN:
1366  aPos->y += KiROUND( 10 * gridSize.y );
1367  break;
1368 
1369  case GR_KB_CTRL|WXK_NUMPAD4:
1370  case GR_KB_CTRL|WXK_LEFT:
1371  aPos->x -= KiROUND( 10 * gridSize.x );
1372  break;
1373 
1374  case GR_KB_CTRL|WXK_NUMPAD6:
1375  case GR_KB_CTRL|WXK_RIGHT:
1376  aPos->x += KiROUND( 10 * gridSize.x );
1377  break;
1378 
1379  case WXK_NUMPAD8:
1380  case WXK_UP:
1381  aPos->y -= KiROUND( gridSize.y );
1382  break;
1383 
1384  case WXK_NUMPAD2:
1385  case WXK_DOWN:
1386  aPos->y += KiROUND( gridSize.y );
1387  break;
1388 
1389  case WXK_NUMPAD4:
1390  case WXK_LEFT:
1391  aPos->x -= KiROUND( gridSize.x );
1392  break;
1393 
1394  case WXK_NUMPAD6:
1395  case WXK_RIGHT:
1396  aPos->x += KiROUND( gridSize.x );
1397  break;
1398 
1399  default: /* Can't happen since we entered the statement */
1400  break;
1401  }
1402  m_canvas->MoveCursor( *aPos );
1404  }
1405  break;
1406 
1407  default:
1408  break;
1409  }
1410 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
Definition: draw_panel.cpp:353
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
#define GR_KB_CTRL
Definition: common.h:64
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:139
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 219 of file wxstruct.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

Referenced by DIALOG_GENERALOPTIONS::init(), and SCH_EDIT_FRAME::OnPreferencesOptions().

219 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
Definition: wxstruct.h:153
virtual const wxPoint& EDA_DRAW_FRAME::GetAuxOrigin ( ) const
pure virtual

Function GetAuxOrigin returns the origin of the axis used for plotting and various exports.

Implemented in PCB_BASE_FRAME, PL_EDITOR_FRAME, GERBVIEW_FRAME, and SCH_BASE_FRAME.

Referenced by EDA_DRAW_PANEL::DrawAuxiliaryAxis().

EDA_DRAW_PANEL* EDA_DRAW_FRAME::GetCanvas ( )
inline

Definition at line 324 of file draw_frame.h.

References m_canvas.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), AddNewTrace(), Autoroute_One_Track(), SCH_EDIT_FRAME::DeleteAnnotation(), PLEDITOR_PRINTOUT::DrawPage(), SCH_PRINTOUT::DrawPage(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), DrawPageOnClipboard(), SCH_EDIT_FRAME::EditComponent(), LEGACY_ARRAY_CREATOR::finalise(), getOptimalModulePlacement(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::InstallConfigFrame(), SCH_EDIT_FRAME::KiwayMailIn(), GERBVIEW_FRAME::LoadGerberJobFile(), SCH_EDIT_FRAME::MirrorSheet(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_ANNOTATE::OnApplyClick(), SCH_EDIT_FRAME::OnAutoplaceFields(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_LABEL_EDITOR::OnCancelClick(), DIALOG_ERC::OnEraseDrcMarkersClick(), SCH_EDIT_FRAME::OnHotKey(), 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(), SCH_EDIT_FRAME::OnLeftDClick(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GENERALOPTIONS::OnOkClick(), DIALOG_EXCHANGE_MODULE::OnOkClick(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_PAGES_SETTINGS::OnOkClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), DIALOG_DIMENSION_EDITOR::OnOKClick(), GERBER_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), PROPERTIES_FRAME::OnSetDefaultValues(), LIB_EDIT_FRAME::OnShowElectricalType(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_UPDATE_PCB::PerformUpdate(), SCH_FIELD::Place(), DIALOG_DRC_CONTROL::RedrawDrawPanel(), Refresh(), PCB_BASE_FRAME::ResetModuleTextSizes(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), PCB_BASE_FRAME::SetNextGrid(), PCB_BASE_FRAME::SetPrevGrid(), DIALOG_ERC::TestErc(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), DialogEditModuleText::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings().

324 { return m_canvas; }
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition ( bool  aInvertY = false) const

Function GetCrossHairPosition 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 1213 of file draw_frame.cpp.

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

Referenced by Abort_EditEdge(), AbortSymbolTraceOn(), AddMenusForBus(), AddMenusForWire(), PCB_BASE_FRAME::AddPad(), PCB_EDIT_FRAME::AutoPlaceModule(), 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(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_EDIT_FRAME::DeleteConnection(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), DrawAndSizingBlockOutlines(), EDA_DRAW_PANEL::DrawCrossHair(), DrawMovePin(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawSegment(), PCB_BASE_EDIT_FRAME::duplicateItem(), PCB_EDIT_FRAME::EditDimension(), LIB_EDIT_FRAME::EndDrawGraphicItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_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(), PCB_EDIT_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), GeneralControlKeyMovement(), LIB_EDIT_FRAME::GraphicItemBeginDraw(), SCH_EDIT_FRAME::ImportSheetPin(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), PL_EDITOR_FRAME::Locate(), Move_Segment(), Move_Texte_Pcb(), moveBitmap(), MoveDimensionText(), MoveFootprint(), moveItem(), PL_EDITOR_FRAME::MoveItem(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnDragItem(), DIALOG_MODULE_MODULE_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_MODULE_EDITOR::OnEditValue(), DIALOG_MODULE_BOARD_EDITOR::OnEditValue(), LIB_VIEW_FRAME::OnHotKey(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PL_EDITOR_FRAME::OnHotKey(), LIB_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), GERBVIEW_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::OnRightClick(), 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(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), RedrawScreen2(), RedrawWhileMovingCursor(), RefreshCrossHair(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), resizeSheetWithMouseCursor(), 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(), SymbolDisplayDraw(), SCH_BASE_FRAME::UpdateStatusBar(), PL_EDITOR_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and GERBVIEW_FRAME::UpdateStatusBar().

1214 {
1215  // subject to change, borrow from old BASE_SCREEN for now.
1216  if( IsGalCanvasActive() )
1217  {
1219 
1220  return wxPoint( cursor.x, cursor.y );
1221  }
1222  else
1223  {
1224  BASE_SCREEN* screen = GetScreen(); // virtual call
1225  return screen->getCrossHairPosition( aInvertY );
1226  }
1227 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
wxPoint getCrossHairPosition(bool aInvertY) const
Function getCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:848
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
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:856
wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition ( ) const

Function GetCursorScreenPosition returns the cross hair position in device (display) units.b.

Returns
The current cross hair position.

Definition at line 1251 of file draw_frame.cpp.

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

1252 {
1253  BASE_SCREEN* screen = GetScreen(); // virtual call
1254  return screen->getCrossHairScreenPosition();
1255 }
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
wxPoint EDA_DRAW_FRAME::GetCursorPosition ( bool  aOnGrid,
wxRealPoint *  aGridSize = NULL 
) const

Function GetCursorPosition returns 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 1237 of file draw_frame.cpp.

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

1238 {
1239  BASE_SCREEN* screen = GetScreen(); // virtual call
1240  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1241 }
wxPoint getCursorPosition(bool aOnGrid, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getCursorPosition returns the current cursor position in logical (drawing) units...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
virtual void* EDA_DRAW_FRAME::GetDisplayOptions ( )
inlinevirtual

Function GetDisplayOptions 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 871 of file draw_frame.h.

Referenced by GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), EDA_DRAW_PANEL::GetDisplayOptions(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), GERBVIEW_DRAW_PANEL_GAL::OnShow(), and PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL().

871 { return NULL; }
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 400 of file basicframe.cpp.

References Format(), GetChars(), KIFACE_I::GetFileHistory(), 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(), and GERBVIEW_FRAME::OnZipFileHistory().

402 {
403  wxFileHistory* fileHistory = aFileHistory;
404 
405  if( !fileHistory )
406  fileHistory = &Kiface().GetFileHistory();
407 
408  int baseId = fileHistory->GetBaseId();
409 
410  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
411 
412  unsigned i = cmdId - baseId;
413 
414  if( i < fileHistory->GetCount() )
415  {
416  wxString fn = fileHistory->GetHistoryFile( i );
417 
418  if( wxFileName::FileExists( fn ) )
419  return fn;
420  else
421  {
422  wxString msg = wxString::Format(
423  wxT( "file '%s' was not found." ),
424  GetChars( fn ) );
425 
426  wxMessageBox( msg );
427 
428  fileHistory->RemoveFileFromHistory( i );
429  }
430  }
431 
432  return wxEmptyString;
433 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
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
EDA_DRAW_PANEL_GAL* EDA_DRAW_FRAME::GetGalCanvas ( ) const
inline

Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.

Returns
Pointer to GAL-based canvas.

Definition at line 856 of file draw_frame.h.

References m_galCanvas.

Referenced by PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), GERBVIEW_FRAME::applyDisplaySettingsToGAL(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), GERBVIEW_FRAME::Clear_DrawLayers(), PCB_EDIT_FRAME::Edit_Zone_Params(), MODULE_EDITOR_TOOLS::EnumeratePads(), EVT_TOOL(), EVT_UPDATE_UI(), SELECTION_TOOL::findCallback(), GERBVIEW_FRAME::GERBVIEW_FRAME(), GetCrossHairPosition(), GERBVIEW_FRAME::GetVisibleLayers(), GRID_HELPER::GRID_HELPER(), PCBNEW_CONTROL::HighContrastMode(), GERBVIEW_CONTROL::HighlightControl(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), PCB_EDIT_FRAME::ListNetsAndSelect(), MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), MODULE_EDITOR_TOOLS::ModuleTextOutlines(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerVisible(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_DRC_CONTROL::OnPopupMenu(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), GERBVIEW_FRAME::OnSelectHighlightChoice(), OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), PCBNEW_CONTROL::PadDisplayMode(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), TOOL_MANAGER::ProcessEvent(), GRID_HELPER::queryVisible(), PCB_EDITOR_CONTROL::ratsnestTimer(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), GERBER_LAYER_WIDGET::ReFill(), Refresh(), EDA_DRAW_PANEL::Refresh(), ZOOM_TOOL::selectRegion(), GERBVIEW_FRAME::SetActiveLayer(), GRID_HELPER::SetAuxAxes(), PCB_BASE_EDIT_FRAME::SetBoard(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), GERBVIEW_FRAME::SetGridColor(), SetNoToolSelected(), SetToolID(), FOOTPRINT_EDIT_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), GERBVIEW_FRAME::SetVisibleLayers(), PCB_BASE_FRAME::SwitchCanvas(), GERBVIEW_FRAME::SwitchCanvas(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PCBNEW_CONTROL::TrackDisplayMode(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), 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(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), COMMON_TOOLS::ZoomInOut(), COMMON_TOOLS::ZoomPreset(), and GERBVIEW_FRAME::~GERBVIEW_FRAME().

856 { 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:68
KIGFX::GAL_DISPLAY_OPTIONS& EDA_DRAW_FRAME::GetGalDisplayOptions ( )
inline

Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering.

Definition at line 877 of file draw_frame.h.

References m_galDisplayOptions.

Referenced by DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS(), DIALOG_MODEDIT_DISPLAY_OPTIONS::DIALOG_MODEDIT_DISPLAY_OPTIONS(), EVT_TOOL(), GERBVIEW_FRAME::GERBVIEW_FRAME(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), OnToggleCrossHairStyle(), OnUpdateCrossHairStyle(), PCBNEW_CONTROL::SwitchCursor(), and COMMON_TOOLS::ToggleCursor().

877 { return *m_galDisplayOptions; }
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_galDisplayOptions
Definition: draw_frame.h:71
virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtual

Function GetGridColor() , virtual.

Returns
the color of the grid

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 487 of file draw_frame.h.

References m_gridColor.

Referenced by EDA_DRAW_PANEL::DrawGridAxis(), GERBVIEW_FRAME::GetVisibleElementColor(), and SaveSettings().

488  {
489  return m_gridColor;
490  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:83
virtual const wxPoint& EDA_DRAW_FRAME::GetGridOrigin ( ) const
pure virtual

Function GetGridOrigin returns 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 PCB_BASE_FRAME, PL_EDITOR_FRAME, GERBVIEW_FRAME, and SCH_BASE_FRAME.

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

wxPoint EDA_DRAW_FRAME::GetGridPosition ( const wxPoint aPosition) const

Function GetGridPosition returns 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 576 of file draw_frame.cpp.

References GetNearestGridPosition(), m_currentScreen, and m_snapToGrid.

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

577 {
578  wxPoint pos = aPosition;
579 
580  if( m_currentScreen != NULL && m_snapToGrid )
581  pos = GetNearestGridPosition( aPosition );
582 
583  return pos;
584 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:63
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:65
EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inline

Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping.

Definition at line 370 of file draw_frame.h.

References m_hotkeysDescrList.

Referenced by PCBNEW_CONTROL::ShowHelp().

370 { return m_hotkeysDescrList; }
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
virtual EDA_HOTKEY* EDA_DRAW_FRAME::GetHotKeyDescription ( int  aCommand) const
pure virtual

Function GetHotKeyDescription Searches 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 GERBVIEW_FRAME, PCB_EDIT_FRAME, SCH_EDIT_FRAME, LIB_EDIT_FRAME, PL_EDITOR_FRAME, FOOTPRINT_WIZARD_FRAME, FOOTPRINT_EDIT_FRAME, FOOTPRINT_VIEWER_FRAME, LIB_VIEW_FRAME, and DISPLAY_FOOTPRINTS_FRAME.

Referenced by ACTION_MANAGER::processHotKey().

void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 527 of file basicframe.cpp.

References ShowAboutDialog().

528 {
529  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
530  ShowAboutDialog( this );
531 }
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
Definition: wxstruct.h:117
void EDA_BASE_FRAME::GetKicadContribute ( wxCommandEvent &  event)
inherited

Definition at line 514 of file basicframe.cpp.

References URL_GET_INVOLVED.

515 {
516  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
517  {
518  wxString msg;
519  msg.Printf( _( "Could not launch the default browser.\n"
520  "For information on how to help the KiCad project, visit %s" ),
522  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
523  }
524 }
#define URL_GET_INVOLVED
Definition: basicframe.cpp:51
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 436 of file basicframe.cpp.

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

437 {
438  const SEARCH_STACK& search = sys_search();
439 
440  /* We have to get document for beginners,
441  * or the full specific doc
442  * if event id is wxID_INDEX, we want the document for beginners.
443  * else the specific doc file (its name is in Kiface().GetHelpFileName())
444  * The document for beginners is the same for all KiCad utilities
445  */
446  if( event.GetId() == wxID_INDEX )
447  {
448  // List of possible names for Getting Started in KiCad
449  const wxChar* names[2] = {
450  wxT( "getting_started_in_kicad" ),
451  wxT( "Getting_Started_in_KiCad" )
452  };
453 
454  wxString helpFile;
455  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
456  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
457  for( unsigned ii = 0; ii < DIM( names ); ii++ )
458  {
459  helpFile = SearchHelpFileFullPath( search, names[ii] );
460 
461  if( !helpFile.IsEmpty() )
462  break;
463  }
464 
465  if( !helpFile )
466  {
467  wxString msg = wxString::Format( _(
468  "Html or pdf help file \n'%s'\n or\n'%s' could not be found." ), names[0], names[1] );
469  wxMessageBox( msg );
470  }
471  else
472  {
473  GetAssociatedDocument( this, helpFile );
474  }
475 
476  return;
477  }
478 
479  wxString base_name = help_name();
480  wxString helpFile = SearchHelpFileFullPath( search, base_name );
481 
482  if( !helpFile )
483  {
484  wxString msg = wxString::Format( _(
485  "Help file '%s' could not be found." ),
486  GetChars( base_name )
487  );
488  wxMessageBox( msg );
489  }
490  else
491  {
492  GetAssociatedDocument( this, helpFile );
493  }
494 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, const wxPathList *aPaths)
Function GetAssociatedDocument open a document (file) with the suitable browser.
Definition: eda_doc.cpp:86
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...
Definition: basicframe.cpp:370
wxString SearchHelpFileFullPath(const SEARCH_STACK &aSStack, const wxString &aBaseName)
Function SearchHelpFileFullPath returns the help file's full path.
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()
Definition: basicframe.cpp:376
wxAuiToolBar* EDA_DRAW_FRAME::GetMainToolBar ( ) const
inline

Definition at line 418 of file draw_frame.h.

References EDA_BASE_FRAME::m_mainToolBar.

418 { return m_mainToolBar; }
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:140
wxString EDA_BASE_FRAME::GetMruPath ( ) const
inlineinherited
wxPoint EDA_DRAW_FRAME::GetNearestGridPosition ( const wxPoint aPosition,
wxRealPoint *  aGridSize = NULL 
) const

Function GetNearestGridPosition returns 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 1244 of file draw_frame.cpp.

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

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), EDA_DRAW_PANEL::DrawGrid(), GeneralControlKeyMovement(), GetGridPosition(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), GERBVIEW_FRAME::Locate(), SCH_EDIT_FRAME::LocateAndShowItem(), LIB_EDIT_FRAME::LocateItemUsingCursor(), PCB_EDIT_FRAME::OnRightClick(), and resizeSheetWithMouseCursor().

1245 {
1246  BASE_SCREEN* screen = GetScreen(); // virtual call
1247  return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
1248 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
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 ...)
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
virtual const PAGE_INFO& EDA_DRAW_FRAME::GetPageSettings ( ) const
pure virtual
virtual const wxSize EDA_DRAW_FRAME::GetPageSizeIU ( ) const
pure virtual

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

Implemented in PCB_BASE_FRAME, GERBVIEW_FRAME, PL_EDITOR_FRAME, and SCH_BASE_FRAME.

Referenced by AdjustScrollBars(), EDA_DRAW_PANEL::DrawAuxiliaryAxis(), EDA_DRAW_PANEL::DrawBackGround(), EDA_DRAW_PANEL::DrawGridAxis(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), and DrawPageOnClipboard().

virtual BASE_SCREEN* EDA_DRAW_FRAME::GetScreen ( ) const
inlinevirtual

Function GetScreen returns 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 334 of file draw_frame.h.

References m_currentScreen.

Referenced by AdjustScrollBars(), GERBVIEW_FRAME::Block_Move(), GERBVIEW_FRAME::Clear_DrawLayers(), CopyToClipboard(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), GeneralControlKeyMovement(), GERBVIEW_FRAME::GERBVIEW_FRAME(), GERBVIEW_FRAME::GetActiveLayer(), GetCrossHairPosition(), GetCrossHairScreenPosition(), GetCursorPosition(), GetNearestGridPosition(), SCH_BASE_FRAME::GetScreen(), PL_EDITOR_FRAME::GetScreen(), EDA_DRAW_PANEL::GetScreen(), PCB_BASE_FRAME::GetScreen(), GetScrollCenterPosition(), GetZoom(), GetZoomLevelIndicator(), GRID_MENU::GRID_MENU(), HandleBlockBegin(), GERBVIEW_FRAME::HandleBlockEnd(), GERBVIEW_FRAME::HandleBlockPlace(), InitBlockPasteInfos(), isBusy(), GERBVIEW_FRAME::LoadSettings(), GERBVIEW_FRAME::OnHotKey(), GERBVIEW_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), EDA_DRAW_PANEL::OnPan(), GERBVIEW_FRAME::OnRightClick(), EDA_DRAW_PANEL::OnScroll(), OnSelectZoom(), OnUpdateRedo(), OnUpdateUndo(), OnZoom(), PushTrack(), GERBVIEW_FRAME::RedrawActiveWindow(), RefPos(), SaveSettings(), GERBVIEW_FRAME::SetActiveLayer(), SetCrossHairPosition(), GERBVIEW_FRAME::SetCurItem(), SetMousePosition(), SetNextGrid(), SetNextZoom(), GERBVIEW_FRAME::SetPageSettings(), SetPresetGrid(), SetPresetZoom(), SetPrevGrid(), SetPrevZoom(), SetScrollCenterPosition(), ZOOM_MENU::update(), GRID_MENU::update(), COMMON_TOOLS::updateGrid(), UpdateMsgPanel(), GERBVIEW_FRAME::UpdateStatusBar(), UseGalCanvas(), Window_Zoom(), Zoom_Automatique(), ZOOM_MENU::ZOOM_MENU(), and COMMON_TOOLS::ZoomPreset().

334 { return m_currentScreen; }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:63
wxString EDA_DRAW_FRAME::GetScreenDesc ( ) const
virtual

Reimplemented in SCH_EDIT_FRAME.

Definition at line 120 of file worksheet.cpp.

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

121 {
122  // Virtual function. In basic class, returns
123  // an empty string.
124  return wxEmptyString;
125 }
const wxPoint & EDA_DRAW_FRAME::GetScrollCenterPosition ( ) const

Definition at line 1272 of file draw_frame.cpp.

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

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

1273 {
1274  BASE_SCREEN* screen = GetScreen(); // virtual call
1275  return screen->getScrollCenterPosition();
1276 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
const wxPoint & getScrollCenterPosition() const
bool EDA_DRAW_FRAME::GetShowBorderAndTitleBlock ( ) const
inline

Definition at line 318 of file draw_frame.h.

References m_showBorderAndTitleBlock.

Referenced by DIALOG_PAGE_SHOW_PAGE_BORDERS::DIALOG_PAGE_SHOW_PAGE_BORDERS(), and DIALOG_DISPLAY_OPTIONS::initOptDialog().

318 { return m_showBorderAndTitleBlock; }
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:113
virtual const TITLE_BLOCK& EDA_DRAW_FRAME::GetTitleBlock ( ) const
pure virtual
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 458 of file draw_frame.h.

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::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(), 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(), LIB_EDIT_FRAME::OnLeftClick(), SCH_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(), FOOTPRINT_EDIT_FRAME::OnRightClick(), PL_EDITOR_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotateItem(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), PCB_EDIT_FRAME::OnSelectTool(), 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().

458 { return m_toolId; }
bool EDA_DRAW_FRAME::GetToolToggled ( int  aToolId)
inline

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

This is needed because GerbView and Pcbnew put some of the same tools in different toolbars (for example, zoom selection is in the main bar in Pcbnew and in the options bar in GerbView).

Definition at line 427 of file draw_frame.h.

References EDA_BASE_FRAME::m_mainToolBar.

Referenced by ZOOM_TOOL::Main().

428  {
429  return ( m_mainToolBar->GetToolToggled( aToolId ) ||
430  m_optionsToolBar->GetToolToggled( aToolId ) ||
431  m_drawToolBar->GetToolToggled( aToolId ) );
432  }
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:126
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:123
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:140
double EDA_DRAW_FRAME::GetZoom ( )

Function GetZoom.

Returns
The current zoom level.

Definition at line 481 of file draw_frame.cpp.

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

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

482 {
483  return GetScreen()->GetZoom();
484 }
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
double EDA_DRAW_FRAME::GetZoomLevelCoeff ( ) const
inline

Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level.

Definition at line 407 of file draw_frame.h.

References m_zoomLevelCoeff.

Referenced by ZOOM_MENU::ZOOM_MENU().

407 { return m_zoomLevelCoeff; }
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator ( ) const
virtual

Function GetZoomLevelIndicator returns 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, PL_EDITOR_FRAME, and SCH_BASE_FRAME.

Definition at line 681 of file draw_frame.cpp.

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

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

682 {
683  wxString Line;
684  double level = 0.0;
685 
686  if( IsGalCanvasActive() )
687  {
688  KIGFX::GAL* gal = m_galCanvas->GetGAL();
689  KIGFX::VIEW* view = m_galCanvas->GetView();
690  double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
691  level = m_zoomLevelCoeff * zoomFactor * view->GetScale();
692  }
693  else if( BASE_SCREEN* screen = GetScreen() )
694  {
695  level = m_zoomLevelCoeff / (double) screen->GetZoom();
696  }
697 
698  // returns a human readable value which can be displayed as zoom
699  // level indicator in dialogs.
700  Line.Printf( wxT( "Z %.2f" ), level );
701 
702  return Line;
703 }
double GetWorldScale() const
Get the world scale.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:848
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:68
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
double GetZoomFactor() const
Get the zoom factor.
double GetScale() const
Function GetScale()
Definition: view.h:265
Class VIEW.
Definition: view.h:58
Class GAL is the abstract interface for drawing on a 2D-surface.
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.

Definition at line 824 of file draw_frame.cpp.

References BLOCK_COPY, BLOCK_DELETE, BLOCK_DRAG, BLOCK_DRAG_ITEM, BLOCK_DUPLICATE, BLOCK_DUPLICATE_AND_INCREMENT, BLOCK_FLIP, BLOCK_IDLE, BLOCK_MIRROR_X, BLOCK_MIRROR_Y, BLOCK_MOVE, BLOCK_PASTE, BLOCK_PRESELECT_MOVE, BLOCK_ROTATE, BLOCK_ZOOM, BlockCommand(), EDA_DRAW_PANEL::CallMouseCapture(), BLOCK_SELECTOR::ClearItemsList(), DisplayError(), BLOCK_SELECTOR::GetCommand(), BLOCK_SELECTOR::GetCount(), GetScreen(), BLOCK_SELECTOR::GetState(), InitBlockPasteInfos(), BLOCK_SELECTOR::InitData(), EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, m_canvas, BLOCK_SELECTOR::SetCommand(), BLOCK_SELECTOR::SetLastCursorPosition(), BLOCK_SELECTOR::SetMessageBlock(), EDA_DRAW_PANEL::SetMouseCaptureCallback(), BLOCK_SELECTOR::SetState(), STATE_BLOCK_MOVE, and STATE_NO_BLOCK.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), PCB_BASE_EDIT_FRAME::duplicateItem(), SCH_EDIT_FRAME::OnDragItem(), EDA_DRAW_PANEL::OnMouseEvent(), and SCH_EDIT_FRAME::Process_Special_Functions().

826 {
828 
829  if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
830  return false;
831 
832  if( aExplicitCommand == 0 )
833  block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
834  else
835  block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
836 
837  if( block->GetCommand() == 0 )
838  return false;
839 
840  switch( block->GetCommand() )
841  {
842  case BLOCK_IDLE:
843  break;
844 
845  case BLOCK_MOVE: // Move
846  case BLOCK_DRAG: // Drag (block defined)
847  case BLOCK_DRAG_ITEM: // Drag from a drag item command
848  case BLOCK_DUPLICATE: // Duplicate
849  case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references
850  case BLOCK_DELETE: // Delete
851  case BLOCK_COPY: // Copy
852  case BLOCK_ROTATE: // Rotate 90 deg
853  case BLOCK_FLIP: // Flip
854  case BLOCK_ZOOM: // Window Zoom
855  case BLOCK_MIRROR_X:
856  case BLOCK_MIRROR_Y: // mirror
857  case BLOCK_PRESELECT_MOVE: // Move with preselection list
858  block->InitData( m_canvas, aPosition );
859  break;
860 
861  case BLOCK_PASTE:
862  block->InitData( m_canvas, aPosition );
863  block->SetLastCursorPosition( wxPoint( 0, 0 ) );
865 
866  if( block->GetCount() == 0 ) // No data to paste
867  {
868  DisplayError( this, wxT( "No block to paste" ), 20 );
871  block->SetState( STATE_NO_BLOCK );
872  block->SetMessageBlock( this );
873  return true;
874  }
875 
876  if( !m_canvas->IsMouseCaptured() )
877  {
878  block->ClearItemsList();
879  DisplayError( this,
880  wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
881  block->SetState( STATE_NO_BLOCK );
882  block->SetMessageBlock( this );
883  return true;
884  }
885 
886  block->SetState( STATE_BLOCK_MOVE );
887  m_canvas->CallMouseCapture( aDC, aPosition, false );
888  break;
889 
890  default:
891  {
892  wxString msg;
893  msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
894  block->GetCommand();
895  DisplayError( this, msg );
896  }
897  break;
898  }
899 
900  block->SetMessageBlock( this );
901  return true;
902 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
virtual int BlockCommand(EDA_KEY aKey)
Function BlockCommand Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the...
Definition: draw_frame.cpp:646
void SetMessageBlock(EDA_DRAW_FRAME *frame)
Function SetMessageBlock Displays the type of block command in the status bar of the window...
BLOCK_COMMAND_T
virtual void InitBlockPasteInfos()
Definition: draw_frame.cpp:652
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
void SetState(BLOCK_STATE_T aState)
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
bool IsMouseCaptured() const
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
Definition: solve.cpp:178
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
BLOCK_STATE_T GetState() const
BLOCK_COMMAND_T GetCommand() const
void InitData(EDA_DRAW_PANEL *Panel, const wxPoint &startpos)
Function InitData sets the initial values of a BLOCK_SELECTOR, before starting a block command...
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:71
unsigned GetCount() const
void SetCommand(BLOCK_COMMAND_T aCommand)
bool EDA_DRAW_FRAME::HandleBlockEnd ( wxDC *  DC)
virtual

Function HandleBlockEnd( ) 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 664 of file draw_frame.cpp.

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

665 {
666  return false;
667 }
void EDA_DRAW_FRAME::HandleBlockPlace ( wxDC *  DC)
virtual

Function HandleBlockPlace( ) 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 659 of file draw_frame.cpp.

Referenced by EDA_DRAW_PANEL::OnMouseEvent().

660 {
661 }
wxString EDA_BASE_FRAME::help_name ( )
protectedvirtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 376 of file basicframe.cpp.

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

Referenced by EDA_BASE_FRAME::GetKicadHelp().

377 {
378  return Kiface().GetHelpFileName();
379 }
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
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 737 of file hotkeys_basic.cpp.

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

Referenced by KICAD_MANAGER_FRAME::Process_Config(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), and FOOTPRINT_EDIT_FRAME::ProcessPreferences().

739 {
740  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
741  wxString mask = wxT( "*." ) + ext;
742 
743 #if 0 // pass in the project dir as an argument
744  wxString path = wxPathOnly( Prj().GetProjectFullName() );
745 #else
746  wxString path = GetMruPath();
747 #endif
748  wxFileName fn( aDefaultShortname );
749  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
750 
751  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
752  path,
753  fn.GetFullPath(),
754  ext,
755  mask,
756  this,
757  wxFD_OPEN,
758  true );
759 
760  if( filename.IsEmpty() )
761  return;
762 
763  ReadHotkeyConfigFile( filename, aDescList );
764  SetMruPath( wxFileName( filename ).GetPath() );
765 }
void SetMruPath(const wxString &aPath)
Definition: wxstruct.h:361
int ReadHotkeyConfigFile(const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfigFile Read an old configuration file (<file>.key) and fill the current ho...
PROJECT & Prj()
Definition: kicad.cpp:270
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
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
Definition: wxstruct.h:363
void EDA_DRAW_FRAME::InitBlockPasteInfos ( )
virtual

Reimplemented in SCH_EDIT_FRAME.

Definition at line 652 of file draw_frame.cpp.

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

Referenced by HandleBlockBegin().

653 {
656 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
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 173 of file wxstruct.h.

Referenced by EDA_BASE_FRAME::ProcessEvent().

173 { return false; }
bool EDA_DRAW_FRAME::isBusy ( ) const
protected
Returns
true if an item edit or a block operation is in progress.

Definition at line 1413 of file draw_frame.cpp.

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().

1414 {
1415  const BASE_SCREEN* screen = const_cast< BASE_SCREEN* >( GetScreen() );
1416 
1417  if( !screen )
1418  return false;
1419 
1420  return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
1421  || ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
1422 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:269
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
EDA_ITEM * GetCurItem() const
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
BLOCK_STATE_T GetState() const
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 163 of file kiway_player.cpp.

References DBG, and KIWAY_PLAYER::m_modal_loop.

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

164 {
165  bool ret = !m_modal_loop;
166 
167  DBG(printf( "%s: ret:%d\n", __func__, ret );)
168 
169  return ret;
170 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:247
#define DBG(x)
Definition: fctsys.h:33
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 848 of file draw_frame.h.

References m_galCanvasActive.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), GERBER_LAYER_WIDGET::AreArbitraryColorsAllowed(), PCB_LAYER_WIDGET::AreArbitraryColorsAllowed(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), PCB_EDIT_FRAME::Edit_Zone_Params(), EVT_TOOL(), EVT_UPDATE_UI(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), GetCrossHairPosition(), GetZoomLevelIndicator(), FOOTPRINT_EDIT_FRAME::Import_Module(), GERBVIEW_FRAME::IsLayerVisible(), PCB_EDIT_FRAME::ListNetsAndSelect(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_BASE_FRAME::OnModify(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), OnSelectGrid(), GERBVIEW_FRAME::OnSelectHighlightChoice(), OnSelectZoom(), OnToggleGridState(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::ReCreateOptToolbar(), DIALOG_PAD_PROPERTIES::redraw(), RedrawScreen(), RedrawScreen2(), Refresh(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), GERBVIEW_FRAME::SetActiveLayer(), GERBVIEW_FRAME::SetGridColor(), SetNoToolSelected(), SetToolID(), DIALOG_SET_GRID::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_VIEWER_FRAME::updateView(), WriteHotkeyConfig(), and Zoom_Automatique().

848 { return m_galCanvasActive; }
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:66
bool EDA_BASE_FRAME::IsType ( FRAME_T  aType) const
inlineinherited
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 534 of file basicframe.cpp.

References GetChars().

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

535 {
536  wxString msg;
537  wxFileName fn = aFileName;
538 
539  // Check for absence of a file path with a file name. Unfortunately KiCad
540  // uses paths relative to the current project path without the ./ part which
541  // confuses wxFileName. Making the file name path absolute may be less than
542  // elegant but it solves the problem.
543  if( fn.GetPath().IsEmpty() && fn.HasName() )
544  fn.MakeAbsolute();
545 
546  wxCHECK_MSG( fn.IsOk(), false,
547  wxT( "File name object is invalid. Bad programmer!" ) );
548  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
549  wxT( "File name object path <" ) + fn.GetFullPath() +
550  wxT( "> is not set. Bad programmer!" ) );
551 
552  if( fn.IsDir() && !fn.IsDirWritable() )
553  {
554  msg.Printf( _( "You do not have write permissions to folder <%s>." ),
555  GetChars( fn.GetPath() ) );
556  }
557  else if( !fn.FileExists() && !fn.IsDirWritable() )
558  {
559  msg.Printf( _( "You do not have write permissions to save file <%s> to folder <%s>." ),
560  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
561  }
562  else if( fn.FileExists() && !fn.IsFileWritable() )
563  {
564  msg.Printf( _( "You do not have write permissions to save file <%s>." ),
565  GetChars( fn.GetFullPath() ) );
566  }
567 
568  if( !msg.IsEmpty() )
569  {
570  wxMessageBox( msg );
571  return false;
572  }
573 
574  return true;
575 }
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
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.

References KIWAY_HOLDER::m_kiway.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), LIB_EDIT_FRAME::InstallConfigFrame(), PCB_EDIT_FRAME::InstallModuleOptionsFrame(), KIWAY_PLAYER::language_change(), SCH_SHEET::Load(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), 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::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), and DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint().

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:85
void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 188 of file kiway_player.cpp.

References KIWAY_EXPRESS::Command(), KIWAY_EXPRESS::GetPayload(), KIWAY_PLAYER::KiwayMailIn(), and name.

189 {
190  // logging support
191 #if defined(DEBUG)
192  const char* class_name = typeid( this ).name();
193 
194  printf( "%s: received cmd:%d pay:'%s'\n", class_name,
195  aEvent.Command(), aEvent.GetPayload().c_str() );
196 #endif
197 
198  KiwayMailIn( aEvent ); // call the virtual, override in derived.
199 }
virtual void KiwayMailIn(KIWAY_EXPRESS &aEvent)
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
const std::string & GetPayload()
Function Payload returns the payload, which can be any text but it typicall self identifying s-expres...
Definition: kiway_express.h:62
const char * name
MAIL_T Command()
Function Command returns the MAIL_T associated with this mail.
Definition: kiway_express.h:52
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 SCH_EDIT_FRAME, PCB_EDIT_FRAME, and CVPCB_MAINFRAME.

Definition at line 75 of file kiway_player.cpp.

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

76 {
77  // override this in derived classes.
78 }
void KIWAY_PLAYER::language_change ( wxCommandEvent &  event)
protectedinherited

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

Definition at line 202 of file kiway_player.cpp.

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

203 {
204  int id = event.GetId();
205 
206  // tell all the KIWAY_PLAYERs about the language change.
207  Kiway().SetLanguage( id );
208 }
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:396
wxString EDA_DRAW_FRAME::LengthDoubleToString ( double  aValue,
bool  aConvertToMils = false 
) const

Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting.

Parameters
aValueThe coordinate to convert.
aConvertToMilsConvert inch values to mils if true. This setting has no effect if the current user unit is millimeters.
Returns
The converted string for display in user interface elements.

Definition at line 818 of file draw_frame.cpp.

References LengthDoubleToString().

Referenced by ShowNewTrackWhenMovingCursor().

819 {
820  return ::LengthDoubleToString( aValue, aConvertToMils );
821 }
wxString LengthDoubleToString(double aValue, bool aConvertToMils)
Function LengthDoubleToString is a helper to convert the double length aValue to a string in inches...
Definition: base_units.cpp:122
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting ( ) const
protected

Returns the canvas type stored in the application settings.

Definition at line 1174 of file draw_frame.cpp.

References CANVAS_TYPE_KEY, EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, Kiface(), and KIFACE_I::KifaceSettings().

Referenced by GERBVIEW_FRAME::GERBVIEW_FRAME().

1175 {
1177  wxConfigBase* cfg = Kiface().KifaceSettings();
1178 
1179  if( cfg )
1180  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
1182 
1183  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1184  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1185  {
1186  assert( false );
1187  canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
1188  }
1189 
1190  return canvasType;
1191 }
Sentinel, do not use as a parameter.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
static const wxChar CANVAS_TYPE_KEY[]
Key in KifaceSettings to store the canvas type.
Definition: draw_frame.h:185
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, and PCB_EDIT_FRAME.

Definition at line 706 of file draw_frame.cpp.

References EDA_BASE_FRAME::ConfigBaseName(), DEFAULT_MAX_UNDO_ITEMS, GalDisplayOptionsKeyword(), GridColorEntryKeyword(), LastGridSizeIdKeyword(), EDA_BASE_FRAME::LoadSettings(), m_galDisplayOptions, m_LastGridSizeId, m_UndoRedoCountMax, MaxUndoItemsEntry(), SetGridColor(), SetGridVisibility(), and ShowGridEntryKeyword().

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

707 {
709 
710  wxString baseCfgName = ConfigBaseName();
711 
712  bool btmp;
713  if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) )
714  SetGridVisibility( btmp );
715 
716  // Read grid color:
717  COLOR4D wtmp = COLOR4D::UNSPECIFIED;
718 
719  if( wtmp.SetFromWxString( aCfg->Read(
720  baseCfgName + GridColorEntryKeyword, wxT( "NONE" ) ) ) )
721  SetGridColor( wtmp );
722 
723  aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L );
724 
725  // m_LastGridSizeId is an offset, expected to be >= 0
726  if( m_LastGridSizeId < 0 )
727  m_LastGridSizeId = 0;
728 
729  m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
730  long( DEFAULT_MAX_UNDO_ITEMS ) );
731 
732  m_galDisplayOptions->ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
733 }
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_galDisplayOptions
Definition: draw_frame.h:71
static const wxString MaxUndoItemsEntry(wxT("DevelMaxUndoItems"))
Integer to set the maximum number of undo items on the stack.
#define DEFAULT_MAX_UNDO_ITEMS
Definition: draw_frame.h:46
wxString ConfigBaseName()
Function ConfigBaseName.
Definition: wxstruct.h:260
virtual void SetGridColor(COLOR4D aColor)
Function SetGridColor() , virtual.
Definition: draw_frame.h:496
static const wxString GalDisplayOptionsKeyword(wxT("GalDisplayOptions"))
GAL Display Options.
virtual void LoadSettings(wxConfigBase *aCfg)
Function LoadSettings loads common frame parameters from a configuration file.
Definition: basicframe.cpp:256
static const wxString ShowGridEntryKeyword(wxT("ShowGrid"))
Nonzero to show grid (suffix)
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:89
int m_LastGridSizeId
Definition: draw_frame.h:78
static const wxString LastGridSizeIdKeyword(wxT("_LastGridSize"))
Most recently used grid size (suffix)
virtual void SetGridVisibility(bool aVisible)
Function SetGridVisibility() , virtual It may be overloaded by derived classes.
Definition: draw_frame.h:478
static const wxString GridColorEntryKeyword(wxT("GridColor"))
Grid color ID (suffix)
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
bool EDA_DRAW_FRAME::LockFile ( const wxString &  aFileName)

Function LockFile marks 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 236 of file draw_frame.cpp.

References m_file_checker.

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

237 {
238  m_file_checker = ::LockFile( aFileName );
239 
240  return bool( m_file_checker );
241 }
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:75
bool LockFile(const wxString &aFileName)
Function LockFile marks a schematic file as being in use.
Definition: draw_frame.cpp:236
void EDA_DRAW_FRAME::OnActivate ( wxActivateEvent &  event)
virtual

Function OnActivate (virtual) is 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 258 of file draw_frame.cpp.

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().

259 {
260  if( m_canvas )
261  m_canvas->SetCanStartBlock( -1 );
262 
263  event.Skip(); // required under wxMAC
264 }
void SetCanStartBlock(int aStartBlock)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Function onAutoSaveTimer handles the auto save timer event.

Definition at line 224 of file basicframe.cpp.

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

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

225 {
226  if( !doAutoSave() )
227  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
228 }
virtual bool doAutoSave()
Function doAutoSave should be overridden by the derived class to handle the auto save feature...
Definition: basicframe.cpp:231
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
Definition: wxstruct.h:156
int m_autoSaveInterval
The auto save interval time in seconds.
Definition: wxstruct.h:153
void KIWAY_PLAYER::OnChangeIconsOptions ( wxCommandEvent &  event)
overrideprotectedvirtualinherited

Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection.

Reimplemented from EDA_BASE_FRAME.

Definition at line 211 of file kiway_player.cpp.

References KIWAY_HOLDER::Kiway(), EDA_BASE_FRAME::OnChangeIconsOptions(), and KIWAY::ShowChangedIcons().

212 {
215 }
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
virtual void OnChangeIconsOptions(wxCommandEvent &event)
Function OnChangeIconsOptions Selects the current icons options in menus (or toolbars) in Kicad (the ...
Definition: basicframe.cpp:662
VTBL_ENTRY void ShowChangedIcons()
Function ShowChangedIcons Calls ShowChangedIcons() on all KIWAY_PLAYERs.
Definition: kiway.cpp:432
void EDA_DRAW_FRAME::OnEraseBackground ( wxEraseEvent &  SizeEvent)
bool EDA_DRAW_FRAME::OnHotKey ( wxDC *  aDC,
int  aHotKey,
const wxPoint aPosition,
EDA_ITEM aItem = NULL 
)
virtual

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

Definition at line 375 of file draw_frame.cpp.

376 {
377  return false;
378 }
virtual void EDA_DRAW_FRAME::OnLeftClick ( wxDC *  DC,
const wxPoint MousePos 
)
pure virtual
void EDA_DRAW_FRAME::OnLeftDClick ( wxDC *  DC,
const wxPoint MousePos 
)
virtual
void EDA_DRAW_FRAME::OnMenuOpen ( wxMenuEvent &  event)

Definition at line 267 of file draw_frame.cpp.

References m_canvas, and EDA_DRAW_PANEL::SetCanStartBlock().

268 {
269  if( m_canvas )
270  m_canvas->SetCanStartBlock( -1 );
271 
272  event.Skip();
273 }
void SetCanStartBlock(int aStartBlock)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
void EDA_DRAW_FRAME::OnMouseEvent ( wxMouseEvent &  event)

Definition at line 487 of file draw_frame.cpp.

488 {
489  event.Skip();
490 }
virtual bool EDA_DRAW_FRAME::OnRightClick ( const wxPoint MousePos,
wxMenu *  PopMenu 
)
pure virtual
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 401 of file draw_frame.cpp.

References GetToolManager(), ID_POPUP_GRID_LEVEL_100, ID_POPUP_GRID_LEVEL_1000, IsGalCanvasActive(), m_canvas, m_gridSelectBox, EDA_DRAW_PANEL::Refresh(), TOOL_MANAGER::RunAction(), and SetPresetGrid().

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

402 {
403  int* clientData;
404  int eventId = ID_POPUP_GRID_LEVEL_100;
405 
406  if( event.GetEventType() == wxEVT_CHOICE )
407  {
408  if( m_gridSelectBox == NULL ) // Should not happen
409  return;
410 
411  /*
412  * Don't use wxCommandEvent::GetClientData() here. It always
413  * returns NULL in GTK. This solution is not as elegant but
414  * it works.
415  */
416  int index = m_gridSelectBox->GetSelection();
417  wxASSERT( index != wxNOT_FOUND );
418  clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( index );
419 
420  if( clientData != NULL )
421  eventId = *clientData;
422  }
423  else
424  {
425  eventId = event.GetId();
426  }
427 
428  int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
429 
430  // Notify GAL
431  TOOL_MANAGER* mgr = GetToolManager();
432 
433  if( mgr && IsGalCanvasActive() )
434  {
435  mgr->RunAction( "common.Control.gridPreset", true, idx );
436  }
437  else
438  SetPresetGrid( idx );
439 
440  m_canvas->Refresh();
441 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:325
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
wxChoice * m_gridSelectBox
Choice box to choose the grid size.
Definition: draw_frame.h:116
Class TOOL_MANAGER.
Definition: tool_manager.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:848
void SetPresetGrid(int aIndex)
Function SetPresetGrid() changes the grid size to one of the preset values.
Definition: draw_frame.cpp:615
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
TOOL_MANAGER * GetToolManager() const
Function GetToolManager returns the tool manager instance, if any.
Definition: draw_frame.h:863
void EDA_BASE_FRAME::OnSelectPreferredEditor ( wxCommandEvent &  event)
virtualinherited

Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ...

) The full filename editor is saved in configuration (global params)

Definition at line 497 of file basicframe.cpp.

References PGM_BASE::AskUserForPreferredEditor(), PGM_BASE::GetEditorName(), Pgm(), and PGM_BASE::SetEditorName().

498 {
499  // Ask for the current editor and instruct GetEditorName() to not show
500  // unless we pass false as argument.
501  wxString editorname = Pgm().GetEditorName( false );
502 
503  // Ask the user to select a new editor, but suggest the current one as the default.
504  editorname = Pgm().AskUserForPreferredEditor( editorname );
505 
506  // If we have a new editor name request it to be copied to m_editor_name and saved
507  // to the preferences file. If the user cancelled the dialog then the previous
508  // value will be retained.
509  if( !editorname.IsEmpty() )
510  Pgm().SetEditorName( editorname );
511 }
VTBL_ENTRY void SetEditorName(const wxString &aFileName)
Definition: pgm_base.cpp:330
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
VTBL_ENTRY const wxString AskUserForPreferredEditor(const wxString &aDefaultEditor=wxEmptyString)
Shows a dialog that instructs the user to select a new preferred editor.
Definition: pgm_base.cpp:375
VTBL_ENTRY const wxString & GetEditorName(bool aCanShowFileChooser=true)
Return the preferred editor name.
Definition: pgm_base.cpp:338
void EDA_DRAW_FRAME::OnSelectUnits ( wxCommandEvent &  aEvent)

Definition at line 296 of file draw_frame.cpp.

References g_UserUnit, INCHES, MILLIMETRES, and unitsChangeRefresh().

297 {
298  if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && g_UserUnit != MILLIMETRES )
299  {
302  }
303  else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && g_UserUnit != INCHES )
304  {
305  g_UserUnit = INCHES;
307  }
308 }
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: draw_frame.cpp:122
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
virtual void unitsChangeRefresh()
Function unitsChangeRefresh is called when when the units setting has changed to allow for any derive...
Definition: draw_frame.cpp:244
void EDA_DRAW_FRAME::OnSelectZoom ( wxCommandEvent &  event)
virtual

Functions OnSelectZoom sets 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 444 of file draw_frame.cpp.

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

445 {
446  if( m_zoomSelectBox == NULL )
447  return; // Should not happen!
448 
449  int id = m_zoomSelectBox->GetCurrentSelection();
450 
451  if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
452  return;
453 
454  if( id == 0 ) // Auto zoom (Fit in Page)
455  {
456  Zoom_Automatique( true );
457  }
458  else
459  {
460  id--;
461  double selectedZoom = GetScreen()->m_ZoomList[id];
462 
463  if( GetScreen()->GetZoom() == selectedZoom )
464  return;
465 
466  GetScreen()->SetZoom( selectedZoom );
468  }
469 
470  // Notify GAL
471  TOOL_MANAGER* mgr = GetToolManager();
472 
473  if( mgr && IsGalCanvasActive() )
474  {
475  mgr->RunAction( "common.Control.zoomPreset", true, id );
476  UpdateStatusBar();
477  }
478 }
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
const wxPoint & GetScrollCenterPosition() const
Class TOOL_MANAGER.
Definition: tool_manager.h:49
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:77
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
wxChoice * m_zoomSelectBox
Choice box to choose the zoom value.
Definition: draw_frame.h:119
double GetZoom()
Function GetZoom.
Definition: draw_frame.cpp:481
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:848
bool SetZoom(double iu_per_du)
Function SetZoom adjusts the current zoom factor.
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
TOOL_MANAGER * GetToolManager() const
Function GetToolManager returns the tool manager instance, if any.
Definition: draw_frame.h:863
virtual void UpdateStatusBar()
Function UpdateStatusBar updates the status bar information.
Definition: draw_frame.cpp:670
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
void EDA_DRAW_FRAME::OnSize ( wxSizeEvent &  event)
virtual

Function OnSize recalculates the size of toolbars and display panel when the frame size changes.

Reimplemented in FOOTPRINT_WIZARD_FRAME, FOOTPRINT_VIEWER_FRAME, and LIB_VIEW_FRAME.

Definition at line 528 of file draw_frame.cpp.

References EDA_BASE_FRAME::m_FrameSize.

529 {
530  m_FrameSize = GetClientSize( );
531 
532  SizeEv.Skip();
533 }
wxSize m_FrameSize
Definition: wxstruct.h:135
void EDA_DRAW_FRAME::OnSockRequest ( wxSocketEvent &  evt)

Definition at line 75 of file eda_dde.cpp.

References ExecuteRemoteCommand(), and IPC_BUF_SIZE.

76 {
77  size_t len;
78  wxSocketBase* sock = evt.GetSocket();
79 
80  switch( evt.GetSocketEvent() )
81  {
82  case wxSOCKET_INPUT:
83  sock->Read( client_ipc_buffer, 1 );
84 
85  if( sock->LastCount() == 0 )
86  break; // No data, occurs on opening connection
87 
88  sock->Read( client_ipc_buffer + 1, IPC_BUF_SIZE - 2 );
89  len = 1 + sock->LastCount();
90  client_ipc_buffer[len] = 0;
92  break;
93 
94  case wxSOCKET_LOST:
95  return;
96  break;
97 
98  default:
99  wxPrintf( wxT( "EDA_DRAW_FRAME::OnSockRequest() error: Invalid event !" ) );
100  break;
101  }
102 }
#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:345
void EDA_DRAW_FRAME::OnSockRequestServer ( wxSocketEvent &  evt)

Definition at line 107 of file eda_dde.cpp.

References ID_EDA_SOCKET_EVENT.

108 {
109  wxSocketBase* sock2;
110  wxSocketServer* server = (wxSocketServer*) evt.GetSocket();
111 
112  sock2 = server->Accept();
113 
114  if( sock2 == NULL )
115  return;
116 
117  sock2->Notify( true );
118  sock2->SetEventHandler( *this, ID_EDA_SOCKET_EVENT );
119  sock2->SetNotify( wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG );
120 }
void EDA_DRAW_FRAME::OnToggleCrossHairStyle ( wxCommandEvent &  aEvent)

Definition at line 311 of file draw_frame.cpp.

References EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), GetGalDisplayOptions(), INSTALL_UNBUFFERED_DC, and m_canvas.

312 {
314  m_canvas->CrossHairOff( &dc );
315 
316  auto& galOpts = GetGalDisplayOptions();
317  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
318  galOpts.NotifyChanged();
319 
320  m_canvas->CrossHairOn( &dc );
321 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:877
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:252
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:259
#define INSTALL_UNBUFFERED_DC(name, parent)
void EDA_DRAW_FRAME::OnToggleGridState ( wxCommandEvent &  aEvent)

Definition at line 282 of file draw_frame.cpp.

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.

283 {
285 
286  if( IsGalCanvasActive() )
287  {
290  }
291 
292  m_canvas->Refresh();
293 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:325
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:468
Auxiliary rendering target (noncached)
Definition: definitions.h:42
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:568
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:848
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:856
virtual void SetGridVisibility(bool aVisible)
Function SetGridVisibility() , virtual It may be overloaded by derived classes.
Definition: draw_frame.h:478
void EDA_DRAW_FRAME::OnUpdateCrossHairStyle ( wxUpdateUIEvent &  aEvent)

Definition at line 359 of file draw_frame.cpp.

References GetGalDisplayOptions().

360 {
361  aEvent.Check( GetGalDisplayOptions().m_fullscreenCursor );
362 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:877
void EDA_DRAW_FRAME::OnUpdateGrid ( wxUpdateUIEvent &  aEvent)

Definition at line 350 of file draw_frame.cpp.

References IsGridVisible(), and m_optionsToolBar.

351 {
352  wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
353 
354  aEvent.Check( IsGridVisible() );
355  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
356 }
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:468
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:126
void EDA_DRAW_FRAME::OnUpdateRedo ( wxUpdateUIEvent &  aEvent)

Definition at line 331 of file draw_frame.cpp.

References GetScreen().

332 {
333  if( GetScreen() )
334  aEvent.Enable( GetScreen()->GetRedoCommandCount() > 0 );
335 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
void EDA_DRAW_FRAME::OnUpdateUndo ( wxUpdateUIEvent &  aEvent)

Definition at line 324 of file draw_frame.cpp.

References GetScreen().

325 {
326  if( GetScreen() )
327  aEvent.Enable( GetScreen()->GetUndoCommandCount() > 0 );
328 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
void EDA_DRAW_FRAME::OnUpdateUnits ( wxUpdateUIEvent &  aEvent)

Definition at line 338 of file draw_frame.cpp.

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

339 {
340  bool enable;
341 
342  enable = ( ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM) && (g_UserUnit == MILLIMETRES))
343  || ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH) && (g_UserUnit == INCHES)) );
344 
345  aEvent.Check( enable );
346  DisplayUnitsMsg();
347 }
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: draw_frame.cpp:122
void DisplayUnitsMsg()
Function DisplayUnitsMsg displays current unit pane on the status bar.
Definition: draw_frame.cpp:504
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void EDA_DRAW_FRAME::OnZoom ( wxCommandEvent &  event)
virtual

Function OnZoom Called from any zoom event (toolbar , hotkey or popup )

Definition at line 125 of file zoom.cpp.

References GetCrossHairPosition(), GetScreen(), GetScrollCenterPosition(), 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(), RedrawScreen(), RedrawScreen2(), EDA_DRAW_PANEL::Refresh(), BASE_SCREEN::SetNextZoom(), SetPresetZoom(), BASE_SCREEN::SetPreviousZoom(), EDA_DRAW_PANEL::ToDeviceXY(), UpdateStatusBar(), and Zoom_Automatique().

126 {
127  if( m_canvas == NULL )
128  return;
129 
130  int id = event.GetId();
131  bool zoom_at_cursor = false;
132  BASE_SCREEN* screen = GetScreen();
133  wxPoint center = GetScrollCenterPosition();
134 
135  switch( id )
136  {
139  if( screen->SetPreviousZoom() )
140  RedrawScreen2( center );
141  break;
142 
143  case ID_POPUP_ZOOM_IN:
144  zoom_at_cursor = true;
145  center = GetCrossHairPosition();
146 
147  // fall thru
148  case ID_VIEWER_ZOOM_IN:
149  case ID_ZOOM_IN:
150  if( screen->SetPreviousZoom() )
151  RedrawScreen( center, zoom_at_cursor );
152  break;
153 
156  if( screen->SetNextZoom() )
157  RedrawScreen2( center );
158  break;
159 
160  case ID_POPUP_ZOOM_OUT:
161  zoom_at_cursor = true;
162  center = GetCrossHairPosition();
163 
164  // fall thru
165  case ID_VIEWER_ZOOM_OUT:
166  case ID_ZOOM_OUT:
167  if( screen->SetNextZoom() )
168  RedrawScreen( center, zoom_at_cursor );
169  break;
170 
173  case ID_ZOOM_REDRAW:
174  m_canvas->Refresh();
175  break;
176 
178  center = GetCrossHairPosition();
179  RedrawScreen( center, true );
180  break;
181 
182  case ID_POPUP_ZOOM_PAGE:
183  case ID_VIEWER_ZOOM_PAGE:
184  case ID_ZOOM_PAGE:
185  Zoom_Automatique( false );
186  break;
187 
189  break;
190 
191  case ID_POPUP_CANCEL:
193  break;
194 
195  default:
197  }
198 
199  UpdateStatusBar();
200 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:325
wxPoint ToDeviceXY(const wxPoint &pos)
Function ToDeviceXY transforms logical to device coordinates.
Definition: draw_panel.cpp:195
Definition: id.h:232
const wxPoint & GetScrollCenterPosition() const
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:347
bool SetPreviousZoom()
bool SetNextZoom()
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:77
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
void SetPresetZoom(int aIndex)
Function SetPresetZoom() changes zoom to one of the preset values.
Definition: zoom.cpp:215
void RedrawScreen2(const wxPoint &posBefore)
Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming...
Definition: zoom.cpp:61
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
virtual void UpdateStatusBar()
Function UpdateStatusBar updates the status bar information.
Definition: draw_frame.cpp:670
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
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 170 of file kiway_player.h.

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

171  {
172  // overload me for your wxFrame type.
173 
174  // Any overload should probably do this also:
175  // Prj().MaybeLoadProjectSettings();
176 
177  // Then update the window title.
178 
179  return false;
180  }
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 647 of file basicframe.cpp.

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().

648 {
649  if( evt_type != 0 )
650  {
651  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
652  evt.SetEventObject( this );
653  evt.SetId( evt_type );
654  wxPostEvent( this, evt );
655  return true;
656  }
657 
658  return false;
659 }
void EDA_BASE_FRAME::PrintMsg ( const wxString &  text)
inherited

Definition at line 382 of file basicframe.cpp.

Referenced by SCH_EDIT_FRAME::LoadOneEEFile(), and EDA_DRAW_PANEL::OnMouseEvent().

383 {
384  SetStatusText( text );
385 }
void EDA_DRAW_FRAME::PrintPage ( wxDC *  aDC,
LSET  aPrintMask,
bool  aPrintMirrorMode,
void *  aData = NULL 
)
virtual

Function PrintPage used to print a page 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, GERBVIEW_FRAME, LIB_EDIT_FRAME, PCB_EDIT_FRAME, PL_EDITOR_FRAME, and FOOTPRINT_EDIT_FRAME.

Definition at line 395 of file draw_frame.cpp.

Referenced by BOARD_PRINTOUT_CONTROLLER::DrawPage(), and DrawPageOnClipboard().

396 {
397  wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
398 }
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.

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

Referenced by SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::AppendOneEEProject(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), SCH_EDIT_FRAME::backAnnotateFootprints(), LIB_VIEW_FRAME::BestZoom(), DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_MODULE_MODULE_EDITOR::Cfg3DPath(), DIALOG_MODULE_BOARD_EDITOR::Cfg3DPath(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_SCREEN::CheckComponentsToPartsLinks(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), SCH_EDIT_FRAME::CreateArchiveLibrary(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), LIB_EDIT_FRAME::DeleteOnePart(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG(), DIALOG_FP_LIB_TABLE::DIALOG_FP_LIB_TABLE(), DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR(), DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName(), DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportToGenCAD(), 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(), LIB_EDIT_FRAME::GetCurPart(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), FOOTPRINT_EDIT_FRAME::getLibPath(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), LIB_EDIT_FRAME::InstallConfigFrame(), SCH_EDIT_FRAME::InstallConfigFrame(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), DIALOG_BOM_EDITOR::LoadComponents(), CVPCB_MAINFRAME::LoadFootprintFiles(), SCH_EDIT_FRAME::LoadOneEEFile(), LIB_EDIT_FRAME::LoadOneLibraryPart(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), LIB_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_GENDRILL::OnGenReportFile(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), DIALOG_NETLIST::OnSaveMessagesToFile(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectIcLib(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OnSelectUnit(), DIALOG_SPICE_MODEL::onSemiSelectLib(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_EDITOR_CONTROL::PlaceModule(), SCH_EDIT_FRAME::prepareForNetlist(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDIT_FRAME::RescueProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_SCREEN::Save(), LIB_EDIT_FRAME::SaveActiveLibrary(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_ERC::TestErc(), DIALOG_SPICE_MODEL::updateFromFile(), SIM_PLOT_FRAME::updateNetlistExporter(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), CVPCB_MAINFRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR(), and DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR().

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:144
void EDA_DRAW_FRAME::Process_PageSettings ( wxCommandEvent &  event)

Definition at line 80 of file dialog_page_settings.cpp.

References m_canvas, BASE_SCREEN::m_PageLayoutDescrFileName, EDA_DRAW_PANEL::Refresh(), and DIALOG_PAGES_SETTINGS::SetWksFileName().

81 {
82  DIALOG_PAGES_SETTINGS dlg( this );
83  dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName );
84 
85  if( dlg.ShowModal() == wxID_OK )
86  {
87  if( m_canvas )
88  m_canvas->Refresh();
89  }
90 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:325
static wxString m_PageLayoutDescrFileName
the name of the page layout descr file, or emty to used the default pagelayout
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
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 166 of file basicframe.cpp.

References 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 LIB_VIEW_FRAME::onSelectNextSymbol(), LIB_VIEW_FRAME::onSelectPreviousSymbol(), KIWAY::ProcessEvent(), LIB_VIEW_FRAME::ReCreateListCmp(), and PCBNEW_CONTROL::SwitchUnits().

167 {
168  if( !wxFrame::ProcessEvent( aEvent ) )
169  return false;
170 
171  if( IsShown() && m_hasAutoSave && IsActive() &&
173  {
174  if( !m_autoSaveState )
175  {
176  wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
177  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
178  m_autoSaveState = true;
179  }
180  else if( m_autoSaveTimer->IsRunning() )
181  {
182  wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
183  m_autoSaveTimer->Stop();
184  m_autoSaveState = false;
185  }
186  }
187 
188  return true;
189 }
bool m_autoSaveState
Flag to indicate the last auto save state.
Definition: wxstruct.h:150
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
Definition: wxstruct.h:156
virtual bool isAutoSaveRequired() const
Function autoSaveRequired returns the auto save status of the application.
Definition: wxstruct.h:173
bool m_hasAutoSave
Flag to indicate if this frame supports auto save.
Definition: wxstruct.h:147
int m_autoSaveInterval
The auto save interval time in seconds.
Definition: wxstruct.h:153
const wxChar traceAutoSave[]
Flag to enable auto save feature debug tracing.
Definition: basicframe.cpp:53
void EDA_DRAW_FRAME::PushPreferences ( const EDA_DRAW_PANEL aParentCanvas)

Function PushPreferences Pushes a few 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 807 of file draw_frame.cpp.

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().

808 {
810  m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
811 }
bool GetEnableAutoPan() const
void SetEnableZoomNoCenter(bool aEnable)
Definition: draw_panel.cpp:656
bool GetEnableZoomNoCenter() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
void SetEnableAutoPan(bool aEnable)
int EDA_BASE_FRAME::ReadHotkeyConfig ( struct EDA_HOTKEY_CONFIG aDescList)
inherited

Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys.

Parameters
aDescList= current hotkey list descr. to initialize.

Definition at line 658 of file hotkeys_basic.cpp.

659 {
660  ::ReadHotkeyConfig( GetName(), aDescList );
661  return 1;
662 }
int ReadHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys...
int EDA_BASE_FRAME::ReadHotkeyConfigFile ( const wxString &  aFilename,
struct EDA_HOTKEY_CONFIG aDescList 
)
inherited

Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys.

Parameters
aFilename= file name to read.
aDescList= current hotkey list descr. to initialize.

Definition at line 601 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, and ParseHotkeyConfig().

Referenced by EDA_BASE_FRAME::ImportHotkeyConfigFromFile().

603 {
604  wxFileName fn( aFilename );
605  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
606 
607  wxFile cfgfile( fn.GetFullPath() );
608 
609  if( !cfgfile.IsOpened() ) // There is a problem to open file
610  return 0;
611 
612  // get length
613  cfgfile.SeekEnd();
614  wxFileOffset size = cfgfile.Tell();
615  cfgfile.Seek( 0 );
616 
617  // read data
618  char* buffer = new char[size];
619  cfgfile.Read( buffer, size );
620 
621  wxString data( buffer, wxConvUTF8 );
622 
623  // parse
624  ParseHotkeyConfig( data, aDescList );
625 
626  // cleanup
627  delete[] buffer;
628  cfgfile.Close();
629  return 1;
630 }
void ParseHotkeyConfig(const wxString &data, struct EDA_HOTKEY_CONFIG *aDescList)
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
void EDA_DRAW_FRAME::ReCreateAuxiliaryToolbar ( )
virtual

Reimplemented in PCB_EDIT_FRAME, GERBVIEW_FRAME, and FOOTPRINT_EDIT_FRAME.

Definition at line 365 of file draw_frame.cpp.

366 {
367 }
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, PCB_BASE_FRAME, LIB_EDIT_FRAME, PL_EDITOR_FRAME, FOOTPRINT_EDIT_FRAME, FOOTPRINT_VIEWER_FRAME, and LIB_VIEW_FRAME.

Definition at line 370 of file draw_frame.cpp.

371 {
372 }
virtual void EDA_DRAW_FRAME::RedrawActiveWindow ( wxDC *  DC,
bool  EraseBg 
)
pure virtual
void EDA_DRAW_FRAME::RedrawScreen ( const wxPoint aCenterPoint,
bool  aWarpPointer 
)

Function RedrawScreen redraws 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.

Definition at line 46 of file zoom.cpp.

References AdjustScrollBars(), IsGalCanvasActive(), m_canvas, EDA_DRAW_PANEL::MoveCursorToCrossHair(), and EDA_DRAW_PANEL::Refresh().

Referenced by PCB_BASE_FRAME::CursorGoto(), SCH_EDIT_FRAME::DisplayCurrentSheet(), CVPCB_MAINFRAME::DisplayModule(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::FindComponentAndItem(), PL_EDITOR_FRAME::MoveItem(), SCH_EDIT_FRAME::OnFindDrcMarker(), DIALOG_ERC::OnLeftClickMarkersList(), DIALOG_ERC::OnLeftDblClickMarkersList(), EDA_DRAW_PANEL::OnMouseEvent(), OnSelectZoom(), OnZoom(), LIB_EDIT_FRAME::PlaceAnchor(), SetPresetZoom(), SCH_EDIT_FRAME::updateFindReplaceView(), Window_Zoom(), and Zoom_Automatique().

47 {
48  if( IsGalCanvasActive() )
49  return;
50 
51  AdjustScrollBars( aCenterPoint );
52 
53  // Move the mouse cursor to the on grid graphic cursor position
54  if( aWarpPointer )
56 
57  m_canvas->Refresh();
58  m_canvas->Update();
59 }
void AdjustScrollBars(const wxPoint &aCenterPosition)
Definition: draw_frame.cpp:912
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:325
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:347
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:848
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
void EDA_DRAW_FRAME::RedrawScreen2 ( const wxPoint posBefore)

Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming.

Parameters
posBeforescreen position of the crosshair before zooming

Definition at line 61 of file zoom.cpp.

References AdjustScrollBars(), GetCrossHairPosition(), IsGalCanvasActive(), m_canvas, EDA_DRAW_PANEL::Refresh(), EDA_DRAW_PANEL::ToDeviceXY(), and EDA_DRAW_PANEL::ToLogicalXY().

Referenced by OnZoom().

62 {
63  if( IsGalCanvasActive() )
64  return;
65 
66  wxPoint dPos = posBefore - m_canvas->GetClientSize() / 2; // relative screen position to center before zoom
67  wxPoint newScreenPos = m_canvas->ToDeviceXY( GetCrossHairPosition() ); // screen position of crosshair after zoom
68  wxPoint newCenter = m_canvas->ToLogicalXY( newScreenPos - dPos );
69 
70  AdjustScrollBars( newCenter );
71 
72  m_canvas->Refresh();
73  m_canvas->Update();
74 }
void AdjustScrollBars(const wxPoint &aCenterPosition)
Definition: draw_frame.cpp:912
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:325
wxPoint ToDeviceXY(const wxPoint &pos)
Function ToDeviceXY transforms logical to device coordinates.
Definition: draw_panel.cpp:195
wxPoint ToLogicalXY(const wxPoint &pos)
Function ToLogicalXY transforms device to logical coordinates.
Definition: draw_panel.cpp:205
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:848
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
wxPoint EDA_DRAW_FRAME::RefPos ( bool  useMouse) const

Function RefPos 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 1265 of file draw_frame.cpp.

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(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), PushTrack(), PCB_EDIT_FRAME::SelectHighLight(), and SetPresetGrid().

1266 {
1267  BASE_SCREEN* screen = GetScreen(); // virtual call
1268  return screen->refPos( useMouse );
1269 }
wxPoint refPos(bool useMouse) const
Function RefPos Return the reference position, coming from either the mouse position or the cursor po...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
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 1287 of file draw_frame.cpp.

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(), LIB_VIEW_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(), PCB_EDIT_FRAME::GeneralControl(), and GERBVIEW_FRAME::GeneralControl().

1290 {
1291  wxPoint newpos = GetCrossHairPosition();
1292 
1293  // Redraw the crosshair if it moved
1294  if( aOldPos != newpos )
1295  {
1296  SetCrossHairPosition( aOldPos, false );
1297  m_canvas->CrossHairOff( aDC );
1298  SetCrossHairPosition( newpos, false );
1299  m_canvas->CrossHairOn( aDC );
1300 
1301  if( m_canvas->IsMouseCaptured() )
1302  {
1303 #ifdef USE_WX_OVERLAY
1304  wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC );
1305  oDC.Clear();
1306  m_canvas->CallMouseCapture( aDC, aEvtPos, false );
1307 #else
1308  m_canvas->CallMouseCapture( aDC, aEvtPos, true );
1309 #endif
1310  }
1311 #ifdef USE_WX_OVERLAY
1312  else
1313  {
1314  m_overlay.Reset();
1315  }
1316 #endif
1317  }
1318 }
bool IsMouseCaptured() const
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:252
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:259
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void EDA_DRAW_FRAME::ReleaseFile ( )

Function ReleaseFile Release the current file marked in use.

See m_file_checker.

Definition at line 230 of file draw_frame.cpp.

References m_file_checker.

Referenced by ~EDA_DRAW_FRAME().

231 {
232  m_file_checker = nullptr;
233 }
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:75
bool EDA_DRAW_FRAME::saveCanvasTypeSetting ( EDA_DRAW_PANEL_GAL::GAL_TYPE  aCanvasType)
protected

Stores the canvas type in the application settings.

Definition at line 1194 of file draw_frame.cpp.

References CANVAS_TYPE_KEY, EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, Kiface(), and KIFACE_I::KifaceSettings().

Referenced by PCB_BASE_FRAME::SwitchCanvas(), and GERBVIEW_FRAME::SwitchCanvas().

1195 {
1196  if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1197  || aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1198  {
1199  assert( false );
1200  return false;
1201  }
1202 
1203  wxConfigBase* cfg = Kiface().KifaceSettings();
1204 
1205  if( cfg )
1206  return cfg->Write( CANVAS_TYPE_KEY, (long) aCanvasType );
1207 
1208  return false;
1209 }
Sentinel, do not use as a parameter.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
static const wxChar CANVAS_TYPE_KEY[]
Key in KifaceSettings to store the canvas type.
Definition: draw_frame.h:185
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 274 of file wxstruct.h.

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick().

274 {};
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, and PCB_EDIT_FRAME.

Definition at line 736 of file draw_frame.cpp.

References EDA_BASE_FRAME::ConfigBaseName(), GalDisplayOptionsKeyword(), GetGridColor(), GetScreen(), GridColorEntryKeyword(), IsGridVisible(), LastGridSizeIdKeyword(), m_galDisplayOptions, m_LastGridSizeId, MaxUndoItemsEntry(), EDA_BASE_FRAME::SaveSettings(), and ShowGridEntryKeyword().

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

737 {
739 
740  wxString baseCfgName = ConfigBaseName();
741 
742  aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
743  aCfg->Write( baseCfgName + GridColorEntryKeyword,
744  GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
745  aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
746 
747  if( GetScreen() )
748  aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) );
749 
750  m_galDisplayOptions->WriteConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
751 }
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_galDisplayOptions
Definition: draw_frame.h:71
static const wxString MaxUndoItemsEntry(wxT("DevelMaxUndoItems"))
Integer to set the maximum number of undo items on the stack.
virtual void SaveSettings(wxConfigBase *aCfg)
Function SaveSettings saves common frame parameters to a configuration data file. ...
Definition: basicframe.cpp:316
wxString ConfigBaseName()
Function ConfigBaseName.
Definition: wxstruct.h:260
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:468
static const wxString GalDisplayOptionsKeyword(wxT("GalDisplayOptions"))
GAL Display Options.
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
static const wxString ShowGridEntryKeyword(wxT("ShowGrid"))
Nonzero to show grid (suffix)
int m_LastGridSizeId
Definition: draw_frame.h:78
virtual COLOR4D GetGridColor()
Function GetGridColor() , virtual.
Definition: draw_frame.h:487
static const wxString LastGridSizeIdKeyword(wxT("_LastGridSize"))
Most recently used grid size (suffix)
static const wxString GridColorEntryKeyword(wxT("GridColor"))
Grid color ID (suffix)
void EDA_BASE_FRAME::SetAutoSaveInterval ( int  aInterval)
inherited

Definition at line 205 of file basicframe.cpp.

References EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_autoSaveState, and EDA_BASE_FRAME::m_autoSaveTimer.

Referenced by DIALOG_GENERALOPTIONS::OnOkClick(), and SCH_EDIT_FRAME::OnPreferencesOptions().

206 {
207  m_autoSaveInterval = aInterval;
208 
209  if( m_autoSaveTimer->IsRunning() )
210  {
211  if( m_autoSaveInterval > 0 )
212  {
213  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
214  }
215  else
216  {
217  m_autoSaveTimer->Stop();
218  m_autoSaveState = false;
219  }
220  }
221 }
bool m_autoSaveState
Flag to indicate the last auto save state.
Definition: wxstruct.h:150
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
Definition: wxstruct.h:156
int m_autoSaveInterval
The auto save interval time in seconds.
Definition: wxstruct.h:153
virtual void EDA_DRAW_FRAME::SetAuxOrigin ( const wxPoint aPosition)
pure virtual
void EDA_DRAW_FRAME::SetCrossHairPosition ( const wxPoint aPosition,
bool  aSnapToGrid = true 
)

Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units.

Parameters
aPositionThe new cross hair position.
aSnapToGridSets the cross hair position to the nearest grid position to aPosition.

Definition at line 1230 of file draw_frame.cpp.

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

Referenced by Abort_EditEdge(), PCB_EDIT_FRAME::AutoPlaceModule(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PL_EDITOR_FRAME::Block_Move(), GERBVIEW_FRAME::Block_Move(), SCH_EDIT_FRAME::CreateSheet(), PCB_BASE_FRAME::CursorGoto(), SCH_EDIT_FRAME::DisplayCurrentSheet(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::FindComponentAndItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_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(), PCB_EDIT_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), InstallBlockCmdFrame(), LIB_EDIT_FRAME::LIB_EDIT_FRAME(), LIB_EDIT_FRAME::LoadOneSymbol(), PL_EDITOR_FRAME::Locate(), SCH_EDIT_FRAME::MoveImage(), PL_EDITOR_FRAME::MoveItem(), DIALOG_MODULE_MODULE_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_MODULE_EDITOR::OnEditValue(), DIALOG_MODULE_BOARD_EDITOR::OnEditValue(), SCH_EDIT_FRAME::OnFindDrcMarker(), DIALOG_ERC::OnLeftClickMarkersList(), DIALOG_ERC::OnLeftDblClickMarkersList(), EDA_DRAW_PANEL::OnMouseLeaving(), EDA_DRAW_PANEL::OnMouseWheel(), SCH_EDIT_FRAME::PrepareMoveItem(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), RefreshCrossHair(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), SetPresetGrid(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), SCH_EDIT_FRAME::updateFindReplaceView(), and Zoom_Automatique().

1231 {
1232  BASE_SCREEN* screen = GetScreen(); // virtual call
1233  screen->setCrossHairPosition( aPosition, GetGridOrigin(), aSnapToGrid );
1234 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
void setCrossHairPosition(const wxPoint &aPosition, const wxPoint &aGridOrigin, bool aSnapToGrid)
Function setCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
virtual void EDA_DRAW_FRAME::SetDrawBgColor ( COLOR4D  aColor)
inlinevirtual
Parameters
aColorthe COLOR4D for the canvas background

Reimplemented in SCH_BASE_FRAME.

Definition at line 316 of file draw_frame.h.

Referenced by PLEDITOR_PRINTOUT::DrawPage(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), PL_EDITOR_FRAME::LoadSettings(), PL_EDITOR_FRAME::PL_EDITOR_FRAME(), PL_EDITOR_FRAME::Process_Config(), and WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl().

316 { m_drawBgColor= aColor ; }
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:84
void EDA_DRAW_FRAME::SetGalCanvas ( EDA_DRAW_PANEL_GAL aPanel)
inline

Definition at line 857 of file draw_frame.h.

Referenced by GERBVIEW_FRAME::GERBVIEW_FRAME().

857 { m_galCanvas = aPanel; }
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:68
virtual void EDA_DRAW_FRAME::SetGridColor ( COLOR4D  aColor)
inlinevirtual

Function SetGridColor() , virtual.

Parameters
aColor= the new color of the grid

Reimplemented in PCB_EDIT_FRAME, and GERBVIEW_FRAME.

Definition at line 496 of file draw_frame.h.

Referenced by LIB_VIEW_FRAME::LoadSettings(), LIB_EDIT_FRAME::LoadSettings(), SCH_EDIT_FRAME::LoadSettings(), LoadSettings(), and WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl().

497  {
498  m_gridColor = aColor;
499  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:83
virtual void EDA_DRAW_FRAME::SetGridOrigin ( const wxPoint aPosition)
pure virtual
virtual void EDA_DRAW_FRAME::SetGridVisibility ( bool  aVisible)
inlinevirtual

Function SetGridVisibility() , virtual It may be overloaded by derived classes.

Parameters
aVisible= true if the grid must be shown

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, GERBVIEW_FRAME, and DISPLAY_FOOTPRINTS_FRAME.

Definition at line 478 of file draw_frame.h.

Referenced by LoadSettings(), LIB_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::OnPreferencesOptions(), OnToggleGridState(), PL_EDITOR_FRAME::Process_Config(), and GERBVIEW_FRAME::SetGridVisibility().

479  {
480  m_drawGrid = aVisible;
481  }
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_player.h:85
const char * name
void KIWAY_PLAYER::SetModal ( bool  aIsModal)
inlineprotectedinherited

Definition at line 217 of file kiway_player.h.

References KIWAY_PLAYER::m_modal.

217 { m_modal = aIsModal; }
void EDA_DRAW_FRAME::SetMousePosition ( const wxPoint aPosition)

Definition at line 1258 of file draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnKeyEvent(), and EDA_DRAW_PANEL::OnMouseEvent().

1259 {
1260  BASE_SCREEN* screen = GetScreen(); // virtual call
1261  screen->setMousePosition( aPosition );
1262 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
void setMousePosition(const wxPoint &aPosition)
void EDA_BASE_FRAME::SetMruPath ( const wxString &  aPath)
inlineinherited

Definition at line 361 of file wxstruct.h.

Referenced by EDA_BASE_FRAME::ExportHotkeyConfigToFile(), EDA_BASE_FRAME::ImportHotkeyConfigFromFile(), and KICAD_MANAGER_FRAME::LoadProject().

361 { m_mruPath = aPath; }
wxString m_mruPath
Most recently used path.
Definition: wxstruct.h:160
void EDA_DRAW_FRAME::SetMsgPanel ( const std::vector< MSG_PANEL_ITEM > &  aList)

Function SetMsgPanel clears the message panel and populates it with the contents of aList.

Parameters
aListis the list of MSG_PANEL_ITEM objects to fill the message panel.

Definition at line 774 of file draw_frame.cpp.

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

Referenced by PCB_BASE_FRAME::AddPad(), PCB_EDIT_FRAME::Attribut_Segment(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Self(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::Change_Side_Module(), PCB_BASE_FRAME::Compile_Ratsnest(), PCB_BASE_FRAME::CreateNewModule(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_Module(), PCB_EDIT_FRAME::Delete_net(), PCB_EDIT_FRAME::Delete_Segment(), FOOTPRINT_EDIT_FRAME::DlgGlobalChange_PadSettings(), PCB_EDIT_FRAME::DlgGlobalChange_PadSettings(), DRC::Drc(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditGraphicSymbol(), PCB_EDIT_FRAME::End_Route(), PCB_BASE_FRAME::Export_Pad_Settings(), PCB_EDIT_FRAME::FlipTextePcb(), getOptimalModulePlacement(), FOOTPRINT_EDIT_FRAME::Import_Module(), SCH_EDIT_FRAME::Load_Component(), GERBVIEW_FRAME::Locate(), SCH_EDIT_FRAME::LocateAndShowItem(), LIB_EDIT_FRAME::locateItem(), SCH_EDIT_FRAME::LocateItem(), PCB_EDIT_FRAME::LockModule(), LIB_EDIT_FRAME::OnEditPin(), PCB_EDIT_FRAME::OnHotKey(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftDClick(), DIALOG_LIB_EDIT_TEXT::OnOkClick(), LIB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::Other_Layer_Route(), DIALOG_UPDATE_PCB::PerformUpdate(), PickModule(), PCB_BASE_FRAME::PlaceModule(), PCB_EDIT_FRAME::Process_Special_Functions(), PAD_TOOL::pushPadSettings(), DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow(), FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow(), FOOTPRINT_WIZARD_FRAME::RedrawActiveWindow(), PCB_EDIT_FRAME::RemoveStruct(), LIB_EDIT_FRAME::RepeatPinItem(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), PCB_BASE_FRAME::RotatePad(), PCB_BASE_FRAME::RotateTextModule(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), GERBVIEW_FRAME::SetCurItem(), SetMsgPanel(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), ShowNewTrackWhenMovingCursor(), PCB_EDIT_FRAME::Start_Move_DrawItem(), PCB_BASE_FRAME::StartMovePad(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), and UpdateMsgPanel().

775 {
776  if( m_messagePanel == NULL )
777  return;
778 
779  ClearMsgPanel();
780 
781  for( unsigned i = 0; i < aList.size(); i++ )
782  m_messagePanel->AppendMessage( aList[i] );
783 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:129
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
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:765
void EDA_DRAW_FRAME::SetMsgPanel ( EDA_ITEM aItem)

Definition at line 786 of file draw_frame.cpp.

References EDA_ITEM::GetMsgPanelInfo(), and SetMsgPanel().

787 {
788  wxCHECK_RET( aItem != NULL, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
789 
790  MSG_PANEL_ITEMS items;
791  aItem->GetMsgPanelInfo( items );
792  SetMsgPanel( items );
793 }
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:774
virtual void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList)
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: base_struct.h:291
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
void EDA_DRAW_FRAME::SetNextGrid ( )
virtual

Function SetNextGrid() changes the grid size settings to the next one available.

Reimplemented in PCB_BASE_FRAME.

Definition at line 587 of file draw_frame.cpp.

References BASE_SCREEN::GetGridCmdId(), GetScreen(), BASE_SCREEN::GridExists(), and SetPresetGrid().

Referenced by COMMON_TOOLS::GridNext(), and PCB_BASE_FRAME::SetNextGrid().

588 {
589  BASE_SCREEN * screen = GetScreen();
590 
591  int new_grid_cmd = screen->GetGridCmdId();
592 
593  // if the grid id is the not the last, increment it
594  if( screen->GridExists( new_grid_cmd + 1 ) )
595  new_grid_cmd += 1;
596 
597  SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
598 }
int GetGridCmdId() const
Return the command ID of the currently selected grid.
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
void SetPresetGrid(int aIndex)
Function SetPresetGrid() changes the grid size to one of the preset values.
Definition: draw_frame.cpp:615
bool GridExists(int aCommandId)
Function GridExists tests for grid command ID (not an index in grid list, but a wxID) exists in grid ...
void EDA_DRAW_FRAME::SetNextZoom ( )

Function SetNextZoom() changes the zoom to the next one available.

Definition at line 203 of file zoom.cpp.

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

204 {
205  GetScreen()->SetNextZoom();
206 }
bool SetNextZoom()
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:334
void EDA_DRAW_FRAME::SetNoToolSelected ( )
virtual

Select the ID_NO_TOOL_SELECTED id tool (Idle tool)

Definition at line 561 of file draw_frame.cpp.

References EDA_DRAW_PANEL_GAL::GetDefaultCursor(), EDA_DRAW_PANEL::GetDefaultCursor(), GetGalCanvas(), ID_NO_TOOL_SELECTED, IsGalCanvasActive(), m_canvas, and SetToolID().

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawZone(), ZOOM_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::MeasureTool(), PCB_EDIT_FRAME::MuWaveCommand(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), PCB_EDIT_FRAME::OnSelectTool(), PCB_EDITOR_CONTROL::PlaceModule(), MODULE_EDITOR_TOOLS::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), DRAWING_TOOL::SetAnchor(), and UseGalCanvas().

562 {
563  // Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
564 
565  int defaultCursor = wxCURSOR_DEFAULT;
566 
567  // Change GAL canvas cursor if requested.
568  if( IsGalCanvasActive() )
569  defaultCursor = GetGalCanvas()->GetDefaultCursor();
570  else if( m_canvas )
571  defaultCursor = m_canvas->GetDefaultCursor();
572 
573  SetToolID( ID_NO_TOOL_SELECTED, defaultCursor, wxEmptyString );
574 }
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to chec