KiCad PCB EDA Suite
PL_EDITOR_FRAME Class Reference

#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
 Function GetPageSizeIU 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
 Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives. More...
 
const wxPointGetAuxOrigin () const override
 Function GetAuxOrigin returns the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPosition) override
 
const wxPointGetGridOrigin () const override
 Function GetGridOrigin returns 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
 Function UpdateStatusBar updates 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 an other 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
 Function GeneralControl performs 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 (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 edition: More...
 
void GetLayoutFromUndoList (wxCommandEvent &event)
 Undo the last edition: More...
 
void RemoveLastCommandInUndoList ()
 Remove the last command in Undo List. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 this function capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Function LockFile marks a schematic file as being in use. More...
 
void ReleaseFile ()
 Function ReleaseFile Release the current file marked in use. More...
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Function GetCursorPosition returns the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Function GetNearestGridPosition returns the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Function GetCursorScreenPosition returns the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Function RefPos Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
EDA_DRAW_PANELGetCanvas ()
 
virtual wxString GetScreenDesc () const
 
virtual void ExecuteRemoteCommand (const char *cmdline)
 Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg)
 Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 Function IsGridVisible() , virtual. More...
 
virtual void SetGridVisibility (bool aVisible)
 Function SetGridVisibility() , virtual It may be overloaded by derived classes. More...
 
virtual COLOR4D GetGridColor ()
 Function GetGridColor() , virtual. More...
 
virtual void SetGridColor (COLOR4D aColor)
 Function SetGridColor() , virtual. More...
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Function SetNextGrid() changes the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Function SetPresetGrid() changes the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Function OnSize recalculates the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Function SetNextZoom() changes the zoom to the next one available. More...
 
void SetPrevZoom ()
 Function SetPrevZoom() changes the zoom to the previous one available. More...
 
void SetPresetZoom (int aIndex)
 Function SetPresetZoom() changes zoom to one of the preset values. More...
 
void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
void RedrawScreen2 (const wxPoint &posBefore)
 Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming. More...
 
void Zoom_Automatique (bool aWarpPointer)
 Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void Window_Zoom (EDA_RECT &Rect)
 
double GetZoom ()
 Function GetZoom. More...
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
virtual void ToolOnRightClick (wxCommandEvent &event)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnActivate (wxActivateEvent &event)
 Function OnActivate (virtual) is called when activating the frame. More...
 
void DisplayUnitsMsg ()
 Function DisplayUnitsMsg displays current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Function CopyToClipboard copies the current page or the current block to the clipboard. More...
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Function SetMsgPanel clears the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Function UpdateMsgPanel redraws the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Function PushPreferences Pushes a few preferences from a parent window to a child window. More...
 
wxString CoordinateToString (int aValue, bool aConvertToMils=false) const
 Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting. More...
 
wxString LengthDoubleToString (double aValue, bool aConvertToMils=false) const
 Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting. More...
 
virtual void UseGalCanvas (bool aEnable)
 Function UseGalCanvas used to switch between standard and GAL-based canvas. More...
 
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
 Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Function GetToolManager returns the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering. More...
 
VTBL_ENTRY bool ImportFile (const wxString &aFileName, int aFileType)
 Function ImportFile load the given filename but sets the path to the current project path. More...
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
virtual void KiwayMailIn (KIWAY_EXPRESS &aEvent)
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
int ReadHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys. More...
 
