KiCad PCB EDA Suite
PL_EDITOR_FRAME Class Reference

Class PL_EDITOR_FRAME is the main window used in the page layout editor. More...

#include <pl_editor_frame.h>

Inheritance diagram for PL_EDITOR_FRAME:
EDA_DRAW_FRAME KIWAY_PLAYER EDA_BASE_FRAME KIWAY_HOLDER

Public Member Functions

 PL_EDITOR_FRAME (KIWAY *aKiway, wxWindow *aParent)
 
 ~PL_EDITOR_FRAME ()
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl) override
 
bool LoadPageLayoutDescrFile (const wxString &aFullFileName)
 Function LoadPageLayoutDescrFile Loads a .kicad_wks page layout descr file. More...
 
bool SavePageLayoutDescrFile (const wxString &aFullFileName)
 Function SavePageLayoutDescrFile Save the current layout in a .kicad_wks page layout descr file. More...
 
bool InsertPageLayoutDescrFile (const wxString &aFullFileName)
 Function InsertPageLayoutDescrFile Loads a .kicad_wks page layout descr file, and add items to the current layout list. More...
 
void OnCloseWindow (wxCloseEvent &Event)
 
void RedrawActiveWindow (wxDC *DC, bool EraseBg) override
 
void ReCreateHToolbar () override
 
void SetPageSettings (const PAGE_INFO &) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxString GetZoomLevelIndicator () const override
 Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs. More...
 
PL_EDITOR_SCREENGetScreen () const override
 Return a pointer to a BASE_SCREEN or one of its derivatives. More...
 
const wxPointGetAuxOrigin () const override
 Return the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPosition) override
 
const wxPointGetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void UpdateStatusBar () override
 Update the status bar information. More...
 
void OnNewPageLayout ()
 Must be called to initialize parameters when a new page layout description is loaded. More...
 
void ReCreateVToolbar () override
 creates or updates the right vertical toolbar. More...
 
void ReCreateOptToolbar ()
 Create or update the left vertical toolbar (option toolbar. More...
 
void ReCreateMenuBar () override
 Function ReCreateMenuBar Creates recreates the menu bar. More...
 
void OnLeftClick (wxDC *aDC, const wxPoint &aMousePos) override
 
void OnLeftDClick (wxDC *aDC, const wxPoint &aMousePos) override
 
bool OnRightClick (const wxPoint &aMousePos, wxMenu *aPopMenu) override
 
double BestZoom () override
 Return the zoom level which displays the full page on screen. More...
 
void OnTreeSelection (wxTreeEvent &event)
 
void OnTreeMiddleClick (wxTreeEvent &event)
 
void OnTreeRightClick (wxTreeEvent &event)
 
const PL_EDITOR_LAYOUTGetPageLayout () const
 
bool GetPageNumberOption () const
 Page layout editor can show the title block using a page number 1 or another number. More...
 
void UpdateTitleAndInfo ()
 Displays the short filename (if exists) loaded file on the caption of the main window. More...
 
PARAM_CFG_ARRAYGetConfigurationSettings (void)
 Populates the applicatios settings list. More...
 
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 Process_Special_Functions (wxCommandEvent &event)
 
void OnSelectOptionToolbar (wxCommandEvent &event)
 
void OnSelectCoordOriginCorner (wxCommandEvent &event)
 called when the user select one of the 4 page corner as corner reference (or the left top paper corner) More...
 
void OnSelectTitleBlockDisplayMode (wxCommandEvent &event)
 Toggle the display mode between the normal mode and the editor mode: In normal mode, title block texts are shown like they will be shown in other kicad applications: the format symbols in texts are replaced by the actual text. More...
 
void OnUpdateTitleBlockDisplayNormalMode (wxUpdateUIEvent &event)
 
void OnUpdateTitleBlockDisplaySpecialMode (wxUpdateUIEvent &event)
 
void OnUpdateSelectTool (wxUpdateUIEvent &aEvent)
 
virtual int BlockCommand (EDA_KEY key) override
 Function BlockCommand returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to the aKey (ALT, SHIFT ALT ..) More...
 
virtual void HandleBlockPlace (wxDC *DC) override
 Function HandleBlockPlace handles the block place command. More...
 
virtual bool HandleBlockEnd (wxDC *DC) override
 Function HandleBlockEnd( ) handles the end of a block command, It is called at the end of the definition of the area of a block. More...
 
void Block_Move (wxDC *DC)
 Function Block_Move moves all items within the selected block. More...
 
void OnQuit (wxCommandEvent &event)
 Function OnQuit called on request of application quit. More...
 
EDA_HOTKEYGetHotKeyDescription (int aCommand) const override
 > More...
 
bool OnHotKey (wxDC *aDC, int aHotkeyCode, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
 Function OnHotKey. More...
 
void Process_Settings (wxCommandEvent &event)
 
void Process_Config (wxCommandEvent &event)
 
void ToPlotter (wxCommandEvent &event)
 Function ToPlotter Open a dialog frame to create plot and drill files relative to the current board. More...
 
void ToPrinter (wxCommandEvent &event)
 Function ToPrinter Open a dialog frame to print layers. More...
 
void Files_io (wxCommandEvent &event)
 
bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
 Perform application specific control using aDC at aPosition in logical units. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMasklayer, bool aPrintMirrorMode, void *aData) override
 Virtual function PrintPage used to print a page. More...
 
void OnFileHistory (wxCommandEvent &event)
 
const wxString & GetCurrFileName () const
 
void SetCurrFileName (const wxString &aName)
 Stores the current layout descr file filename. More...
 
void RebuildDesignTree ()
 Function RebuildDesignTree Re creates the design graphic tree list items, and ensures each item has an unique name. More...
 
WORKSHEET_DATAITEMAddPageLayoutItem (int aType, int aIdx=-1)
 Function AddPageLayoutItem Add a new item to the page layout item list. More...
 
WORKSHEET_DATAITEMGetSelectedItem ()
 Function GetSelectedItem. More...
 
WORKSHEET_DATAITEMLocate (wxDC *aDC, const wxPoint &aPosition)
 Function Locate. More...
 
void MoveItem (WORKSHEET_DATAITEM *aItem)
 Initialize a move item command. More...
 
void PlaceItem (WORKSHEET_DATAITEM *aItem)
 Save in Undo list the layout, and place an item being moved. More...
 
void OnModify ()
 Must be called after a change in order to set the "modify" flag of the current screen. More...
 
void SaveCopyInUndoList ()
 Save a copy of the description (in a S expr string) for Undo/redo commands. More...
 
void GetLayoutFromRedoList (wxCommandEvent &event)
 Redo the last edit: More...
 
void GetLayoutFromUndoList (wxCommandEvent &event)
 Undo the last edit: More...
 
void RemoveLastCommandInUndoList ()
 Remove the last command in Undo List. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
EDA_UNITS_T GetUserUnits () const override
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS_T aUnits)
 
int GetLastGridSizeId () const
 
void SetLastGridSizeId (int aId)
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Set the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Return the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Return the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Return the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
virtual EDA_DRAW_PANELGetCanvas () const
 
virtual wxString GetScreenDesc () const
 
virtual void ExecuteRemoteCommand (const char *cmdline)
 Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 After calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Return a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Return the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
wxAuiToolBar * GetOptionsToolBar () const
 
wxAuiToolBar * GetDrawToolBar () const
 
wxAuiToolBar * GetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
wxAuiToolBarItem * GetToolbarTool (int aToolId)
 Checks all the toolbars and returns a reference to the given tool id or nullptr if not found. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg)
 Set the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 
virtual void SetGridVisibility (bool aVisible)
 It may be overloaded by derived classes. More...
 
virtual COLOR4D GetGridColor ()
 
virtual void SetGridColor (COLOR4D aColor)
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Change the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Change the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Change the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Set the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Change the zoom to the next one available. More...
 
void SetNextZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the next one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPrevZoom ()
 Change the zoom to the previous one available. More...
 
void SetPreviousZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the previous one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPresetZoom (int aIndex)
 Change zoom to one of the preset values. More...
 
virtual void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
virtual void RedrawScreen2 (const wxPoint &posBefore)
 Put the crosshair back to the screen position it had before zooming. More...
 
virtual void HardRedraw ()
 Rebuild the GAL and redraws the screen. More...
 
virtual void Zoom_Automatique (bool aWarpPointer)
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
virtual void Window_Zoom (EDA_RECT &Rect)
 
void FocusOnLocation (const wxPoint &aPos, bool aWarpCursor=true, bool aCenterView=false)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
double GetZoom ()
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
virtual void ToolOnRightClick (wxCommandEvent &event)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnActivate (wxActivateEvent &event)
 Called when activating the frame. More...
 
void DisplayUnitsMsg ()
 Display current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Copy the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Redraw the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Push preferences from a parent window to a child window. More...
 
virtual void UseGalCanvas (bool aEnable)
 Use to switch between standard and GAL-based canvas. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Return the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
bool GetShowAxis () const
 
bool GetShowGridAxis () const
 
bool GetShowOriginAxis () const
 
virtual const BOX2I GetDocumentExtents () const
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
virtual void KiwayMailIn (KIWAY_EXPRESS &aEvent)
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
bool ShowPreferences (EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys, const wxString &aHotkeysNickname)
 
void PrintMsg (const wxString &text)
 
virtual void InstallPreferences (PAGED_DIALOG *aParent)
 Function InstallPreferences allows a Frame to load its preference panels (if any) into the preferences dialog. More...
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, 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...
 
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...
 

Static Public Member Functions

static EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. More...
 

Protected Member Functions

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

Protected Attributes

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

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 
static const wxChar CANVAS_TYPE_KEY [] = wxT( "canvas_type" )
 

Key in KifaceSettings to store the canvas type.

More...
 

Private Attributes

PL_EDITOR_LAYOUT m_pageLayout
 
int m_designTreeWidth
 
int m_propertiesFrameWidth
 
wxChoice * m_originSelectBox
 
int m_originSelectChoice
 
wxChoice * m_pageSelectBox
 
wxPoint m_grid_origin
 
PARAM_CFG_ARRAY m_configSettings
 

Detailed Description

Class PL_EDITOR_FRAME is the main window used in the page layout editor.

Definition at line 50 of file pl_editor_frame.h.

Constructor & Destructor Documentation

PL_EDITOR_FRAME::PL_EDITOR_FRAME ( KIWAY aKiway,
wxWindow *  aParent 
)

Definition at line 56 of file pl_editor_frame.cpp.

References WORKSHEET_LAYOUT::AllowVoidList(), PCAD2KICAD::Center, WORKSHEET_LAYOUT::ClearList(), EDA_BASE_FRAME::config(), DIM, PROPERTIES_FRAME::GetMinSize(), DESIGN_TREE_FRAME::GetMinSize(), GetPageLayout(), PL_EDITOR_LAYOUT::GetPageSettings(), GetScreen(), GetTextSize(), WORKSHEET_LAYOUT::GetTheInstance(), ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_LEVEL_1MM, KiBitmap(), PCAD2KICAD::Left, LoadSettings(), EDA_BASE_FRAME::m_auimgr, EDA_DRAW_FRAME::m_canvas, m_designTreeWidth, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, EDA_DRAW_FRAME::m_hotkeysDescrList, EDA_DRAW_FRAME::m_LastGridSizeId, EDA_BASE_FRAME::m_mainToolBar, EDA_DRAW_FRAME::m_messagePanel, m_originSelectChoice, m_propertiesFrameWidth, m_propertiesPagelayout, EDA_DRAW_FRAME::m_showAxis, EDA_DRAW_FRAME::m_showBorderAndTitleBlock, EDA_DRAW_FRAME::m_showGridAxis, m_treePagelayout, EDA_DRAW_FRAME::m_UserUnits, EDA_DRAW_FRAME::m_zoomLevelCoeff, MILLIMETRES, OnNewPageLayout(), PlEditorHokeysDescr, ReCreateHToolbar(), ReCreateMenuBar(), PCAD2KICAD::Right, EDA_DRAW_FRAME::SetDrawBgColor(), EDA_DRAW_PANEL::SetEnableBlockCommands(), BASE_SCREEN::SetGrid(), WORKSHEET_LAYOUT::SetPageLayout(), EDA_DRAW_FRAME::SetScreen(), EDA_DRAW_FRAME::SetShowPageLimits(), WHITE, wxPoint::x, and wxPoint::y.

56  :
57  EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ),
58  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME )
59 {
61  m_zoomLevelCoeff = 290.0; // Adjusted to roughly displays zoom level = 1
62  // when the screen shows a 1:1 image
63  // obviously depends on the monitor,
64  // but this is an acceptable value
65 
66  m_showAxis = false; // true to show X and Y axis on screen
67  m_showGridAxis = true;
68  m_showBorderAndTitleBlock = true; // true for reference drawings.
71  SetDrawBgColor( WHITE ); // default value, user option (WHITE/BLACK)
72  SetShowPageLimits( true );
73 
74  m_designTreeWidth = 150;
76 
77  if( m_canvas )
79 
80  // Give an icon
81  wxIcon icon;
82  icon.CopyFromBitmap( KiBitmap( icon_pagelayout_editor_xpm ) );
83  SetIcon( icon );
84  wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU();
85  SetScreen( new PL_EDITOR_SCREEN( pageSizeIU ) );
86 
87  LoadSettings( config() );
88  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
89 
90  if( ! GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
92 
93  GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
94 
97 
98  wxWindow* stsbar = GetStatusBar();
99  int dims[] = {
100 
101  // balance of status bar on far left is set to a default or whatever is left over.
102  -1,
103 
104  // When using GetTextSize() remember the width of '1' is not the same
105  // as the width of '0' unless the font is fixed width, and it usually won't be.
106 
107  // zoom:
108  GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,
109 
110  // cursor coords
111  GetTextSize( wxT( "X 0234.567 Y 0234.567" ), stsbar ).x + 10,
112 
113  // delta distances
114  GetTextSize( wxT( "dx 0234.567 dx 0234.567" ), stsbar ).x + 10,
115 
116  // Coord origin (use the bigger message)
117  GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10,
118 
119  // units display, Inches is bigger than mm
120  GetTextSize( _( "Inches" ), stsbar ).x + 10
121  };
122 
123  SetStatusWidths( DIM( dims ), dims );
124 
125  m_auimgr.SetManagedWindow( this );
126  m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
127 
129  m_treePagelayout = new DESIGN_TREE_FRAME( this );
130 
131  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
132  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
133 
134  m_auimgr.AddPane( m_treePagelayout, EDA_PANE().Palette().Name( "Design" ).Left().Layer(1)
135  .Caption( _( "Design" ) ).MinSize( m_treePagelayout->GetMinSize() )
136  .BestSize( m_designTreeWidth, -1 ) );
137  m_auimgr.AddPane( m_propertiesPagelayout, EDA_PANE().Palette().Name( "Props" ).Right().Layer(1)
138  .Caption( _( "Properties" ) ).MinSize( m_propertiesPagelayout->GetMinSize() )
139  .BestSize( m_propertiesFrameWidth, -1 ) );
140 
141  m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
142 
143  m_auimgr.Update();
144 
145  // Initialize the current page layout
147 #if 0 //start with empty layout
148  pglayout.AllowVoidList( true );
149  pglayout.ClearList();
150 #else // start with the default Kicad layout
151  pglayout.SetPageLayout();
152 #endif
153  OnNewPageLayout();
154 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
const PL_EDITOR_LAYOUT & GetPageLayout() const
void AllowVoidList(bool Allow)
In Kicad applications, a page layout description is needed So if the list is empty, a default description is loaded, the first time a page layout is drawn.
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:133
virtual void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:181
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
Class PROPERTIES_FRAME display properties of the current item.
#define PL_EDITOR_FRAME_NAME
Definition: draw_frame.h:51
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:380
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
wxAuiManager m_auimgr
wxSize GetMinSize() const override
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
Definition: common.cpp:111
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
Class DESIGN_TREE_FRAME is the left window showing the list of items.
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:105
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:163
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:143
void ClearList()
erase the list of items
void OnNewPageLayout()
Must be called to initialize parameters when a new page layout description is loaded.
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:136
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxSize GetMinSize() const override
#define KICAD_DEFAULT_DRAWFRAME_STYLE
const PAGE_INFO & GetPageSettings() const
int m_LastGridSizeId
Definition: draw_frame.h:107
Specialization of the wxAuiPaneInfo class for KiCad panels.
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
EDA_DRAW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
WORKSHEET_LAYOUT handles the graphic items list to draw/plot the title block and other items (page re...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:115
PROPERTIES_FRAME * m_propertiesPagelayout
struct EDA_HOTKEY_CONFIG PlEditorHokeysDescr[]
Definition: colors.h:49
void SetEnableBlockCommands(bool aEnable)
void SetShowPageLimits(bool aShow)
Definition: draw_frame.h:386
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:120
void ReCreateHToolbar() override
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available...
DESIGN_TREE_FRAME * m_treePagelayout
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
PL_EDITOR_FRAME::~PL_EDITOR_FRAME ( )

Definition at line 157 of file pl_editor_frame.cpp.

158 {
159 }

Member Function Documentation

void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

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 1493 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnRightClick().

1494 {
1495  int maxZoomIds;
1496  double zoom;
1497  wxString msg;
1498  BASE_SCREEN* screen = m_canvas->GetScreen();
1499 
1500  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
1501  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
1502  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
1503  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
1504  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
1505  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
1506  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
1507  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
1508  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
1509  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
1510 
1511 
1512  wxMenu* zoom_choice = new wxMenu;
1513  AddMenuItem( MasterMenu, zoom_choice,
1514  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
1515  KiBitmap( zoom_selection_xpm ) );
1516 
1517  zoom = screen->GetZoom();
1519  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
1520  maxZoomIds : screen->m_ZoomList.size();
1521 
1522  // Populate zoom submenu.
1523  for( int i = 0; i < maxZoomIds; i++ )
1524  {
1525  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
1526 
1527  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
1528  wxEmptyString, wxITEM_CHECK );
1529  if( zoom == screen->m_ZoomList[i] )
1530  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
1531  }
1532 
1533  // Create grid submenu as required.
1534  if( screen->GetGridCount() )
1535  {
1536  wxMenu* gridMenu = new wxMenu;
1537  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
1538  _( "Grid" ), KiBitmap( grid_select_xpm ) );
1539 
1540  wxArrayString gridsList;
1541  int icurr = screen->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES );
1542 
1543  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
1544  {
1545  GRID_TYPE& grid = screen->GetGrid( i );
1546  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
1547 
1548  if( (int)i == icurr )
1549  gridMenu->Check( grid.m_CmdId, true );
1550  }
1551  }
1552 
1553  MasterMenu->AppendSeparator();
1554  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
1555 }
virtual BASE_SCREEN * GetScreen()=0
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:105
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:284
Definition: common.h:160
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:115
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Class GRID_TYPE is for grid arrays.
Definition: base_screen.h:45
size_t i
Definition: json11.cpp:597
int m_CmdId
Definition: base_screen.h:48
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
WORKSHEET_DATAITEM * PL_EDITOR_FRAME::AddPageLayoutItem ( int  aType,
int  aIdx = -1 
)

Function AddPageLayoutItem Add a new item to the page layout item list.

Parameters
aType= the type of item: WS_TEXT, WS_SEGMENT, WS_RECT, WS_POLYPOLYGON
aIdx= the position in list to insert the new item.
Returns
a reference to the new item

Definition at line 531 of file pl_editor_frame.cpp.

References GetChars(), WORKSHEET_LAYOUT::GetTheInstance(), WORKSHEET_LAYOUT::Insert(), BITMAP_BASE::ReadImageFile(), RebuildDesignTree(), WORKSHEET_DATAITEM::WS_BITMAP, WORKSHEET_DATAITEM::WS_POLYPOLYGON, WORKSHEET_DATAITEM::WS_RECT, WORKSHEET_DATAITEM::WS_SEGMENT, and WORKSHEET_DATAITEM::WS_TEXT.

Referenced by GetPageNumberOption().