int ReadHotkeyConfigFile (const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedLanguage ()
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
virtual int GetIconScale ()
 Function GetIconScale. More...
 
virtual void SetIconScale (int aScale)
 Function SetIconScale. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Member Functions

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

Protected Attributes

wxString m_lastFileName
 The last filename chosen to be proposed to the user. More...
 
DESIGN_TREE_FRAMEm_treePagelayout
 
PROPERTIES_FRAMEm_propertiesPagelayout
 
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
 prevents opening same file multiple times. More...
 
EDA_HOTKEY_CONFIGm_hotkeysDescrList
 
int m_LastGridSizeId
 
bool m_drawGrid
 
bool m_showPageLimits
 true to display the page limits More...
 
COLOR4D m_gridColor
 Grid color. More...
 
COLOR4D m_drawBgColor
 the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema More...
 
double m_zoomLevelCoeff
 a suitable value to convert the internal zoom scaling factor More...
 
int m_UndoRedoCountMax
 default Undo/Redo command Max depth, to be handed More...
 
EDA_DRAW_PANELm_canvas
 The area to draw on. More...
 
TOOL_MANAGERm_toolManager
 
TOOL_DISPATCHERm_toolDispatcher
 
ACTIONSm_actions
 
int m_lastDrawToolId
 Tool ID of previously active draw tool bar button. More...
 
bool m_showAxis
 True shows the X and Y axis indicators. More...
 
bool m_showGridAxis
 True shows the grid axis indicators. More...
 
bool m_showOriginAxis
 True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files. More...
 
bool m_showBorderAndTitleBlock
 True shows the drawing border and title block. More...
 
long m_firstRunDialogSetting
 Key to control whether first run dialog is shown on startup. More...
 
wxChoice * m_gridSelectBox
 Choice box to choose the grid size. More...
 
wxChoice * m_zoomSelectBox
 Choice box to choose the zoom value. More...
 
wxAuiToolBar * m_drawToolBar
 The tool bar that contains the buttons for quick access to the application draw tools. More...
 
wxAuiToolBar * m_optionsToolBar
 The options tool bar typcially located on the left edge of the main window. More...
 
EDA_MSG_PANELm_messagePanel
 Panel used to display information at the bottom of the main window. More...
 
int m_MsgFrameHeight
 
bool m_movingCursorWithKeyboard
 One-shot to avoid a recursive mouse event during hotkey movement. More...
 
bool m_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

Definition at line 51 of file pl_editor_frame.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file pl_editor_frame.cpp.

References WORKSHEET_LAYOUT::AllowVoidList(), 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(), EDA_PANEINFO::HorizontalToolbarPane(), ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_LEVEL_1MM, KiBitmap(), EDA_PANEINFO::LayersToolbarPane(), PCAD2KICAD::Left, LoadSettings(), EDA_BASE_FRAME::m_auimgr, EDA_DRAW_FRAME::m_canvas, m_designTreeWidth, EDA_DRAW_FRAME::m_drawToolBar, 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, EDA_DRAW_FRAME::m_optionsToolBar, 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_zoomLevelCoeff, EDA_PANEINFO::MessageToolbarPane(), OnNewPageLayout(), PlEditorHokeysDescr, ReCreateHToolbar(), ReCreateMenuBar(), ReCreateOptToolbar(), PCAD2KICAD::Right, EDA_DRAW_FRAME::SetDrawBgColor(), EDA_DRAW_PANEL::SetEnableBlockCommands(), BASE_SCREEN::SetGrid(), WORKSHEET_LAYOUT::SetPageLayout(), EDA_DRAW_FRAME::SetScreen(), EDA_DRAW_FRAME::SetShowPageLimits(), EDA_PANEINFO::VerticalToolbarPane(), WHITE, wxPoint::x, and wxPoint::y.

55  :
56  EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ),
57  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME )
58 {
59  m_zoomLevelCoeff = 290.0; // Adjusted to roughly displays zoom level = 1
60  // when the screen shows a 1:1 image
61  // obviously depends on the monitor,
62  // but this is an acceptable value
63 
64  m_showAxis = false; // true to show X and Y axis on screen
65  m_showGridAxis = true;
66  m_showBorderAndTitleBlock = true; // true for reference drawings.
69  SetDrawBgColor( WHITE ); // default value, user option (WHITE/BLACK)
70  SetShowPageLimits( true );
71 
72  m_designTreeWidth = 150;
74 
75  if( m_canvas )
77 
78  // Give an icon
79  wxIcon icon;
80  icon.CopyFromBitmap( KiBitmap( icon_pagelayout_editor_xpm ) );
81  SetIcon( icon );
82  wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU();
83  SetScreen( new PL_EDITOR_SCREEN( pageSizeIU ) );
84 
85  LoadSettings( config() );
86  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
87 
88  if( ! GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
90 
91  GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
92 
96 
97  wxWindow* stsbar = GetStatusBar();
98  int dims[] = {
99 
100  // balance of status bar on far left is set to a default or whatever is left over.
101  -1,
102 
103  // When using GetTextSize() remember the width of '1' is not the same
104  // as the width of '0' unless the font is fixed width, and it usually won't be.
105 
106  // zoom:
107  GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,
108 
109  // cursor coords
110  GetTextSize( wxT( "X 0234.567 Y 0234.567" ), stsbar ).x + 10,
111 
112  // delta distances
113  GetTextSize( wxT( "dx 0234.567 dx 0234.567" ), stsbar ).x + 10,
114 
115  // Coord origin (use the bigger message)
116  GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10,
117 
118  // units display, Inches is bigger than mm
119  GetTextSize( _( "Inches" ), stsbar ).x + 10
120  };
121 
122  SetStatusWidths( DIM( dims ), dims );
123 
124 
125  m_auimgr.SetManagedWindow( this );
126 
127  EDA_PANEINFO horiz;
128  horiz.HorizontalToolbarPane();
129 
130  EDA_PANEINFO vert;
131  vert.VerticalToolbarPane();
132 
133  EDA_PANEINFO mesg;
134  mesg.MessageToolbarPane();
135 
137  EDA_PANEINFO props;
138  props.LayersToolbarPane();
139  props.MinSize( m_propertiesPagelayout->GetMinSize() );
140  props.BestSize( m_propertiesFrameWidth, -1 );
141  props.Caption( _( "Properties" ) );
142 
143  m_treePagelayout = new DESIGN_TREE_FRAME( this );
144  EDA_PANEINFO tree;
145  tree.LayersToolbarPane();
146  tree.MinSize( m_treePagelayout->GetMinSize() );
147  tree.BestSize( m_designTreeWidth, -1 );
148  tree.Caption( _( "Design" ) );
149 
150  if( m_mainToolBar )
151  m_auimgr.AddPane( m_mainToolBar,
152  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
153 
154  if( m_drawToolBar )
155  m_auimgr.AddPane( m_drawToolBar,
156  wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right().Row( 1 ) );
157 
159  props.Name( wxT( "m_propertiesPagelayout" ) ).Right().Layer( 1 ) );
160 
161  m_auimgr.AddPane( m_treePagelayout,
162  tree.Name( wxT( "m_treePagelayout" ) ).Left().Layer( 0 ) );
163 
164  if( m_optionsToolBar )
165  m_auimgr.AddPane( m_optionsToolBar,
166  wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
167 
168  if( m_canvas )
169  m_auimgr.AddPane( m_canvas,
170  wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane().Layer( 5 ) );
171 
172  if( m_messagePanel )
173  m_auimgr.AddPane( m_messagePanel,
174  wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) );
175 
176  m_auimgr.Update();
177 
178  // Initialize the current page layout
180 #if 0 //start with empty layout
181  pglayout.AllowVoidList( true );
182  pglayout.ClearList();
183 #else // start with the default Kicad layout
184  pglayout.SetPageLayout();
185 #endif
186  OnNewPageLayout();
187 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
#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:103
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:150
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
Class PROPERTIES_FRAME display properties of the current item.
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:334
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
EDA_PANEINFO & LayersToolbarPane()
Function LayersToolbarPane Change *this to a layers toolbar for KiCad.
Specialization of the wxAuiPaneInfo class for KiCad panels.
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Function GetTextSize returns the size of aSingleLine of text when it is rendered in aWindow using wha...
Definition: common.cpp:93
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
Class DESIGN_TREE_FRAME is the left window showing the list of items.
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:129
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:132
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:113
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:106
PL_EDITOR_SCREEN * GetScreen() const override
Function GetScreen returns 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
#define PL_EDITOR_FRAME_NAME
Class PL_EDITOR_FRAME is the main window used in the page layout editor.
int m_LastGridSizeId
Definition: draw_frame.h:78
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:126
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)
Definition: draw_frame.cpp:127
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:93
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
void ReCreateOptToolbar()
Create or update the left vertical toolbar (option toolbar.
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:340
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
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 190 of file pl_editor_frame.cpp.

191 {
192 }

Member Function Documentation

void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

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

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

Definition at line 677 of file eda_base_frame.cpp.

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

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

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

Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands.

Parameters
aMasterMenu= the menu to populate.

Definition at line 266 of file zoom.cpp.

References AddHotkeyName(), AddMenuItem(), BASE_SCREEN::BuildGridsChoiceList(), g_UserUnit, BASE_SCREEN::GetGrid(), BASE_SCREEN::GetGridCount(), EDA_DRAW_PANEL::GetScreen(), BASE_SCREEN::GetZoom(), HK_ZOOM_AUTO, HK_ZOOM_CENTER, HK_ZOOM_IN, HK_ZOOM_OUT, HK_ZOOM_REDRAW, ID_POPUP_CANCEL, ID_POPUP_GRID_SELECT, ID_POPUP_ZOOM_CENTER, ID_POPUP_ZOOM_IN, ID_POPUP_ZOOM_LEVEL_END, ID_POPUP_ZOOM_LEVEL_START, ID_POPUP_ZOOM_OUT, ID_POPUP_ZOOM_PAGE, ID_POPUP_ZOOM_REDRAW, ID_POPUP_ZOOM_SELECT, INCHES, KiBitmap(), 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().

267 {
268  int maxZoomIds;
269  double zoom;
270  wxString msg;
271  BASE_SCREEN* screen = m_canvas->GetScreen();
272 
273  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
274  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
275  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
276  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
277  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
278  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
279  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
280  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
281  msg = AddHotkeyName( _( "Zoom Auto" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
282  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
283 
284 
285  wxMenu* zoom_choice = new wxMenu;
286  AddMenuItem( MasterMenu, zoom_choice,
287  ID_POPUP_ZOOM_SELECT, _( "Zoom Select" ),
288  KiBitmap( zoom_selection_xpm ) );
289 
290  zoom = screen->GetZoom();
292  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
293  maxZoomIds : screen->m_ZoomList.size();
294 
295  // Populate zoom submenu.
296  for( int i = 0; i < maxZoomIds; i++ )
297  {
298  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
299 
300  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
301  wxEmptyString, wxITEM_CHECK );
302  if( zoom == screen->m_ZoomList[i] )
303  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
304  }
305 
306  // Create grid submenu as required.
307  if( screen->GetGridCount() )
308  {
309  wxMenu* gridMenu = new wxMenu;
310  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
311  _( "Grid Select" ), KiBitmap( grid_select_xpm ) );
312 
313  wxArrayString gridsList;
314  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
315 
316  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
317  {
318  GRID_TYPE& grid = screen->GetGrid( i );
319  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
320 
321  if( (int)i == icurr )
322  gridMenu->Check( grid.m_CmdId, true );
323  }
324  }
325 
326  MasterMenu->AppendSeparator();
327  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
328 }
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:174
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)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
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
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Class GRID_TYPE is for grid arrays.
Definition: base_screen.h:45
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:194
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 600 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().

601 {
602  WORKSHEET_DATAITEM * item = NULL;
603 
604  switch( aType )
605  {
607  item = new WORKSHEET_DATAITEM_TEXT( wxT( "Text") );
608  break;
609 
612  break;
613 
616  break;
617 
619  item = new WORKSHEET_DATAITEM_POLYPOLYGON();
620  break;
621 
623  {
624  wxFileDialog fileDlg( this, _( "Choose Image" ), wxEmptyString, wxEmptyString,
625  _( "Image Files " ) + wxImage::GetImageExtWildcard(),
626  wxFD_OPEN );
627 
628  if( fileDlg.ShowModal() != wxID_OK )
629  return NULL;
630 
631  wxString fullFilename = fileDlg.GetPath();
632 
633  if( !wxFileExists( fullFilename ) )
634  {
635  wxMessageBox( _( "Couldn't load image from \"%s\"" ), GetChars( fullFilename ) );
636  break;
637  }
638 
639  BITMAP_BASE* image = new BITMAP_BASE();
640 
641  if( !image->ReadImageFile( fullFilename ) )
642  {
643  wxMessageBox( _( "Couldn't load image from \"%s\"" ),
644  GetChars( fullFilename ) );
645  delete image;
646  break;
647  }
648 
649  item = new WORKSHEET_DATAITEM_BITMAP( image );
650  }
651  break;
652  }
653 
654  if( item == NULL )
655  return NULL;
656 
658  pglayout.Insert( item, aIdx );
660 
661  return item;
662 }
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:44
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:82
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 928 of file draw_frame.cpp.

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

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

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

773 {
774  if( m_messagePanel == NULL )
775  return;
776 
777  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
778 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:132
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 EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited

Definition at line 86 of file zoom.cpp.

References EDA_DRAW_FRAME::m_canvas, max, EDA_DRAW_FRAME::SetScrollCenterPosition(), wxPoint::x, and wxPoint::y.

Referenced by FOOTPRINT_EDIT_FRAME::BestZoom(), LIB_VIEW_FRAME::BestZoom(), BestZoom(), PCB_BASE_FRAME::BestZoom(), GERBVIEW_FRAME::BestZoom(), and LIB_EDIT_FRAME::BestZoom().

87 {
88  double bestzoom = std::max( sizeX * scaleFactor / (double) m_canvas->GetClientSize().x,
89  sizeY * scaleFactor / (double) m_canvas->GetClientSize().y );
90 
91  // Take scrollbars into account
92  DSIZE scrollbarSize = m_canvas->GetSize() - m_canvas->GetClientSize();
93  centre.x -= int( bestzoom * scrollbarSize.x / 2.0 );
94  centre.y -= int( bestzoom * scrollbarSize.y / 2.0 );
95 
96  SetScrollCenterPosition( centre );
97 
98  return bestzoom;
99 }
void SetScrollCenterPosition(const wxPoint &aPoint)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
#define max(a, b)
Definition: auxiliary.h:86
double PL_EDITOR_FRAME::BestZoom ( )
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 278 of file pl_editor_frame.cpp.

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

Referenced by SetGridOrigin().

279 {
280  double sizeX = (double) GetPageLayout().GetPageSettings().GetWidthIU();
281  double sizeY = (double) GetPageLayout().GetPageSettings().GetHeightIU();
282  wxPoint centre( sizeX / 2, sizeY / 2 );
283 
284  // The sheet boundary already affords us some margin, so add only an
285  // additional 5%.
286  double margin_scale_factor = 1.05;
287 
288  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
289 }
const PL_EDITOR_LAYOUT & GetPageLayout() const
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
Definition: zoom.cpp:86
const PAGE_INFO & GetPageSettings() const
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
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
void GetAllItems(std::vector< WS_DRAW_ITEM_BASE * > *aList)
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:361
static const int delta[8][2]
Definition: solve.cpp:112
PL_EDITOR_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
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:93
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
void SetModify()
Definition: base_screen.h:324
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
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
Definition: common.h:65
#define GR_KB_SHIFT
Definition: common.h:66
#define GR_KB_SHIFTCTRL
Definition: common.h:67
#define MOUSE_MIDDLE
Definition: common.h:68
#define GR_KB_CTRL
Definition: common.h:64
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 582 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().

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

Function ConfigBaseName.

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

Definition at line 266 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

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

267  {
268  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
269  return baseCfgName;
270  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
wxString EDA_DRAW_FRAME::CoordinateToString ( int  aValue,
bool  aConvertToMils = false 
) const
inherited

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

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

Definition at line 829 of file draw_frame.cpp.

References CoordinateToString().

Referenced by getOptimalModulePlacement().

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

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

Definition at line 42 of file copy_to_clipboard.cpp.

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

Referenced by add_search_paths().

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

Function DisplayUnitsMsg displays current unit pane on the status bar.

Definition at line 517 of file draw_frame.cpp.

References g_UserUnit, INCHES, and MILLIMETRES.

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

518 {
519  wxString msg;
520 
521  switch( g_UserUnit )
522  {
523  case INCHES:
524  msg = _( "Inches" );
525  break;
526 
527  case MILLIMETRES:
528  msg = _( "mm" );
529  break;
530 
531  default:
532  msg = _( "Units" );
533  break;
534  }
535 
536  SetStatusText( msg, 4 );
537 }
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

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

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 235 of file eda_base_frame.cpp.

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

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

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

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

Definition at line 76 of file worksheet.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(), SCH_PRINTOUT::DrawPage(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), PrintPage(), FOOTPRINT_EDIT_FRAME::RedrawActiveWindow(), RedrawActiveWindow(), GERBVIEW_FRAME::RedrawActiveWindow(), SCH_EDIT_FRAME::RedrawActiveWindow(), and PCB_EDIT_FRAME::RedrawActiveWindow().

79 {
81  return;
82 
83  const PAGE_INFO& pageInfo = GetPageSettings();
84  wxSize pageSize = pageInfo.GetSizeMils();
85 
86  // if not printing, draw the page limits:
87  if( !aScreen->m_IsPrinting && m_showPageLimits )
88  {
89  GRSetDrawMode( aDC, GR_COPY );
90  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
91  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
93  }
94 
95  TITLE_BLOCK t_block = GetTitleBlock();
96  COLOR4D color = COLOR4D( RED );
97 
98  wxPoint origin = aDC->GetDeviceOrigin();
99 
100  if( aScreen->m_IsPrinting && origin.y > 0 )
101  {
102  aDC->SetDeviceOrigin( 0, 0 );
103  aDC->SetAxisOrientation( true, false );
104  }
105 
106  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
107  GetScreenDesc(), aFilename, t_block,
108  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
109  aLineWidth, aScalar, color, color, aSheetLayer );
110 
111  if( aScreen->m_IsPrinting && origin.y > 0 )
112  {
113  aDC->SetDeviceOrigin( origin.x, origin.y );
114  aDC->SetAxisOrientation( true, true );
115  }
116 }
int m_ScreenNumber
Definition: base_screen.h:216
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
virtual const TITLE_BLOCK & GetTitleBlock() const =0
int color
Definition: DXF_plotter.cpp:62
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:84
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:39
const wxSize & GetSizeMils() const
Definition: page_info.h:137
virtual const PAGE_INFO & GetPageSettings() const =0
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1098
virtual wxString GetScreenDesc() const
Definition: worksheet.cpp:119
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:49
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:113
EDA_RECT * GetClipBox()
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:93
void DrawPageLayout(wxDC *aDC, EDA_RECT *aClipBox, const PAGE_INFO &aPageInfo, const wxString &aFullSheetName, const wxString &aFileName, TITLE_BLOCK &aTitleBlock, int aSheetCount, int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor, COLOR4D aAltColor, const wxString &aSheetLayer)
Function DrawPageLayout is a core function to draw the page layout with the frame and the basic inscr...
Definition: worksheet.cpp:48
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:82
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 264 of file draw_frame.cpp.

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

Referenced by GERBVIEW_FRAME::SetCurItem().

265 {
266  if( m_messagePanel )
268 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:132
void EraseMsgBox()
Definition: msgpanel.cpp:215
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 363 of file draw_frame.h.

References EDA_DRAW_PANEL::OnMouseEvent().

Referenced by EDA_DRAW_FRAME::OnSockRequest().

363 {}
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 757 of file hotkeys_basic.cpp.

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

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

759 {
760  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
761  wxString mask = wxT( "*." ) + ext;
762 
763 #if 0
764  wxString path = wxPathOnly( Prj().GetProjectFullName() );
765 #else
766  wxString path = GetMruPath();
767 #endif
768  wxFileName fn( aDefaultShortname );
769  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
770 
771  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
772  path,
773  fn.GetFullPath(),
774  ext,
775  mask,
776  this,
777  wxFD_SAVE,
778  true );
779 
780  if( filename.IsEmpty() )
781  return;
782 
783  WriteHotkeyConfig( aDescList, &filename );
784  SetMruPath( wxFileName( filename ).GetPath() );
785 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:270
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
void PL_EDITOR_FRAME::Files_io ( wxCommandEvent &  event)

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

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

Referenced by GetPageNumberOption().

74 {
75  wxString msg;
76  int id = event.GetId();
77  wxString filename = GetCurrFileName();
79 
80  if( filename.IsEmpty() && id == wxID_SAVE )
81  id = wxID_SAVEAS;
82 
83  switch( id )
84  {
85  case wxID_NEW:
86  case wxID_OPEN:
87  if( GetScreen()->IsModify() && !IsOK( this,
88  _( "The current page layout has been modified.\n"
89  "Do you wish to discard the changes?" ) ) )
90  return;
91  break;
92 
93  default:
94  break;
95  }
96 
97  switch( id )
98  {
99  case wxID_NEW:
100  pglayout.AllowVoidList( true );
101  SetCurrFileName( wxEmptyString );
102  pglayout.ClearList();
103  OnNewPageLayout();
104  break;
105 
107  {
108  wxFileDialog openFileDialog( this, _( "Append Existing Page Layout File" ),
109  wxEmptyString, wxEmptyString,
110  PageLayoutDescrFileWildcard(), wxFD_OPEN );
111 
112  if( openFileDialog.ShowModal() == wxID_CANCEL )
113  return;
114 
115  filename = openFileDialog.GetPath();
116 
117  if( ! InsertPageLayoutDescrFile( filename ) )
118  {
119  msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) );
120  wxMessageBox( msg );
121  }
122  else
123  {
124  GetScreen()->SetModify();
126  m_canvas->Refresh();
127  msg.Printf( _( "File \"%s\" inserted" ), GetChars( filename ) );
128  SetStatusText( msg );
129  }
130  }
131  break;
132 
133  case wxID_OPEN:
134  {
135  wxFileDialog openFileDialog( this, _( "Open" ), wxEmptyString, wxEmptyString,
136  PageLayoutDescrFileWildcard(), wxFD_OPEN );
137 
138  if( openFileDialog.ShowModal() == wxID_CANCEL )
139  return;
140 
141  filename = openFileDialog.GetPath();
142 
143  if( ! LoadPageLayoutDescrFile( filename ) )
144  {
145  msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) );
146  wxMessageBox( msg );
147  }
148  else
149  {
150  OnNewPageLayout();
151  msg.Printf( _( "File \"%s\" loaded" ), GetChars( filename ) );
152  SetStatusText( msg );
153  }
154  }
155  break;
156 
157  case wxID_SAVE:
158  if( !SavePageLayoutDescrFile( filename ) )
159  {
160  msg.Printf( _( "Unable to write \"%s\"" ), GetChars( filename ) );
161  wxMessageBox( msg );
162  }
163  else
164  {
165  msg.Printf( _("File \"%s\" written"), GetChars( filename ) );
166  SetStatusText( msg );
167  }
168  break;
169 
170  case wxID_SAVEAS:
171  {
172  wxFileDialog openFileDialog( this, _( "Save As" ), wxEmptyString, wxEmptyString,
173  PageLayoutDescrFileWildcard(), wxFD_SAVE );
174 
175  if( openFileDialog.ShowModal() == wxID_CANCEL )
176  return;
177 
178  filename = openFileDialog.GetPath();
179  // Ensure the file has the right extension:
180  // because a name like name.subname.subsubname is legal,
181  // add the right extension without replacing the wxFileName
182  // extension
183  wxFileName fn(filename);
184 
185  if( fn.GetExt() != PageLayoutDescrFileExtension )
186  filename << wxT(".") << PageLayoutDescrFileExtension;
187 
188  if( !SavePageLayoutDescrFile( filename ) )
189  {
190  msg.Printf( _("Unable to create \"%s\""), GetChars( filename ) );
191  wxMessageBox( msg );
192  }
193 
194  else
195  {
196  msg.Printf( _("File \"%s\" written"), GetChars( filename ) );
197  SetStatusText( msg );
198 
199  if( GetCurrFileName().IsEmpty() )
200  SetCurrFileName( filename );
201  }
202  }
203  break;
204 
205  default:
206  wxMessageBox( wxT( "File_io: unexpected command id" ) );
207  break;
208  }
209 }
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.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
bool IsModify() const
Definition: base_screen.h:328
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
const wxString PageLayoutDescrFileExtension
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
Function GetScreen returns 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...
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:93
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...
void SetModify()
Definition: base_screen.h:324
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:122
const wxString & GetCurrFileName() const
bool PL_EDITOR_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint aPosition,
EDA_KEY  aHotKey = 0 
)
overridevirtual

Function GeneralControl performs application specific control using aDC at aPosition in logical units.

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

Parameters
aDCA device context.
aPositionThe current cursor position in logical (drawing) units.
aHotKeyA key event used for application specific control if not zero.
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
Function UpdateStatusBar updates the status bar information.
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
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)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:142
bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint aPos,
bool  aSnapToGrid 
)
protectedinherited

Function GeneralControlKeyMovement 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 1351 of file 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 DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), and GERBVIEW_FRAME::GeneralControl().

1353 {
1354  bool key_handled = false;
1355 
1356  // If requested snap the current position to the grid
1357  if( aSnapToGrid )
1358  *aPos = GetNearestGridPosition( *aPos );
1359 
1360  switch( aHotKey )
1361  {
1362  // All these keys have almost the same treatment
1363  case GR_KB_CTRL | WXK_NUMPAD8:
1364  case GR_KB_CTRL | WXK_UP:
1365  case GR_KB_CTRL | WXK_NUMPAD2:
1366  case GR_KB_CTRL | WXK_DOWN:
1367  case GR_KB_CTRL | WXK_NUMPAD4:
1368  case GR_KB_CTRL | WXK_LEFT:
1369  case GR_KB_CTRL | WXK_NUMPAD6:
1370  case GR_KB_CTRL | WXK_RIGHT:
1371  case WXK_NUMPAD8:
1372  case WXK_UP:
1373  case WXK_NUMPAD2:
1374  case WXK_DOWN:
1375  case WXK_NUMPAD4:
1376  case WXK_LEFT:
1377  case WXK_NUMPAD6:
1378  case WXK_RIGHT:
1379  key_handled = true;
1380  {
1381  /* Here's a tricky part: when doing cursor key movement, the
1382  * 'previous' point should be taken from memory, *not* from the
1383  * freshly computed position in the event. Otherwise you can't do
1384  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1385  * the automatic motion event generated by cursor warping */
1386  wxRealPoint gridSize = GetScreen()->GetGridSize();
1387  *aPos = GetCrossHairPosition();
1388 
1389  // Bonus: ^key moves faster (x10)
1390  switch( aHotKey )
1391  {
1392  case GR_KB_CTRL|WXK_NUMPAD8:
1393  case GR_KB_CTRL|WXK_UP:
1394  aPos->y -= KiROUND( 10 * gridSize.y );
1395  break;
1396 
1397  case GR_KB_CTRL|WXK_NUMPAD2:
1398  case GR_KB_CTRL|WXK_DOWN:
1399  aPos->y += KiROUND( 10 * gridSize.y );
1400  break;
1401 
1402  case GR_KB_CTRL|WXK_NUMPAD4:
1403  case GR_KB_CTRL|WXK_LEFT:
1404  aPos->x -= KiROUND( 10 * gridSize.x );
1405  break;
1406 
1407  case GR_KB_CTRL|WXK_NUMPAD6:
1408  case GR_KB_CTRL|WXK_RIGHT:
1409  aPos->x += KiROUND( 10 * gridSize.x );
1410  break;
1411 
1412  case WXK_NUMPAD8:
1413  case WXK_UP:
1414  aPos->y -= KiROUND( gridSize.y );
1415  break;
1416 
1417  case WXK_NUMPAD2:
1418  case WXK_DOWN:
1419  aPos->y += KiROUND( gridSize.y );
1420  break;
1421 
1422  case WXK_NUMPAD4:
1423  case WXK_LEFT:
1424  aPos->x -= KiROUND( gridSize.x );
1425  break;
1426 
1427  case WXK_NUMPAD6:
1428  case WXK_RIGHT:
1429  aPos->x += KiROUND( gridSize.x );
1430  break;
1431 
1432  default: /* Can't happen since we entered the statement */
1433  break;
1434  }
1435 
1436  m_canvas->MoveCursor( *aPos );
1438  }
1439  break;
1440 
1441  default:
1442  break;
1443  }
1444 
1445  return key_handled;
1446 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
Definition: draw_panel.cpp:367
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
#define GR_KB_CTRL
Definition: common.h:64
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:142
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 225 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

225 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
const wxPoint& PL_EDITOR_FRAME::GetAuxOrigin ( ) const
inlineoverridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 127 of file pl_editor_frame.h.

References dummy().

128  {
129  static wxPoint dummy; // ( 0,0 );
130  return dummy;
131  }
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...
EDA_DRAW_PANEL* EDA_DRAW_FRAME::GetCanvas ( )
inlineinherited

Definition at line 342 of file draw_frame.h.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), AddNewTrace(), Autoroute_One_Track(), SCH_EDIT_FRAME::DeleteAnnotation(), PLEDITOR_PRINTOUT::DrawPage(), SCH_PRINTOUT::DrawPage(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), DrawPageOnClipboard(), SCH_EDIT_FRAME::EditComponent(), getOptimalModulePlacement(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::MirrorSheet(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_EDIT_COMPONENTS_LIBID::onApplyButton(), DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClick(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_LABEL_EDITOR::OnCancelClick(), DIALOG_ERC::OnEraseDrcMarkersClick(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerSelect(), GERBER_LAYER_WIDGET::OnLayerSelect(), PCB_LAYER_WIDGET::OnLayerVisible(), GERBER_LAYER_WIDGET::OnLayerVisible(), SCH_EDIT_FRAME::OnLeftDClick(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GENERALOPTIONS::OnOkClick(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_PAGES_SETTINGS::OnOkClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), DIALOG_DIMENSION_EDITOR::OnOKClick(), GERBER_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), PROPERTIES_FRAME::OnSetDefaultValues(), LIB_EDIT_FRAME::OnShowElectricalType(), EDA_DRAW_FRAME::OnZoom(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_UPDATE_PCB::PerformUpdate(), SCH_FIELD::Place(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), DIALOG_DRC_CONTROL::RedrawDrawPanel(), Refresh(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), PCB_BASE_FRAME::SetNextGrid(), PCB_BASE_FRAME::SetPrevGrid(), DIALOG_ERC::TestErc(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings().

342 { return m_canvas; }
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
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 95 of file pl_editor_config.cpp.

References g_UserUnit, and m_configSettings.

Referenced by GetPageNumberOption(), and SaveSettings().

96 {
97  if( !m_configSettings.empty() )
98  return m_configSettings;
99 
100  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
101  (int*) &g_UserUnit, 0, 0, 1 ) );
102 
103  return m_configSettings;
104 }
PARAM_CFG_ARRAY m_configSettings
Configuration parameter - Integer Class.
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition ( bool  aInvertY = false) const
inherited

Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates.

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

Definition at line 1244 of file draw_frame.cpp.

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

Referenced by Abort_EditEdge(), AbortSymbolTraceOn(), AddMenusForBus(), AddMenusForWire(), PCB_BASE_FRAME::AddPad(), PCB_EDIT_FRAME::AutoPlaceModule(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Self(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), 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(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_EDIT_FRAME::DeleteConnection(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), DrawAndSizingBlockOutlines(), EDA_DRAW_PANEL::DrawCrossHair(), DrawMovePin(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawSegment(), PCB_BASE_EDIT_FRAME::duplicateItem(), LIB_EDIT_FRAME::EndDrawGraphicItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), LIB_EDIT_FRAME::GraphicItemBeginDraw(), SCH_EDIT_FRAME::ImportSheetPin(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), Locate(), Move_Segment(), Move_Texte_Pcb(), moveBitmap(), MoveDimensionText(), MoveFootprint(), moveItem(), MoveItem(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnDragItem(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditValue(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditValue(), LIB_VIEW_FRAME::OnHotKey(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), LIB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), GERBVIEW_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::OnRightClick(), LIB_VIEW_FRAME::OnSetRelativeOffset(), FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset(), FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset(), 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(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), EDA_DRAW_FRAME::RedrawScreen2(), RedrawWhileMovingCursor(), EDA_DRAW_FRAME::RefreshCrossHair(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), resizeSheetWithMouseCursor(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), Show_MoveTexte_Module(), Show_New_Edge_While_Move_Mouse(), Show_Pad_Move(), Show_Zone_Corner_Or_Outline_While_Move_Mouse(), ShowBoundingBoxMicroWaveInductor(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), ShowNewTrackWhenMovingCursor(), ShowTargetShapeWhileMovingMouse(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SymbolDisplayDraw(), UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and GERBVIEW_FRAME::UpdateStatusBar().

1245 {
1246  // subject to change, borrow from old BASE_SCREEN for now.
1247  if( IsGalCanvasActive() )
1248  {
1250 
1251  return wxPoint( cursor.x, cursor.y );
1252  }
1253  else
1254  {
1255  BASE_SCREEN* screen = GetScreen(); // virtual call
1256  return screen->getCrossHairPosition( aInvertY );
1257  }
1258 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
wxPoint getCrossHairPosition(bool aInvertY) const
Function getCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Definition: base_screen.h:107
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:882
wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition ( ) const
inherited

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

Returns
The current cross hair position.

Definition at line 1282 of file draw_frame.cpp.

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

1283 {
1284  BASE_SCREEN* screen = GetScreen(); // virtual call
1285  return screen->getCrossHairScreenPosition();
1286 }
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
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 339 of file pl_editor_frame.cpp.

References BASE_SCREEN::m_PageLayoutDescrFileName.

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

340 {
342 }
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

Function GetCursorPosition returns the current cursor position in logical (drawing) units.

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

Definition at line 1268 of file draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnMouseWheel().

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

Function GetDisplayOptions A way to pass info to draw functions.

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

Reimplemented in PCB_BASE_FRAME.

Definition at line 897 of file draw_frame.h.

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

897 { return NULL; }
virtual COLOR4D EDA_DRAW_FRAME::GetDrawBgColor ( ) const
inlinevirtualinherited
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 404 of file eda_base_frame.cpp.

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

406 {
407  wxFileHistory* fileHistory = aFileHistory;
408 
409  if( !fileHistory )
410  fileHistory = &Kiface().GetFileHistory();
411 
412  int baseId = fileHistory->GetBaseId();
413 
414  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
415 
416  unsigned i = cmdId - baseId;
417 
418  if( i < fileHistory->GetCount() )
419  {
420  wxString fn = fileHistory->GetHistoryFile( i );
421 
422  if( wxFileName::FileExists( fn ) )
423  return fn;
424  else
425  {
426  wxString msg = wxString::Format(
427  _( "File \"%s\" was not found." ),
428  GetChars( fn ) );
429 
430  wxMessageBox( msg );
431 
432  fileHistory->RemoveFileFromHistory( i );
433  }
434  }
435 
436  return wxEmptyString;
437 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
EDA_DRAW_PANEL_GAL* EDA_DRAW_FRAME::GetGalCanvas ( ) const
inlineinherited

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

Returns
Pointer to GAL-based canvas.

Definition at line 882 of file draw_frame.h.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), GERBVIEW_FRAME::applyDisplaySettingsToGAL(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), PCB_TOOL::canvas(), GERBVIEW_FRAME::Clear_DrawLayers(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCB_EDIT_FRAME::Edit_Zone_Params(), MODULE_EDITOR_TOOLS::EnumeratePads(), EVT_TOOL(), EVT_UPDATE_UI(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SELECTION_TOOL::findCallback(), PCB_BASE_FRAME::FocusOnLocation(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDA_DRAW_FRAME::GetCrossHairPosition(), GERBVIEW_FRAME::GetVisibleLayers(), GRID_HELPER::GRID_HELPER(), GERBVIEW_CONTROL::HighlightControl(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerVisible(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), GERBVIEW_FRAME::OnSelectHighlightChoice(), EDA_DRAW_FRAME::OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), TOOL_MANAGER::ProcessEvent(), BOARD_COMMIT::Push(), GRID_HELPER::queryVisible(), PCB_EDITOR_CONTROL::ratsnestTimer(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), GERBER_LAYER_WIDGET::ReFill(), Refresh(), EDA_DRAW_PANEL::Refresh(), ZOOM_TOOL::selectRegion(), GERBVIEW_FRAME::SetActiveLayer(), GRID_HELPER::SetAuxAxes(), PCB_BASE_EDIT_FRAME::SetBoard(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), EDA_DRAW_PANEL::SetEnableAutoPan(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), GERBVIEW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetNoToolSelected(), EDA_DRAW_FRAME::SetToolID(), FOOTPRINT_EDIT_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), GERBVIEW_FRAME::SetVisibleLayers(), EDA_DRAW_FRAME::SwitchCanvas(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::updateView(), PCB_BASE_EDIT_FRAME::UseGalCanvas(), FOOTPRINT_EDIT_FRAME::UseGalCanvas(), PCB_BASE_FRAME::UseGalCanvas(), GERBVIEW_FRAME::UseGalCanvas(), EDA_DRAW_FRAME::UseGalCanvas(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), COMMON_TOOLS::ZoomInOut(), and COMMON_TOOLS::ZoomPreset().

882 { 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:68
KIGFX::GAL_DISPLAY_OPTIONS& EDA_DRAW_FRAME::GetGalDisplayOptions ( )
inlineinherited
virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited

Function GetGridColor() , virtual.

Returns
the color of the grid

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 505 of file draw_frame.h.

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

506  {
507  return m_gridColor;
508  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:83
const wxPoint& PL_EDITOR_FRAME::GetGridOrigin ( ) const
inlineoverridevirtual

Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid.

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

Implements EDA_DRAW_FRAME.

Definition at line 134 of file pl_editor_frame.h.

References m_grid_origin.

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

Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled.

Otherwise, the original positions is returned.

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

Definition at line 589 of file 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().

590 {
591  wxPoint pos = aPosition;
592 
593  if( m_currentScreen != NULL && m_snapToGrid )
594  pos = GetNearestGridPosition( aPosition );
595 
596  return pos;
597 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:63
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:65
EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inlineinherited

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

Definition at line 388 of file draw_frame.h.

Referenced by PCBNEW_CONTROL::ShowHelp().

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

>

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

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

Implements EDA_DRAW_FRAME.

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

References GetDescriptorFromCommand().

Referenced by GetPageNumberOption().

139 {
141 
142  if( HK_Descr == NULL )
143  HK_Descr = GetDescriptorFromCommand( aCommand, s_PlEditor_Hotkey_List );
144 
145  return HK_Descr;
146 }
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:57
EDA_HOTKEY * GetDescriptorFromCommand(int aCommand, EDA_HOTKEY **aList)
Function GetDescriptorFromCommand Returns a EDA_HOTKEY* pointer from a hot key identifier.
virtual int EDA_BASE_FRAME::GetIconScale ( )
inlinevirtualinherited

Function GetIconScale.

Return the desired scaling for toolbar/menubar icons in fourths (e.g. 4 is unity). A negative number indicates autoscale based on font size.

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

Definition at line 459 of file eda_base_frame.h.

Referenced by get_scale_factor(), and FOOTPRINT_EDIT_FRAME::GetIconScale().

459 { return -1; }
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 531 of file eda_base_frame.cpp.

References ShowAboutDialog().

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

532 {
533  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
534  ShowAboutDialog( this );
535 }
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 518 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

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

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

Definition at line 440 of file eda_base_frame.cpp.

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

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

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

Redo the last edition:

  • 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...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
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
Function GetScreen returns 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:93
ITEM_PICKER PopItem()
Function PopItem.
void RebuildDesignTree()
Function RebuildDesignTree Re creates the design graphic tree list items, and ensures each item has a...
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 edition:

  • 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 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
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
Function GetScreen returns 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:93
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...
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 436 of file draw_frame.h.

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

Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.

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

Definition at line 1275 of file draw_frame.cpp.

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

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

1276 {
1277  BASE_SCREEN* screen = GetScreen(); // virtual call
1278  return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
1279 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
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
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
const PL_EDITOR_LAYOUT& PL_EDITOR_FRAME::GetPageLayout ( ) const
inline

Definition at line 177 of file pl_editor_frame.h.

References m_pageLayout.

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

177 { 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 an other 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 187 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().

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

Implements EDA_DRAW_FRAME.

Definition at line 360 of file pl_editor_frame.cpp.

References PL_EDITOR_LAYOUT::GetPageSettings(), and m_pageLayout.

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

361 {
362  return m_pageLayout.GetPageSettings();
363 }
PL_EDITOR_LAYOUT m_pageLayout
const PAGE_INFO & GetPageSettings() const
const wxSize PL_EDITOR_FRAME::GetPageSizeIU ( ) const
overridevirtual

Function GetPageSizeIU 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 366 of file pl_editor_frame.cpp.

References PL_EDITOR_LAYOUT::GetPageSettings(), and m_pageLayout.

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

Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.

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

Reimplemented from EDA_DRAW_FRAME.

Definition at line 122 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(), SavePageLayoutDescrFile(), SetPageSettings(), and UpdateStatusBar().

123  {
125  }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
wxString EDA_DRAW_FRAME::GetScreenDesc ( ) const
virtualinherited

Reimplemented in SCH_EDIT_FRAME.

Definition at line 119 of file worksheet.cpp.

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

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

Definition at line 1303 of file 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(), EDA_DRAW_FRAME::OnZoom(), EDA_DRAW_FRAME::SetPresetZoom(), and EDA_DRAW_FRAME::Zoom_Automatique().

1304 {
1305  BASE_SCREEN* screen = GetScreen(); // virtual call
1306  return screen->getScrollCenterPosition();
1307 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
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 665 of file pl_editor_frame.cpp.

References DESIGN_TREE_FRAME::GetPageLayoutSelectedItem(), and m_treePagelayout.

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

666 {
668  return item;
669 }
WORKSHEET_DATAITEM * GetPageLayoutSelectedItem() const
DESIGN_TREE_FRAME * m_treePagelayout
bool EDA_DRAW_FRAME::GetShowBorderAndTitleBlock ( ) const
inlineinherited

Definition at line 336 of file draw_frame.h.

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

336 { return m_showBorderAndTitleBlock; }
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:113
const TITLE_BLOCK & PL_EDITOR_FRAME::GetTitleBlock ( ) const
overridevirtual

Implements EDA_DRAW_FRAME.

Definition at line 375 of file pl_editor_frame.cpp.

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

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

376 {
377  return GetPageLayout().GetTitleBlock();
378 }
const PL_EDITOR_LAYOUT & GetPageLayout() const
const TITLE_BLOCK & GetTitleBlock() const
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 476 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(), 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(), PICKER_TOOL::Init(), PAD_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), EDIT_TOOL::Init(), GERBVIEW_SELECTION_TOOL::Main(), PCB_EDIT_FRAME::MuWaveCommand(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), FOOTPRINT_EDIT_FRAME::OnRightClick(), OnRightClick(), GERBVIEW_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotateItem(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), PCB_EDIT_FRAME::OnSelectTool(), LIB_EDIT_FRAME::OnUpdateEditingPart(), PCB_EDIT_FRAME::OnUpdateMuWaveToolbar(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectTool(), 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().

476 { return m_toolId; }
bool EDA_DRAW_FRAME::GetToolToggled ( int  aToolId)
inlineinherited

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

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

Definition at line 445 of file draw_frame.h.

Referenced by ZOOM_TOOL::Main().

446  {
447  return ( m_mainToolBar->GetToolToggled( aToolId ) ||
448  m_optionsToolBar->GetToolToggled( aToolId ) ||
449  m_drawToolBar->GetToolToggled( aToolId ) );
450  }
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:129
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:126
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
double EDA_DRAW_FRAME::GetZoom ( )
inherited

Function GetZoom.

Returns
The current zoom level.

Definition at line 494 of file 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(), and PCB_BASE_FRAME::updateZoomSelectBox().

495 {
496  return GetScreen()->GetZoom();
497 }
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
double EDA_DRAW_FRAME::GetZoomLevelCoeff ( ) const
inlineinherited

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

Definition at line 425 of file draw_frame.h.

Referenced by ZOOM_MENU::ZOOM_MENU().

425 { return m_zoomLevelCoeff; }
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
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 769 of file pl_editor_frame.cpp.

References EDA_DRAW_FRAME::GetZoomLevelIndicator().

770 {
772 }
virtual const wxString GetZoomLevelIndicator() const
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
Definition: draw_frame.cpp:694
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.

Definition at line 840 of file draw_frame.cpp.

References BLOCK_COPY, BLOCK_DELETE, BLOCK_DRAG, BLOCK_DRAG_ITEM, BLOCK_DUPLICATE, BLOCK_DUPLICATE_AND_INCREMENT, BLOCK_FLIP, BLOCK_IDLE, BLOCK_MIRROR_X, BLOCK_MIRROR_Y, BLOCK_MOVE, BLOCK_PASTE, BLOCK_PRESELECT_MOVE, BLOCK_ROTATE, BLOCK_ZOOM, 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(), SCH_EDIT_FRAME::OnDragItem(), EDA_DRAW_PANEL::OnMouseEvent(), LIB_EDIT_FRAME::Process_Special_Functions(), and SCH_EDIT_FRAME::Process_Special_Functions().

842 {
844 
845  if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
846  return false;
847 
848  if( aExplicitCommand == 0 )
849  block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
850  else
851  block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
852 
853  if( block->GetCommand() == 0 )
854  return false;
855 
856  switch( block->GetCommand() )
857  {
858  case BLOCK_IDLE:
859  break;
860 
861  case BLOCK_MOVE: // Move
862  case BLOCK_DRAG: // Drag (block defined)
863  case BLOCK_DRAG_ITEM: // Drag from a drag item command
864  case BLOCK_DUPLICATE: // Duplicate
865  case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references
866  case BLOCK_DELETE: // Delete
867  case BLOCK_COPY: // Copy
868  case BLOCK_ROTATE: // Rotate 90 deg
869  case BLOCK_FLIP: // Flip
870  case BLOCK_ZOOM: // Window Zoom
871  case BLOCK_MIRROR_X:
872  case BLOCK_MIRROR_Y: // mirror
873  case BLOCK_PRESELECT_MOVE: // Move with preselection list
874  block->InitData( m_canvas, aPosition );
875  break;
876 
877  case BLOCK_PASTE:
878  block->InitData( m_canvas, aPosition );
879  block->SetLastCursorPosition( wxPoint( 0, 0 ) );
881 
882  if( block->GetCount() == 0 ) // No data to paste
883  {
884  DisplayError( this, wxT( "No block to paste" ), 20 );
887  block->SetState( STATE_NO_BLOCK );
888  block->SetMessageBlock( this );
889  return true;
890  }
891 
892  if( !m_canvas->IsMouseCaptured() )
893  {
894  block->ClearItemsList();
895  DisplayError( this,
896  wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
897  block->SetState( STATE_NO_BLOCK );
898  block->SetMessageBlock( this );
899  return true;
900  }
901 
902  block->SetState( STATE_BLOCK_MOVE );
903  m_canvas->CallMouseCapture( aDC, aPosition, false );
904  break;
905 
906  default:
907  {
908  wxString msg;
909  msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
910  block->GetCommand();
911  DisplayError( this, msg );
912  }
913  break;
914  }
915 
916  block->SetMessageBlock( this );
917  return true;
918 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
virtual int BlockCommand(EDA_KEY aKey)
Function BlockCommand Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the...
Definition: draw_frame.cpp:659
void SetMessageBlock(EDA_DRAW_FRAME *frame)
Function SetMessageBlock Displays the type of block command in the status bar of the window...
BLOCK_COMMAND_T
virtual void InitBlockPasteInfos()
Definition: draw_frame.cpp:665
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
void SetState(BLOCK_STATE_T aState)
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
bool IsMouseCaptured() const
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
Definition: solve.cpp:178
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
BLOCK_STATE_T GetState() const
BLOCK_COMMAND_T GetCommand() const
void InitData(EDA_DRAW_PANEL *Panel, const wxPoint &startpos)
Function InitData sets the initial values of a BLOCK_SELECTOR, before starting a block command...
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:74
unsigned GetCount() const
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.
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)
bool IsMouseCaptured() const
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
PL_EDITOR_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
int GetToolId() const
Definition: draw_frame.h:476
void Window_Zoom(EDA_RECT &Rect)
Definition: zoom.cpp:124
BLOCK_COMMAND_T GetCommand() const
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.
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)
bool IsMouseCaptured() const
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
PL_EDITOR_SCREEN * GetScreen() const override
Function GetScreen returns 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:93
void DisplayToolMsg(const wxString &msg)
Definition: draw_frame.cpp:511
int GetToolId() const
Definition: draw_frame.h:476
void SetModify()
Definition: base_screen.h:324
wxString EDA_BASE_FRAME::help_name ( )
protectedvirtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 380 of file eda_base_frame.cpp.

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

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

381 {
382  return Kiface().GetHelpFileName();
383 }
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
VTBL_ENTRY bool KIWAY_PLAYER::ImportFile ( const wxString &  aFileName,
int  aFileType 
)
inlineinherited

Function ImportFile load the given filename but sets the path to the current project path.

Parameters
fullfilepath of file to be imported.
aFileTypeenum value for filetype

Definition at line 188 of file kiway_player.h.

References VTBL_ENTRY.

189  {
190  // overload me for your wxFrame type.
191 
192  return false;
193  }
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 728 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, and EDA_FILE_SELECTOR().

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

730 {
731  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
732  wxString mask = wxT( "*." ) + ext;
733 
734 
735  wxString path = GetMruPath();
736  wxFileName fn( aDefaultShortname );
737  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
738 
739  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
740  path,
741  fn.GetFullPath(),
742  ext,
743  mask,
744  this,
745  wxFD_OPEN,
746  true );
747 
748  if( filename.IsEmpty() )
749  return;
750 
751  ReadHotkeyConfigFile( filename, aDescList );
752  WriteHotkeyConfig( aDescList );
753  SetMruPath( wxFileName( filename ).GetPath() );
754 }
void SetMruPath(const wxString &aPath)
int ReadHotkeyConfigFile(const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current ho...
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 665 of file 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 EDA_DRAW_FRAME::HandleBlockBegin().

666 {
669 }
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
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 227 of file pagelayout_editor/files.cpp.

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

Referenced by Files_io().

228 {
229  if( wxFileExists( aFullFileName ) )
230  {
231  const bool append = true;
233  WORKSHEET_LAYOUT::GetTheInstance().SetPageLayout( aFullFileName, append );
234  return true;
235  }
236 
237  return false;
238 }
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 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 181 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().

181 { 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 1449 of file 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().

1450 {
1451  const BASE_SCREEN* screen = const_cast< BASE_SCREEN* >( GetScreen() );
1452 
1453  if( !screen )
1454  return false;
1455 
1456  return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
1457  || ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
1458 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:284
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:352
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 158 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().

159 {
160  return !m_modal_loop;
161 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:260
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 874 of file draw_frame.h.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), GERBER_LAYER_WIDGET::AreArbitraryColorsAllowed(), PCB_LAYER_WIDGET::AreArbitraryColorsAllowed(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), PCB_EDIT_FRAME::Edit_Zone_Params(), EVT_TOOL(), EVT_UPDATE_UI(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_BASE_FRAME::FocusOnLocation(), EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_FRAME::GetZoomLevelIndicator(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), FOOTPRINT_EDIT_FRAME::Import_Module(), GERBVIEW_FRAME::IsLayerVisible(), DIALOG_PAD_PROPERTIES::OnCancel(), DIALOG_PAD_PROPERTIES::onChangePadMode(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_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(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_DRC_CONTROL::OnPopupMenu(), GERBER_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), EDA_DRAW_FRAME::OnSelectGrid(), GERBVIEW_FRAME::OnSelectHighlightChoice(), EDA_DRAW_FRAME::OnSelectZoom(), EDA_DRAW_FRAME::OnToggleGridState(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateOptToolbar(), DIALOG_PAD_PROPERTIES::redraw(), EDA_DRAW_FRAME::RedrawScreen(), EDA_DRAW_FRAME::RedrawScreen2(), Refresh(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), GERBVIEW_FRAME::SetActiveLayer(), GERBVIEW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetNoToolSelected(), EDA_DRAW_FRAME::SetToolID(), DIALOG_SET_GRID::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_VIEWER_FRAME::updateView(), EDA_DRAW_FRAME::WriteHotkeyConfig(), and EDA_DRAW_FRAME::Zoom_Automatique().

874 { return m_galCanvasActive; }
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:66
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 538 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().

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

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

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), and KIWAY_HOLDER::SetKiway().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), FOOTPRINT_EDIT_FRAME::GetIconScale(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), 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(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), 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:85
void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 179 of file kiway_player.cpp.

References KIWAY_PLAYER::KiwayMailIn().

180 {
181  // logging support
182  KiwayMailIn( aEvent ); // call the virtual, override in derived.
183 }
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 SCH_EDIT_FRAME, PCB_EDIT_FRAME, and CVPCB_MAINFRAME.

Definition at line 73 of file kiway_player.cpp.

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

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

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

Definition at line 186 of file kiway_player.cpp.

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

187 {
188  int id = event.GetId();
189 
190  // tell all the KIWAY_PLAYERs about the language change.
191  Kiway().SetLanguage( id );
192 }
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
wxString EDA_DRAW_FRAME::LengthDoubleToString ( double  aValue,
bool  aConvertToMils = false 
) const
inherited

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

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

Definition at line 834 of file draw_frame.cpp.

References LengthDoubleToString().

Referenced by ShowNewTrackWhenMovingCursor().

835 {
836  return ::LengthDoubleToString( aValue, aConvertToMils );
837 }
wxString LengthDoubleToString(double aValue, bool aConvertToMils)
Function LengthDoubleToString is a helper to convert the double length aValue to a string in inches...
Definition: base_units.cpp:123
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting ( ) const
protectedinherited

Returns the canvas type stored in the application settings.

Definition at line 1205 of file 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 GERBVIEW_FRAME::GERBVIEW_FRAME().

1206 {
1208  wxConfigBase* cfg = Kiface().KifaceSettings();
1209 
1210  if( cfg )
1211  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
1213 
1214  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1215  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1216  {
1217  assert( false );
1218  canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
1219  }
1220 
1221  return canvasType;
1222 }
Sentinel, do not use as a parameter.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
static const wxChar CANVAS_TYPE_KEY[]
Key in KifaceSettings to store the canvas type.
Definition: draw_frame.h:195
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 212 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().

213 {
214  if( wxFileExists( aFullFileName ) )
215  {
217  SetCurrFileName( aFullFileName );
218  UpdateFileHistory( aFullFileName );
219  GetScreen()->ClrModify();
220  return true;
221  }
222 
223  return false;
224 }
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
Function GetScreen returns 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 298 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().

299 {
301 
302  aCfg->Read( designTreeWidthKey, &m_designTreeWidth, 100);
305  bool tmp;
306  aCfg->Read( blackBgColorKey, &tmp, false );
307  SetDrawBgColor( tmp ? BLACK : WHITE );
308 }
static const wxChar cornerOriginChoiceKey[]
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:334
static const wxChar blackBgColorKey[]
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Definition: draw_frame.cpp:719
static const wxChar designTreeWidthKey[]
static const wxChar propertiesFrameWidthKey[]
Definition: colors.h:49
Definition: colors.h:45
WORKSHEET_DATAITEM * PL_EDITOR_FRAME::Locate ( 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 672 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(), 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().

673 {
674  const PAGE_INFO& pageInfo = GetPageSettings();
675  TITLE_BLOCK t_block = GetTitleBlock();
676  COLOR4D color = COLOR4D( RED ); // Needed, not used
678 
679  screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
680 
681  WS_DRAW_ITEM_LIST drawList;
682  drawList.SetPenSize( 0 );
683  drawList.SetMilsToIUfactor( IU_PER_MILS );
684  drawList.SetSheetNumber( screen->m_ScreenNumber );
685  drawList.SetSheetCount( screen->m_NumberOfScreens );
686  drawList.SetFileName( GetCurrFileName() );
687  // GetScreenDesc() returns a temporary string. Store it to avoid issues.
688  wxString descr = GetScreenDesc();
689  drawList.SetSheetName( descr );
690 
691  drawList.BuildWorkSheetGraphicList( pageInfo, t_block, color, color );
692 
693  // locate items.
694  // We do not use here the COLLECTOR classes in use in pcbnew and eeschema
695  // because the locate requirements are very basic.
696  std::vector <WS_DRAW_ITEM_BASE*> list;
697  drawList.Locate( list, aPosition );
698 
699  if( list.size() == 0 )
700  return NULL;
701 
702  WS_DRAW_ITEM_BASE* drawitem = list[0];
703 
704  // Choose item in list if more than 1 item
705  if( list.size() > 1 )
706  {
707  wxArrayString choices;
708  wxString text;
709  wxPoint cursPos = GetCrossHairPosition();
710 
711  for( unsigned ii = 0; ii < list.size(); ++ii )
712  {
713  drawitem = list[ii];
714  text = drawitem->GetParent()->m_Name;
715 
716  if( (drawitem->m_Flags & (LOCATE_STARTPOINT|LOCATE_ENDPOINT))
718  text << wxT( " " ) << _( "(start or end point)" );
719  else
720  {
721  if( (drawitem->m_Flags & LOCATE_STARTPOINT) )
722  text << wxT( " " ) << _( "(start point)" );
723 
724  if( (drawitem->m_Flags & LOCATE_ENDPOINT) )
725  text << wxT( " " ) << _( "(end point)" );
726  }
727 
728  if( ! drawitem->GetParent()->m_Info.IsEmpty() )
729  text << wxT( " \"" ) << drawitem->GetParent()->m_Info << wxT( "\"" );
730 
731  choices.Add( text );
732  }
733 
734  int selection = wxGetSingleChoiceIndex ( wxEmptyString,
735  _( "Selection Clarification" ),
736  choices, this );
737  if( selection < 0 )
738  return NULL;
739 
740  SetCrossHairPosition( cursPos );
742  drawitem = list[selection];
743  }
744 
745  WORKSHEET_DATAITEM* item = drawitem->GetParent();
747 
748  if( (drawitem->m_Flags & LOCATE_STARTPOINT) )
749  item->SetFlags( LOCATE_STARTPOINT );
750 
751  if( (drawitem->m_Flags & LOCATE_ENDPOINT) )
752  item->SetFlags( LOCATE_ENDPOINT );
753 
754  return item;
755 }
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...
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:361
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:39
#define LOCATE_ENDPOINT
void SetFlags(int aMask)
void Locate(std::vector< WS_DRAW_ITEM_BASE * > &aList, const wxPoint &aPosition)
Locate graphic items in m_graphicList at location aPosition.
virtual wxString GetScreenDesc() const
Definition: worksheet.cpp:119
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:49
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
Function GetScreen returns 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:93
bool GetPageNumberOption() const
Page layout editor can show the title block using a page number 1 or an other number.
void SetSheetNumber(int aSheetNumber)
Function SetSheetNumber Set the value of the sheet number, for basic inscriptions.
int m_NumberOfScreens
Definition: base_screen.h:217
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
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

Function LockFile marks a schematic file as being in use.

Use ReleaseFile() to undo this.

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

Definition at line 249 of file draw_frame.cpp.

References EDA_DRAW_FRAME::m_file_checker.

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

250 {
251  m_file_checker = ::LockFile( aFileName );
252 
253  return bool( m_file_checker );
254 }
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:75
bool LockFile(const wxString &aFileName)
Function LockFile marks a schematic file as being in use.
Definition: draw_frame.cpp:249
void PL_EDITOR_FRAME::MoveItem ( WORKSHEET_DATAITEM aItem)

Initialize a move item command.

Parameters
aItemis the item to move

Definition at line 419 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().

420 {
421  wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
422  initialPosition = aItem->GetStartPos();
423  initialPositionUi = aItem->GetStartPosUi();
425 
426  if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
427  {
428  initialPosition = aItem->GetEndPos();
429  initialPositionUi = aItem->GetEndPosUi();
430  }
431 
432  if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
433  {
436 
438  {
440  m_canvas->Refresh();
441  }
442  else
443  {
445  }
446  }
447 
449  GetScreen()->SetCurItem( aItem );
450 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
const DPOINT GetStartPos(int ii=0) const
void SetCurItem(WORKSHEET_DATAITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
#define LOCATE_STARTPOINT
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:361
const wxPoint GetStartPosUi(int ii=0) const
#define LOCATE_ENDPOINT
bool IsPointOnDisplay(const wxPoint &aPosition)
Function IsPointOnDisplay.
Definition: draw_panel.cpp:301
DPOINT initialPosition
wxPoint initialPositionUi
wxPoint initialCursorPosition
const wxPoint GetEndPosUi(int ii=0) const
PL_EDITOR_SCREEN * GetScreen() const override
Function GetScreen returns 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:93
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
static void moveItem(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
static void abortMoveItem(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
void EDA_DRAW_FRAME::OnActivate ( wxActivateEvent &  event)
virtualinherited

Function OnActivate (virtual) is called when activating the frame.

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

Reimplemented in LIB_EDIT_FRAME, FOOTPRINT_WIZARD_FRAME, LIB_VIEW_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 271 of file draw_frame.cpp.

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

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

272 {
273  if( m_canvas )
274  m_canvas->SetCanStartBlock( -1 );
275 
276  event.Skip(); // required under wxMAC
277 }
void SetCanStartBlock(int aStartBlock)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Function onAutoSaveTimer handles the auto save timer event.

Definition at line 228 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().

229 {
230  if( !doAutoSave() )
231  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
232 }
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 KIWAY_PLAYER::OnChangeIconsOptions ( wxCommandEvent &  event)
overrideprotectedvirtualinherited

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

Reimplemented from EDA_BASE_FRAME.

Definition at line 195 of file kiway_player.cpp.

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

196 {
199 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
virtual void OnChangeIconsOptions(wxCommandEvent &event)
Function OnChangeIconsOptions Selects the current icons options in menus (or toolbars) in Kicad (the ...
VTBL_ENTRY void ShowChangedIcons()
Function ShowChangedIcons Calls ShowChangedIcons() on all KIWAY_PLAYERs.
Definition: kiway.cpp:431
void EDA_DRAW_FRAME::OnCharHook ( wxKeyEvent &  event)
virtualinherited

this function 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 235 of file draw_frame.cpp.

236 {
237  // Key events can be filtered here.
238  // Currently no filtering is made.
239  event.Skip();
240 }
void PL_EDITOR_FRAME::OnCloseWindow ( wxCloseEvent &  Event)

Definition at line 217 of file pl_editor_frame.cpp.

References KIWAY_PLAYER::Destroy(), DisplayExitDialog(), GetChars(), GetCurrFileName(), GetScreen(), Kiface(), m_configSettings, m_propertiesPagelayout, PageLayoutDescrFileWildcard(), SavePageLayoutDescrFile(), and wxConfigSaveSetups().

218 {
219  if( GetScreen()->IsModify() )
220  {
221  wxString msg;
222  wxString filename = GetCurrFileName();
223 
224  if( filename.IsEmpty() )
225  msg = _( "Save changes in a new file before closing?" );
226  else
227  msg.Printf( _( "Save the changes in\n\"%s\"\nbefore closing?" ),
228  GetChars( filename ) );
229 
230  int ii = DisplayExitDialog( this, msg );
231 
232  switch( ii )
233  {
234  case wxID_CANCEL:
235  Event.Veto();
236  return;
237 
238  case wxID_NO:
239  break;
240 
241  case wxID_OK:
242  case wxID_YES:
243  {
244  if( filename.IsEmpty() )
245  {
246  wxFileDialog openFileDialog( this, _( "Save As" ), wxEmptyString, wxEmptyString,
247  PageLayoutDescrFileWildcard(), wxFD_SAVE );
248 
249  if(openFileDialog.ShowModal() == wxID_CANCEL )
250  return;
251 
252  filename = openFileDialog.GetPath();
253  }
254 
255  if( !SavePageLayoutDescrFile( filename ) )
256  {
257  msg.Printf( _( "Unable to create \"%s\"" ), GetChars( filename ) );
258  wxMessageBox( msg );
259  }
260  }
261  break;
262  }
263  }
264 
265  // do not show the window because we do not want any paint event
266  Show( false );
267 
268  // was: Pgm().SaveCurrentSetupValues( m_configSettings );
269  wxConfigSaveSetups( Kiface().KifaceSettings(), m_configSettings );
270 
271  // On Linux, m_propertiesPagelayout must be destroyed
272  // before deleting the main frame to avoid a crash when closing
273  m_propertiesPagelayout->Destroy();
274  Destroy();
275 }
wxString PageLayoutDescrFileWildcard()
PARAM_CFG_ARRAY m_configSettings
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
PL_EDITOR_SCREEN * GetScreen() const override
Function GetScreen returns 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...
int DisplayExitDialog(wxWindow *parent, const wxString &aMessage)
Function DisplayExitDialog displays a dialog with 3 buttons: Save and Exit Cancel Exit without save...
Definition: confirm.cpp:62
void wxConfigSaveSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigSaveSetups writes aList of PARAM_CFG_ARRAY elements to save configuration values to ...
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
PROPERTIES_FRAME * m_propertiesPagelayout
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
const wxString & GetCurrFileName() const
void EDA_DRAW_FRAME::OnEraseBackground ( wxEraseEvent &  SizeEvent)
inherited
void PL_EDITOR_FRAME::OnFileHistory ( wxCommandEvent &  event)

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

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

Referenced by GetPageNumberOption().

45 {
46  wxString filename;
47 
48  filename = GetFileFromHistory( event.GetId(), _( "Page Layout Description File" ) );
49 
50  if( filename != wxEmptyString )
51  {
52  if( GetScreen()->IsModify() && !IsOK( this,
53  _( "The current page layout has been modified.\n"
54  "Do you wish to discard the changes?" ) ) )
55  return;
56 
58  ::wxSetWorkingDirectory( ::wxPathOnly( filename ) );
59 
60  if( LoadPageLayoutDescrFile( filename ) )
61  {
62  wxString msg;
63  msg.Printf( _( "File \"%s\" loaded"), GetChars( filename ) );
64  SetStatusText( msg );
65  }
66 
68  }
69 }
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
Function GetScreen returns 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:93
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 IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:122
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 149 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().

151 {
152  bool busy = GetScreen()->GetCurItem() != NULL;
153  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
154  cmd.SetEventObject( this );
155 
156  /* Convert lower to upper case (the usual toupper function has problem with non ascii
157  * codes like function keys */
158  if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
159  aHotkeyCode += 'A' - 'a';
160 
161  EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_PlEditor_Hotkey_List );
162 
163  if( HK_Descr == NULL )
164  HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_Common_Hotkey_List );
165 
166  if( HK_Descr == NULL )
167  return false;
168 
169  WORKSHEET_DATAITEM* item;
170 
171  switch( HK_Descr->m_Idcommand )
172  {
173  case HK_NOT_FOUND:
174  return false;
175 
176  case HK_LEFT_CLICK:
177  OnLeftClick( aDC, aPosition );
178  break;
179 
180  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
181  OnLeftClick( aDC, aPosition );