532 {
533  WORKSHEET_DATAITEM * item = NULL;
534 
535  switch( aType )
536  {
538  item = new WORKSHEET_DATAITEM_TEXT( wxT( "Text") );
539  break;
540 
543  break;
544 
547  break;
548 
550  item = new WORKSHEET_DATAITEM_POLYPOLYGON();
551  break;
552 
554  {
555  wxFileDialog fileDlg( this, _( "Choose Image" ), wxEmptyString, wxEmptyString,
556  _( "Image Files " ) + wxImage::GetImageExtWildcard(),
557  wxFD_OPEN );
558 
559  if( fileDlg.ShowModal() != wxID_OK )
560  return NULL;
561 
562  wxString fullFilename = fileDlg.GetPath();
563 
564  if( !wxFileExists( fullFilename ) )
565  {
566  wxMessageBox( _( "Couldn't load image from \"%s\"" ), GetChars( fullFilename ) );
567  break;
568  }
569 
570  BITMAP_BASE* image = new BITMAP_BASE();
571 
572  if( !image->ReadImageFile( fullFilename ) )
573  {
574  wxMessageBox( _( "Couldn't load image from \"%s\"" ),
575  GetChars( fullFilename ) );
576  delete image;
577  break;
578  }
579 
580  item = new WORKSHEET_DATAITEM_BITMAP( image );
581  }
582  break;
583  }
584 
585  if( item == NULL )
586  return NULL;
587 
589  pglayout.Insert( item, aIdx );
591 
592  return item;
593 }
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
This class handle bitmap images in KiCad.
Definition: bitmap_base.h:46
WORKSHEET_LAYOUT handles the graphic items list to draw/plot the title block and other items (page re...
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 RebuildDesignTree()
Function RebuildDesignTree Re creates the design graphic tree list items, and ensures each item has a...
bool ReadImageFile(const wxString &aFullFilename)
Function ReadImageFile Reads and stores in memory an image file.
Definition: bitmap_base.cpp:81
void Insert(WORKSHEET_DATAITEM *aItem, unsigned aIdx)
Insert an item to the list of items at position aIdx.
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

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

980 {
981 }
void EDA_DRAW_FRAME::AppendMsgPanel ( const wxString &  textUpper,
const wxString &  textLower,
COLOR4D  color,
int  pad = 6 
)
inherited

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 833 of file legacy_gal/eda_draw_frame.cpp.

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

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

836 {
837  if( m_messagePanel == NULL )
838  return;
839 
840  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
841 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:163
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
double PL_EDITOR_FRAME::BestZoom ( )
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 209 of file pl_editor_frame.cpp.

References EDA_DRAW_FRAME::bestZoom(), GetPageLayout(), and PL_EDITOR_LAYOUT::GetPageSettings().

Referenced by SetGridOrigin().

210 {
211  double sizeX = (double) GetPageLayout().GetPageSettings().GetWidthIU();
212  double sizeY = (double) GetPageLayout().GetPageSettings().GetHeightIU();
213  wxPoint centre( sizeX / 2, sizeY / 2 );
214 
215  // The sheet boundary already affords us some margin, so add only an
216  // additional 5%.
217  double margin_scale_factor = 1.05;
218 
219  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
220 }
const PL_EDITOR_LAYOUT & GetPageLayout() const
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
const PAGE_INFO & GetPageSettings() const
double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited
void PL_EDITOR_FRAME::Block_Move ( wxDC *  DC)

Function Block_Move moves all items within the selected block.

New location is determined by the current offset from the selected block's original location.

Parameters
DCA device context to draw on.

Definition at line 203 of file pagelayout_editor/block.cpp.

References ConfigureDrawList(), delta, WS_DRAW_ITEM_LIST::GetAllItems(), EDA_DRAW_FRAME::GetCrossHairPosition(), BLOCK_SELECTOR::GetMoveVector(), GetScreen(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::MoveCursorToCrossHair(), EDA_RECT::Normalize(), EDA_DRAW_PANEL::Refresh(), SaveCopyInUndoList(), EDA_DRAW_FRAME::SetCrossHairPosition(), BASE_SCREEN::SetModify(), and EDA_DRAW_PANEL::SetMouseCaptureCallback().

Referenced by GetPageNumberOption(), and HandleBlockPlace().

204 {
205  auto screen = static_cast<PL_EDITOR_SCREEN*>( GetScreen() );
206 
207  wxPoint delta;
208  wxPoint oldpos;
209 
210  oldpos = GetCrossHairPosition();
212 
213  SetCrossHairPosition( oldpos );
215  GetScreen()->SetModify();
217 
218  // Calculate displacement vectors.
220 
221  // Get the items
222  std::vector<WS_DRAW_ITEM_BASE*> items;
223  WS_DRAW_ITEM_LIST drawList;
224  ConfigureDrawList( &drawList, screen, this );
225  drawList.GetAllItems( &items );
226 
227  // Move items in block
229  for( auto item: items )
230  {
231  if( item->HitTest( screen->m_BlockLocate ) )
232  {
233  auto data_item = item->GetParent();
234  data_item->MoveToUi( data_item->GetStartPosUi() + delta );
235  }
236  }
237 
238  m_canvas->Refresh( true );
239 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
void GetAllItems(std::vector< WS_DRAW_ITEM_BASE * > *aList)
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
static const int delta[8][2]
Definition: solve.cpp:112
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void Normalize()
Function Normalize ensures that the height ant width are positive.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
void SetModify()
Definition: base_screen.h:324
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
wxPoint GetMoveVector() const
static void ConfigureDrawList(WS_DRAW_ITEM_LIST *aDrawList, PL_EDITOR_SCREEN *aScreen, PL_EDITOR_FRAME *aFrame)
int PL_EDITOR_FRAME::BlockCommand ( EDA_KEY  key)
overridevirtual

Function BlockCommand returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to the aKey (ALT, SHIFT ALT ..)

Reimplemented from EDA_DRAW_FRAME.

Definition at line 61 of file pagelayout_editor/block.cpp.

References BLOCK_MOVE, BLOCK_ZOOM, GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, GR_KB_SHIFTCTRL, and MOUSE_MIDDLE.

Referenced by GetPageNumberOption().

62 {
63  int cmd = 0;
64 
65  switch( key )
66  {
67  default:
68  cmd = key & 0x255;
69  break;
70 
71  case 0:
72  cmd = BLOCK_MOVE;
73  break;
74 
75  case GR_KB_SHIFT:
76  case GR_KB_CTRL:
77  case GR_KB_SHIFTCTRL:
78  case GR_KB_ALT:
79  break;
80 
81  case MOUSE_MIDDLE:
82  cmd = BLOCK_ZOOM;
83  break;
84  }
85 
86  return cmd;
87 }
#define GR_KB_ALT
#define MOUSE_MIDDLE
#define GR_KB_CTRL
#define GR_KB_SHIFT
#define GR_KB_SHIFTCTRL
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 585 of file eda_base_frame.cpp.

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

Referenced by EDA_BASE_FRAME::GetMruPath(), and PCB_EDIT_FRAME::OpenProjectFiles().

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

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

Update menus, toolbars, local variables, etc.

Reimplemented from EDA_BASE_FRAME.

Reimplemented in PCB_BASE_FRAME.

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

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

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

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

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

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 360 of file eda_base_frame.cpp.

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

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

361 {
362  // KICAD_MANAGER_FRAME overrides this
363  wxConfigBase* ret = Kiface().KifaceSettings();
364  //wxASSERT( ret );
365  return ret;
366 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
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 269 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

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

270  {
271  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
272  return baseCfgName;
273  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)
inherited

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

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

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

Referenced by add_search_paths(), and findDialog().

1598 {
1599  DrawPageOnClipboard( this );
1600 
1601  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
1602  {
1603  // fixme-gal
1604  //if( GetScreen()->IsBlockActive() )
1605  //m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
1606 
1608  }
1609 }
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void EDA_DRAW_FRAME::CreateServer ( int  service,
bool  local = true 
)
inherited

Definition at line 49 of file eda_dde.cpp.

References HOSTNAME(), ID_EDA_SOCKET_EVENT_SERV, and EDA_DRAW_FRAME::m_socketServer.

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

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

Display current unit pane on the status bar.

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

References INCHES, EDA_DRAW_FRAME::m_UserUnits, and MILLIMETRES.

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

585 {
586  wxString msg;
587 
588  switch( m_UserUnits )
589  {
590  case INCHES: msg = _( "Inches" ); break;
591  case MILLIMETRES: msg = _( "mm" ); break;
592  default: msg = _( "Units" ); break;
593  }
594 
595  SetStatusText( msg, 4 );
596 }
Definition: common.h:160
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:120
bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

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

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 223 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::isAutoSaveRequired(), and EDA_BASE_FRAME::onAutoSaveTimer().

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

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 1746 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by PLEDITOR_PRINTOUT::DrawPage(), DrawPageLayout(), PrintPage(), RedrawActiveWindow(), FOOTPRINT_EDIT_FRAME::RedrawActiveWindow(), GERBVIEW_FRAME::RedrawActiveWindow(), and PCB_EDIT_FRAME::RedrawActiveWindow().

1749 {
1751  return;
1752 
1753  const PAGE_INFO& pageInfo = GetPageSettings();
1754  wxSize pageSize = pageInfo.GetSizeMils();
1755 
1756  // if not printing, draw the page limits:
1757  if( !aScreen->m_IsPrinting && m_showPageLimits )
1758  {
1759  GRSetDrawMode( aDC, GR_COPY );
1760  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
1761  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
1763  }
1764 
1765  TITLE_BLOCK t_block = GetTitleBlock();
1766  COLOR4D color = COLOR4D( RED );
1767 
1768  wxPoint origin = aDC->GetDeviceOrigin();
1769 
1770  if( aScreen->m_IsPrinting && origin.y > 0 )
1771  {
1772  aDC->SetDeviceOrigin( 0, 0 );
1773  aDC->SetAxisOrientation( true, false );
1774  }
1775 
1776  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
1777  GetScreenDesc(), aFilename, t_block,
1778  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
1779  aLineWidth, aScalar, color, color, aSheetLayer );
1780 
1781  if( aScreen->m_IsPrinting && origin.y > 0 )
1782  {
1783  aDC->SetDeviceOrigin( origin.x, origin.y );
1784  aDC->SetAxisOrientation( true, true );
1785  }
1786 }
int m_ScreenNumber
Definition: base_screen.h:216
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
virtual const TITLE_BLOCK & GetTitleBlock() const =0
int color
Definition: DXF_plotter.cpp:62
virtual EDA_RECT * GetClipBox()
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:113
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
const wxSize & GetSizeMils() const
Definition: page_info.h:142
virtual const PAGE_INFO & GetPageSettings() const =0
void DrawPageLayout(wxDC *aDC, EDA_RECT *aClipBox, const PAGE_INFO &aPageInfo, const wxString &aFullSheetName, const wxString &aFileName, TITLE_BLOCK &aTitleBlock, int aSheetCount, int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor, COLOR4D aAltColor, const wxString &aSheetLayer)
Function DrawPageLayout is a core function to draw the page layout with the frame and the basic inscr...
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1003
virtual wxString GetScreenDesc() const
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:143
Definition: colors.h:60
bool m_IsPrinting
Definition: base_screen.h:220
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:111
Definition: colors.h:49
int m_NumberOfScreens
Definition: base_screen.h:217
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

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

References EDA_MSG_PANEL::EraseMsgBox(), and EDA_DRAW_FRAME::m_messagePanel.

Referenced by GERBVIEW_FRAME::SetCurItem().

309 {
310  if( m_messagePanel )
312 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:163
void EraseMsgBox()
Definition: msgpanel.cpp:216
virtual void EDA_DRAW_FRAME::ExecuteRemoteCommand ( const char *  cmdline)
inlinevirtualinherited

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 408 of file draw_frame.h.

References EDA_DRAW_PANEL::OnMouseEvent().

Referenced by EDA_DRAW_FRAME::OnSockRequest().

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

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

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

Definition at line 738 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), and Prj().

Referenced by PANEL_HOTKEYS_EDITOR::installButtons(), and EDA_BASE_FRAME::SaveProjectSettings().

740 {
741  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
742  wxString mask = wxT( "*." ) + ext;
743 
744 #if 0
745  wxString path = wxPathOnly( Prj().GetProjectFullName() );
746 #else
747  wxString path = GetMruPath();
748 #endif
749  wxFileName fn( aDefaultShortname );
750  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
751 
752  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
753  path,
754  fn.GetFullPath(),
755  ext,
756  mask,
757  this,
758  wxFD_SAVE,
759  true );
760 
761  if( filename.IsEmpty() )
762  return;
763 
764  WriteHotkeyConfig( aDescList, &filename );
765  SetMruPath( wxFileName( filename ).GetPath() );
766 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:292
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
void PL_EDITOR_FRAME::Files_io ( wxCommandEvent &  event)

Definition at line 89 of file pagelayout_editor/files.cpp.

References WORKSHEET_LAYOUT::AllowVoidList(), WORKSHEET_LAYOUT::ClearList(), GetChars(), GetCurrFileName(), GetScreen(), WORKSHEET_LAYOUT::GetTheInstance(), HandleUnsavedChanges(), ID_APPEND_DESCR_FILE, InsertPageLayoutDescrFile(), BASE_SCREEN::IsModify(), LoadPageLayoutDescrFile(), EDA_DRAW_FRAME::m_canvas, OnNewPageLayout(), PageLayoutDescrFileExtension, PageLayoutDescrFileWildcard(), RebuildDesignTree(), EDA_DRAW_PANEL::Refresh(), saveCurrentPageLayout(), SavePageLayoutDescrFile(), SetCurrFileName(), and BASE_SCREEN::SetModify().

Referenced by GetPageNumberOption(), and saveCurrentPageLayout().

90 {
91  wxString msg;
92  int id = event.GetId();
93  wxString filename = GetCurrFileName();
95 
96  if( filename.IsEmpty() && id == wxID_SAVE )
97  id = wxID_SAVEAS;
98 
99  if( ( id == wxID_NEW || id == wxID_OPEN ) && GetScreen()->IsModify() )
100  {
101  if( !HandleUnsavedChanges( this, _( "The current page layout has been modified. Save changes?" ),
102  [&]()->bool { return saveCurrentPageLayout(); } ) )
103  {
104  return;
105  }
106  }
107 
108  switch( id )
109  {
110  case wxID_NEW:
111  pglayout.AllowVoidList( true );
112  SetCurrFileName( wxEmptyString );
113  pglayout.ClearList();
114  OnNewPageLayout();
115  break;
116 
118  {
119  wxFileDialog openFileDialog( this, _( "Append Existing Page Layout File" ),
120  wxEmptyString, wxEmptyString,
121  PageLayoutDescrFileWildcard(), wxFD_OPEN );
122 
123  if( openFileDialog.ShowModal() == wxID_CANCEL )
124  return;
125 
126  filename = openFileDialog.GetPath();
127 
128  if( ! InsertPageLayoutDescrFile( filename ) )
129  {
130  msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) );
131  wxMessageBox( msg );
132  }
133  else
134  {
135  GetScreen()->SetModify();
137  m_canvas->Refresh();
138  msg.Printf( _( "File \"%s\" inserted" ), GetChars( filename ) );
139  SetStatusText( msg );
140  }
141  }
142  break;
143 
144  case wxID_OPEN:
145  {
146  wxFileDialog openFileDialog( this, _( "Open" ), wxEmptyString, wxEmptyString,
147  PageLayoutDescrFileWildcard(), wxFD_OPEN );
148 
149  if( openFileDialog.ShowModal() == wxID_CANCEL )
150  return;
151 
152  filename = openFileDialog.GetPath();
153 
154  if( ! LoadPageLayoutDescrFile( filename ) )
155  {
156  msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) );
157  wxMessageBox( msg );
158  }
159  else
160  {
161  OnNewPageLayout();
162  msg.Printf( _( "File \"%s\" loaded" ), GetChars( filename ) );
163  SetStatusText( msg );
164  }
165  }
166  break;
167 
168  case wxID_SAVE:
169  if( !SavePageLayoutDescrFile( filename ) )
170  {
171  msg.Printf( _( "Unable to write \"%s\"" ), GetChars( filename ) );
172  wxMessageBox( msg );
173  }
174  else
175  {
176  msg.Printf( _("File \"%s\" written"), GetChars( filename ) );
177  SetStatusText( msg );
178  }
179  break;
180 
181  case wxID_SAVEAS:
182  {
183  wxFileDialog openFileDialog( this, _( "Save As" ), wxEmptyString, wxEmptyString,
184  PageLayoutDescrFileWildcard(), wxFD_SAVE );
185 
186  if( openFileDialog.ShowModal() == wxID_CANCEL )
187  return;
188 
189  filename = openFileDialog.GetPath();
190  // Ensure the file has the right extension:
191  // because a name like name.subname.subsubname is legal,
192  // add the right extension without replacing the wxFileName
193  // extension
194  wxFileName fn(filename);
195 
196  if( fn.GetExt() != PageLayoutDescrFileExtension )
197  filename << wxT(".") << PageLayoutDescrFileExtension;
198 
199  if( !SavePageLayoutDescrFile( filename ) )
200  {
201  msg.Printf( _("Unable to create \"%s\""), GetChars( filename ) );
202  wxMessageBox( msg );
203  }
204 
205  else
206  {
207  msg.Printf( _("File \"%s\" written"), GetChars( filename ) );
208  SetStatusText( msg );
209 
210  if( GetCurrFileName().IsEmpty() )
211  SetCurrFileName( filename );
212  }
213  }
214  break;
215 
216  default:
217  wxMessageBox( wxT( "File_io: unexpected command id" ) );
218  break;
219  }
220 }
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Function HandleUnsavedChanges displays a dialog with Save, Cancel and Discard Changes buttons...
Definition: confirm.cpp:213
wxString PageLayoutDescrFileWildcard()
void AllowVoidList(bool Allow)
In Kicad applications, a page layout description is needed So if the list is empty, a default description is loaded, the first time a page layout is drawn.
bool IsModify() const
Definition: base_screen.h:328
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
void ClearList()
erase the list of items
void OnNewPageLayout()
Must be called to initialize parameters when a new page layout description is loaded.
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool SavePageLayoutDescrFile(const wxString &aFullFileName)
Function SavePageLayoutDescrFile Save the current layout in a .kicad_wks page layout descr file...
const std::string PageLayoutDescrFileExtension
WORKSHEET_LAYOUT handles the graphic items list to draw/plot the title block and other items (page re...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.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 SetCurrFileName(const wxString &aName)
Stores the current layout descr file filename.
bool InsertPageLayoutDescrFile(const wxString &aFullFileName)
Function InsertPageLayoutDescrFile Loads a .kicad_wks page layout descr file, and add items to the cu...
bool LoadPageLayoutDescrFile(const wxString &aFullFileName)
Function LoadPageLayoutDescrFile Loads a .kicad_wks page layout descr file.
void RebuildDesignTree()
Function RebuildDesignTree Re creates the design graphic tree list items, and ensures each item has a...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
void SetModify()
Definition: base_screen.h:324
const wxString & GetCurrFileName() const
void EDA_DRAW_FRAME::FocusOnLocation ( const wxPoint aPos,
bool  aWarpCursor = true,
bool  aCenterView = false 
)
inherited

Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested.

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

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

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

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

1571 {
1572  if( aCenterView )
1573  {
1574  wxWindow* dialog = findDialog( GetChildren() );
1575 
1576  // If a dialog partly obscures the window, then center on the uncovered area.
1577  if( dialog )
1578  {
1579  wxRect dialogRect( GetGalCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
1580  dialog->GetSize() );
1581  GetGalCanvas()->GetView()->SetCenter( aPos, dialogRect );
1582  }
1583  else
1584  GetGalCanvas()->GetView()->SetCenter( aPos );
1585  }
1586 
1587  if( aWarpCursor )
1589  else
1591 }
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves cursor to the requested position expressed in world coordinates.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:590
wxWindow * findDialog(wxWindowList &aList)
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:918
bool PL_EDITOR_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint aPosition,
EDA_KEY  aHotKey = 0 
)
overridevirtual

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

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

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

Reimplemented from EDA_DRAW_FRAME.

Definition at line 35 of file pagelayout_editor/controle.cpp.

References EDA_DRAW_FRAME::GeneralControlKeyMovement(), EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_FRAME::m_movingCursorWithKeyboard, OnHotKey(), EDA_DRAW_FRAME::RefreshCrossHair(), EDA_DRAW_FRAME::SetCrossHairPosition(), and UpdateStatusBar().

Referenced by GetPageNumberOption().

36 {
37  bool eventHandled = true;
38 
39  // Filter out the 'fake' mouse motion after a keyboard movement
40  if( !aHotKey && m_movingCursorWithKeyboard )
41  {
43  return false;
44  }
45 
46  wxPoint pos = aPosition;
47  wxPoint oldpos = GetCrossHairPosition();
48  GeneralControlKeyMovement( aHotKey, &pos, true );
49 
50  // Update cursor position.
51  SetCrossHairPosition( pos, true );
52  RefreshCrossHair( oldpos, aPosition, aDC );
53 
54  if( aHotKey )
55  {
56  eventHandled = OnHotKey( aDC, aHotKey, aPosition );
57  }
58 
60 
61  return eventHandled;
62 }
bool OnHotKey(wxDC *aDC, int aHotkeyCode, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Function OnHotKey.
void UpdateStatusBar() override
Update the status bar information.
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Handle the common part of GeneralControl dedicated to global cursor keys (i.e.
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
Move and refresh the crosshair after movement and call the mouse capture function.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:173
bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint aPos,
bool  aSnapToGrid 
)
protectedinherited

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

cursor movement by keyboard)

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

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

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

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

1172 {
1173  bool key_handled = false;
1174 
1175  // If requested snap the current position to the grid
1176  if( aSnapToGrid )
1177  *aPos = GetNearestGridPosition( *aPos );
1178 
1179  switch( aHotKey )
1180  {
1181  // All these keys have almost the same treatment
1182  case GR_KB_CTRL | WXK_NUMPAD8:
1183  case GR_KB_CTRL | WXK_UP:
1184  case GR_KB_CTRL | WXK_NUMPAD2:
1185  case GR_KB_CTRL | WXK_DOWN:
1186  case GR_KB_CTRL | WXK_NUMPAD4:
1187  case GR_KB_CTRL | WXK_LEFT:
1188  case GR_KB_CTRL | WXK_NUMPAD6:
1189  case GR_KB_CTRL | WXK_RIGHT:
1190  case WXK_NUMPAD8:
1191  case WXK_UP:
1192  case WXK_NUMPAD2:
1193  case WXK_DOWN:
1194  case WXK_NUMPAD4:
1195  case WXK_LEFT:
1196  case WXK_NUMPAD6:
1197  case WXK_RIGHT:
1198  key_handled = true;
1199  {
1200  /* Here's a tricky part: when doing cursor key movement, the
1201  * 'previous' point should be taken from memory, *not* from the
1202  * freshly computed position in the event. Otherwise you can't do
1203  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1204  * the automatic motion event generated by cursor warping */
1205  wxRealPoint gridSize = GetScreen()->GetGridSize();
1206  *aPos = GetCrossHairPosition();
1207 
1208  // Bonus: ^key moves faster (x10)
1209  switch( aHotKey )
1210  {
1211  case GR_KB_CTRL|WXK_NUMPAD8:
1212  case GR_KB_CTRL|WXK_UP:
1213  aPos->y -= KiROUND( 10 * gridSize.y );
1214  break;
1215 
1216  case GR_KB_CTRL|WXK_NUMPAD2:
1217  case GR_KB_CTRL|WXK_DOWN:
1218  aPos->y += KiROUND( 10 * gridSize.y );
1219  break;
1220 
1221  case GR_KB_CTRL|WXK_NUMPAD4:
1222  case GR_KB_CTRL|WXK_LEFT:
1223  aPos->x -= KiROUND( 10 * gridSize.x );
1224  break;
1225 
1226  case GR_KB_CTRL|WXK_NUMPAD6:
1227  case GR_KB_CTRL|WXK_RIGHT:
1228  aPos->x += KiROUND( 10 * gridSize.x );
1229  break;
1230 
1231  case WXK_NUMPAD8:
1232  case WXK_UP:
1233  aPos->y -= KiROUND( gridSize.y );
1234  break;
1235 
1236  case WXK_NUMPAD2:
1237  case WXK_DOWN:
1238  aPos->y += KiROUND( gridSize.y );
1239  break;
1240 
1241  case WXK_NUMPAD4:
1242  case WXK_LEFT:
1243  aPos->x -= KiROUND( gridSize.x );
1244  break;
1245 
1246  case WXK_NUMPAD6:
1247  case WXK_RIGHT:
1248  aPos->x += KiROUND( gridSize.x );
1249  break;
1250 
1251  default: /* Can't happen since we entered the statement */
1252  break;
1253  }
1254 
1255  m_canvas->MoveCursor( *aPos );
1257  }
1258  break;
1259 
1260  default:
1261  break;
1262  }
1263 
1264  return key_handled;
1265 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
#define GR_KB_CTRL
virtual void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
wxPoint GetCrossHairPosition(bool aInvertY=false) const
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:173
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 217 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

217 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
wxAuiToolBar* EDA_DRAW_FRAME::GetAuxiliaryToolBar ( ) const
inlineinherited

Definition at line 478 of file draw_frame.h.

478 { return m_auxiliaryToolBar; }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:153
const wxPoint& PL_EDITOR_FRAME::GetAuxOrigin ( ) const
inlineoverridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 126 of file pl_editor_frame.h.

References dummy().

127  {
128  static wxPoint dummy; // ( 0,0 );
129  return dummy;
130  }
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
virtual EDA_DRAW_PANEL* EDA_DRAW_FRAME::GetCanvas ( ) const
inlinevirtualinherited

Reimplemented in SCH_BASE_FRAME.

Definition at line 388 of file draw_frame.h.

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

388 { return m_canvas; }
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
PARAM_CFG_ARRAY & PL_EDITOR_FRAME::GetConfigurationSettings ( void  )

Populates the applicatios settings list.

(list of parameters that must be saved in project parameters) Currently, only the settings that are needed at start up by the main window are defined here. There are other locally used settings scattered throughout the source code (mainly in dialogs). If you need to define a configuration setting that need to be loaded at run time, this is the place to define it.

Definition at line 83 of file pl_editor_config.cpp.

References m_configSettings.

Referenced by GetPageNumberOption(), and SaveSettings().

84 {
85  if( !m_configSettings.empty() )
86  return m_configSettings;
87 
88  // Add settings here....
89 
90  return m_configSettings;
91 }
PARAM_CFG_ARRAY m_configSettings
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition ( bool  aInvertY = false) const
inherited

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 1069 of file legacy_gal/eda_draw_frame.cpp.

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

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

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

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

Returns
The current cross hair position.

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

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

1106 {
1107  BASE_SCREEN* screen = GetScreen(); // virtual call
1108  return screen->getCrossHairScreenPosition();
1109 }
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units...
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
const wxString & PL_EDITOR_FRAME::GetCurrFileName ( ) const
Returns
the filename of the current layout descr file If this is the default (no loaded file) returns a emtpy name or a new design.

Definition at line 270 of file pl_editor_frame.cpp.

References BASE_SCREEN::m_PageLayoutDescrFileName.

Referenced by ConfigureDrawList(), Files_io(), GetPageNumberOption(), Locate(), RedrawActiveWindow(), and UpdateTitleAndInfo().

271 {
273 }
static wxString m_PageLayoutDescrFileName
the name of the page layout descr file, or emty to used the default pagelayout
Definition: base_screen.h:180
wxPoint EDA_DRAW_FRAME::GetCursorPosition ( bool  aOnGrid,
wxRealPoint *  aGridSize = NULL 
) const
inherited

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

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

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

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

Referenced by EDA_DRAW_PANEL::OnMouseWheel().

1091 {
1092  BASE_SCREEN* screen = GetScreen(); // virtual call
1093  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1094 }
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
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
virtual void* EDA_DRAW_FRAME::GetDisplayOptions ( )
inlinevirtualinherited

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 931 of file draw_frame.h.

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

931 { return NULL; }
const BOX2I EDA_DRAW_FRAME::GetDocumentExtents ( ) const
virtualinherited

Reimplemented in SCH_EDIT_FRAME, LIB_EDIT_FRAME, and LIB_VIEW_FRAME.

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

Referenced by DrawPageLayout(), and SCH_BASE_FRAME::Zoom_Automatique().

1281 {
1282  return BOX2I();
1283 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520
virtual COLOR4D EDA_DRAW_FRAME::GetDrawBgColor ( ) const
inlinevirtualinherited
Returns
the COLOR4D for the canvas background

Definition at line 375 of file draw_frame.h.

Referenced by EDA_DOCKART::DrawBorder(), PLEDITOR_PRINTOUT::DrawPage(), EDA_DRAW_PANEL::EDA_DRAW_PANEL(), GERBVIEW_FRAME::GetNegativeItemsColor(), EDA_DRAW_PANEL::OnPaint(), EDA_DRAW_PANEL::OnScroll(), Process_Config(), ReCreateMenuBar(), RedrawActiveWindow(), GERBVIEW_FRAME::RedrawActiveWindow(), and SaveSettings().

375 { return m_drawBgColor; }
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:113
wxAuiToolBar* EDA_DRAW_FRAME::GetDrawToolBar ( ) const
inlineinherited

Definition at line 477 of file draw_frame.h.

477 { return m_drawToolBar; }
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:157
wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
wxFileHistory *  aFileHistory = NULL 
)
inherited

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

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

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

Definition at line 399 of file eda_base_frame.cpp.

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

Referenced by GERBVIEW_FRAME::OnDrlFileHistory(), KICAD_MANAGER_FRAME::OnFileHistory(), OnFileHistory(), PCB_EDIT_FRAME::OnFileHistory(), GERBVIEW_FRAME::OnGbrFileHistory(), GERBVIEW_FRAME::OnJobFileHistory(), GERBVIEW_FRAME::OnZipFileHistory(), and EDA_BASE_FRAME::SaveProjectSettings().

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

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

Returns
Pointer to GAL-based canvas.

Definition at line 918 of file draw_frame.h.

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

918 { return m_galCanvas; }
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame&#39;s interface to setting GAL display options.
Definition: draw_frame.h:91
virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited
Returns
the color of the grid

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 545 of file draw_frame.h.

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

546  {
547  return m_gridColor;
548  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:112
const wxPoint& PL_EDITOR_FRAME::GetGridOrigin ( ) const
inlineoverridevirtual

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

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

Implements EDA_DRAW_FRAME.

Definition at line 133 of file pl_editor_frame.h.

References m_grid_origin.

134  {
135  return m_grid_origin;
136  }
wxPoint EDA_DRAW_FRAME::GetGridPosition ( const wxPoint aPosition) const
inherited

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

Otherwise, the original positions is returned.

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

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

References EDA_DRAW_FRAME::GetNearestGridPosition(), EDA_DRAW_FRAME::m_currentScreen, and EDA_DRAW_FRAME::m_snapToGrid.

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

644 {
645  wxPoint pos = aPosition;
646 
647  if( m_currentScreen != NULL && m_snapToGrid )
648  pos = GetNearestGridPosition( aPosition );
649 
650  return pos;
651 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:87
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:89
EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inlineinherited

Return a structure containing currently used hotkey mapping.

Definition at line 431 of file draw_frame.h.

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

431 { return m_hotkeysDescrList; }
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:105
EDA_HOTKEY * PL_EDITOR_FRAME::GetHotKeyDescription ( int  aCommand) const
overridevirtual

>

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

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

Implements EDA_DRAW_FRAME.

Definition at line 141 of file pagelayout_editor/hotkeys.cpp.

References GetDescriptorFromCommand().

Referenced by GetPageNumberOption().

142 {
144 
145  if( HK_Descr == NULL )
146  HK_Descr = GetDescriptorFromCommand( aCommand, s_PlEditor_Hotkey_List );
147 
148  return HK_Descr;
149 }
EDA_HOTKEY * s_Common_Hotkey_List[]
EDA_HOTKEY * s_PlEditor_Hotkey_List[]
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
EDA_HOTKEY * GetDescriptorFromCommand(int aCommand, EDA_HOTKEY **aList)
Function GetDescriptorFromCommand Returns a EDA_HOTKEY* pointer from a hot key identifier.
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 506 of file eda_base_frame.cpp.

References ShowAboutDialog().

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

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

Definition at line 493 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

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

Definition at line 432 of file eda_base_frame.cpp.

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

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

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

Definition at line 301 of file draw_frame.h.

301 { return m_LastGridSizeId; }
int m_LastGridSizeId
Definition: draw_frame.h:107
void PL_EDITOR_FRAME::GetLayoutFromRedoList ( wxCommandEvent &  event)

Redo the last edit:

  • Place the current edited layout in undo list
  • Get the previous version of the current edited layput

Definition at line 90 of file pl_editor_undo_redo.cpp.

References ITEM_PICKER::GetItem(), WORKSHEET_LAYOUT::GetTheInstance(), PL_ITEM_LAYOUT::m_Layout, PL_ITEM_LAYOUT::PL_ITEM_LAYOUT(), PICKED_ITEMS_LIST::PopItem(), PICKED_ITEMS_LIST::PushItem(), WORKSHEET_LAYOUT::SaveInString(), WORKSHEET_LAYOUT::SetPageLayout(), TO_UTF8, and UR_LIBEDIT.

Referenced by OnModify().

91 {
92  if ( GetScreen()->GetRedoCommandCount() <= 0 )
93  return;
94 
95  PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
96  PL_ITEM_LAYOUT* copyItem = new PL_ITEM_LAYOUT;
98  pglayout.SaveInString( copyItem->m_Layout );
99 
100  ITEM_PICKER wrapper( copyItem, UR_LIBEDIT );
101 
102  lastcmd->PushItem( wrapper );
103  GetScreen()->PushCommandToUndoList( lastcmd );
104 
105  lastcmd = GetScreen()->PopCommandFromRedoList();
106 
107  wrapper = lastcmd->PopItem();
108  copyItem = static_cast<PL_ITEM_LAYOUT*>( wrapper.GetItem() );
109  pglayout.SetPageLayout( TO_UTF8(copyItem->m_Layout) );
110  delete copyItem;
111 
112  OnModify();
114  m_canvas->Refresh();
115 }
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Function PushCommandToUndoList add a command to undo in undo list delete the very old commands when t...
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen.
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
PopCommandFromRedoList return the last command to undo and remove it from list nothing is deleted...
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
WORKSHEET_LAYOUT handles the graphic items list to draw/plot the title block and other items (page re...
void SaveInString(wxString &aOutputString)
Save the description in a buffer.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
ITEM_PICKER PopItem()
Function PopItem.
void RebuildDesignTree()
Function RebuildDesignTree Re creates the design graphic tree list items, and ensures each item has a...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available...
void PL_EDITOR_FRAME::GetLayoutFromUndoList ( wxCommandEvent &  event)

Undo the last edit:

  • Place the current layout in Redo list
  • Get the previous version of the current edited layout

Definition at line 122 of file pl_editor_undo_redo.cpp.

References ITEM_PICKER::GetItem(), WORKSHEET_LAYOUT::GetTheInstance(), PL_ITEM_LAYOUT::m_Layout, PL_ITEM_LAYOUT::PL_ITEM_LAYOUT(), PICKED_ITEMS_LIST::PopItem(), PICKED_ITEMS_LIST::PushItem(), WORKSHEET_LAYOUT::SaveInString(), WORKSHEET_LAYOUT::SetPageLayout(), TO_UTF8, and UR_LIBEDIT.

Referenced by OnModify().

123 {
124  if ( GetScreen()->GetUndoCommandCount() <= 0 )
125  return;
126 
127  PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
128  PL_ITEM_LAYOUT* copyItem = new PL_ITEM_LAYOUT;
130  pglayout.SaveInString( copyItem->m_Layout );
131 
132  ITEM_PICKER wrapper( copyItem, UR_LIBEDIT );
133  lastcmd->PushItem( wrapper );
134  GetScreen()->PushCommandToRedoList( lastcmd );
135 
136  lastcmd = GetScreen()->PopCommandFromUndoList();
137 
138  wrapper = lastcmd->PopItem();
139  copyItem = static_cast<PL_ITEM_LAYOUT*>( wrapper.GetItem() );
140  pglayout.SetPageLayout( TO_UTF8(copyItem->m_Layout) );
141  delete copyItem;
142 
143  OnModify();
145  m_canvas->Refresh();
146 }
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen.
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
PopCommandFromUndoList return the last command to undo and remove it from list nothing is deleted...
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
WORKSHEET_LAYOUT handles the graphic items list to draw/plot the title block and other items (page re...
void SaveInString(wxString &aOutputString)
Save the description in a buffer.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
virtual void PushCommandToRedoList(PICKED_ITEMS_LIST *aItem)
Function PushCommandToRedoList add a command to redo in redo list delete the very old commands when t...
ITEM_PICKER PopItem()
Function PopItem.
void RebuildDesignTree()
Function RebuildDesignTree Re creates the design graphic tree list items, and ensures each item has a...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available...
wxAuiToolBar* EDA_DRAW_FRAME::GetMainToolBar ( ) const
inlineinherited

Definition at line 475 of file draw_frame.h.

475 { return m_mainToolBar; }
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
wxPoint EDA_DRAW_FRAME::GetNearestGridPosition ( const wxPoint aPosition,
wxRealPoint *  aGridSize = NULL 
) const
inherited

Return the nearest aGridSize location to aPosition.

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

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

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

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

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

Definition at line 476 of file draw_frame.h.

476 { return m_optionsToolBar; }
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:160
const PL_EDITOR_LAYOUT& PL_EDITOR_FRAME::GetPageLayout ( ) const
inline

Definition at line 176 of file pl_editor_frame.h.

References m_pageLayout.

Referenced by BestZoom(), GetTitleBlock(), and PL_EDITOR_FRAME().

176 { return m_pageLayout; }
PL_EDITOR_LAYOUT m_pageLayout
bool PL_EDITOR_FRAME::GetPageNumberOption ( ) const
inline

Page layout editor can show the title block using a page number 1 or another number.

This is because some items can be shown (or not) only on page 1 (a feature which look like word processing option "page 1 differs from other pages".

Returns
true if the page 1 is selected, and false if not

Definition at line 186 of file pl_editor_frame.h.

References AddPageLayoutItem(), Block_Move(), BlockCommand(), Files_io(), GeneralControl(), GetConfigurationSettings(), GetCurrFileName(), GetHotKeyDescription(), GetSelectedItem(), HandleBlockEnd(), HandleBlockPlace(), LoadSettings(), Locate(), MoveItem(), OnFileHistory(), OnHotKey(), OnQuit(), OnSelectCoordOriginCorner(), OnSelectOptionToolbar(), OnSelectTitleBlockDisplayMode(), OnUpdateSelectTool(), OnUpdateTitleBlockDisplayNormalMode(), OnUpdateTitleBlockDisplaySpecialMode(), PlaceItem(), PrintPage(), Process_Config(), Process_Settings(), Process_Special_Functions(), RebuildDesignTree(), SaveSettings(), SetCurrFileName(), ToPlotter(), ToPrinter(), and UpdateTitleAndInfo().

Referenced by Locate(), PrintPage(), and RedrawActiveWindow().

187  {
188  return m_pageSelectBox->GetSelection() == 0;
189  }
wxChoice * m_pageSelectBox
const PAGE_INFO & PL_EDITOR_FRAME::GetPageSettings ( ) const
overridevirtual

Implements EDA_DRAW_FRAME.

Definition at line 291 of file pl_editor_frame.cpp.

References PL_EDITOR_LAYOUT::GetPageSettings(), and m_pageLayout.

Referenced by ConfigureDrawList(), PLEDITOR_PRINTOUT::DrawPage(), Locate(), ToPrinter(), and UpdateStatusBar().

292 {
293  return m_pageLayout.GetPageSettings();
294 }
PL_EDITOR_LAYOUT m_pageLayout
const PAGE_INFO & GetPageSettings() const
const wxSize PL_EDITOR_FRAME::GetPageSizeIU ( ) const
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 297 of file pl_editor_frame.cpp.

References PL_EDITOR_LAYOUT::GetPageSettings(), and m_pageLayout.

298 {
299  // this function is only needed because EDA_DRAW_FRAME is not compiled
300  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
301  // into an application specific source file.
302  return m_pageLayout.GetPageSettings().GetSizeIU();
303 }
PL_EDITOR_LAYOUT m_pageLayout
const PAGE_INFO & GetPageSettings() const
PL_EDITOR_SCREEN* PL_EDITOR_FRAME::GetScreen ( ) const
inlineoverridevirtual

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

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

Reimplemented from EDA_DRAW_FRAME.

Definition at line 121 of file pl_editor_frame.h.

References EDA_DRAW_FRAME::GetScreen().

Referenced by Block_Move(), PLEDITOR_PRINTOUT::DrawPage(), Files_io(), HandleBlockEnd(), HandleBlockPlace(), LoadPageLayoutDescrFile(), Locate(), MoveItem(), OnCloseWindow(), OnFileHistory(), OnHotKey(), OnLeftClick(), OnModify(), OnNewPageLayout(), OnRightClick(), PL_EDITOR_FRAME(), PlaceItem(), PrintPage(), RedrawActiveWindow(), saveCurrentPageLayout(), SavePageLayoutDescrFile(), SetPageSettings(), and UpdateStatusBar().

122  {
124  }
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
wxString EDA_DRAW_FRAME::GetScreenDesc ( ) const
virtualinherited

Reimplemented in SCH_EDIT_FRAME.

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

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

1790 {
1791  // Virtual function. Base class implementation returns an empty string.
1792  return wxEmptyString;
1793 }
const wxPoint & EDA_DRAW_FRAME::GetScrollCenterPosition ( ) const
inherited

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

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

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

1127 {
1128  BASE_SCREEN* screen = GetScreen(); // virtual call
1129  return screen->getScrollCenterPosition();
1130 }
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
const wxPoint & getScrollCenterPosition() const
Definition: base_screen.h:173
WORKSHEET_DATAITEM * PL_EDITOR_FRAME::GetSelectedItem ( )

Function GetSelectedItem.

Returns
the current selected item, or NULL

Definition at line 596 of file pl_editor_frame.cpp.

References DESIGN_TREE_FRAME::GetPageLayoutSelectedItem(), and m_treePagelayout.

Referenced by GetPageNumberOption(), PROPERTIES_FRAME::OnAcceptPrms(), OnTreeSelection(), and RedrawActiveWindow().

597 {
599  return item;
600 }
WORKSHEET_DATAITEM * GetPageLayoutSelectedItem() const
DESIGN_TREE_FRAME * m_treePagelayout
bool EDA_DRAW_FRAME::GetShowAxis ( ) const
inlineinherited

Definition at line 944 of file draw_frame.h.

944 { return m_showAxis; }
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:133
bool EDA_DRAW_FRAME::GetShowBorderAndTitleBlock ( ) const
inlineinherited

Definition at line 382 of file draw_frame.h.

382 { return m_showBorderAndTitleBlock; }
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:143
bool EDA_DRAW_FRAME::GetShowGridAxis ( ) const
inlineinherited

Definition at line 945 of file draw_frame.h.

945 { return m_showGridAxis; }
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:136
bool EDA_DRAW_FRAME::GetShowOriginAxis ( ) const
inlineinherited

Definition at line 946 of file draw_frame.h.

946 { return m_showOriginAxis; }
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:140
const TITLE_BLOCK & PL_EDITOR_FRAME::GetTitleBlock ( ) const
overridevirtual

Implements EDA_DRAW_FRAME.

Definition at line 306 of file pl_editor_frame.cpp.

References GetPageLayout(), and PL_EDITOR_LAYOUT::GetTitleBlock().

Referenced by ConfigureDrawList(), Locate(), and SetGridOrigin().

307 {
308  return GetPageLayout().GetTitleBlock();
309 }
const PL_EDITOR_LAYOUT & GetPageLayout() const
const TITLE_BLOCK & GetTitleBlock() const
wxAuiToolBarItem * EDA_DRAW_FRAME::GetToolbarTool ( int  aToolId)
inherited

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

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

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

365 {
366  // Checks all the toolbars and returns a reference to the given tool id
367  // (or the first tool found, but only one or 0 tool is expected, because on
368  // Windows, when different tools have the same ID, it creates issues)
369  if( m_mainToolBar && m_mainToolBar->FindTool( aToolId ) )
370  return m_mainToolBar->FindTool( aToolId );
371 
372  if( m_optionsToolBar && m_optionsToolBar->FindTool( aToolId ) )
373  return m_optionsToolBar->FindTool( aToolId );
374 
375  if( m_drawToolBar && m_drawToolBar->FindTool( aToolId ) )
376  return m_drawToolBar->FindTool( aToolId );
377 
378  if( m_auxiliaryToolBar && m_auxiliaryToolBar->FindTool( aToolId ) )
379  return m_auxiliaryToolBar->FindTool( aToolId );
380 
381  return nullptr;
382 }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:153
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:160
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:157
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
int EDA_DRAW_FRAME::GetToolId ( ) const
inlineinherited
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 519 of file draw_frame.h.

Referenced by PCB_EDIT_FRAME::Begin_Zone(), LIB_EDIT_FRAME::CreateGraphicItem(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), LIB_EDIT_FRAME::EndDrawGraphicItem(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), HandleBlockEnd(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), GERBVIEW_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockEnd(), PCB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), HandleBlockPlace(), FOOTPRINT_EDIT_FRAME::HandleBlockPlace(), GERBVIEW_FRAME::HandleBlockPlace(), LIB_EDIT_FRAME::HandleBlockPlace(), PCB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PAD_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), EDIT_TOOL::Init(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PCB_EDIT_FRAME::MuWaveCommand(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), LIB_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), PCB_EDIT_FRAME::OnSelectTool(), DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection(), LIB_EDIT_FRAME::OnUpdateEditingPart(), PCB_EDIT_FRAME::OnUpdateMuWaveToolbar(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectTool(), 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().

519 { return m_toolId; }
bool EDA_DRAW_FRAME::GetToolToggled ( int  aToolId)
inherited

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

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

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

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

Referenced by ZOOM_TOOL::Main().

354 {
355  // Checks all the toolbars and returns true if the given tool id is toggled.
356  return ( ( m_mainToolBar && m_mainToolBar->GetToolToggled( aToolId ) ) ||
357  ( m_optionsToolBar && m_optionsToolBar->GetToolToggled( aToolId ) ) ||
358  ( m_drawToolBar && m_drawToolBar->GetToolToggled( aToolId ) ) ||
359  ( m_auxiliaryToolBar && m_auxiliaryToolBar->GetToolToggled( aToolId ) )
360  );
361 }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:153
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:160
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:157
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
EDA_UNITS_T EDA_DRAW_FRAME::GetUserUnits ( ) const
inlineoverrideinherited

Return the user units currently in use.

Definition at line 284 of file draw_frame.h.

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

284 { return m_UserUnits; }
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:120
double EDA_DRAW_FRAME::GetZoom ( )
inherited
Returns
The current zoom level.

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

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

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

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

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

Definition at line 464 of file draw_frame.h.

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

464 { return m_zoomLevelCoeff; }
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:115
const wxString PL_EDITOR_FRAME::GetZoomLevelIndicator ( ) const
overridevirtual

Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs.

Virtual from the base class

Reimplemented from EDA_DRAW_FRAME.

Definition at line 700 of file pl_editor_frame.cpp.

References EDA_DRAW_FRAME::GetZoomLevelIndicator().

701 {
703 }
virtual const wxString GetZoomLevelIndicator() const
Return a human readable value which can be displayed as zoom level indicator in dialogs.
bool EDA_DRAW_FRAME::HandleBlockBegin ( wxDC *  aDC,
EDA_KEY  aKey,
const wxPoint aPosition,
int  aExplicitCommand = 0 
)
virtualinherited

Initialize a block command.

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

Reimplemented in SCH_BASE_FRAME.

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

References BLOCK_COPY, BLOCK_DELETE, BLOCK_DRAG, BLOCK_DRAG_ITEM, BLOCK_DUPLICATE, BLOCK_DUPLICATE_AND_INCREMENT, BLOCK_FLIP, BLOCK_IDLE, BLOCK_MOVE, BLOCK_PASTE, BLOCK_PRESELECT_MOVE, BLOCK_ZOOM, EDA_DRAW_FRAME::BlockCommand(), EDA_DRAW_PANEL::CallMouseCapture(), BLOCK_SELECTOR::ClearItemsList(), DisplayError(), BLOCK_SELECTOR::GetCommand(), BLOCK_SELECTOR::GetCount(), EDA_DRAW_FRAME::GetScreen(), BLOCK_SELECTOR::GetState(), EDA_DRAW_FRAME::InitBlockPasteInfos(), BLOCK_SELECTOR::InitData(), EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::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(), and EDA_DRAW_PANEL::OnMouseEvent().

896 {
898 
899  if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
900  return false;
901 
902  if( aExplicitCommand == 0 )
903  block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
904  else
905  block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
906 
907  if( block->GetCommand() == 0 )
908  return false;
909 
910  switch( block->GetCommand() )
911  {
912  case BLOCK_IDLE:
913  break;
914 
915  case BLOCK_MOVE: // Move
916  case BLOCK_DRAG: // Drag (block defined)
917  case BLOCK_DRAG_ITEM: // Drag from a drag item command
918  case BLOCK_DUPLICATE: // Duplicate
919  case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references
920  case BLOCK_DELETE: // Delete
921  case BLOCK_COPY: // Copy
922  case BLOCK_FLIP: // Flip
923  case BLOCK_ZOOM: // Window Zoom
924  case BLOCK_PRESELECT_MOVE: // Move with preselection list
925  block->InitData( m_canvas, aPosition );
926  break;
927 
928  case BLOCK_PASTE:
929  block->InitData( m_canvas, aPosition );
930  block->SetLastCursorPosition( wxPoint( 0, 0 ) );
932 
933  if( block->GetCount() == 0 ) // No data to paste
934  {
935  DisplayError( this, wxT( "No block to paste" ), 20 );
938  block->SetState( STATE_NO_BLOCK );
939  block->SetMessageBlock( this );
940  return true;
941  }
942 
943  if( !m_canvas->IsMouseCaptured() )
944  {
945  block->ClearItemsList();
946  DisplayError( this,
947  wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
948  block->SetState( STATE_NO_BLOCK );
949  block->SetMessageBlock( this );
950  return true;
951  }
952 
953  block->SetState( STATE_BLOCK_MOVE );
954  m_canvas->CallMouseCapture( aDC, aPosition, false );
955  break;
956 
957  default:
958  {
959  wxString msg;
960  msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
961  block->GetCommand();
962  DisplayError( this, msg );
963  }
964  break;
965  }
966 
967  block->SetMessageBlock( this );
968  return true;
969 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
virtual int BlockCommand(EDA_KEY aKey)
Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT...
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()
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
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
Definition: solve.cpp:178
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
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:245
unsigned GetCount() const
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
void SetCommand(BLOCK_COMMAND_T aCommand)
bool PL_EDITOR_FRAME::HandleBlockEnd ( wxDC *  DC)
overridevirtual

Function HandleBlockEnd( ) handles the end of a block command, It 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 from EDA_DRAW_FRAME.

Definition at line 121 of file pagelayout_editor/block.cpp.

References BLOCK_MOVE, BLOCK_ZOOM, EDA_DRAW_PANEL::CallMouseCapture(), BASE_SCREEN::ClearBlockCommand(), DrawMovingBlockOutlines(), EDA_DRAW_PANEL::EndMouseCapture(), BLOCK_SELECTOR::GetCommand(), EDA_DRAW_PANEL::GetCurrentCursor(), GetScreen(), EDA_DRAW_FRAME::GetToolId(), EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::SetMouseCaptureCallback(), BLOCK_SELECTOR::SetState(), STATE_BLOCK_MOVE, and EDA_DRAW_FRAME::Window_Zoom().

Referenced by GetPageNumberOption().

122 {
123  bool nextcmd = false;
124  bool zoom_command = false;
125 
126  if( m_canvas->IsMouseCaptured() )
127 
128  switch( GetScreen()->m_BlockLocate.GetCommand() )
129  {
130  case BLOCK_MOVE: /* Move */
132  nextcmd = true;
133  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
135  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
136  break;
137 
138  case BLOCK_ZOOM: /* Window Zoom */
139  zoom_command = true;
140  break;
141 
142  default:
143  break;
144  }
145 
146  if( ! nextcmd )
147  {
150  false );
151  }
152 
153  if( zoom_command )
154  Window_Zoom( GetScreen()->m_BlockLocate );
155 
156  return nextcmd ;
157 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
int GetCurrentCursor() const
Function GetCurrentCursor.
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
void ClearBlockCommand()
Definition: base_screen.h:501
void SetState(BLOCK_STATE_T aState)
static void DrawMovingBlockOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool erase)
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
int GetToolId() const
Definition: draw_frame.h:519
virtual void Window_Zoom(EDA_RECT &Rect)
BLOCK_COMMAND_T GetCommand() const
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
void PL_EDITOR_FRAME::HandleBlockPlace ( wxDC *  DC)
overridevirtual

Function HandleBlockPlace handles the block place command.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 90 of file pagelayout_editor/block.cpp.

References BLOCK_MOVE, Block_Move(), EDA_DRAW_PANEL::CallMouseCapture(), BASE_SCREEN::ClearBlockCommand(), BLOCK_SELECTOR::ClearItemsList(), EDA_DRAW_FRAME::DisplayToolMsg(), EDA_DRAW_PANEL::EndMouseCapture(), EDA_DRAW_PANEL::GetCurrentCursor(), GetScreen(), EDA_DRAW_FRAME::GetToolId(), EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, BASE_SCREEN::SetModify(), BLOCK_SELECTOR::SetState(), and STATE_BLOCK_STOP.

Referenced by GetPageNumberOption().

91 {
92  wxASSERT( m_canvas->IsMouseCaptured() );
93 
95 
96  switch( GetScreen()->m_BlockLocate.GetCommand() )
97  {
98  case BLOCK_MOVE: /* Move */
99  if( m_canvas->IsMouseCaptured() )
100  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
101 
102  Block_Move( DC );
104  break;
105 
106  default:
107  wxFAIL_MSG( wxT("HandleBlockPlace: Unexpected block command") );
108  break;
109  }
110 
111  m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
112  GetScreen()->SetModify();
114 
115  wxASSERT( GetScreen()->m_BlockLocate.GetCount() == 0 );
116 
117  DisplayToolMsg( wxEmptyString );
118 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
int GetCurrentCursor() const
Function GetCurrentCursor.
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
void Block_Move(wxDC *DC)
Function Block_Move moves all items within the selected block.
void ClearBlockCommand()
Definition: base_screen.h:501
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 void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void DisplayToolMsg(const wxString &msg)
int GetToolId() const
Definition: draw_frame.h:519
void SetModify()
Definition: base_screen.h:324
void EDA_DRAW_FRAME::HardRedraw ( )
virtualinherited

Rebuild the GAL and redraws the screen.

Call when something went wrong.

Reimplemented in LIB_EDIT_FRAME, SCH_EDIT_FRAME, and SCH_BASE_FRAME.

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

Referenced by EDA_DRAW_FRAME::OnZoom().

1297 {
1298 }
wxString EDA_BASE_FRAME::help_name ( )
protectedvirtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 375 of file eda_base_frame.cpp.

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

Referenced by EDA_BASE_FRAME::GetKicadHelp(), and EDA_BASE_FRAME::isAutoSaveRequired().

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

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

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

Definition at line 709 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), and ReadHotkeyConfigFile().

Referenced by PANEL_HOTKEYS_EDITOR::installButtons(), and EDA_BASE_FRAME::SaveProjectSettings().

711 {
712  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
713  wxString mask = wxT( "*." ) + ext;
714 
715 
716  wxString path = GetMruPath();
717  wxFileName fn( aDefaultShortname );
718  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
719 
720  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
721  path,
722  fn.GetFullPath(),
723  ext,
724  mask,
725  this,
726  wxFD_OPEN,
727  true );
728 
729  if( filename.IsEmpty() )
730  return;
731 
732  ::ReadHotkeyConfigFile( filename, aDescList, false );
733  WriteHotkeyConfig( aDescList );
734  SetMruPath( wxFileName( filename ).GetPath() );
735 }
void SetMruPath(const wxString &aPath)
int ReadHotkeyConfigFile(const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList, const bool aDefaultLocation)
Function ReadHotkeyConfig Read hotkey configuration for a given app, possibly before the frame for th...
wxString 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
void EDA_DRAW_FRAME::InitBlockPasteInfos ( )
virtualinherited

Reimplemented in SCH_EDIT_FRAME, and LIB_EDIT_FRAME.

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

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

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

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

Function InsertPageLayoutDescrFile Loads a .kicad_wks page layout descr file, and add items to the current layout list.

Parameters
aFullFileName= the filename.

Definition at line 238 of file pagelayout_editor/files.cpp.

References WORKSHEET_LAYOUT::GetTheInstance(), SaveCopyInUndoList(), and WORKSHEET_LAYOUT::SetPageLayout().

Referenced by Files_io().

239 {
240  if( wxFileExists( aFullFileName ) )
241  {
242  const bool append = true;
244  WORKSHEET_LAYOUT::GetTheInstance().SetPageLayout( aFullFileName, append );
245  return true;
246  }
247 
248  return false;
249 }
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available...
virtual void EDA_BASE_FRAME::InstallPreferences ( PAGED_DIALOG aParent)
inlinevirtualinherited

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

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

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

Definition at line 238 of file eda_base_frame.h.

References EDA_BASE_FRAME::LoadSettings(), and EDA_BASE_FRAME::SaveSettings().

Referenced by EDA_BASE_FRAME::ShowPreferences().

238 { }
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 eda_base_frame.h.

References EDA_BASE_FRAME::config(), EDA_BASE_FRAME::doAutoSave(), EDA_BASE_FRAME::EDA_BASE_FRAME(), EDA_BASE_FRAME::help_name(), EDA_BASE_FRAME::ProcessEvent(), EDA_BASE_FRAME::SetAutoSaveInterval(), EDA_BASE_FRAME::sys_search(), and EDA_BASE_FRAME::~EDA_BASE_FRAME().

Referenced by EDA_BASE_FRAME::ProcessEvent().

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

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

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

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

1269 {
1270  const BASE_SCREEN* screen = const_cast< BASE_SCREEN* >( GetScreen() );
1271 
1272  if( !screen )
1273  return false;
1274 
1275  return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
1276  || ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
1277 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
EDA_ITEM * GetCurItem() const
Definition: base_screen.h:233
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
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 156 of file kiway_player.cpp.

References KIWAY_PLAYER::m_modal_loop.

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

157 {
158  return !m_modal_loop;
159 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:250
bool EDA_DRAW_FRAME::IsGalCanvasActive ( ) const
inlineinherited

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 911 of file draw_frame.h.

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

911 { return m_galCanvasActive; }
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:97
virtual bool EDA_DRAW_FRAME::IsGridVisible ( ) const
inlinevirtualinherited
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 541 of file eda_base_frame.cpp.

References GetChars().

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

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

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

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

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 177 of file kiway_player.cpp.

References KIWAY_PLAYER::KiwayMailIn().

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

Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.

Merely override it in derived classes.

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

Definition at line 71 of file kiway_player.cpp.

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

72 {
73  // override this in derived classes.
74 }
void KIWAY_PLAYER::language_change ( wxCommandEvent &  event)
protectedinherited

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

Definition at line 184 of file kiway_player.cpp.

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

185 {
186  int id = event.GetId();
187 
188  // tell all the KIWAY_PLAYERs about the language change.
189  Kiway().SetLanguage( id );
190 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY void SetLanguage(int aLanguage)
Function SetLanguage changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs...
Definition: kiway.cpp:395
bool EDA_DRAW_FRAME::LibraryFileBrowser ( bool  doOpen,
wxFileName &  aFilename,
const wxString &  wildcard,
const wxString &  ext,
bool  isDirectory 
)
protectedinherited
Parameters
doOpenif true runs an Open Library browser, otherwise New Library
aFilenamefor New may contain a default name; in both cases return the chosen filename.
wildcarda wildcard to filter the displayed files
extthe library file extension
isDirectoryindicates the library files are directories
Returns
true for OK; false for Cancel.

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

References KIWAY_HOLDER::Prj().

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

1798 {
1799  wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
1800  aFilename.SetExt( ext );
1801 
1802  if( isDirectory )
1803  {
1804  wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
1805  doOpen ? wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST : wxDD_DEFAULT_STYLE );
1806 
1807  if( dlg.ShowModal() == wxID_CANCEL )
1808  return false;
1809 
1810  aFilename = dlg.GetPath();
1811  aFilename.SetExt( ext );
1812  }
1813  else
1814  {
1815  wxFileDialog dlg( this, prompt, Prj().GetProjectPath(), aFilename.GetFullName() ,
1816  wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
1817  : wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
1818 
1819  if( dlg.ShowModal() == wxID_CANCEL )
1820  return false;
1821 
1822  aFilename = dlg.GetPath();
1823  aFilename.SetExt( ext );
1824  }
1825 
1826  return true;
1827 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting ( )
staticinherited

Returns the canvas type stored in the application settings.

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

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

Referenced by SCH_BASE_FRAME::createCanvas(), PCB::IFACE::CreateWindow(), and GERBVIEW_FRAME::GERBVIEW_FRAME().

1031 {
1033  wxConfigBase* cfg = Kiface().KifaceSettings();
1034 
1035  if( cfg )
1036  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
1038 
1039  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1040  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1041  {
1042  wxASSERT( false );
1043  canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
1044  }
1045 
1046  return canvasType;
1047 }
Sentinel, do not use as a parameter.
static const wxChar CANVAS_TYPE_KEY[]
Key in KifaceSettings to store the canvas type.
Definition: draw_frame.h:237
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile ( const wxString &  aFullFileName)

Function LoadPageLayoutDescrFile Loads a .kicad_wks page layout descr file.

Parameters
aFullFileName= the filename.

Definition at line 223 of file pagelayout_editor/files.cpp.

References BASE_SCREEN::ClrModify(), GetScreen(), WORKSHEET_LAYOUT::GetTheInstance(), SetCurrFileName(), WORKSHEET_LAYOUT::SetPageLayout(), and EDA_BASE_FRAME::UpdateFileHistory().

Referenced by Files_io(), IfaceOrAddress(), OnFileHistory(), and OpenProjectFiles().

224 {
225  if( wxFileExists( aFullFileName ) )
226  {
228  SetCurrFileName( aFullFileName );
229  UpdateFileHistory( aFullFileName );
230  GetScreen()->ClrModify();
231  return true;
232  }
233 
234  return false;
235 }
void UpdateFileHistory(const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
Function UpdateFileHistory Updates the list of recently opened files.
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetCurrFileName(const wxString &aName)
Stores the current layout descr file filename.
void ClrModify()
Definition: base_screen.h:325
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available...
void PL_EDITOR_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.

Definition at line 229 of file pl_editor_frame.cpp.

References BLACK, blackBgColorKey, cornerOriginChoiceKey, designTreeWidthKey, EDA_DRAW_FRAME::LoadSettings(), m_designTreeWidth, m_originSelectChoice, m_propertiesFrameWidth, propertiesFrameWidthKey, EDA_DRAW_FRAME::SetDrawBgColor(), and WHITE.

Referenced by GetPageNumberOption(), and PL_EDITOR_FRAME().

230 {
232 
233  aCfg->Read( designTreeWidthKey, &m_designTreeWidth, 100);
236  bool tmp;
237  aCfg->Read( blackBgColorKey, &tmp, false );
238  SetDrawBgColor( tmp ? BLACK : WHITE );
239 }
static const wxChar cornerOriginChoiceKey[]
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:380
static const wxChar blackBgColorKey[]
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
static const wxChar designTreeWidthKey[]
static const wxChar propertiesFrameWidthKey[]
Definition: colors.h:49
Definition: colors.h:45
WORKSHEET_DATAITEM * PL_EDITOR_FRAME::Locate ( wxDC *  aDC,
const wxPoint aPosition 
)

Function Locate.

Returns
the page layout item found at position aPosition
Parameters
aPosition= the position (in user units) of the reference point

Definition at line 603 of file pl_editor_frame.cpp.

References WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), WORKSHEET_DATAITEM::ClearFlags(), color, EDA_DRAW_FRAME::GetCrossHairPosition(), GetCurrFileName(), GetPageNumberOption(), GetPageSettings(), WS_DRAW_ITEM_BASE::GetParent(), GetScreen(), EDA_DRAW_FRAME::GetScreenDesc(), GetTitleBlock(), IU_PER_MILS, WS_DRAW_ITEM_LIST::Locate(), LOCATE_ENDPOINT, LOCATE_STARTPOINT, EDA_DRAW_FRAME::m_canvas, WS_DRAW_ITEM_BASE::m_Flags, WORKSHEET_DATAITEM::m_Info, WORKSHEET_DATAITEM::m_Name, BASE_SCREEN::m_NumberOfScreens, BASE_SCREEN::m_ScreenNumber, EDA_DRAW_PANEL::MoveCursorToCrossHair(), RED, EDA_DRAW_FRAME::SetCrossHairPosition(), WS_DRAW_ITEM_LIST::SetFileName(), WORKSHEET_DATAITEM::SetFlags(), WS_DRAW_ITEM_LIST::SetMilsToIUfactor(), WS_DRAW_ITEM_LIST::SetPenSize(), WS_DRAW_ITEM_LIST::SetSheetCount(), WS_DRAW_ITEM_LIST::SetSheetName(), and WS_DRAW_ITEM_LIST::SetSheetNumber().

Referenced by GetPageNumberOption(), OnHotKey(), OnLeftClick(), and OnRightClick().

604 {
605  const PAGE_INFO& pageInfo = GetPageSettings();
606  TITLE_BLOCK t_block = GetTitleBlock();
607  COLOR4D color = COLOR4D( RED ); // Needed, not used
609 
610  screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
611 
612  WS_DRAW_ITEM_LIST drawList;
613  drawList.SetPenSize( 0 );
614  drawList.SetMilsToIUfactor( IU_PER_MILS );
615  drawList.SetSheetNumber( screen->m_ScreenNumber );
616  drawList.SetSheetCount( screen->m_NumberOfScreens );
617  drawList.SetFileName( GetCurrFileName() );
618  // GetScreenDesc() returns a temporary string. Store it to avoid issues.
619  wxString descr = GetScreenDesc();
620  drawList.SetSheetName( descr );
621 
622  drawList.BuildWorkSheetGraphicList( pageInfo, t_block, color, color );
623 
624  // locate items.
625  // We do not use here the COLLECTOR classes in use in pcbnew and eeschema
626  // because the locate requirements are very basic.
627  std::vector <WS_DRAW_ITEM_BASE*> list;
628  drawList.Locate( aDC, list, aPosition );
629 
630  if( list.size() == 0 )
631  return NULL;
632 
633  WS_DRAW_ITEM_BASE* drawitem = list[0];
634 
635  // Choose item in list if more than 1 item
636  if( list.size() > 1 )
637  {
638  wxArrayString choices;
639  wxString text;
640  wxPoint cursPos = GetCrossHairPosition();
641 
642  for( unsigned ii = 0; ii < list.size(); ++ii )
643  {
644  drawitem = list[ii];
645  text = drawitem->GetParent()->m_Name;
646 
647  if( (drawitem->m_Flags & (LOCATE_STARTPOINT|LOCATE_ENDPOINT))
649  text << wxT( " " ) << _( "(start or end point)" );
650  else
651  {
652  if( (drawitem->m_Flags & LOCATE_STARTPOINT) )
653  text << wxT( " " ) << _( "(start point)" );
654 
655  if( (drawitem->m_Flags & LOCATE_ENDPOINT) )
656  text << wxT( " " ) << _( "(end point)" );
657  }
658 
659  if( ! drawitem->GetParent()->m_Info.IsEmpty() )
660  text << wxT( " \"" ) << drawitem->GetParent()->m_Info << wxT( "\"" );
661 
662  choices.Add( text );
663  }
664 
665  int selection = wxGetSingleChoiceIndex ( wxEmptyString,
666  _( "Selection Clarification" ),
667  choices, this );
668  if( selection < 0 )
669  return NULL;
670 
671  SetCrossHairPosition( cursPos );
673  drawitem = list[selection];
674  }
675 
676  WORKSHEET_DATAITEM* item = drawitem->GetParent();
678 
679  if( (drawitem->m_Flags & LOCATE_STARTPOINT) )
680  item->SetFlags( LOCATE_STARTPOINT );
681 
682  if( (drawitem->m_Flags & LOCATE_ENDPOINT) )
683  item->SetFlags( LOCATE_ENDPOINT );
684 
685  return item;
686 }
int m_ScreenNumber
Definition: base_screen.h:216
void SetFileName(const wxString &aFileName)
Set the filename to draw/plot.
void SetPenSize(int aPenSize)
Function SetPenSize Set the default pen size to draw/plot lines and texts.
const PAGE_INFO & GetPageSettings() const override
int color
Definition: DXF_plotter.cpp:62
#define LOCATE_STARTPOINT
void SetSheetName(const wxString &aSheetName)
Set the sheet name to draw/plot.
void ClearFlags(int aMask)
void BuildWorkSheetGraphicList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock, COLOR4D aColor, COLOR4D aAltColor)
Function BuildWorkSheetGraphicList is a core function for drawing or plotting the page layout with th...
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
#define LOCATE_ENDPOINT
void SetFlags(int aMask)
virtual wxString GetScreenDesc() const
void SetSheetCount(int aSheetCount)
Function SetSheetCount Set the value of the count of sheets, for basic inscriptions.
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
WORKSHEET_DATAITEM * GetParent() const
void SetMilsToIUfactor(double aScale)
Function SetMilsToIUfactor Set the scalar to convert pages units ( mils) to draw/plot units...
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const TITLE_BLOCK & GetTitleBlock() const override
Definition: colors.h:60
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
bool GetPageNumberOption() const
Page layout editor can show the title block using a page number 1 or another number.
void SetSheetNumber(int aSheetNumber)
Function SetSheetNumber Set the value of the sheet number, for basic inscriptions.
#define IU_PER_MILS
Definition: plotter.cpp:134
void Locate(wxDC *aDC, std::vector< WS_DRAW_ITEM_BASE * > &aList, const wxPoint &aPosition)
Locate graphic items in m_graphicList at location aPosition.
int m_NumberOfScreens
Definition: base_screen.h:217
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
const wxString & GetCurrFileName() const
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)
inherited

Mark a schematic file as being in use.

Use ReleaseFile() to undo this.

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

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

References EDA_DRAW_FRAME::m_file_checker.

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

263 {
264  m_file_checker = ::LockFile( aFileName );
265 
266  return bool( m_file_checker );
267 }
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:103
bool LockFile(const wxString &aFileName)
Mark a schematic file as being in use.
void PL_EDITOR_FRAME::MoveItem ( WORKSHEET_DATAITEM aItem)

Initialize a move item command.

Parameters
aItemis the item to move

Definition at line 431 of file events_functions.cpp.

References abortMoveItem(), EDA_DRAW_FRAME::GetCrossHairPosition(), WORKSHEET_DATAITEM::GetEndPos(), WORKSHEET_DATAITEM::GetEndPosUi(), WORKSHEET_DATAITEM::GetFlags(), GetScreen(), WORKSHEET_DATAITEM::GetStartPos(), WORKSHEET_DATAITEM::GetStartPosUi(), EDA_DRAW_PANEL::IsPointOnDisplay(), LOCATE_ENDPOINT, LOCATE_STARTPOINT, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::MoveCursorToCrossHair(), moveItem(), EDA_DRAW_FRAME::RedrawScreen(), EDA_DRAW_PANEL::Refresh(), EDA_DRAW_FRAME::SetCrossHairPosition(), PL_EDITOR_SCREEN::SetCurItem(), and EDA_DRAW_PANEL::SetMouseCapture().

Referenced by GetPageNumberOption().

432 {
433  wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
434  initialPosition = aItem->GetStartPos();
435  initialPositionUi = aItem->GetStartPosUi();
437 
438  if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
439  {
440  initialPosition = aItem->GetEndPos();
441  initialPositionUi = aItem->GetEndPosUi();
442  }
443 
444  if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
445  {
448 
450  {
452  m_canvas->Refresh();
453  }
454  else
455  {
457  }
458  }
459 
461  GetScreen()->SetCurItem( aItem );
462 }
const DPOINT GetStartPos(int ii=0) const
void SetCurItem(WORKSHEET_DATAITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
#define LOCATE_STARTPOINT
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
const wxPoint GetStartPosUi(int ii=0) const
#define LOCATE_ENDPOINT
virtual bool IsPointOnDisplay(const wxPoint &aPosition)
Function IsPointOnDisplay.
DPOINT initialPosition
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
wxPoint initialPositionUi
wxPoint initialCursorPosition
const wxPoint GetEndPosUi(int ii=0) const
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const DPOINT GetEndPos(int ii=0) const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterP...
static void moveItem(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
static void abortMoveItem(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
void EDA_DRAW_FRAME::OnActivate ( wxActivateEvent &  event)
virtualinherited

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, FOOTPRINT_VIEWER_FRAME, and LIB_VIEW_FRAME.

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

References EDA_DRAW_FRAME::m_canvas, and EDA_DRAW_PANEL::SetCanStartBlock().

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

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

Function onAutoSaveTimer handles the auto save timer event.

Definition at line 216 of file eda_base_frame.cpp.

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

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

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

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

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

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

References dump(), and kicadTraceKeyEvent.

248 {
249  wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_FRAME::OnCharHook %s", dump( event ) );
250  // Key events can be filtered here.
251  // Currently no filtering is made.
252  event.Skip();
253 }
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.
void PL_EDITOR_FRAME::OnCloseWindow ( wxCloseEvent &  Event)

Definition at line 184 of file pl_editor_frame.cpp.

References KIWAY_PLAYER::Destroy(), GetScreen(), HandleUnsavedChanges(), Kiface(), m_configSettings, m_propertiesPagelayout, saveCurrentPageLayout(), and wxConfigSaveSetups().

185 {
186  if( GetScreen()->IsModify() )
187  {
188  if( !HandleUnsavedChanges( this, _( "The current page layout has been modified. Save changes?" ),
189  [&]()->bool { return saveCurrentPageLayout(); } ) )
190  {
191  Event.Veto();
192  return;
193  }
194  }
195 
196  // do not show the window because we do not want any paint event
197  Show( false );
198 
199  // was: Pgm().SaveCurrentSetupValues( m_configSettings );
200  wxConfigSaveSetups( Kiface().KifaceSettings(), m_configSettings );
201 
202  // On Linux, m_propertiesPagelayout must be destroyed
203  // before deleting the main frame to avoid a crash when closing
204  m_propertiesPagelayout->Destroy();
205  Destroy();
206 }
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Function HandleUnsavedChanges displays a dialog with Save, Cancel and Discard Changes buttons...
Definition: confirm.cpp:213
PARAM_CFG_ARRAY m_configSettings
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void wxConfigSaveSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigSaveSetups writes aList of PARAM_CFG_ARRAY elements to save configuration values to ...
PROPERTIES_FRAME * m_propertiesPagelayout
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void EDA_DRAW_FRAME::OnEraseBackground ( wxEraseEvent &  SizeEvent)
inherited
void PL_EDITOR_FRAME::OnFileHistory ( wxCommandEvent &  event)

Definition at line 55 of file pagelayout_editor/files.cpp.

References EDA_DRAW_PANEL::EndMouseCapture(), GetChars(), EDA_DRAW_PANEL::GetDefaultCursor(), EDA_BASE_FRAME::GetFileFromHistory(), GetScreen(), HandleUnsavedChanges(), ID_NO_TOOL_SELECTED, BASE_SCREEN::IsModify(), LoadPageLayoutDescrFile(), EDA_DRAW_FRAME::m_canvas, OnNewPageLayout(), and saveCurrentPageLayout().

Referenced by GetPageNumberOption().

56 {
57  wxString filename;
58 
59  filename = GetFileFromHistory( event.GetId(), _( "Page Layout Description File" ) );
60 
61  if( filename != wxEmptyString )
62  {
63  if( GetScreen()->IsModify() )
64  {
65  if( !HandleUnsavedChanges( this,
66  _( "The current page layout has been modified. Save changes?" ),
67  [&]()->bool { return saveCurrentPageLayout(); } ) )
68  {
69  return;
70  }
71  }
72 
74  ::wxSetWorkingDirectory( ::wxPathOnly( filename ) );
75 
76  if( LoadPageLayoutDescrFile( filename ) )
77  {
78  wxString msg;
79  msg.Printf( _( "File \"%s\" loaded"), GetChars( filename ) );
80  SetStatusText( msg );
81  }
82 
84  }
85 }
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Function HandleUnsavedChanges displays a dialog with Save, Cancel and Discard Changes buttons...
Definition: confirm.cpp:213
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
bool IsModify() const
Definition: base_screen.h:328
void OnNewPageLayout()
Must be called to initialize parameters when a new page layout description is loaded.
PL_EDITOR_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.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
wxString GetFileFromHistory(int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
Function GetFileFromHistory fetches the file name from the file history list.
bool LoadPageLayoutDescrFile(const wxString &aFullFileName)
Function LoadPageLayoutDescrFile Loads a .kicad_wks page layout descr file.
int GetDefaultCursor() const
Function GetDefaultCursor.
bool PL_EDITOR_FRAME::OnHotKey ( wxDC *  aDC,
int  aHotkeyCode,
const wxPoint aPosition,
EDA_ITEM aItem = NULL 
)
overridevirtual

Function OnHotKey.

** Commands are case insensitive ** Some commands are relatives to the item under the mouse cursor

Parameters
aDC= current device context
aHotkeyCode= hotkey code (ascii or wxWidget code for special keys)
aPositionThe cursor position in logical (drawing) units.
aItem= NULL or pointer on a EDA_ITEM under the mouse cursor

Reimplemented from EDA_DRAW_FRAME.

Definition at line 152 of file pagelayout_editor/hotkeys.cpp.

References DisplayHotkeyList(), EDA_DRAW_FRAME::GetCrossHairPosition(), PL_EDITOR_SCREEN::GetCurItem(), GetDescriptorFromHotkey(), DESIGN_TREE_FRAME::GetPageLayoutSelectedItem(), GetScreen(), WORKSHEET_DATAITEM::HasEndPoint(), HK_DELETE_ITEM, HK_HELP, HK_LEFT_CLICK, HK_LEFT_DCLICK, HK_MOVE_END_POINT, HK_MOVE_ITEM, HK_MOVE_START_POINT, HK_NEW, HK_NOT_FOUND, HK_OPEN, HK_PLACE_ITEM, HK_PRINT, HK_REDO, HK_RESET_LOCAL_COORD, HK_SAVE, HK_SAVEAS, HK_SET_GRID_ORIGIN, HK_UNDO, HK_ZOOM_AUTO, HK_ZOOM_CENTER, HK_ZOOM_IN, HK_ZOOM_OUT, HK_ZOOM_REDRAW, HK_ZOOM_SELECTION, ID_POPUP_ZOOM_CENTER, ID_POPUP_ZOOM_IN, ID_POPUP_ZOOM_OUT, ID_ZOOM_PAGE, ID_ZOOM_REDRAW, ID_ZOOM_SELECTION, Locate(), EDA_HOTKEY::m_Idcommand, EDA_HOTKEY::m_IdMenuEvent, BASE_SCREEN::m_O_Curseur, m_treePagelayout, OnLeftClick(), OnLeftDClick(), DESIGN_TREE_FRAME::SelectCell(), and SetGridOrigin().

Referenced by GeneralControl(), and GetPageNumberOption().

154 {
155  bool busy = GetScreen()->GetCurItem() != NULL;
156  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
157  cmd.SetEventObject( this );
158 
159  /* Convert lower to upper case (the usual toupper function has problem with non ascii
160  * codes like function keys */
161  if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
162  aHotkeyCode += 'A' - 'a';
163 
164  EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_PlEditor_Hotkey_List );
165 
166  if( HK_Descr == NULL )
167  HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_Common_Hotkey_List );
168 
169  if( HK_Descr == NULL )
170  return false;
171 
172  WORKSHEET_DATAITEM* item;
173 
174  switch( HK_Descr->m_Idcommand )
175  {
176  case HK_NOT_FOUND:
177  return false;
178 
179  case HK_LEFT_CLICK:
180  OnLeftClick( aDC, aPosition );
181  break;
182 
183  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
184  OnLeftClick( aDC, aPosition );
185  OnLeftDClick( aDC, aPosition );
186  break;
187 
188  case HK_NEW:
189  cmd.SetId( wxID_NEW );
190  GetEventHandler()->ProcessEvent( cmd );
191  break;
192 
193  case HK_OPEN:
194  cmd.SetId( wxID_OPEN );
195  GetEventHandler()->ProcessEvent( cmd );
196  break;
197 
198  case HK_SAVE:
199  cmd.SetId( wxID_SAVE );
200  GetEventHandler()->ProcessEvent( cmd );
201  break;
202