KiCad PCB EDA Suite
FOOTPRINT_EDIT_FRAME Class Reference

#include <footprint_edit_frame.h>

Inheritance diagram for FOOTPRINT_EDIT_FRAME:
PCB_BASE_EDIT_FRAME PCB_BASE_FRAME EDA_DRAW_FRAME KIWAY_PLAYER EDA_BASE_FRAME TOOLS_HOLDER KIWAY_HOLDER UNITS_PROVIDER

Public Types

enum  UNDO_REDO_LIST { UNDO_LIST , REDO_LIST }
 Specifies whether we are interacting with the undo or redo stacks. More...
 
enum  HOLDER_TYPE { DIALOG , FRAME , PANEL }
 

Public Member Functions

 ~FOOTPRINT_EDIT_FRAME ()
 
BOARD_ITEM_CONTAINERGetModel () const override
 
SELECTIONGetCurrentSelection () override
 Get the current selection from the canvas area. More...
 
bool IsContentModified () const override
 Get if any footprints or libraries have been modified but not saved. More...
 
bool IsCurrentFPFromBoard () const
 
bool CanCloseFPFromBoard (bool doClose)
 
FOOTPRINT_EDITOR_SETTINGSGetSettings ()
 
EDA_ANGLE GetRotationAngle () const override
 Return the angle used for rotate operations. More...
 
APP_SETTINGS_BASEconfig () const override
 Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
BOARD_DESIGN_SETTINGSGetDesignSettings () const override
 Returns the BOARD_DESIGN_SETTINGS for the open project. More...
 
const PCB_PLOT_PARAMSGetPlotSettings () const override
 Return the PCB_PLOT_PARAMS for the BOARD owned by this frame. More...
 
void SetPlotSettings (const PCB_PLOT_PARAMS &aSettings) override
 
MAGNETIC_SETTINGSGetMagneticItemsSettings () override
 
void LoadSettings (APP_SETTINGS_BASE *aCfg) override
 Load common frame parameters from a configuration file. More...
 
void SaveSettings (APP_SETTINGS_BASE *aCfg) override
 Save common frame parameters to a configuration data file. More...
 
COLOR_SETTINGSGetColorSettings (bool aForceRefresh=false) const override
 Helper to retrieve the current color settings. More...
 
const BOX2I GetDocumentExtents (bool aIncludeAllVisible=true) const override
 Returns bbox of document with option to not include some items. More...
 
bool canCloseWindow (wxCloseEvent &Event) override
 
void doCloseWindow () override
 
void CloseFootprintEditor (wxCommandEvent &Event)
 
void OnExitKiCad (wxCommandEvent &aEvent)
 
void SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
 Switch the currently used canvas (Cairo / OpenGL). More...
 
void UpdateUserInterface ()
 Update the layer manager and other widgets from the board setup (layer and items visibility, colors ...). More...
 
void UpdateMsgPanel () override
 Redraw the message panel. More...
 
void HardRedraw () override
 Refresh the library tree and redraw the window. More...
 
void ReCreateHToolbar () override
 Create the main horizontal toolbar for the footprint editor. More...
 
void ReCreateVToolbar () override
 
void ReCreateOptToolbar () override
 
void UpdateToolbarControlSizes () override
 Update the sizes of any controls in the toolbars of the frame. More...
 
void ReCreateLayerBox (bool aForceResizeToolbar=true)
 Re create the layer Box by clearing the old list, and building a new one from the new layers names and layer colors. More...
 
void OnUpdateLayerSelectBox (wxUpdateUIEvent &aEvent)
 
void SelectLayer (wxCommandEvent &event)
 
void setupTools ()
 
void OnSaveFootprintAsPng (wxCommandEvent &event)
 
bool IsSearchTreeShown () const
 
void ToggleSearchTree ()
 
void ToggleLayersManager ()
 
bool SaveLibraryAs (const wxString &aLibraryPath)
 Save a library to a new name and/or library type. More...
 
void OnUpdateLoadFootprintFromBoard (wxUpdateUIEvent &aEvent)
 
void OnUpdateSaveFootprintToBoard (wxUpdateUIEvent &aEvent)
 Install the corresponding dialog editor for the given item. More...
 
void OnEditItemRequest (BOARD_ITEM *aItem) override
 Install the corresponding dialog editor for the given item. More...
 
void OnLoadFootprintFromBoard (wxCommandEvent &event)
 Called from the main toolbar to load a footprint from board mainly to edit it. More...
 
void OnSaveFootprintToBoard (wxCommandEvent &event)
 
void LoadFootprintFromLibrary (LIB_ID aFPID)
 
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > & GetLibTreeAdapter ()
 Return the adapter object that provides the stored data. More...
 
bool SaveFootprint (FOOTPRINT *aFootprint)
 Save in an existing library a given footprint. More...
 
bool DuplicateFootprint (FOOTPRINT *aFootprint)
 
bool SaveFootprintAs (FOOTPRINT *aFootprint)
 
bool SaveFootprintToBoard (bool aAddNew)
 
bool SaveFootprintInLibrary (FOOTPRINT *aFootprint, const wxString &aLibraryName)
 
bool RevertFootprint ()
 
void OnModify () override
 Must be called after a footprint change in order to set the "modify" flag of the current screen and prepare, if needed the refresh of the 3D frame showing the footprint. More...
 
bool Clear_Pcb (bool aQuery)
 Delete all and reinitialize the current board. More...
 
LIB_ID GetTreeFPID () const
 Return the LIB_ID of the part or library selected in the footprint tree. More...
 
LIB_TREE_NODEGetCurrentTreeNode () const
 
LIB_ID GetLoadedFPID () const
 Return the LIB_ID of the part being edited. More...
 
LIB_ID GetTargetFPID () const
 Return the LIB_ID of the part selected in the footprint tree, or the loaded part if there is no selection in the tree. More...
 
void ClearModify ()
 
void ExportFootprint (FOOTPRINT *aFootprint)
 Create a file containing only one footprint. More...
 
FOOTPRINTImportFootprint (const wxString &aName=wxT(""))
 Read a file containing only one footprint. More...
 
bool LoadFootprintFromBoard (FOOTPRINT *aFootprint)
 Load a footprint from the main board into the Footprint Editor. More...
 
FOOTPRINTSelectFootprintFromBoard (BOARD *aPcb)
 Display the list of footprints currently existing on the BOARD. More...
 
bool DeleteFootprintFromLibrary (const LIB_ID &aFPID, bool aConfirm)
 Delete the given footprint from its library. More...
 
COLOR4D GetGridColor () override
 
void SetActiveLayer (PCB_LAYER_ID aLayer) override
 
void OnDisplayOptionsChanged () override
 
void ActivateGalCanvas () override
 Use to start up the GAL drawing canvas. More...
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl=0) override
 Load a KiCad board (.kicad_pcb) from aFileName. More...
 
void AddFootprintToBoard (FOOTPRINT *aFootprint) override
 Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board, NOT to the user's PCB. More...
 
void ShowChangedLanguage () override
 Update visible items after a language change. More...
 
void CommonSettingsChanged (bool aEnvVarsChanged, bool aTextVarsChanged) override
 Called after the preferences dialog is run. More...
 
void SyncLibraryTree (bool aProgress)
 Synchronize the footprint library tree to the current state of the footprint library table. More...
 
void RegenerateLibraryTree ()
 Filter, sort, and redisplay the library tree. More...
 
void RefreshLibraryTree ()
 Redisplay the library tree. More...
 
void UpdateLibraryTree (const wxDataViewItem &treeItem, FOOTPRINT *aFootprint)
 Update a single node in the library tree. More...
 
void UpdateView ()
 
void UpdateTitle ()
 
void FocusOnLibID (const LIB_ID &aLibID)
 
void KiwayMailIn (KIWAY_EXPRESS &mail) override
 Receive KIWAY_EXPRESS messages from other players. More...
 
bool TryBefore (wxEvent &aEvent) override
 
wxString CreateNewLibrary (const wxString &aLibName=wxEmptyString, const wxString &aProposedName=wxEmptyString)
 If a library name is given, creates a new footprint library in the project folder with the given name. More...
 
wxString CreateNewProjectLibrary (const wxString &aLibName=wxEmptyString, const wxString &aProposedName=wxEmptyString)
 
bool AddLibrary (const wxString &aLibName=wxEmptyString, FP_LIB_TABLE *aTable=nullptr)
 Add an existing library to either the global or project library table. More...
 
void SaveCopyInUndoList (EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand) override
 Create a new entry in undo list of commands. More...
 
void SaveCopyInUndoList (const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO aCommandType) override
 Create a new entry in undo list of commands. More...
 
void AppendCopyToUndoList (const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO aCommandType) override
 As SaveCopyInUndoList, but appends the changes to the last undo item on the stack. More...
 
void RestoreCopyFromRedoList (wxCommandEvent &aEvent)
 Redo the last edit: More...
 
void RestoreCopyFromUndoList (wxCommandEvent &aEvent)
 Undo the last edit: More...
 
void RollbackFromUndo ()
 Perform an undo of the last edit without logging a corresponding redo. More...
 
void PutDataInPreviousState (PICKED_ITEMS_LIST *aList)
 Used in undo or redo command. More...
 
bool UndoRedoBlocked () const
 Check if the undo and redo operations are currently blocked. More...
 
void UndoRedoBlock (bool aBlock=true)
 Enable/disable undo and redo operations. More...
 
void SetGridVisibility (bool aVisible) override
 Override this function in the PCB_BASE_EDIT_FRAME to refill the layer widget. More...
 
void SetObjectVisible (GAL_LAYER_ID aLayer, bool aVisible=true)
 
void ShowBitmapPropertiesDialog (BOARD_ITEM *aBitmap)
 Set the angle used for rotate operations. More...
 
void ShowTextPropertiesDialog (BOARD_ITEM *aText)
 
int ShowTextBoxPropertiesDialog (BOARD_ITEM *aText)
 
void ShowGraphicItemPropertiesDialog (BOARD_ITEM *aItem)
 
virtual void SetBoard (BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
 Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD. More...
 
void ClearUndoORRedoList (UNDO_REDO_LIST whichList, int aItemCount=-1) override
 Free the undo or redo list from List element. More...
 
void ClearListAndDeleteItems (PICKED_ITEMS_LIST *aList)
 
wxString GetDesignRulesPath ()
 Return the absolute path to the design rules file for the currently-loaded board. More...
 
APPEARANCE_CONTROLSGetAppearancePanel ()
 
PROPERTIES_PANELGetPropertiesPanel ()
 
void UpdateProperties ()
 
EDA_3D_VIEWER_FRAMEGet3DViewerFrame ()
 
virtual void Update3DView (bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
 Update the 3D view, if the viewer is opened by this frame. More...
 
FOOTPRINTLoadFootprint (const LIB_ID &aFootprintId)
 Attempt to load aFootprintId from the footprint library table. More...
 
BOX2I GetBoardBoundingBox (bool aBoardEdgesOnly=false) const
 Calculate the bounding box containing all board items (or board edge segments). More...
 
virtual void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const VECTOR2IGetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const VECTOR2I &aPoint) override
 
const VECTOR2IGetAuxOrigin () const
 
const VECTOR2I GetUserOrigin () const
 
ORIGIN_TRANSFORMSGetOriginTransforms () override
 Return a reference to the default ORIGIN_TRANSFORMS object. More...
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void SetDrawBgColor (const COLOR4D &aColor) override
 
const PCB_DISPLAY_OPTIONSGetDisplayOptions () const
 Display options control the way tracks, vias, outlines and other things are shown (for instance solid or sketch mode). More...
 
void SetDisplayOptions (const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
 Updates the current display options from the given options struct. More...
 
const ZONE_SETTINGSGetZoneSettings () const
 
void SetZoneSettings (const ZONE_SETTINGS &aSettings)
 
BOARDGetBoard () const
 
void UpdateUserUnits (BOARD_ITEM *aItem, bool *aSelectedItemsModified=nullptr)
 Update any references within aItem (or its descendants) to the user units. More...
 
EDA_ITEMGetItem (const KIID &aId) const override
 Fetch an item by KIID. More...
 
void FocusOnItem (BOARD_ITEM *aItem, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
 
void FocusOnItems (std::vector< BOARD_ITEM * > aItems, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
 
void HideSolderMask ()
 
void ShowSolderMask ()
 
virtual void UpdateStatusBar () override
 Update the status bar information. More...
 
PCB_SCREENGetScreen () const override
 Return a pointer to a BASE_SCREEN or one of its derivatives. More...
 
EDA_3D_VIEWER_FRAMECreateAndShow3D_Frame ()
 Shows the 3D view frame. More...
 
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide ()
 
wxString SelectLibrary (const wxString &aNicknameExisting)
 Put up a dialog and allows the user to pick a library, for unspecified use. More...
 
FOOTPRINTGetFootprintFromBoardByReference ()
 
FOOTPRINTCreateNewFootprint (const wxString &aFootprintName, bool aQuiet=false)
 Creates a new footprint, at position 0,0. More...
 
void PlaceFootprint (FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
 Places aFootprint at the current cursor position and updates footprint coordinates with the new position. More...
 
void ShowPadPropertiesDialog (PAD *aPad)
 
FOOTPRINTSelectFootprintFromLibTree (LIB_ID aPreselect=LIB_ID())
 Open a dialog to select a footprint. More...
 
wxString SelectFootprintFromLibBrowser ()
 Launch the footprint viewer to select the name of a footprint to load. More...
 
void Compile_Ratsnest (bool aDisplayStatus)
 Create the entire board ratsnest. More...
 
PCB_LAYER_ID SelectOneLayer (PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
 Show the dialog box for a layer selection. More...
 
virtual void SwitchLayer (PCB_LAYER_ID aLayer)
 Change the active layer in the frame. More...
 
virtual PCB_LAYER_ID GetActiveLayer () const
 
SEVERITY GetSeverity (int aErrorCode) const override
 
PCBNEW_SETTINGSGetPcbNewSettings () const
 
FOOTPRINT_EDITOR_SETTINGSGetFootprintEditorSettings () const
 
virtual PCB_VIEWERS_SETTINGS_BASEGetViewerSettingsBase () const
 
void DisplayGridMsg () override
 Display the current grid pane on the status bar. More...
 
PCB_DRAW_PANEL_GALGetCanvas () const override
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
void ScriptingConsoleEnableDisable ()
 Toggles the scripting console visibility. More...
 
bool IsScriptingConsoleVisible ()
 Gets the current visibility of the scripting console window. More...
 
EDA_SEARCH_DATAGetFindReplaceData ()
 
wxArrayString & GetFindHistoryList ()
 
bool GetShowPolarCoords () const
 For those frames that support polar coordinates. More...
 
void SetShowPolarCoords (bool aShow)
 
void ToggleUserUnits () override
 
void GetUnitPair (EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits)
 Get the pair or units in current use. More...
 
VECTOR2I GetNearestGridPosition (const VECTOR2I &aPosition) const
 Return the nearest aGridSize location to aPosition. More...
 
VECTOR2I GetNearestHalfGridPosition (const VECTOR2I &aPosition) const
 Return the nearest aGridSize / 2 location to aPosition. More...
 
virtual COLOR4D GetDrawBgColor () const
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false, bool aIsGlobal=false, const wxString &aGlobalPath=wxEmptyString)
 
virtual wxString GetScreenDesc () const
 
void EraseMsgBox ()
 
virtual void ReCreateAuxiliaryToolbar ()
 
bool IsGridVisible () const
 
virtual void SetGridColor (const COLOR4D &aColor)
 
void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
void OnGridSettings (wxCommandEvent &event)
 
void UpdateGridSelectBox ()
 Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes, etc.). More...
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 Update the checked item in the grid wxchoice. More...
 
void OnUpdateSelectZoom (wxUpdateUIEvent &aEvent)
 Update the checked item in the zoom wxchoice. More...
 
void UpdateZoomSelectBox ()
 Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes, etc.) More...
 
const wxString GetZoomLevelIndicator () const
 Return a human readable value for display in dialogs. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Set the zoom factor when selected by the zoom list box in the main tool bar. More...
 
virtual void OnSize (wxSizeEvent &event) override
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnMove (wxMoveEvent &aEvent) override
 
virtual void Zoom_Automatique (bool aWarpPointer)
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void FocusOnLocation (const VECTOR2I &aPos)
 Useful to focus on a particular location, in find functions. More...
 
void AddStandardSubMenus (TOOL_MENU &aMenu)
 Construct a "basic" menu for a tool, containing only items that apply to all tools (e.g. More...
 
void PrintDrawingSheet (const RENDER_SETTINGS *aSettings, BASE_SCREEN *aScreen, const std::map< wxString, wxString > *aProperties, double aMils2Iu, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Prints the drawing-sheet (frame and title block). More...
 
void DisplayToolMsg (const wxString &msg) override
 
void DisplayConstraintsMsg (const wxString &msg)
 
virtual void OnPageSettingsChange ()
 Called when modifying the page settings. More...
 
void DisplayUnitsMsg ()
 Display current unit pane in the status bar. More...
 
void AppendMsgPanel (const wxString &aTextUpper, const wxString &aTextLower, int aPadding=6)
 Append a message to the message panel. More...
 
virtual void ClearMsgPanel ()
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
void SetMsgPanel (const wxString &aTextUpper, const wxString &aTextLower, int aPadding=6)
 Helper function that erases the msg panel and then appends a single message. More...
 
virtual void PrintPage (const RENDER_SETTINGS *aSettings)
 Print the page pointed by current screen, set by the calling print function. More...
 
void SetCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
wxWindow * GetToolCanvas () const override
 Canvas access. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
void RefreshCanvas () override
 
void RecreateToolbars ()
 Rebuild all toolbars, and update the checked state of check tools. More...
 
virtual bool ShowModal (wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
 Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool IsModal () const override
 Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame. More...
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
virtual void ExecuteRemoteCommand (const char *cmdline)
 Execute a remote command sent via socket (to port KICAD_PCB_PORT_SERVICE_NUMBER, currently 4242). More...
 
void ChangeUserUnits (EDA_UNITS aUnits)
 
SETTINGS_MANAGERGetSettingsManager () const
 
bool ProcessEvent (wxEvent &aEvent) override
 Override the default process event handler to implement the auto save feature. More...
 
virtual void OnCharHook (wxKeyEvent &aKeyEvent)
 Capture the key event before it is sent to the GUI. More...
 
void OnMenuEvent (wxMenuEvent &event)
 The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't captured by the menus themselves. More...
 
virtual void RegisterUIUpdateHandler (int aID, const ACTION_CONDITIONS &aConditions) override
 Register a UI update handler for the control with ID aID. More...
 
virtual void RegisterUIUpdateHandler (const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
 Register an action's update conditions with the UI layer to allow the UI to appropriately display the state of its controls. More...
 
virtual void UnregisterUIUpdateHandler (int aID) override
 Unregister a UI handler for a given ID that was registered using RegisterUIUpdateHandler. More...
 
virtual void UnregisterUIUpdateHandler (const TOOL_ACTION &aAction)
 Unregister a UI handler for an action that was registered using RegisterUIUpdateHandler. More...
 
void OnMaximize (wxMaximizeEvent &aEvent)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
FRAME_T GetFrameType () const
 
virtual const SEARCH_STACKsys_search ()
 Return a SEARCH_STACK pertaining to entire program. More...
 
virtual wxString help_name ()
 
void OnKicadAbout (wxCommandEvent &event)
 
void OnPreferences (wxCommandEvent &event)
 Displays the preferences and settings of all opened editors paged dialog. More...
 
void ShowPreferences (wxString aStartPage, wxString aStartParentPage)
 Displays the preferences and settings of all opened editors paged dialog, starting with a particular page. More...
 
void PrintMsg (const wxString &text)
 
void CreateInfoBar ()
 
void FinishAUIInitialization ()
 
WX_INFOBARGetInfoBar ()
 
void ShowInfoBarError (const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
 Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left of the infobar, and an optional closebox to the right. More...
 
void ShowInfoBarError (const wxString &aErrorMsg, bool aShowCloseButton, std::function< void(void)> aCallback)
 Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left of the infobar, and an optional closebox to the right. More...
 
void ShowInfoBarWarning (const wxString &aWarningMsg, bool aShowCloseButton=false)
 Show the WX_INFOBAR displayed on the top of the canvas with a message and a warning icon on the left of the infobar. More...
 
void ShowInfoBarMsg (const wxString &aMsg, bool aShowCloseButton=false)
 Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of the infobar. More...
 
void LoadWindowState (const wxString &aFileName)
 
virtual void LoadWindowState (const WINDOW_STATE &aState)
 Load frame state info from a configuration file. More...
 
void LoadWindowSettings (const WINDOW_SETTINGS *aCfg)
 Load window settings from the given settings object. More...
 
void SaveWindowSettings (WINDOW_SETTINGS *aCfg)
 Save window settings to the given settings object. More...
 
virtual WINDOW_SETTINGSGetWindowSettings (APP_SETTINGS_BASE *aCfg)
 Return a pointer to the window settings for this frame. More...
 
wxString ConfigBaseName () override
 Get the configuration base name. More...
 
virtual void SaveProjectSettings ()
 Save changes to the project settings to the project (.pro) file. More...
 
void ImportHotkeyConfigFromFile (std::map< std::string, TOOL_ACTION * > aActionMap, const wxString &aDefaultShortname)
 Prompt the user for a hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
 Fetches the file name from the file history list. More...
 
void ClearFileHistory (FILE_HISTORY *aFileHistory=nullptr)
 Removes all files from the file history. More...
 
void UpdateFileHistory (const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
 Update the list of recently opened files. More...
 
FILE_HISTORYGetFileHistory ()
 Get the frame's main file history. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
virtual wxString GetCurrentFileName () const
 Get the full filename + path of the currently opened file in the frame. More...
 
void ReCreateMenuBar ()
 Recreates the menu bar. More...
 
void AddStandardHelpMenu (wxMenuBar *aMenuBar)
 Adds the standard KiCad help menu to the menubar. More...
 
bool IsWritable (const wxFileName &aFileName, bool aVerbose=true)
 Checks if aFileName can be written. More...
 
virtual void CheckForAutoSaveFile (const wxFileName &aFileName)
 Check if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ThemeChanged ()
 Process light/dark theme change. More...
 
virtual void ProjectChanged ()
 Notification event that the project has changed. More...
 
const wxString & GetAboutTitle () const
 
const wxString & GetUntranslatedAboutTitle () const
 
wxSize GetWindowSize ()
 Get the undecorated window size that can be used for restoring the window size. More...
 
virtual void ClearUndoRedoList ()
 Clear the undo and redo list using ClearUndoORRedoList() More...
 
virtual void PushCommandToUndoList (PICKED_ITEMS_LIST *aItem)
 Add a command to undo in the undo list. More...
 
virtual void PushCommandToRedoList (PICKED_ITEMS_LIST *aItem)
 Add a command to redo in the redo list. More...
 
virtual PICKED_ITEMS_LISTPopCommandFromUndoList ()
 Return the last command to undo and remove it from list, nothing is deleted. More...
 
virtual PICKED_ITEMS_LISTPopCommandFromRedoList ()
 Return the last command to undo and remove it from list, nothing is deleted. More...
 
virtual int GetUndoCommandCount () const
 
virtual int GetRedoCommandCount () const
 
int GetMaxUndoItems () const
 
bool NonUserClose (bool aForce)
 
virtual void HandleSystemColorChange ()
 Update the UI in response to a change in the system colors. More...
 
TOOL_MANAGERGetToolManager () const
 Return the MVC controller. More...
 
virtual void PushTool (const TOOL_EVENT &aEvent)
 NB: the definition of "tool" is different at the user level. More...
 
virtual void PopTool (const TOOL_EVENT &aEvent)
 Pops a tool from the stack. More...
 
bool ToolStackIsEmpty ()
 
std::string CurrentToolName () const
 
bool IsCurrentTool (const TOOL_ACTION &aAction) const
 
bool GetDoImmediateActions () const
 Indicate that hotkeys should perform an immediate action even if another tool is currently active. More...
 
MOUSE_DRAG_ACTION GetDragAction () const
 Indicates whether a drag should draw a selection rectangle or drag selected (or unselected) objects. More...
 
bool GetMoveWarpsCursor () const
 Indicate that a move operation should warp the mouse pointer to the origin of the move object. More...
 
HOLDER_TYPE GetType () const
 
KIWAYKiway () const
 Return a reference to the KIWAY that this object has an opportunity to participate in. More...
 
bool HasKiway () const
 Safety check before asking for the Kiway reference. More...
 
PROJECTPrj () const
 Return a reference to the PROJECT associated with this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 It is only used for debugging, since "this" is not a wxWindow*. More...
 
EDA_UNITS GetUserUnits () const
 
void SetUserUnits (EDA_UNITS aUnits)
 
const EDA_IU_SCALEGetIuScale () const
 
wxString StringFromValue (double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 Converts aValue in internal units into a united string. More...
 
wxString StringFromValue (const EDA_ANGLE &aValue, bool aAddUnitLabel=false)
 
wxString MessageTextFromValue (double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 A lower-precision version of StringFromValue(). More...
 
wxString MessageTextFromValue (const EDA_ANGLE &aValue, bool aAddUnitLabel=true)
 
int ValueFromString (const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 Converts aTextValue in aUnits to internal units used by the frame. More...
 
EDA_ANGLE AngleValueFromString (const wxString &aTextValue)
 

Static Public Member Functions

static const wxChar * GetFootprintEditorFrameName ()
 
static void HandleUpdateUIEvent (wxUpdateUIEvent &aEvent, EDA_BASE_FRAME *aFrame, ACTION_CONDITIONS aCond)
 Handle events generated when the UI is trying to figure out the current state of the UI controls related to TOOL_ACTIONS (e.g. More...
 

Protected Member Functions

 FOOTPRINT_EDIT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 protected so only friend PCB::IFACE::CreateWindow() can act as sole factory. More...
 
EDA_LIST_DIALOGbuildSaveAsDialog (const wxString &aFootprintName, const wxString &aLibraryPreselect)
 
void initLibraryTree ()
 Make sure the footprint info list is loaded (with a progress dialog) and then initialize the footprint library tree. More...
 
void restoreLastFootprint ()
 
void retainLastFootprint ()
 
void doReCreateMenuBar () override
 (Re)Create the menubar for the Footprint Editor frame More...
 
void editFootprintProperties (FOOTPRINT *aFootprint)
 Run the Footprint Properties dialog and handle changes made in it. More...
 
void setupUIConditions () override
 Setup the UI conditions for the various actions and their controls in this frame. More...
 
void centerItemIdleHandler (wxIdleEvent &aEvent)
 
FP_LIB_TABLEselectLibTable (bool aOptional=false)
 Prompts a user to select global or project library tables. More...
 
wxString createNewLibrary (const wxString &aLibName, const wxString &aProposedName, FP_LIB_TABLE *aTable)
 Create a new library in the given table (presumed to be either the global or project library table). More...
 
void handleActivateEvent (wxActivateEvent &aEvent) override
 Handle a window activation event. More...
 
void saveCopyInUndoList (PICKED_ITEMS_LIST *commandToUndo, const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO aCommandType)
 
void unitsChangeRefresh () override
 Called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
virtual void onDarkModeToggle ()
 
void handleIconizeEvent (wxIconizeEvent &aEvent) override
 Handle a window iconize event. More...
 
FOOTPRINTloadFootprint (const LIB_ID &aFootprintId)
 Attempts to load aFootprintId from the footprint library table. More...
 
void rebuildConnectivity ()
 
virtual void SetScreen (BASE_SCREEN *aScreen)
 
void setupUnits (APP_SETTINGS_BASE *aCfg)
 
std::vector< wxWindow * > findDialogs ()
 
void resolveCanvasType ()
 Determines the Canvas type to load (with prompt if required) and initializes m_canvasType. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting ()
 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...
 
void onActivate (wxActivateEvent &aEvent)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 An event handler called on a language menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Handle the auto save timer event. More...
 
void onIconize (wxIconizeEvent &aEvent)
 
virtual bool isAutoSaveRequired () const
 Return the auto save status of the application. More...
 
virtual bool doAutoSave ()
 This should be overridden by the derived class to handle the auto save feature. More...
 
void onSystemColorChange (wxSysColourChangedEvent &aEvent)
 
void initExitKey ()
 Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id. More...
 
void ensureWindowIsOnScreen ()
 
virtual void OnDropFiles (wxDropFilesEvent &aEvent)
 Handles event fired when a file is dropped to the window. More...
 
virtual void DoWithAcceptedFiles ()
 Execute action on accepted dropped file. More...
 

Static Protected Member Functions

static wxString GetAutoSaveFilePrefix ()
 

Protected Attributes

PCB_LAYER_BOX_SELECTORm_selLayerBox
 
FOOTPRINT_EDITOR_SETTINGSm_editorSettings
 
bool m_undoRedoBlocked
 
PANEL_SELECTION_FILTERm_selectionFilterPanel
 
APPEARANCE_CONTROLSm_appearancePanel
 
PROPERTIES_PANELm_propertiesPanel
 
wxAuiNotebook * m_tabbedPanel
 
bool m_darkMode
 Panel with Layers and Object Inspector tabs. More...
 
BOARDm_pcb
 
PCB_DISPLAY_OPTIONS m_displayOptions
 
PCB_ORIGIN_TRANSFORMS m_originTransforms
 
wxSocketServer * m_socketServer
 
std::vector< wxSocketBase * > m_sockets
 interprocess communication More...
 
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
 
COLOR4D m_gridColor
 
COLOR4D m_drawBgColor
 
int m_undoRedoCountMax
 
bool m_polarCoords
 
bool m_showBorderAndTitleBlock
 
wxChoice * m_gridSelectBox
 
wxChoice * m_zoomSelectBox
 
ACTION_TOOLBARm_mainToolBar
 
ACTION_TOOLBARm_auxiliaryToolBar
 
ACTION_TOOLBARm_drawToolBar
 
ACTION_TOOLBARm_optionsToolBar
 
std::unique_ptr< EDA_SEARCH_DATAm_findReplaceData
 
wxArrayString m_findStringHistoryList
 
wxArrayString m_replaceStringHistoryList
 
EDA_MSG_PANELm_messagePanel
 
int m_msgFrameHeight
 
COLOR_SETTINGSm_colorSettings
 
SEARCH_PANEm_searchPane
 The current canvas type. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 < Points to nested event_loop. NULL means not modal and dismissed. More...
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
std::vector< wxFileName > m_AcceptedFiles
 
FRAME_T m_ident
 
wxPoint m_framePos
 
wxSize m_frameSize
 
bool m_maximizeByDefault
 
int m_displayIndex
 
wxPoint m_normalFramePos
 
wxSize m_normalFrameSize
 
wxString m_aboutTitle
 
wxAuiManager m_auimgr
 
wxString m_perspective
 
WX_INFOBARm_infoBar
 
wxString m_configName
 
SETTINGS_MANAGERm_settingsManager
 
FILE_HISTORYm_fileHistory
 
bool m_supportsAutoSave
 
bool m_autoSavePending
 
bool m_autoSaveRequired
 
wxTimer * m_autoSaveTimer
 
UNDO_REDO_CONTAINER m_undoList
 
UNDO_REDO_CONTAINER m_redoList
 
wxString m_mruPath
 
std::map< int, UIUpdateHandlerm_uiUpdateMap
 < Map containing the UI update handlers registered with wx for each action. More...
 
bool m_isClosing
 Set by NonUserClose() to indicate that the user did not request the current close. More...
 
bool m_isNonUserClose
 
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
 Associates files extensions with action to execute. More...
 
TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
TOOL_DISPATCHERm_toolDispatcher
 
SELECTION m_dummySelection
 
std::vector< std::string > m_toolStack
 
bool m_immediateActions
 
MOUSE_DRAG_ACTION m_dragAction
 
bool m_moveWarpsCursor
 

Static Protected Attributes

static bool m_openGLFailureOccured = false
 Has any failure occured when switching to OpenGL in any EDA_DRAW_FRAME? More...
 
static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 < Default style flags used for wxAUI toolbars. More...
 

Private Member Functions

void windowClosing (wxCloseEvent &event)
 (with its unexpected name so it does not collide with the real OnWindowClose() function provided in derived classes) is called just before a window closing, and is used to call a derivation specific SaveSettings(). More...
 
void commonInit (FRAME_T aFrameType)
 Collect common initialization functions used in all CTORs. More...
 
wxWindow * findQuasiModalDialog ()
 

Private Attributes

FOOTPRINT_TREE_PANEm_treePane
 
LIB_ID m_centerItemOnIdle
 
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTERm_adapter
 
bool m_show_layer_manager_tools
 
std::unique_ptr< FOOTPRINTm_originalFootprintCopy
 
wxString m_footprintNameWhenLoaded
 
std::map< KIID, KIIDm_boardFootprintUuids
 
NL_PCBNEW_PLUGINm_spaceMouse
 
BASE_SCREENm_currentScreen
 current used SCREEN More...
 
EDA_DRAW_PANEL_GALm_canvas
 This the frame's interface to setting GAL display options. More...
 
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
 
KIWAYm_kiway
 
HOLDER_TYPE m_type
 
const EDA_IU_SCALEm_iuScale
 
EDA_UNITS m_userUnits
 

Friends

struct PCB::IFACE
 

Detailed Description

Definition at line 39 of file footprint_edit_frame.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 39 of file kiway_holder.h.

◆ UNDO_REDO_LIST

Specifies whether we are interacting with the undo or redo stacks.

Enumerator
UNDO_LIST 
REDO_LIST 

Definition at line 111 of file eda_base_frame.h.

112 {
113 UNDO_LIST,
115 };

Constructor & Destructor Documentation

◆ ~FOOTPRINT_EDIT_FRAME()

FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME ( )

Definition at line 322 of file footprint_edit_frame.cpp.

323{
324 // Shutdown all running tools
325 if( m_toolManager )
327
328 // save the footprint in the PROJECT
330
332 delete m_appearancePanel;
333 delete m_treePane;
334}
FOOTPRINT_TREE_PANE * m_treePane
APPEARANCE_CONTROLS * m_appearancePanel
PANEL_SELECTION_FILTER * m_selectionFilterPanel
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...

References PCB_BASE_EDIT_FRAME::m_appearancePanel, PCB_BASE_EDIT_FRAME::m_selectionFilterPanel, TOOLS_HOLDER::m_toolManager, m_treePane, retainLastFootprint(), and TOOL_MANAGER::ShutdownAllTools().

◆ FOOTPRINT_EDIT_FRAME()

FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME ( KIWAY aKiway,
wxWindow *  aParent 
)
protected

protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.

Definition at line 107 of file footprint_edit_frame.cpp.

107 :
108 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_FOOTPRINT_EDITOR, wxEmptyString,
109 wxDefaultPosition, wxDefaultSize,
112{
113 m_showBorderAndTitleBlock = false; // true to show the frame references
114 m_aboutTitle = _HKI( "KiCad Footprint Editor" );
115 m_selLayerBox = nullptr;
116 m_editorSettings = nullptr;
117
118 // Give an icon
119 wxIcon icon;
120 wxIconBundle icon_bundle;
121
122 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit ) );
123 icon_bundle.AddIcon( icon );
124 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit_32 ) );
125 icon_bundle.AddIcon( icon );
126 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit_16 ) );
127 icon_bundle.AddIcon( icon );
128
129 SetIcons( icon_bundle );
130
131 // Create GAL canvas
133
134 PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
136 SetCanvas( drawPanel );
137 SetBoard( new BOARD() );
138
139 // This board will only be used to hold a footprint for editing
141
142 // In Footprint Editor, the default net clearance is not known (it depends on the actual
143 // board). So we do not show the default clearance, by setting it to 0. The footprint or
144 // pad specific clearance will be shown.
145 GetBoard()->GetDesignSettings().m_NetSettings->m_DefaultNetClass->SetClearance( 0 );
146
147 // Don't show the default board solder mask expansion in the footprint editor. Only the
148 // footprint or pad mask expansions settings should be shown.
150
151 // restore the last footprint from the project, if any
153
154 // Ensure all layers and items are visible:
155 // In footprint editor, some layers have no meaning or cannot be used, but we show all of
156 // them, at least to be able to edit a bad layer
158
160
161 // In Footprint Editor, set the default paper size to A4 for plot/print
164
165 // Create the manager and dispatcher & route draw panel events to the dispatcher
166 setupTools();
168
170 m_treePane = new FOOTPRINT_TREE_PANE( this );
171
176
178 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true );
179
180 // LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize
181 // parameters in m_LayersManager
182 // NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew
184
185 // Must be set after calling LoadSettings() to be sure these parameters are not dependent
186 // on what is read in stored settings. Enable one internal layer, because footprints
187 // support keepout areas that can be on internal layers only (therefore on the first internal
188 // layer). This is needed to handle these keepout in internal layers only.
190 GetBoard()->SetEnabledLayers( GetBoard()->GetEnabledLayers().set( In1_Cu ) );
191 GetBoard()->SetVisibleLayers( GetBoard()->GetEnabledLayers() );
192 GetBoard()->SetLayerName( In1_Cu, _( "Inner layers" ) );
193
195
196 m_auimgr.SetManagedWindow( this );
197
199
200 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
201#if !defined( _WIN32 )
202 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
203 // of graphical glitches
204 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
205#endif
206 m_auimgr.SetFlags( auiFlags );
207
208 // Rows; layers 4 - 6
209 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
210 .Top().Layer( 6 ) );
211
212 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
213 .Bottom().Layer( 6 ) );
214
215 // Columns; layers 1 - 3
216 m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" )
217 .Left().Layer( 3 )
218 .Caption( _( "Libraries" ) )
219 .MinSize( 250, -1 ).BestSize( 250, -1 ) );
220 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
221 .Left().Layer( 2 ) );
222
223 m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" )
224 .Right().Layer(2) );
225 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" )
226 .Right().Layer( 3 )
227 .Caption( _( "Appearance" ) ).PaneBorder( false )
228 .MinSize( 180, -1 ).BestSize( 180, -1 ) );
229 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Palette().Name( "SelectionFilter" )
230 .Right().Layer( 3 ).Position( 2 )
231 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
232 .MinSize( 160, -1 ).BestSize( m_selectionFilterPanel->GetBestSize() ) );
233
234 // Center
235 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
236 .Center() );
237
238 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
239 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
240
241 // The selection filter doesn't need to grow in the vertical direction when docked
242 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
243
246 DragAcceptFiles( true );
247
249
251
252 // Apply saved visibility stuff at the end
254 wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
255 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
256
257 // wxAUI hack: force widths by setting MinSize() and then Fixed()
258 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
259
260 if( cfg->m_LibWidth > 0 )
261 {
262 SetAuiPaneSize( m_auimgr, treePane, cfg->m_LibWidth, -1 );
263
264 treePane.MinSize( cfg->m_LibWidth, -1 );
265 treePane.Fixed();
266 }
267
268 if( cfg->m_AuiPanels.right_panel_width > 0 )
269 {
270 SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
271
272 layersManager.MinSize( cfg->m_LibWidth, -1 );
273 layersManager.Fixed();
274 }
275
276 // Apply fixed sizes
277 m_auimgr.Update();
278
279 // Now make them resizable again
280 treePane.Resizable();
281 m_auimgr.Update();
282
283 // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the sizes
284 // back to minimum.
285 treePane.MinSize( 250, -1 );
286 layersManager.MinSize( 250, -1 );
287
291
293 UpdateTitle();
295
297
298 // Default shutdown reason until a file is loaded
299 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Footprint changes are unsaved" ) );
300
301 // Catch unhandled accelerator command characters that were no handled by the library tree
302 // panel.
304 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
305
306 // Ensure the window is on top
307 Raise();
308 Show( true );
309
310 // Register a call to update the toolbar sizes. It can't be done immediately because
311 // it seems to require some sizes calculated that aren't yet (at least on GTK).
312 CallAfter(
313 [&]()
314 {
315 // Ensure the controls on the toolbars all are correctly sized
318 } );
319}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ icon_modedit_32
@ icon_modedit
@ icon_modedit_16
static TOOL_ACTION zoomFitScreen
Definition: actions.h:98
static TOOL_ACTION ddAddLibrary
Definition: actions.h:60
void ApplyLayerPreset(const wxString &aPresetName)
void SetUserLayerPresets(std::vector< LAYER_PRESET > &aPresetList)
std::shared_ptr< NET_SETTINGS > m_NetSettings
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:277
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:589
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition: board.cpp:472
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:618
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:601
void SetCopperLayerCount(int aCount)
Definition: board.cpp:551
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:686
void FinishAUIInitialization()
wxAuiManager m_auimgr
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associates files extensions with action to execute.
wxString m_aboutTitle
void ReCreateMenuBar()
Recreates the menu bar.
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
void setupUnits(APP_SETTINGS_BASE *aCfg)
ACTION_TOOLBAR * m_optionsToolBar
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
void resolveCanvasType()
Determines the Canvas type to load (with prompt if required) and initializes m_canvasType.
EDA_MSG_PANEL * m_messagePanel
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
virtual void SetScreen(BASE_SCREEN *aScreen)
ACTION_TOOLBAR * m_mainToolBar
ACTION_TOOLBAR * m_drawToolBar
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
bool m_showBorderAndTitleBlock
Specialization of the wxAuiPaneInfo class for KiCad panels.
std::vector< LAYER_PRESET > m_LayerPresets
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
static const wxChar * GetFootprintEditorFrameName()
void initLibraryTree()
Make sure the footprint info list is loaded (with a progress dialog) and then initialize the footprin...
void UpdateToolbarControlSizes() override
Update the sizes of any controls in the toolbars of the frame.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void ReCreateHToolbar() override
Create the main horizontal toolbar for the footprint editor.
FOOTPRINT_EDITOR_SETTINGS * m_editorSettings
void SetActiveLayer(PCB_LAYER_ID aLayer) override
PCB_LAYER_BOX_SELECTOR * m_selLayerBox
FOOTPRINT_EDITOR_SETTINGS * GetSettings()
Footprint Editor pane with footprint library tree.
void FocusSearchFieldIfExists()
Focus the search widget if it exists.
bool m_axesEnabled
Fullscreen crosshair or small cross.
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
static const wxChar A4[]
Definition: page_info.h:63
static TOOL_ACTION ddImportFootprint
Definition: pcb_actions.h:529
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
PCB_BASE_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
const PAGE_INFO & GetPageSettings() const override
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
BOARD * GetBoard() const
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:172
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
#define _HKI(x)
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:41
const std::string KiCadFootprintLibPathExtension
const std::string KiCadFootprintFileExtension
@ F_SilkS
Definition: layer_ids.h:104
@ In1_Cu
Definition: layer_ids.h:65
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:83
const double IU_PER_MILS
Definition: base_units.h:78
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.

References _, _HKI, PAGE_INFO::A4, FOOTPRINT_EDITOR_SETTINGS::AUI_PANELS::appearance_panel_tab, PCAD2KICAD::Center, ACTIONS::ddAddLibrary, PCB_ACTIONS::ddImportFootprint, TOOL_DISPATCHER::DispatchWxEvent(), F_SilkS, FPHOLDER, GetBoard(), BOARD::GetDesignSettings(), icon_modedit, icon_modedit_16, icon_modedit_32, In1_Cu, EDA_IU_SCALE::IU_PER_MILS, KiBitmap(), KiCadFootprintFileExtension, KiCadFootprintLibPathExtension, PCAD2KICAD::Left, FOOTPRINT_EDITOR_SETTINGS::m_ActiveLayerPreset, FOOTPRINT_EDITOR_SETTINGS::m_AuiPanels, FOOTPRINT_EDITOR_SETTINGS::m_LayerPresets, FOOTPRINT_EDITOR_SETTINGS::m_LibWidth, BOARD_DESIGN_SETTINGS::m_NetSettings, BOARD_DESIGN_SETTINGS::m_SolderMaskExpansion, pcbIUScale, PCAD2KICAD::Right, FOOTPRINT_EDITOR_SETTINGS::AUI_PANELS::right_panel_width, SetAuiPaneSize(), BOARD::SetBoardUse(), BOARD::SetCopperLayerCount(), BOARD::SetEnabledLayers(), BOARD::SetLayerName(), KIPLATFORM::APP::SetShutdownBlockReason(), BOARD::SetVisibleAlls(), BOARD::SetVisibleLayers(), and ACTIONS::zoomFitScreen.

Member Function Documentation

◆ ActivateGalCanvas()

void FOOTPRINT_EDIT_FRAME::ActivateGalCanvas ( )
overridevirtual

Use to start up the GAL drawing canvas.

Reimplemented from PCB_BASE_FRAME.

Definition at line 1242 of file footprint_edit_frame.cpp.

1243{
1245
1246 // Be sure the axis are enabled
1247 GetCanvas()->GetGAL()->SetAxesEnabled( true );
1248
1249 UpdateView();
1250
1251 // Ensure the m_Layers settings are using the canvas type:
1253}
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.

References PCB_BASE_EDIT_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetGAL(), KIGFX::GAL::SetAxesEnabled(), UpdateUserInterface(), and UpdateView().

◆ AddFootprintToBoard()

void FOOTPRINT_EDIT_FRAME::AddFootprintToBoard ( FOOTPRINT aFootprint)
overridevirtual

Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board, NOT to the user's PCB.

Reimplemented from PCB_BASE_FRAME.

Definition at line 524 of file footprint_edit_frame.cpp.

525{
526 m_originalFootprintCopy.reset( static_cast<FOOTPRINT*>( aFootprint->Clone() ) );
527 m_originalFootprintCopy->SetParent( nullptr );
528
530
532 // Ensure item UUIDs are valid
533 // ("old" footprints can have null uuids that create issues in fp editor)
534 aFootprint->FixUuids();
535
537 {
538 wxString msg;
539 msg.Printf( _( "Editing %s from board. Saving will update the board only." ),
540 aFootprint->GetReference() );
541
544 GetInfoBar()->ShowMessage( msg, wxICON_INFORMATION );
545 }
546 else
547 {
548 GetInfoBar()->Dismiss();
549 }
550
552}
WX_INFOBAR * GetInfoBar()
void UpdateMsgPanel() override
Redraw the message panel.
std::unique_ptr< FOOTPRINT > m_originalFootprintCopy
bool FixUuids()
Old footprints do not always have a valid UUID (some can be set to null uuid) However null UUIDs,...
Definition: footprint.cpp:239
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1375
const LIB_ID & GetFPID() const
Definition: footprint.h:212
const wxString & GetReference() const
Definition: footprint.h:519
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
virtual void AddFootprintToBoard(FOOTPRINT *aFootprint)
Add the given footprint to the board.
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: wx_infobar.cpp:289
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:175
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
Definition: wx_infobar.cpp:279
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: wx_infobar.cpp:142

References _, WX_INFOBAR::AddCloseButton(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT::Clone(), WX_INFOBAR::Dismiss(), FOOTPRINT::FixUuids(), FOOTPRINT::GetFPID(), EDA_BASE_FRAME::GetInfoBar(), LIB_ID::GetLibItemName(), FOOTPRINT::GetReference(), IsCurrentFPFromBoard(), m_footprintNameWhenLoaded, m_originalFootprintCopy, WX_INFOBAR::RemoveAllButtons(), WX_INFOBAR::ShowMessage(), and UpdateMsgPanel().

Referenced by FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), ImportFootprint(), LoadFootprintFromBoard(), LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), restoreLastFootprint(), and RevertFootprint().

◆ AddLibrary()

bool PCB_BASE_EDIT_FRAME::AddLibrary ( const wxString &  aLibName = wxEmptyString,
FP_LIB_TABLE aTable = nullptr 
)
inherited

Add an existing library to either the global or project library table.

Parameters
aFileNamethe library to add; a file open dialog will be displayed if empty.
Returns
true if successfully added.

Definition at line 547 of file footprint_libraries_utils.cpp.

548{
549 if( aTable == nullptr )
550 aTable = selectLibTable();
551
552 if( aTable == nullptr )
553 return wxEmptyString;
554
555 bool isGlobal = ( aTable == &GFootprintTable );
556
557 wxFileName fn( aFilename );
558
559 if( aFilename.IsEmpty() )
560 {
562 KiCadFootprintLibPathExtension, true, isGlobal,
564 {
565 return false;
566 }
567 }
568
569 wxString libPath = fn.GetFullPath();
570 wxString libName = fn.GetName();
571
572 if( libName.IsEmpty() )
573 return false;
575
576 wxString type = IO_MGR::ShowType( lib_type );
577
578 // KiCad lib is our default guess. So it might not have the .pretty extension
579 // In this case, the extension is part of the library name
580 if( lib_type == IO_MGR::KICAD_SEXP && fn.GetExt() != KiCadFootprintLibPathExtension )
581 libName = fn.GetFullName();
582
583 // try to use path normalized to an environmental variable or project path
584 wxString normalizedPath = NormalizePath( libPath, &Pgm().GetLocalEnvVariables(), &Prj() );
585
586 try
587 {
588 FP_LIB_TABLE_ROW* row = new FP_LIB_TABLE_ROW( libName, normalizedPath, type, wxEmptyString );
589 aTable->InsertRow( row );
590
591 if( isGlobal )
593 else
594 Prj().PcbFootprintLibs()->Save( Prj().FootprintLibTblName() );
595 }
596 catch( const IO_ERROR& ioe )
597 {
598 DisplayError( this, ioe.What() );
599 return false;
600 }
601
603
604 if( editor )
605 {
606 LIB_ID libID( libName, wxEmptyString );
607 editor->SyncLibraryTree( true );
608 editor->FocusOnLibID( libID );
609 }
610
611 auto viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER, false );
612
613 if( viewer )
614 viewer->ReCreateLibraryList();
615
616 return true;
617}
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false, bool aIsGlobal=false, const wxString &aGlobalPath=wxEmptyString)
Component library viewer main window.
Hold a record identifying a library accessed by the appropriate footprint library PLUGIN object in th...
Definition: fp_lib_table.h:41
static wxString GetGlobalTableFileName()
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
static const wxString ShowType(PCB_FILE_T aFileType)
Return a brief name for a plugin given aFileType enum.
Definition: io_mgr.cpp:77
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Return a plugin type given a footprint library's libPath.
Definition: io_mgr.cpp:124
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
Definition: io_mgr.h:54
@ KICAD_SEXP
S-expression Pcbnew file format.
Definition: io_mgr.h:56
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
static wxString GetDefaultUserFootprintsPath()
Gets the default path we point users to create projects.
Definition: paths.cpp:108
FP_LIB_TABLE * selectLibTable(bool aOptional=false)
Prompts a user to select global or project library tables.
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:324
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:300
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: cvpcb.cpp:134
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Definition: env_paths.cpp:71
@ FRAME_FOOTPRINT_VIEWER
Definition: frame_type.h:42
wxString KiCadFootprintLibPathWildcard()
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References DisplayError(), editor, FRAME_FOOTPRINT_EDITOR, FRAME_FOOTPRINT_VIEWER, PATHS::GetDefaultUserFootprintsPath(), FP_LIB_TABLE::GetGlobalTableFileName(), GFootprintTable, IO_MGR::GuessPluginTypeFromLibPath(), LIB_TABLE::InsertRow(), IO_MGR::KICAD_SEXP, KiCadFootprintLibPathExtension, KiCadFootprintLibPathWildcard(), KIWAY_HOLDER::Kiway(), EDA_DRAW_FRAME::LibraryFileBrowser(), NormalizePath(), PROJECT::PcbFootprintLibs(), Pgm(), KIWAY::Player(), KIWAY_HOLDER::Prj(), LIB_TABLE::Save(), PCB_BASE_EDIT_FRAME::selectLibTable(), IO_MGR::ShowType(), and IO_ERROR::What().

Referenced by PCB_CONTROL::AddLibrary(), and PCB_BASE_EDIT_FRAME::createNewLibrary().

◆ AddStandardHelpMenu()

void EDA_BASE_FRAME::AddStandardHelpMenu ( wxMenuBar *  aMenuBar)
inherited

Adds the standard KiCad help menu to the menubar.

Definition at line 462 of file eda_base_frame.cpp.

463{
465 ACTION_MENU* helpMenu = new ACTION_MENU( false, commonControl );
466
467 helpMenu->Add( ACTIONS::help );
468 helpMenu->Add( ACTIONS::gettingStarted );
469 helpMenu->Add( ACTIONS::listHotKeys );
470 helpMenu->Add( ACTIONS::getInvolved );
471 helpMenu->Add( ACTIONS::donate );
472 helpMenu->Add( ACTIONS::reportBug );
473
474 helpMenu->AppendSeparator();
475 helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, BITMAPS::about );
476
477 // Trailing space keeps OSX from hijacking our menu (and disabling everything in it).
478 aMenuBar->Append( helpMenu, _( "&Help" ) + wxS( " " ) );
479}
static TOOL_ACTION reportBug
Cursor control event types.
Definition: actions.h:187
static TOOL_ACTION donate
Definition: actions.h:185
static TOOL_ACTION listHotKeys
Definition: actions.h:184
static TOOL_ACTION getInvolved
Definition: actions.h:186
static TOOL_ACTION gettingStarted
Definition: actions.h:182
static TOOL_ACTION help
Definition: actions.h:183
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
Handle actions that are shared between different applications.

References _, about, ACTIONS::donate, ACTIONS::getInvolved, ACTIONS::gettingStarted, TOOL_MANAGER::GetTool(), ACTIONS::help, ACTIONS::listHotKeys, TOOLS_HOLDER::m_toolManager, and ACTIONS::reportBug.

Referenced by EDA_3D_VIEWER_FRAME::CreateMenuBar(), CVPCB_MAINFRAME::doReCreateMenuBar(), SCH_EDIT_FRAME::doReCreateMenuBar(), SYMBOL_EDIT_FRAME::doReCreateMenuBar(), SYMBOL_VIEWER_FRAME::doReCreateMenuBar(), GERBVIEW_FRAME::doReCreateMenuBar(), KICAD_MANAGER_FRAME::doReCreateMenuBar(), PL_EDITOR_FRAME::doReCreateMenuBar(), doReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::doReCreateMenuBar(), and PCB_EDIT_FRAME::doReCreateMenuBar().

◆ AddStandardSubMenus()

void EDA_DRAW_FRAME::AddStandardSubMenus ( TOOL_MENU aMenu)
inherited

Construct a "basic" menu for a tool, containing only items that apply to all tools (e.g.

zoom and grid).

Definition at line 576 of file eda_draw_frame.cpp.

577{
579 CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
580
581 aMenu.AddSeparator( 1000 );
582
583 std::shared_ptr<ZOOM_MENU> zoomMenu = std::make_shared<ZOOM_MENU>( this );
584 zoomMenu->SetTool( commonTools );
585 aToolMenu.RegisterSubMenu( zoomMenu );
586
587 std::shared_ptr<GRID_MENU> gridMenu = std::make_shared<GRID_MENU>( this );
588 gridMenu->SetTool( commonTools );
589 aToolMenu.RegisterSubMenu( gridMenu );
590
591 aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
592 aMenu.AddMenu( gridMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
593}
Handles action that are shared between different applications.
Definition: common_tools.h:38
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44

References CONDITIONAL_MENU::AddSeparator(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::m_toolManager, TOOL_MENU::RegisterSubMenu(), and SELECTION_CONDITIONS::ShowAlways().

Referenced by EE_SELECTION_TOOL::Init(), PICKER_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_SELECTION_TOOL::Init(), ROUTER_TOOL::Init(), PCB_SELECTION_TOOL::Init(), and PCB_VIEWER_TOOLS::Init().

◆ AngleValueFromString()

EDA_ANGLE UNITS_PROVIDER::AngleValueFromString ( const wxString &  aTextValue)
inlineinherited

Definition at line 116 of file units_provider.h.

117 {
119 aTextValue );
120
121 return EDA_ANGLE( angle, DEGREES_T );
122 }
const EDA_IU_SCALE & GetIuScale() const
@ DEGREES_T
Definition: eda_angle.h:31
double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
Definition: eda_units.cpp:456
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)

References PNS::angle(), DEGREES, DEGREES_T, EDA_UNIT_UTILS::UI::DoubleValueFromString(), and UNITS_PROVIDER::GetIuScale().

Referenced by FP_TEXT_GRID_TABLE::SetValue().

◆ AppendCopyToUndoList()

void PCB_BASE_EDIT_FRAME::AppendCopyToUndoList ( const PICKED_ITEMS_LIST aItemsList,
UNDO_REDO  aCommandType 
)
overridevirtualinherited

As SaveCopyInUndoList, but appends the changes to the last undo item on the stack.

Implements PCB_BASE_FRAME.

Definition at line 301 of file undo_redo.cpp.

303{
304 PICKED_ITEMS_LIST* commandToUndo = PopCommandFromUndoList();
305
306 if( !commandToUndo )
307 commandToUndo = new PICKED_ITEMS_LIST();
308
309 saveCopyInUndoList( commandToUndo, aItemsList, aCommandType );
310}
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
void saveCopyInUndoList(PICKED_ITEMS_LIST *commandToUndo, const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO aCommandType)
Definition: undo_redo.cpp:155
A holder to handle information on schematic or board items.

References EDA_BASE_FRAME::PopCommandFromUndoList(), and PCB_BASE_EDIT_FRAME::saveCopyInUndoList().

◆ AppendMsgPanel()

void EDA_DRAW_FRAME::AppendMsgPanel ( const wxString &  aTextUpper,
const wxString &  aTextLower,
int  aPadding = 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
aTextUpperThe message upper text.
aTextLowerThe message lower text.
aPaddingNumber of spaces to pad between messages.

Definition at line 736 of file eda_draw_frame.cpp.

738{
739 if( m_messagePanel )
740 m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
741}
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, int aPadding=6)
Append a message to the message panel.
Definition: msgpanel.cpp:93

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

Referenced by GERBER_FILE_IMAGE::DisplayImageInfo(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), and SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo().

◆ buildSaveAsDialog()

EDA_LIST_DIALOG * FOOTPRINT_EDIT_FRAME::buildSaveAsDialog ( const wxString &  aFootprintName,
const wxString &  aLibraryPreselect 
)
protected

Definition at line 1032 of file footprint_libraries_utils.cpp.

1034{
1035 COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
1038 std::vector<wxString> nicknames = tbl->GetLogicalLibs();
1039 wxArrayString headers;
1040 std::vector<wxArrayString> itemsToDisplay;
1041
1042 headers.Add( _( "Nickname" ) );
1043 headers.Add( _( "Description" ) );
1044
1045 for( const wxString& nickname : nicknames )
1046 {
1047 if( alg::contains( project.m_PinnedFootprintLibs, nickname )
1048 || alg::contains( cfg->m_Session.pinned_fp_libs, nickname ) )
1049 {
1050 wxArrayString item;
1051
1052 item.Add( LIB_TREE_MODEL_ADAPTER::GetPinningSymbol() + nickname );
1053 item.Add( tbl->GetDescription( nickname ) );
1054 itemsToDisplay.push_back( item );
1055 }
1056 }
1057
1058 for( const wxString& nickname : nicknames )
1059 {
1060 if( !alg::contains( project.m_PinnedFootprintLibs, nickname )
1061 && !alg::contains( cfg->m_Session.pinned_fp_libs, nickname ) )
1062 {
1063 wxArrayString item;
1064
1065 item.Add( nickname );
1066 item.Add( tbl->GetDescription( nickname ) );
1067 itemsToDisplay.push_back( item );
1068 }
1069 }
1070
1071 EDA_LIST_DIALOG* dlg = new EDA_LIST_DIALOG( this, _( "Save Footprint As" ), headers,
1072 itemsToDisplay, aLibraryPreselect, false );
1073
1074 dlg->SetListLabel( _( "Save in library:" ) );
1075 dlg->SetOKLabel( _( "Save" ) );
1076
1077 wxBoxSizer* bNameSizer = new wxBoxSizer( wxHORIZONTAL );
1078
1079 wxStaticText* label = new wxStaticText( dlg, wxID_ANY, _( "Name:" ) );
1080 bNameSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
1081
1082 wxTextCtrl* nameTextCtrl = new wxTextCtrl( dlg, ID_SAVE_AS_NAME, aFootprintName );
1083 bNameSizer->Add( nameTextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1084
1085 wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST );
1086 nameValidator.SetCharExcludes( FOOTPRINT::StringLibNameInvalidChars( false ) );
1087 nameTextCtrl->SetValidator( nameValidator );
1088
1089 wxButton* newLibraryButton = new wxButton( dlg, ID_MAKE_NEW_LIBRARY, _( "New Library..." ) );
1090 dlg->m_ButtonsSizer->Prepend( 80, 20 );
1091 dlg->m_ButtonsSizer->Prepend( newLibraryButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
1092
1093 dlg->GetSizer()->Prepend( bNameSizer, 0, wxEXPAND|wxTOP|wxLEFT|wxRIGHT, 5 );
1094
1095 dlg->Bind( wxEVT_BUTTON,
1096 [dlg]( wxCommandEvent& )
1097 {
1098 dlg->EndModal( ID_MAKE_NEW_LIBRARY );
1100
1101 // Move nameTextCtrl to the head of the tab-order
1102 if( dlg->GetChildren().DeleteObject( nameTextCtrl ) )
1103 dlg->GetChildren().Insert( nameTextCtrl );
1104
1105 dlg->SetInitialFocus( nameTextCtrl );
1106
1107 dlg->Layout();
1108 dlg->GetSizer()->Fit( dlg );
1109
1110 return dlg;
1111}
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
A dialog which shows:
void SetOKLabel(const wxString &aLabel)
void SetListLabel(const wxString &aLabel)
static const wxChar * StringLibNameInvalidChars(bool aUserReadable)
Test for validity of the name in a library of the footprint ( no spaces, dir separators ....
Definition: footprint.cpp:1529
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:192
const wxString GetDescription(const wxString &aNickname)
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
static const wxString GetPinningSymbol()
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:65
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:149
static int ID_MAKE_NEW_LIBRARY
static int ID_SAVE_AS_NAME
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
std::vector< wxString > pinned_fp_libs

References _, alg::contains(), LIB_TABLE::GetDescription(), LIB_TABLE::GetLogicalLibs(), LIB_TREE_MODEL_ADAPTER::GetPinningSymbol(), PROJECT::GetProjectFile(), ID_MAKE_NEW_LIBRARY, ID_SAVE_AS_NAME, KIWAY_HOLDER::Kiway(), EDA_LIST_DIALOG_BASE::m_ButtonsSizer, COMMON_SETTINGS::m_Session, PROJECT::PcbFootprintLibs(), Pgm(), COMMON_SETTINGS::SESSION::pinned_fp_libs, KIWAY::Prj(), KIWAY_HOLDER::Prj(), project, DIALOG_SHIM::SetInitialFocus(), EDA_LIST_DIALOG::SetListLabel(), EDA_LIST_DIALOG::SetOKLabel(), and FOOTPRINT::StringLibNameInvalidChars().

Referenced by SaveFootprintAs().

◆ CanCloseFPFromBoard()

bool FOOTPRINT_EDIT_FRAME::CanCloseFPFromBoard ( bool  doClose)

Definition at line 698 of file footprint_edit_frame.cpp.

699{
700 if( IsContentModified() )
701 {
702 wxString footprintName = GetBoard()->GetFirstFootprint()->GetReference();
703 wxString msg = _( "Save changes to '%s' before closing?" );
704
705 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
706 [&]() -> bool
707 {
708 return SaveFootprint( GetBoard()->GetFirstFootprint() );
709 } ) )
710 {
711 return false;
712 }
713 }
714
715 if( doClose )
716 {
717 GetInfoBar()->ShowMessageFor( wxEmptyString, 1 );
718 Clear_Pcb( false );
719 UpdateTitle();
720 }
721
722 return true;
723}
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:397
bool SaveFootprint(FOOTPRINT *aFootprint)
Save in an existing library a given footprint.
bool IsContentModified() const override
Get if any footprints or libraries have been modified but not saved.
bool Clear_Pcb(bool aQuery)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:97
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
Definition: wx_infobar.cpp:128
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition: confirm.cpp:260
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References _, Clear_Pcb(), Format(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFirstFootprint(), EDA_BASE_FRAME::GetInfoBar(), FOOTPRINT::GetReference(), HandleUnsavedChanges(), IsContentModified(), SaveFootprint(), WX_INFOBAR::ShowMessageFor(), and UpdateTitle().

◆ canCloseWindow()

bool FOOTPRINT_EDIT_FRAME::canCloseWindow ( wxCloseEvent &  Event)
overridevirtual

Reimplemented from PCB_BASE_FRAME.

Definition at line 726 of file footprint_edit_frame.cpp.

727{
728 if( IsContentModified() )
729 {
730 // Shutdown blocks must be determined and vetoed as early as possible
732 aEvent.GetId() == wxEVT_QUERY_END_SESSION )
733 {
734 aEvent.Veto();
735 return false;
736 }
737
738 wxString footprintName = GetBoard()->GetFirstFootprint()->GetFPID().GetLibItemName();
739
741 footprintName = GetBoard()->GetFirstFootprint()->GetReference();
742
743 wxString msg = _( "Save changes to '%s' before closing?" );
744
745 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
746 [&]() -> bool
747 {
748 return SaveFootprint( GetBoard()->GetFirstFootprint() );
749 } ) )
750 {
751 aEvent.Veto();
752 return false;
753 }
754 }
755
756 // Save footprint tree column widths
757 m_adapter->SaveSettings();
758
760}
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > m_adapter
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:72

References _, PCB_BASE_FRAME::canCloseWindow(), Format(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFirstFootprint(), FOOTPRINT::GetFPID(), LIB_ID::GetLibItemName(), FOOTPRINT::GetReference(), HandleUnsavedChanges(), IsContentModified(), IsCurrentFPFromBoard(), m_adapter, SaveFootprint(), and KIPLATFORM::APP::SupportsShutdownBlockReason().

◆ centerItemIdleHandler()

void FOOTPRINT_EDIT_FRAME::centerItemIdleHandler ( wxIdleEvent &  aEvent)
protected

Definition at line 114 of file footprint_editor_utils.cpp.

115{
117 Unbind( wxEVT_IDLE, &FOOTPRINT_EDIT_FRAME::centerItemIdleHandler, this );
118}
void centerItemIdleHandler(wxIdleEvent &aEvent)
LIB_TREE * GetLibTree() const
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
Definition: lib_tree.cpp:236

References centerItemIdleHandler(), LIB_TREE::CenterLibId(), FOOTPRINT_TREE_PANE::GetLibTree(), m_centerItemOnIdle, and m_treePane.

Referenced by centerItemIdleHandler(), and LoadFootprintFromLibrary().

◆ ChangeUserUnits()

void EDA_BASE_FRAME::ChangeUserUnits ( EDA_UNITS  aUnits)
inherited

Definition at line 1352 of file eda_base_frame.cpp.

1353{
1354 SetUserUnits( aUnits );
1356
1357 wxCommandEvent e( UNITS_CHANGED );
1358 e.SetClientData( this );
1359 ProcessEventLocally( e );
1360}
virtual void unitsChangeRefresh()
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void SetUserUnits(EDA_UNITS aUnits)

References UNITS_PROVIDER::SetUserUnits(), and EDA_BASE_FRAME::unitsChangeRefresh().

Referenced by COMMON_TOOLS::SwitchUnits(), and COMMON_TOOLS::ToggleUnits().

◆ CheckForAutoSaveFile()

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

Check 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.

Reimplemented in SCH_EDIT_FRAME.

Definition at line 1231 of file eda_base_frame.cpp.

1232{
1233 if( !IsGUI() )
1234 return;
1235
1236 wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
1237
1238 wxFileName autoSaveFileName = aFileName;
1239
1240 // Check for auto save file.
1241 autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
1242
1243 wxLogTrace( traceAutoSave,
1244 wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
1245
1246 if( !autoSaveFileName.FileExists() )
1247 return;
1248
1249 wxString msg = wxString::Format( _( "Well this is potentially embarrassing!\n"
1250 "It appears that the last time you were editing\n"
1251 "%s\n"
1252 "KiCad exited before saving.\n"
1253 "\n"
1254 "Do you wish to open the auto-saved file instead?" ),
1255 aFileName.GetFullName() );
1256
1257 int response = wxMessageBox( msg, Pgm().App().GetAppDisplayName(), wxYES_NO | wxICON_QUESTION,
1258 this );
1259
1260 // Make a backup of the current file, delete the file, and rename the auto save file to
1261 // the file name.
1262 if( response == wxYES )
1263 {
1264 if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
1265 {
1266 wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
1267 Pgm().App().GetAppDisplayName(), wxOK | wxICON_EXCLAMATION, this );
1268 }
1269 }
1270 else
1271 {
1272 wxLogTrace( traceAutoSave,
1273 wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
1274
1275 // Remove the auto save file when using the previous file as is.
1276 wxRemoveFile( autoSaveFileName.GetFullPath() );
1277 }
1278}
static wxString GetAutoSaveFilePrefix()
bool IsGUI()
Determine if the application is running with a GUI.
Definition: confirm.cpp:40
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.

References _, Format(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), IsGUI(), Pgm(), and traceAutoSave.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ Clear_Pcb()

bool FOOTPRINT_EDIT_FRAME::Clear_Pcb ( bool  aQuery)

Delete all and reinitialize the current board.

Parameters
aQuery= true to prompt user for confirmation, false to initialize silently

Definition at line 97 of file initpcb.cpp.

98{
99 if( GetBoard() == nullptr )
100 return false;
101
102 bool is_last_fp_from_brd = IsCurrentFPFromBoard();
103
104 if( aQuery && IsContentModified() )
105 {
106 wxSafeYield( this, true ); // Allow frame to come to front before showing warning.
107
109 this, _( "The current footprint has been modified. Save changes?" ),
110 [&]() -> bool
111 {
112 return SaveFootprint( GetBoard()->Footprints().front() );
113 } ) )
114 {
115 return false;
116 }
117 }
118
119 if( is_last_fp_from_brd )
120 m_boardFootprintUuids.clear();
121
122 // Clear undo and redo lists because we want a full deletion
124 GetScreen()->SetContentModified( false );
125
126 BOARD* board = new BOARD;
127
129 board->SynchronizeNetsAndNetClasses( true );
130 SetBoard( board );
131
132 // This board will only be used to hold a footprint for editing
134
135 // clear filename, to avoid overwriting an old file
136 GetBoard()->SetFileName( wxEmptyString );
137
139
140 return true;
141}
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:46
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
void SetFileName(const wxString &aFileName)
Definition: board.h:300
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1528
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Returns the BOARD_DESIGN_SETTINGS for the open project.
std::map< KIID, KIID > m_boardFootprintUuids
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...

References _, EDA_BASE_FRAME::ClearUndoRedoList(), FPHOLDER, PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignSettings(), GetDesignSettings(), PCB_BASE_FRAME::GetPageSizeIU(), PCB_BASE_FRAME::GetScreen(), HandleUnsavedChanges(), BASE_SCREEN::InitDataPoints(), IsContentModified(), IsCurrentFPFromBoard(), m_boardFootprintUuids, SaveFootprint(), PCB_BASE_EDIT_FRAME::SetBoard(), BOARD::SetBoardUse(), BASE_SCREEN::SetContentModified(), BOARD::SetFileName(), and BOARD::SynchronizeNetsAndNetClasses().

Referenced by CanCloseFPFromBoard(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), doCloseWindow(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), LoadFootprintFromBoard(), LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), OpenProjectFiles(), and RevertFootprint().

◆ ClearFileHistory()

void EDA_BASE_FRAME::ClearFileHistory ( FILE_HISTORY aFileHistory = nullptr)
inherited

Removes all files from the file history.

Parameters
aFileHistoryThe FILE_HISTORY in use. If null, the main application file history is used

Definition at line 969 of file eda_base_frame.cpp.

970{
971 if( !aFileHistory )
972 aFileHistory = m_fileHistory;
973
974 wxASSERT( aFileHistory );
975
976 aFileHistory->ClearFileHistory();
977
978 // Update the menubar to update the file history menu
979 if( GetMenuBar() )
980 {
982 GetMenuBar()->Refresh();
983 }
984}
FILE_HISTORY * m_fileHistory
void ClearFileHistory()
Clear all entries from the file history.

References FILE_HISTORY::ClearFileHistory(), EDA_BASE_FRAME::m_fileHistory, and EDA_BASE_FRAME::ReCreateMenuBar().

Referenced by GERBVIEW_FRAME::OnClearDrlFileHistory(), SCH_EDIT_FRAME::OnClearFileHistory(), KICAD_MANAGER_FRAME::OnClearFileHistory(), PL_EDITOR_FRAME::OnClearFileHistory(), PCB_EDIT_FRAME::OnClearFileHistory(), GERBVIEW_FRAME::OnClearGbrFileHistory(), GERBVIEW_FRAME::OnClearJobFileHistory(), and GERBVIEW_FRAME::OnClearZipFileHistory().

◆ ClearListAndDeleteItems()

void PCB_BASE_EDIT_FRAME::ClearListAndDeleteItems ( PICKED_ITEMS_LIST aList)
inherited

Definition at line 587 of file undo_redo.cpp.

588{
589 aList->ClearListAndDeleteItems( []( EDA_ITEM* item )
590 {
591 static_cast<BOARD_ITEM*>( item )->SetParentGroup( nullptr );
592 delete item;
593 } );
594}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
void ClearListAndDeleteItems(std::function< void(EDA_ITEM *)> aItemDeleter)
Delete the list of pickers AND the data pointed by #m_PickedItem or #m_PickedItemLink according to th...

References PICKED_ITEMS_LIST::ClearListAndDeleteItems().

Referenced by PCB_BASE_EDIT_FRAME::ClearUndoORRedoList(), PCB_EDIT_FRAME::Edit_Zone_Params(), BOARD_EDITOR_CONTROL::PlaceFootprint(), and PCB_BASE_EDIT_FRAME::RollbackFromUndo().

◆ ClearModify()

◆ ClearMsgPanel()

◆ ClearUndoORRedoList()

void PCB_BASE_EDIT_FRAME::ClearUndoORRedoList ( UNDO_REDO_LIST  whichList,
int  aItemCount = -1 
)
overridevirtualinherited

Free the undo or redo list from List element.

Wrappers are deleted. Data pointed by wrappers are deleted if not in use in schematic i.e. when they are copy of a schematic item or they are no more in use (DELETED). Items are removed from the beginning of the list so this function can be called to remove old commands.

Parameters
whichListthe UNDO_REDO_CONTAINER to clear.
aItemCountthe count of items to remove. < 0 for all items.

Reimplemented from EDA_BASE_FRAME.

Definition at line 563 of file undo_redo.cpp.

564{
565 if( aItemCount == 0 )
566 return;
567
568 UNDO_REDO_CONTAINER& list = whichList == UNDO_LIST ? m_undoList : m_redoList;
569 unsigned icnt = list.m_CommandsList.size();
570
571 if( aItemCount > 0 )
572 icnt = aItemCount;
573
574 for( unsigned ii = 0; ii < icnt; ii++ )
575 {
576 if( list.m_CommandsList.size() == 0 )
577 break;
578
579 PICKED_ITEMS_LIST* curr_cmd = list.m_CommandsList[0];
580 list.m_CommandsList.erase( list.m_CommandsList.begin() );
581 ClearListAndDeleteItems( curr_cmd );
582 delete curr_cmd; // Delete command
583 }
584}
UNDO_REDO_CONTAINER m_undoList
UNDO_REDO_CONTAINER m_redoList
void ClearListAndDeleteItems(PICKED_ITEMS_LIST *aList)
Definition: undo_redo.cpp:587
A holder to handle a list of undo (or redo) commands.
std::vector< PICKED_ITEMS_LIST * > m_CommandsList

References PCB_BASE_EDIT_FRAME::ClearListAndDeleteItems(), UNDO_REDO_CONTAINER::m_CommandsList, EDA_BASE_FRAME::m_redoList, EDA_BASE_FRAME::m_undoList, and EDA_BASE_FRAME::UNDO_LIST.

Referenced by PCB_BASE_EDIT_FRAME::saveCopyInUndoList().

◆ ClearUndoRedoList()

◆ CloseFootprintEditor()

void FOOTPRINT_EDIT_FRAME::CloseFootprintEditor ( wxCommandEvent &  Event)

Definition at line 794 of file footprint_edit_frame.cpp.

795{
796 Close();
797}

◆ commonInit()

void EDA_BASE_FRAME::commonInit ( FRAME_T  aFrameType)
privateinherited

Collect common initialization functions used in all CTORs.

Definition at line 117 of file eda_base_frame.cpp.

118{
119 m_ident = aFrameType;
120 m_maximizeByDefault = false;
121 m_infoBar = nullptr;
122 m_settingsManager = nullptr;
123 m_fileHistory = nullptr;
124 m_supportsAutoSave = false;
125 m_autoSavePending = false;
127 m_isClosing = false;
128 m_isNonUserClose = false;
129 m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
130 m_autoSaveRequired = false;
132 m_frameSize = defaultSize( aFrameType );
133 m_displayIndex = -1;
134
135 m_auimgr.SetArtProvider( new WX_AUI_DOCK_ART() );
136
137 m_settingsManager = &Pgm().GetSettingsManager();
138
139 // Set a reasonable minimal size for the frame
140 SetSizeHints( minSize( aFrameType ).x, minSize( aFrameType ).y, -1, -1, -1, -1 );
141
142 // Store dimensions of the user area of the main window.
143 GetClientSize( &m_frameSize.x, &m_frameSize.y );
144
145 Connect( ID_AUTO_SAVE_TIMER, wxEVT_TIMER,
146 wxTimerEventHandler( EDA_BASE_FRAME::onAutoSaveTimer ) );
147
148 // hook wxEVT_CLOSE_WINDOW so we can call SaveSettings(). This function seems
149 // to be called before any other hook for wxCloseEvent, which is necessary.
150 Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_BASE_FRAME::windowClosing ) );
151
152 initExitKey();
153}
void windowClosing(wxCloseEvent &event)
(with its unexpected name so it does not collide with the real OnWindowClose() function provided in d...
void initExitKey()
Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id.
WX_INFOBAR * m_infoBar
void onAutoSaveTimer(wxTimerEvent &aEvent)
Handle the auto save timer event.
wxTimer * m_autoSaveTimer
SETTINGS_MANAGER * m_settingsManager
bool m_isClosing
Set by NonUserClose() to indicate that the user did not request the current close.
wxString m_mruPath
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
Definition: paths.cpp:139
static const wxSize minSize(FRAME_T aFrameType)
static const wxSize defaultSize(FRAME_T aFrameType)
#define DEFAULT_MAX_UNDO_ITEMS
@ ID_AUTO_SAVE_TIMER
Definition: id.h:79

References DEFAULT_MAX_UNDO_ITEMS, defaultSize(), PATHS::GetDefaultUserProjectsPath(), ID_AUTO_SAVE_TIMER, minSize(), EDA_BASE_FRAME::onAutoSaveTimer(), Pgm(), and EDA_BASE_FRAME::windowClosing().

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

◆ CommonSettingsChanged()

void FOOTPRINT_EDIT_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged,
bool  aTextVarsChanged 
)
overridevirtual

Called after the preferences dialog is run.

Reimplemented from PCB_BASE_FRAME.

Definition at line 1256 of file footprint_edit_frame.cpp.

1257{
1258 PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1259
1260 auto cfg = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
1261 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1262
1263 GetBoard()->GetDesignSettings() = cfg->m_DesignSettings;
1264
1268
1270
1271 if( aEnvVarsChanged )
1272 SyncLibraryTree( true );
1273
1274 Layout();
1275 SendSizeEvent();
1276}
void ForceRefresh()
Force a redraw.
void SyncLibraryTree(bool aProgress)
Synchronize the footprint library tree to the current state of the footprint library table.
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:761
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:617
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:49

References PCB_BASE_FRAME::CommonSettingsChanged(), EDA_DRAW_PANEL_GAL::ForceRefresh(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), BOARD::GetDesignSettings(), EDA_DRAW_FRAME::GetGalDisplayOptions(), PCB_DRAW_PANEL_GAL::GetView(), KIGFX::VIEW::MarkTargetDirty(), Pgm(), KIGFX::GAL_DISPLAY_OPTIONS::ReadWindowSettings(), SyncLibraryTree(), KIGFX::TARGET_NONCACHED, KIGFX::VIEW::UpdateAllLayersColor(), and UpdateUserInterface().

◆ Compile_Ratsnest()

void PCB_BASE_FRAME::Compile_Ratsnest ( bool  aDisplayStatus)
inherited

Create the entire board ratsnest.

Function Compile_Ratsnest Create the entire board ratsnest.

This must be called after a board change (changes for pads, footprints or a read netlist ).

Parameters
aDisplayStatusif true, display the computation results.

Must be called after a board change (changes for pads, footprints or a read netlist ).

Parameters
aDisplayStatus: if true, display the computation results

Definition at line 35 of file ratsnest.cpp.

36{
37 GetBoard()->GetConnectivity()->RecalculateRatsnest();
39
40 if( aDisplayStatus )
42}
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition: board.cpp:270
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:424
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.

References PCB_BASE_FRAME::GetBoard(), BOARD::GetConnectivity(), PCB_BASE_FRAME::m_pcb, EDA_DRAW_FRAME::SetMsgPanel(), and BOARD::UpdateRatsnestExclusions().

Referenced by DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::OnNetlistChanged(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), PCB_BASE_FRAME::PlaceFootprint(), and PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

◆ config()

APP_SETTINGS_BASE * FOOTPRINT_EDIT_FRAME::config ( ) const
overridevirtual

Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.

Reimplemented from EDA_BASE_FRAME.

Definition at line 590 of file footprint_edit_frame.cpp.

591{
593 : Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
594}

References m_editorSettings, and Pgm().

Referenced by setupTools().

◆ ConfigBaseName()

wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineoverridevirtualinherited

Get the configuration base name.

This is usually the name of the frame set by CTOR, except for frames shown in multiple modes in which case the m_configName must be set to the base name so that a single configuration can be used.

Returns
a base name prefix used in Load/Save settings to build the full name of keys used in configuration.

Reimplemented from TOOLS_HOLDER.

Definition at line 350 of file eda_base_frame.h.

351 {
352 wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
353 return baseCfgName;
354 }
wxString m_configName

References EDA_BASE_FRAME::m_configName.

◆ CreateAndShow3D_Frame()

EDA_3D_VIEWER_FRAME * PCB_BASE_FRAME::CreateAndShow3D_Frame ( )
inherited

Shows the 3D view frame.

If it does not exist, it is created. If it exists, it is brought to the foreground.

Definition at line 721 of file pcb_base_frame.cpp.

722{
723 EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
724
725 if( !draw3DFrame )
726 draw3DFrame = new EDA_3D_VIEWER_FRAME( &Kiway(), this, _( "3D Viewer" ) );
727
728 // Raising the window does not show the window on Windows if iconized. This should work
729 // on any platform.
730 if( draw3DFrame->IsIconized() )
731 draw3DFrame->Iconize( false );
732
733 draw3DFrame->Raise();
734 draw3DFrame->Show( true );
735
736 // Raising the window does not set the focus on Linux. This should work on any platform.
737 if( wxWindow::FindFocus() != draw3DFrame )
738 draw3DFrame->SetFocus();
739
740 // Allocate a slice of time to display the 3D frame
741 // a call to wxSafeYield() should be enough (and better), but on Linux we need
742 // to call wxYield()
743 // otherwise the activity messages are not displayed during the first board loading
744 wxYield();
745
746 // Note, the caller is responsible to load/update the board 3D view.
747 // after frame creation the board is not automatically created.
748
749 return draw3DFrame;
750}
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
EDA_3D_VIEWER_FRAME * Get3DViewerFrame()

References _, PCB_BASE_FRAME::Get3DViewerFrame(), and KIWAY_HOLDER::Kiway().

Referenced by PCB_VIEWER_TOOLS::Show3DViewer().

◆ CreateInfoBar()

void EDA_BASE_FRAME::CreateInfoBar ( )
inherited

Definition at line 834 of file eda_base_frame.cpp.

835{
836#if defined( __WXOSX_MAC__ )
838#else
839 m_infoBar = new WX_INFOBAR( this, &m_auimgr );
840
841 m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( wxS( "InfoBar" ) ).Top().Layer(1) );
842#endif
843}
virtual wxWindow * GetToolCanvas() const =0
Canvas access.
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75

References TOOLS_HOLDER::GetToolCanvas(), EDA_BASE_FRAME::m_auimgr, and EDA_BASE_FRAME::m_infoBar.

Referenced by SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME().

◆ CreateNewFootprint()

FOOTPRINT * PCB_BASE_FRAME::CreateNewFootprint ( const wxString &  aFootprintName,
bool  aQuiet = false 
)
inherited

Creates a new footprint, at position 0,0.

The new footprint contains only 2 texts: a reference and a value: Reference = REF** Value = "VAL**" or Footprint name in lib

Note
They are dummy texts, which will be replaced by the actual texts when the footprint is placed on a board and a netlist is read.
Parameters
aFootprintNameis the name of the new footprint in library.
aQuietprevents user dialogs from being shown

Definition at line 1247 of file footprint_libraries_utils.cpp.

1248{
1249 wxString footprintName = aFootprintName;
1250
1251 // Static to store user preference for a session
1252 static int footprintType = 1;
1253 int footprintTranslated = FP_SMD;
1254
1255 // Ask for the new footprint name
1256 if( footprintName.IsEmpty() && !aQuiet )
1257 {
1258 WX_TEXT_ENTRY_DIALOG dlg( this, _( "Enter footprint name:" ), _( "New Footprint" ),
1259 footprintName, _( "Footprint type:" ),
1260 { _( "Through hole" ), _( "SMD" ), _( "Other" ) },
1261 footprintType );
1262 dlg.SetTextValidator( FOOTPRINT_NAME_VALIDATOR( &footprintName ) );
1263
1264 if( dlg.ShowModal() != wxID_OK )
1265 return nullptr; //Aborted by user
1266
1267 footprintType = dlg.GetChoice();
1268
1269 switch( footprintType )
1270 {
1271 case 0: footprintTranslated = FP_THROUGH_HOLE; break;
1272 case 1: footprintTranslated = FP_SMD; break;
1273 default: footprintTranslated = 0; break;
1274 }
1275 }
1276
1277 footprintName.Trim( true );
1278 footprintName.Trim( false );
1279
1280 if( footprintName.IsEmpty() )
1281 {
1282 if( !aQuiet )
1283 DisplayInfoMessage( this, _( "No footprint name defined." ) );
1284
1285 return nullptr;
1286 }
1287
1288 // Creates the new footprint and add it to the head of the linked list of footprints
1289 FOOTPRINT* footprint = new FOOTPRINT( GetBoard() );
1290
1291 // Update its name in lib
1292 footprint->SetFPID( LIB_ID( wxEmptyString, footprintName ) );
1293
1294 footprint->SetAttributes( footprintTranslated );
1295
1296 PCB_LAYER_ID txt_layer;
1297 wxPoint default_pos;
1299
1300 footprint->Reference().SetText( settings.m_DefaultFPTextItems[0].m_Text );
1301 footprint->Reference().SetVisible( settings.m_DefaultFPTextItems[0].m_Visible );
1302 txt_layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[0].m_Layer;
1303 footprint->Reference().SetLayer( txt_layer );
1304 default_pos.y -= settings.GetTextSize( txt_layer ).y / 2;
1305 footprint->Reference().SetPosition( default_pos );
1306 default_pos.y += settings.GetTextSize( txt_layer ).y;
1307
1308 footprint->Value().SetText( settings.m_DefaultFPTextItems[1].m_Text );
1309 footprint->Value().SetVisible( settings.m_DefaultFPTextItems[1].m_Visible );
1310 txt_layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[1].m_Layer;
1311 footprint->Value().SetLayer( txt_layer );
1312 default_pos.y += settings.GetTextSize( txt_layer ).y / 2;
1313 footprint->Value().SetPosition( default_pos );
1314 default_pos.y += settings.GetTextSize( txt_layer ).y;
1315
1316 for( size_t i = 2; i < settings.m_DefaultFPTextItems.size(); ++i )
1317 {
1318 FP_TEXT* textItem = new FP_TEXT( footprint );
1319 textItem->SetText( settings.m_DefaultFPTextItems[i].m_Text );
1320 textItem->SetVisible( settings.m_DefaultFPTextItems[i].m_Visible );
1321 txt_layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[i].m_Layer;
1322 textItem->SetLayer( txt_layer );
1323 default_pos.y += settings.GetTextSize( txt_layer ).y / 2;
1324 textItem->SetPosition( default_pos );
1325 default_pos.y += settings.GetTextSize( txt_layer ).y;
1326 footprint->GraphicalItems().push_back( textItem );
1327 }
1328
1329 if( footprint->GetReference().IsEmpty() )
1330 footprint->SetReference( footprintName );
1331
1332 if( footprint->GetValue().IsEmpty() )
1333 footprint->SetValue( footprintName );
1334
1335 footprint->RunOnChildren(
1336 [&] ( BOARD_ITEM* aChild )
1337 {
1338 if( aChild->Type() == PCB_FP_TEXT_T )
1339 {
1340 FP_TEXT* textItem = static_cast<FP_TEXT*>( aChild );
1341 PCB_LAYER_ID layer = textItem->GetLayer();
1342
1343 textItem->SetTextThickness( settings.GetTextThickness( layer ) );
1344 textItem->SetTextSize( settings.GetTextSize( layer ) );
1345 textItem->SetItalic( settings.GetTextItalic( layer ) );
1346 textItem->SetKeepUpright( settings.GetTextUpright( layer ) );
1347 }
1348 } );
1349
1350 SetMsgPanel( footprint );
1351 return footprint;
1352}
Container for design settings for a BOARD object.
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
bool GetTextUpright(PCB_LAYER_ID aLayer) const
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
bool GetTextItalic(PCB_LAYER_ID aLayer) const
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:192
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:226
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:217
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:185
void SetKeepUpright(bool aKeepUpright)
Definition: eda_text.cpp:256
void SetTextSize(const VECTOR2I &aNewSize)
Definition: eda_text.cpp:347
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:163
void SetItalic(bool aItalic)
Definition: eda_text.cpp:201
This class provides a custom wxValidator object for limiting the allowable characters when defining f...
Definition: validators.h:64
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:213
void SetAttributes(int aAttributes)
Definition: footprint.h:251
void SetReference(const wxString &aReference)
Definition: footprint.h:528
void SetValue(const wxString &aValue)
Definition: footprint.h:555
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:567
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1381
const wxString & GetValue() const
Definition: footprint.h:547
DRAWINGS & GraphicalItems()
Definition: footprint.h:173
FP_TEXT & Reference()
Definition: footprint.h:568
virtual void SetPosition(const VECTOR2I &aPos) override
Definition: fp_text.h:92
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
A KICAD version of wxTextEntryDialog which supports the various improvements/work-arounds from DIALOG...
void SetTextValidator(wxTextValidatorStyle style)
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:352
@ FP_SMD
Definition: footprint.h:69
@ FP_THROUGH_HOLE
Definition: footprint.h:68
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92

References _, DisplayInfoMessage(), FP_SMD, FP_THROUGH_HOLE, PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_ITEM::GetLayer(), FOOTPRINT::GetReference(), BOARD_DESIGN_SETTINGS::GetTextItalic(), BOARD_DESIGN_SETTINGS::GetTextSize(), BOARD_DESIGN_SETTINGS::GetTextThickness(), BOARD_DESIGN_SETTINGS::GetTextUpright(), FOOTPRINT::GetValue(), FOOTPRINT::GraphicalItems(), BOARD_DESIGN_SETTINGS::m_DefaultFPTextItems, PCB_FP_TEXT_T, FOOTPRINT::Reference(), FOOTPRINT::RunOnChildren(), FOOTPRINT::SetAttributes(), FOOTPRINT::SetFPID(), EDA_TEXT::SetItalic(), EDA_TEXT::SetKeepUpright(), BOARD_ITEM::SetLayer(), EDA_DRAW_FRAME::SetMsgPanel(), FP_TEXT::SetPosition(), FOOTPRINT::SetReference(), EDA_TEXT::SetText(), EDA_TEXT::SetTextSize(), EDA_TEXT::SetTextThickness(), WX_TEXT_ENTRY_DIALOG::SetTextValidator(), FOOTPRINT::SetValue(), EDA_TEXT::SetVisible(), EDA_ITEM::Type(), and FOOTPRINT::Value().

Referenced by MICROWAVE_TOOL::createBaseFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), and FOOTPRINT_EDITOR_CONTROL::NewFootprint().

◆ createNewLibrary()

wxString PCB_BASE_EDIT_FRAME::createNewLibrary ( const wxString &  aLibName,
const wxString &  aProposedName,
FP_LIB_TABLE aTable 
)
protectedinherited

Create a new library in the given table (presumed to be either the global or project library table).

Definition at line 402 of file footprint_libraries_utils.cpp.

405{
406 // Kicad cannot write legacy format libraries, only .pretty new format because the legacy
407 // format cannot handle current features.
408 // The footprint library is actually a directory.
409
410 if( aTable == nullptr )
411 return wxEmptyString;
412
413 wxString initialPath = aProposedName.IsEmpty() ? Prj().GetProjectPath() : aProposedName;
414 wxFileName fn;
415 bool doAdd = false;
416 bool isGlobal = ( aTable == &GFootprintTable );
417
418 if( aLibName.IsEmpty() )
419 {
420 fn = initialPath;
421
423 KiCadFootprintLibPathExtension, false, isGlobal,
425 {
426 return wxEmptyString;
427 }
428
429 doAdd = true;
430 }
431 else
432 {
433 fn = aLibName;
434
435 if( !fn.IsAbsolute() )
436 {
437 fn.SetName( aLibName );
438 fn.MakeAbsolute( initialPath );
439 }
440
441 // Enforce the .pretty extension:
443 }
444
445 // We can save fp libs only using IO_MGR::KICAD_SEXP format (.pretty libraries)
447 wxString libPath = fn.GetFullPath();
448
449 try
450 {
451 PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
452
453 bool writable = false;
454 bool exists = false;
455
456 try
457 {
458 writable = pi->IsFootprintLibWritable( libPath );
459 exists = true; // no exception was thrown, lib must exist.
460 }
461 catch( const IO_ERROR& )
462 {
463 // best efforts....
464 }
465
466 if( exists )
467 {
468 if( !writable )
469 {
470 wxString msg = wxString::Format( _( "Library %s is read only." ), libPath );
471 ShowInfoBarError( msg );
472 return wxEmptyString;
473 }
474 else
475 {
476 wxString msg = wxString::Format( _( "Library %s already exists." ), libPath );
477 KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
478 dlg.SetOKLabel( _( "Overwrite" ) );
479 dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
480
481 if( dlg.ShowModal() == wxID_CANCEL )
482 return wxEmptyString;
483
484 pi->FootprintLibDelete( libPath );
485 }
486 }
487
488 pi->FootprintLibCreate( libPath );
489 }
490 catch( const IO_ERROR& ioe )
491 {
492 DisplayError( this, ioe.What() );
493 return wxEmptyString;
494 }
495
496 if( doAdd )
497 AddLibrary( libPath, aTable );
498
499 return libPath;
500}
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:46
bool AddLibrary(const wxString &aLibName=wxEmptyString, FP_LIB_TABLE *aTable=nullptr)
Add an existing library to either the global or project library table.
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:564
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:126

References _, PCB_BASE_EDIT_FRAME::AddLibrary(), DisplayError(), KIDIALOG::DoNotShowCheckbox(), PLUGIN::FootprintLibCreate(), PLUGIN::FootprintLibDelete(), Format(), PATHS::GetDefaultUserFootprintsPath(), PROJECT::GetProjectPath(), GFootprintTable, PLUGIN::IsFootprintLibWritable(), IO_MGR::KICAD_SEXP, KiCadFootprintLibPathExtension, KiCadFootprintLibPathWildcard(), EDA_DRAW_FRAME::LibraryFileBrowser(), IO_MGR::PluginFind(), KIWAY_HOLDER::Prj(), EDA_BASE_FRAME::ShowInfoBarError(), KIDIALOG::ShowModal(), and IO_ERROR::What().

Referenced by PCB_BASE_EDIT_FRAME::CreateNewLibrary(), and PCB_BASE_EDIT_FRAME::CreateNewProjectLibrary().

◆ CreateNewLibrary()

wxString PCB_BASE_EDIT_FRAME::CreateNewLibrary ( const wxString &  aLibName = wxEmptyString,
const wxString &  aProposedName = wxEmptyString 
)
inherited

If a library name is given, creates a new footprint library in the project folder with the given name.

If no library name is given it prompts user for a library path, then creates a new footprint library at that location. If library exists, user is warned about that, and is given a chance to abort the new creation, and in that case existing library is first deleted.

Parameters
aProposedNameis the initial path and filename shown in the file chooser dialog.
Returns
The newly created library path if library was successfully created, else wxEmptyString because user aborted or error.

Definition at line 393 of file footprint_libraries_utils.cpp.

395{
396 FP_LIB_TABLE* table = selectLibTable();
397
398 return createNewLibrary( aLibName, aProposedName, table );
399}
wxString createNewLibrary(const wxString &aLibName, const wxString &aProposedName, FP_LIB_TABLE *aTable)
Create a new library in the given table (presumed to be either the global or project library table).

References PCB_BASE_EDIT_FRAME::createNewLibrary(), and PCB_BASE_EDIT_FRAME::selectLibTable().

Referenced by PCB_EDIT_FRAME::ExportFootprintsToLibrary(), SaveFootprintAs(), and SaveLibraryAs().

◆ CreateNewProjectLibrary()

wxString PCB_BASE_EDIT_FRAME::CreateNewProjectLibrary ( const wxString &  aLibName = wxEmptyString,
const wxString &  aProposedName = wxEmptyString 
)
inherited

Definition at line 386 of file footprint_libraries_utils.cpp.

388{
389 return createNewLibrary( aLibName, aProposedName, Prj().PcbFootprintLibs() );
390}

References PCB_BASE_EDIT_FRAME::createNewLibrary(), and KIWAY_HOLDER::Prj().

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ CreateServer()

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

Definition at line 43 of file eda_dde.cpp.

44{
45 wxIPV4address addr;
46
47 // Set the port number
48 addr.Service( service );
49
50 // Listen on localhost only if requested
51 if( local )
52 addr.Hostname( HOSTNAME );
53
54 if( m_socketServer )
55 {
56 // this helps prevent any events that could come in during deletion
57 m_socketServer->Notify( false );
58 delete m_socketServer;
59 }
60
61 m_socketServer = new wxSocketServer( addr );
62
63 m_socketServer->SetNotify( wxSOCKET_CONNECTION_FLAG );
64 m_socketServer->SetEventHandler( *this, ID_EDA_SOCKET_EVENT_SERV );
65 m_socketServer->Notify( true );
66}
wxSocketServer * m_socketServer
Definition: kiway_player.h:204
static const wxString HOSTNAME(wxT("localhost"))
@ ID_EDA_SOCKET_EVENT_SERV
Definition: id.h:163

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

Referenced by SaveFileAs().

◆ CurrentToolName()

std::string TOOLS_HOLDER::CurrentToolName ( ) const
inherited

Definition at line 110 of file tools_holder.cpp.

111{
112 if( m_toolStack.empty() )
114 else
115 return m_toolStack.back();
116}
static TOOL_ACTION selectionTool
Definition: actions.h:156
std::vector< std::string > m_toolStack
Definition: tools_holder.h:176
const std::string & GetName() const
Return name of the action.
Definition: tool_action.h:101

References TOOL_ACTION::GetName(), TOOLS_HOLDER::m_toolStack, and ACTIONS::selectionTool.

Referenced by TOOLS_HOLDER::ShowChangedLanguage().

◆ DeleteFootprintFromLibrary()

bool FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary ( const LIB_ID aFPID,
bool  aConfirm 
)

Delete the given footprint from its library.

Definition at line 620 of file footprint_libraries_utils.cpp.

621{
622 if( !aFPID.IsValid() )
623 return false;
624
625 wxString nickname = aFPID.GetLibNickname();
626 wxString fpname = aFPID.GetLibItemName();
627
628 // Legacy libraries are readable, but modifying legacy format is not allowed
629 // So prompt the user if he try to delete a footprint from a legacy lib
630 wxString libfullname = Prj().PcbFootprintLibs()->FindRow( nickname )->GetFullURI();
631
633 {
635 return false;
636 }
637
638 if( !Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname ) )
639 {
640 wxString msg = wxString::Format( _( "Library '%s' is read only." ), nickname );
641 ShowInfoBarError( msg );
642 return false;
643 }
644
645 // Confirmation
646 wxString msg = wxString::Format( _( "Delete footprint '%s' from library '%s'?" ),
647 fpname.GetData(),
648 nickname.GetData() );
649
650 if( aConfirm && !IsOK( this, msg ) )
651 return false;
652
653 try
654 {
655 Prj().PcbFootprintLibs()->FootprintDelete( nickname, fpname );
656 }
657 catch( const IO_ERROR& ioe )
658 {
659 DisplayError( this, ioe.What() );
660 return false;
661 }
662
663 msg.Printf( _( "Footprint '%s' deleted from library '%s'" ),
664 fpname.GetData(),
665 nickname.GetData() );
666
667 SetStatusText( msg );
668
669 return true;
670}
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table frag...
void FootprintDelete(const wxString &aNickname, const wxString &aFootprintName)
Delete the aFootprintName from the library given by aNickname.
@ LEGACY
Legacy Pcbnew file formats prior to s-expression.
Definition: io_mgr.h:55
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:380
static const wxString INFO_LEGACY_LIB_WARN_DELETE(_("Modifying legacy libraries (.mod files) is not allowed\n" "Please save the current library under the new .pretty format\n" "and update your footprint lib table\n" "before deleting a footprint"))

References _, DisplayError(), DisplayInfoMessage(), FP_LIB_TABLE::FindRow(), FP_LIB_TABLE::FootprintDelete(), Format(), LIB_TABLE_ROW::GetFullURI(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), IO_MGR::GuessPluginTypeFromLibPath(), INFO_LEGACY_LIB_WARN_DELETE(), IsOK(), LIB_ID::IsValid(), IO_MGR::LEGACY, PROJECT::PcbFootprintLibs(), KIWAY_HOLDER::Prj(), EDA_BASE_FRAME::ShowInfoBarError(), and IO_ERROR::What().

Referenced by SaveFootprint().

◆ Destroy()

◆ DismissModal()

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

Definition at line 182 of file kiway_player.cpp.

183{
184 m_modal_ret_val = aRetVal;
185 m_modal_string = aResult;
186
187 if( m_modal_loop )
188 {
189 m_modal_loop->Exit();
190 m_modal_loop = nullptr; // this marks it as dismissed.
191 }
192
193 Show( false );
194}
wxString m_modal_string
Definition: kiway_player.h:201
WX_EVENT_LOOP * m_modal_loop
< Points to nested event_loop. NULL means not modal and dismissed.
Definition: kiway_player.h:199
bool m_modal_ret_val
Definition: kiway_player.h:202

References KIWAY_PLAYER::m_modal_loop, KIWAY_PLAYER::m_modal_ret_val, and KIWAY_PLAYER::m_modal_string.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SYMBOL_VIEWER_FRAME::doCloseWindow(), FOOTPRINT_VIEWER_FRAME::doCloseWindow(), FOOTPRINT_WIZARD_FRAME::doCloseWindow(), FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint(), and SYMBOL_VIEWER_FRAME::FinishModal().

◆ DisplayConstraintsMsg()

void EDA_DRAW_FRAME::DisplayConstraintsMsg ( const wxString &  msg)
inherited

Definition at line 602 of file eda_draw_frame.cpp.

603{
604 SetStatusText( msg, 7 );
605}

Referenced by EDIT_TOOL::doMoveSelection(), and DRAWING_TOOL::UpdateStatusBar().

◆ DisplayGridMsg()

void PCB_BASE_FRAME::DisplayGridMsg ( )
overridevirtualinherited

Display the current grid pane on the status bar.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 820 of file pcb_base_frame.cpp.

821{
822 VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
823 wxString line;
824
825 line.Printf( wxT( "grid X %s Y %s" ),
826 MessageTextFromValue( gridSize.x, false ),
827 MessageTextFromValue( gridSize.y, false ) );
828
829 SetStatusText( line, 4 );
830}
const VECTOR2D & GetGridSize() const
Return the grid size.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().

References PCB_BASE_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetGAL(), KIGFX::GAL::GetGridSize(), UNITS_PROVIDER::MessageTextFromValue(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PCB_BASE_FRAME::UpdateStatusBar().

◆ DisplayToolMsg()

void EDA_DRAW_FRAME::DisplayToolMsg ( const wxString &  msg)
overridevirtualinherited

Reimplemented from TOOLS_HOLDER.

Definition at line 596 of file eda_draw_frame.cpp.

597{
598 SetStatusText( msg, 6 );
599}

Referenced by EDIT_TOOL::Duplicate(), and PCB_CONTROL::Paste().

◆ DisplayUnitsMsg()

void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Display current unit pane in the status bar.

Definition at line 618 of file eda_draw_frame.cpp.

619{
620 wxString msg;
621
622 switch( GetUserUnits() )
623 {
624 case EDA_UNITS::INCHES: msg = _( "inches" ); break;
625 case EDA_UNITS::MILS: msg = _( "mils" ); break;
626 case EDA_UNITS::MILLIMETRES: msg = _( "mm" ); break;
627 default: msg = _( "Units" ); break;
628 }
629
630 SetStatusText( msg, 5 );
631}
EDA_UNITS GetUserUnits() const

References _, UNITS_PROVIDER::GetUserUnits(), INCHES, MILLIMETRES, and MILS.

Referenced by EDA_DRAW_FRAME::UpdateGridSelectBox(), SCH_BASE_FRAME::UpdateStatusBar(), and EDA_DRAW_FRAME::UpdateStatusBar().

◆ doAutoSave()

bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

This 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 SCH_EDIT_FRAME, and PCB_EDIT_FRAME.

Definition at line 318 of file eda_base_frame.cpp.

319{
320 wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
321}

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

◆ doCloseWindow()

void FOOTPRINT_EDIT_FRAME::doCloseWindow ( )
overridevirtual

Reimplemented from EDA_BASE_FRAME.

Definition at line 763 of file footprint_edit_frame.cpp.

764{
765 // No more vetos
766 GetCanvas()->SetEventDispatcher( nullptr );
768
769 // Do not show the layer manager during closing to avoid flicker
770 // on some platforms (Windows) that generate useless redraw of items in
771 // the Layer Manager
772 m_auimgr.GetPane( wxT( "LayersManager" ) ).Show( false );
773 m_auimgr.GetPane( wxT( "SelectionFilter" ) ).Show( false );
774
775 Clear_Pcb( false );
776
778
779 if( mgr->IsProjectOpen() && wxFileName::IsDirWritable( Prj().GetProjectPath() ) )
780 {
781 GFootprintList.WriteCacheToFile( Prj().GetProjectPath() + wxT( "fp-info-cache" ) );
782 }
783
785}
SETTINGS_MANAGER * GetSettingsManager() const
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void WriteCacheToFile(const wxString &aFilePath) override
bool IsProjectOpen() const
Helper for checking if we have a project open TODO: This should be deprecated along with Prj() once w...
void FlushAndRelease(JSON_SETTINGS *aSettings, bool aSave=true)
If the given settings object is registered, save it to disk and unregister it.
FOOTPRINT_LIST_IMPL GFootprintList
The global footprint info table.
Definition: cvpcb.cpp:140

References Clear_Pcb(), SETTINGS_MANAGER::FlushAndRelease(), PCB_BASE_FRAME::GetCanvas(), GetSettings(), EDA_BASE_FRAME::GetSettingsManager(), GFootprintList, SETTINGS_MANAGER::IsProjectOpen(), EDA_BASE_FRAME::m_auimgr, KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL_GAL::SetEventDispatcher(), EDA_DRAW_PANEL_GAL::StopDrawing(), and FOOTPRINT_LIST_IMPL::WriteCacheToFile().

◆ doReCreateMenuBar()

void FOOTPRINT_EDIT_FRAME::doReCreateMenuBar ( )
overrideprotectedvirtual

(Re)Create the menubar for the Footprint Editor frame

Reimplemented from PCB_BASE_FRAME.

Definition at line 39 of file menubar_footprint_editor.cpp.

40{
42 // wxWidgets handles the Mac Application menu behind the scenes, but that means
43 // we always have to start from scratch with a new wxMenuBar.
44 wxMenuBar* oldMenuBar = GetMenuBar();
45 WX_MENUBAR* menuBar = new WX_MENUBAR();
46
47 //-- File menu ----------------------------------------------------------
48 //
49 ACTION_MENU* fileMenu = new ACTION_MENU( false, selTool );
50
51 fileMenu->Add( ACTIONS::newLibrary );
52 fileMenu->Add( ACTIONS::addLibrary );
53 fileMenu->Add( PCB_ACTIONS::newFootprint );
55
56 fileMenu->AppendSeparator();
57
58 fileMenu->Add( ACTIONS::save );
59 fileMenu->Add( ACTIONS::saveAs );
60 fileMenu->Add( ACTIONS::revert );
61
62 fileMenu->AppendSeparator();
63
64 ACTION_MENU* submenuImport = new ACTION_MENU( false, selTool );
65 submenuImport->SetTitle( _( "Import" ) );
66 submenuImport->SetIcon( BITMAPS::import );
67
68 submenuImport->Add( PCB_ACTIONS::importFootprint, ACTION_MENU::NORMAL, _( "Footprint..." ) );
69 submenuImport->Add( PCB_ACTIONS::placeImportedGraphics, ACTION_MENU::NORMAL, _( "Graphics..." ) );
70
71 fileMenu->Add( submenuImport );
72
73 ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
74 submenuExport->SetTitle( _( "Export" ) );
75 submenuExport->SetIcon( BITMAPS::export_file );
76
77 submenuExport->Add( PCB_ACTIONS::exportFootprint, ACTION_MENU::NORMAL, _( "Footprint..." ) );
78 submenuExport->Add( _( "View as &PNG..." ),
79 _( "Create a PNG file from the current view" ),
82
83 fileMenu->Add( submenuExport );
84
85 fileMenu->AppendSeparator();
87
88 fileMenu->AppendSeparator();
89 fileMenu->Add( ACTIONS::print );
90
91 fileMenu->AppendSeparator();
92 fileMenu->AddClose( _( "Footprint Editor" ) );
93
94
95 //-- Edit menu -------------------------------------------------------
96 //
97 ACTION_MENU* editMenu = new ACTION_MENU( false, selTool );
98
99 editMenu->Add( ACTIONS::undo );
100 editMenu->Add( ACTIONS::redo );
101
102 editMenu->AppendSeparator();
103 editMenu->Add( ACTIONS::cut );
104 editMenu->Add( ACTIONS::copy );
105 editMenu->Add( ACTIONS::paste );
106 editMenu->Add( ACTIONS::doDelete );
107 editMenu->Add( ACTIONS::duplicate );
108
109 editMenu->AppendSeparator();
110 editMenu->Add( ACTIONS::selectAll );
111
112 editMenu->AppendSeparator();
115
116
117 //-- View menu -------------------------------------------------------
118 //
119 ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool );
120
122 viewMenu->Add( ACTIONS::show3DViewer );
123
124 viewMenu->AppendSeparator();
125 viewMenu->Add( ACTIONS::zoomInCenter );
126 viewMenu->Add( ACTIONS::zoomOutCenter );
127 viewMenu->Add( ACTIONS::zoomFitScreen );
128 viewMenu->Add( ACTIONS::zoomTool );
129 viewMenu->Add( ACTIONS::zoomRedraw );
130
131 viewMenu->AppendSeparator();
133 viewMenu->Add( ACTIONS::gridProperties );
135
136 // Units submenu
137 ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool );
138 unitsSubMenu->SetTitle( _( "&Units" ) );
139 unitsSubMenu->SetIcon( BITMAPS::unit_mm );
141 unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK );
143 viewMenu->Add( unitsSubMenu );
144
146
147 viewMenu->AppendSeparator();
148 // Drawing Mode Submenu
149 ACTION_MENU* drawingModeSubMenu = new ACTION_MENU( false, selTool );
150 drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
151 drawingModeSubMenu->SetIcon( BITMAPS::add_zone );
152
153 drawingModeSubMenu->Add( PCB_ACTIONS::padDisplayMode, ACTION_MENU::CHECK );
155 drawingModeSubMenu->Add( PCB_ACTIONS::textOutlines, ACTION_MENU::CHECK );
156 viewMenu->Add( drawingModeSubMenu );
157
158 // Contrast Mode Submenu
159 ACTION_MENU* contrastModeSubMenu = new ACTION_MENU( false, selTool );
160 contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
161 contrastModeSubMenu->SetIcon( BITMAPS::contrast_mode );
162
163 contrastModeSubMenu->Add( ACTIONS::highContrastMode, ACTION_MENU::CHECK );
164 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaDec );
165 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaInc );
166 viewMenu->Add( contrastModeSubMenu );
167
169
170 viewMenu->AppendSeparator();
173
174
175 //-- Place menu -------------------------------------------------------
176 //
177 ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
178
179 placeMenu->Add( PCB_ACTIONS::placePad );
180 placeMenu->Add( PCB_ACTIONS::drawRuleArea );
181
182 placeMenu->AppendSeparator();
183 placeMenu->Add( PCB_ACTIONS::drawLine );
184 placeMenu->Add( PCB_ACTIONS::drawArc );
185 placeMenu->Add( PCB_ACTIONS::drawRectangle );
186 placeMenu->Add( PCB_ACTIONS::drawCircle );
187 placeMenu->Add( PCB_ACTIONS::drawPolygon );
188 placeMenu->Add( PCB_ACTIONS::placeImage );
189 placeMenu->Add( PCB_ACTIONS::placeText );
190 placeMenu->Add( PCB_ACTIONS::drawTextBox );
191
192 placeMenu->AppendSeparator();
197 placeMenu->Add( PCB_ACTIONS::drawLeader );
198
199 placeMenu->AppendSeparator();
200 placeMenu->Add( PCB_ACTIONS::setAnchor );
201 placeMenu->Add( ACTIONS::gridSetOrigin );
202
203
204 //-- Inspect menu ------------------------------------------------------
205 //
206 ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
207
208 inspectMenu->Add( ACTIONS::measureTool );
209
210 inspectMenu->AppendSeparator();
211 inspectMenu->Add( PCB_ACTIONS::checkFootprint );
212
213
214 //-- Tools menu --------------------------------------------------------
215 //
216 ACTION_MENU* toolsMenu = new ACTION_MENU( false, selTool );
217
218 toolsMenu->Add( _( "&Load Footprint from PCB..." ),
219 _( "Load a footprint from the current board into the editor" ),
222
223 toolsMenu->Add( _( "&Insert Footprint on PCB" ),
224 _( "Insert footprint onto current board" ),
227
228 toolsMenu->AppendSeparator();
229 toolsMenu->Add( PCB_ACTIONS::cleanupGraphics );
230 toolsMenu->Add( PCB_ACTIONS::repairFootprint );
231
232
233 //-- Preferences menu -------------------------------------------------
234 //
235 ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool );
236
237 prefsMenu->Add( ACTIONS::configurePaths );
239
240 // We can't use ACTIONS::showPreferences yet because wxWidgets moves this on
241 // Mac, and it needs the wxID_PREFERENCES id to find it.
242 prefsMenu->Add( _( "Preferences..." ) + wxT( "\tCtrl+," ),
243 _( "Show preferences for all open tools" ),
244 wxID_PREFERENCES,
246
247 prefsMenu->AppendSeparator();
248 AddMenuLanguageList( prefsMenu, selTool );
249
250 //--MenuBar -----------------------------------------------------------
251 //
252 menuBar->Append( fileMenu, _( "&File" ) );
253 menuBar->Append( editMenu, _( "&Edit" ) );
254 menuBar->Append( viewMenu, _( "&View" ) );
255 menuBar->Append( placeMenu, _( "&Place" ) );
256 menuBar->Append( inspectMenu, _( "&Inspect" ) );
257 menuBar->Append( toolsMenu, _( "&Tools" ) );
258 menuBar->Append( prefsMenu, _( "P&references" ) );
259 AddStandardHelpMenu( menuBar );
260
261 SetMenuBar( menuBar );
262 delete oldMenuBar;
263}
@ insert_module_board
@ contrast_mode
@ load_module_board
static TOOL_ACTION gridProperties
Definition: actions.h:144
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION zoomRedraw
Definition: actions.h:92
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
static TOOL_ACTION revert
Definition: actions.h:55
static TOOL_ACTION show3DViewer
Definition: actions.h:162
static TOOL_ACTION zoomOutCenter
Definition: actions.h:96
static TOOL_ACTION togglePolarCoords
Definition: actions.h:152
static TOOL_ACTION saveAs
Definition: actions.h:52
static TOOL_ACTION addLibrary
Definition: actions.h:49
static TOOL_ACTION copy
Definition: actions.h:68
static TOOL_ACTION milsUnits
Definition: actions.h:148
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:181
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION duplicate
Definition: actions.h:72
static TOOL_ACTION inchesUnits
Definition: actions.h:147
static TOOL_ACTION highContrastMode
Definition: actions.h:105
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:104
static TOOL_ACTION measureTool
Definition: actions.h:157
static TOOL_ACTION doDelete
Definition: actions.h:73
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION zoomTool
Definition: actions.h:101
static TOOL_ACTION print
Definition: actions.h:57
static TOOL_ACTION zoomInCenter
Definition: actions.h:95
static TOOL_ACTION newLibrary
Definition: actions.h:48
static TOOL_ACTION cut
Definition: actions.h:67
static TOOL_ACTION gridSetOrigin
Definition: actions.h:140
static TOOL_ACTION configurePaths
Definition: actions.h:179
static TOOL_ACTION showFootprintBrowser
Definition: actions.h:165
static TOOL_ACTION selectAll
Definition: actions.h:71
static constexpr bool CHECK
Definition: action_menu.h:189
void AddClose(const wxString &aAppname="")
Add a standard close item to the menu with the accelerator key CTRL-W.
void SetTitle(const wxString &aTitle) override
Set title for the menu.
Definition: action_menu.cpp:87
static constexpr bool NORMAL
Definition: action_menu.h:188
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:73
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Adds the standard KiCad help menu to the menubar.
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:185
static TOOL_ACTION placeText
Definition: pcb_actions.h:176
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:181
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:172
static TOOL_ACTION setAnchor
Definition: pcb_actions.h:192
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:280
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:389
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:173
static TOOL_ACTION placeImage
Definition: pcb_actions.h:175
static TOOL_ACTION createFootprint
Definition: pcb_actions.h:403
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:418
static TOOL_ACTION showFootprintTree
Definition: pcb_actions.h:395
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:177
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:325
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:171
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:426
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:180
static TOOL_ACTION editTextAndGraphics
Definition: pcb_actions.h:360
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:182
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:324
static TOOL_ACTION newFootprint
Definition: pcb_actions.h:400
static TOOL_ACTION defaultPadProperties
Definition: pcb_actions.h:421
static TOOL_ACTION importFootprint
Definition: pcb_actions.h:417
static TOOL_ACTION placeImportedGraphics
Definition: pcb_actions.h:191
static TOOL_ACTION drawArc
Definition: pcb_actions.h:174
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:438
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:179
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:420
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:330
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:441
static TOOL_ACTION checkFootprint
Definition: pcb_actions.h:423
static TOOL_ACTION repairFootprint
Definition: pcb_actions.h:491
static TOOL_ACTION drawLine
Definition: pcb_actions.h:170
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:363
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:178
The selection tool: currently supports:
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:46
void AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to Master...
@ ID_FPEDIT_SAVE_PNG
Definition: pcbnew_id.h:98
@ ID_ADD_FOOTPRINT_TO_BOARD
Definition: pcbnew_id.h:116
@ ID_LOAD_FOOTPRINT_FROM_BOARD
Definition: pcbnew_id.h:117

References _, ACTION_MENU::Add(), add_zone, ACTION_MENU::AddClose(), ACTIONS::addLibrary, AddMenuLanguageList(), EDA_BASE_FRAME::AddStandardHelpMenu(), ACTION_MENU::CHECK, PCB_ACTIONS::checkFootprint, PCB_ACTIONS::cleanupGraphics, ACTIONS::configurePaths, contrast_mode, ACTIONS::copy, PCB_ACTIONS::createFootprint, ACTIONS::cut, PCB_ACTIONS::defaultPadProperties, ACTIONS::doDelete, PCB_ACTIONS::drawAlignedDimension, PCB_ACTIONS::drawArc, PCB_ACTIONS::drawCenterDimension, PCB_ACTIONS::drawCircle, PCB_ACTIONS::drawLeader, PCB_ACTIONS::drawLine, PCB_ACTIONS::drawOrthogonalDimension, PCB_ACTIONS::drawPolygon, PCB_ACTIONS::drawRadialDimension, PCB_ACTIONS::drawRectangle, PCB_ACTIONS::drawRuleArea, PCB_ACTIONS::drawTextBox, ACTIONS::duplicate, PCB_ACTIONS::editTextAndGraphics, export_file, export_png, PCB_ACTIONS::exportFootprint, PCB_ACTIONS::flipBoard, PCB_ACTIONS::footprintProperties, TOOL_MANAGER::GetTool(), PCB_ACTIONS::graphicsOutlines, ACTIONS::gridProperties, ACTIONS::gridSetOrigin, ACTIONS::highContrastMode, ID_ADD_FOOTPRINT_TO_BOARD, ID_FPEDIT_SAVE_PNG, ID_LOAD_FOOTPRINT_FROM_BOARD, import, PCB_ACTIONS::importFootprint, ACTIONS::inchesUnits, insert_module_board, PCB_ACTIONS::layerAlphaDec, PCB_ACTIONS::layerAlphaInc, load_module_board, TOOLS_HOLDER::m_toolManager, ACTIONS::measureTool, ACTIONS::millimetersUnits, ACTIONS::milsUnits, PCB_ACTIONS::newFootprint, ACTIONS::newLibrary, ACTION_MENU::NORMAL, PCB_ACTIONS::padDisplayMode, ACTIONS::paste, PCB_ACTIONS::placeImage, PCB_ACTIONS::placeImportedGraphics, PCB_ACTIONS::placePad, PCB_ACTIONS::placeText, preference, ACTIONS::print, ACTIONS::redo, PCB_ACTIONS::repairFootprint, ACTIONS::revert, ACTIONS::save, ACTIONS::saveAs, ACTIONS::selectAll, PCB_ACTIONS::setAnchor, ACTION_MENU::SetIcon(), ACTION_MENU::SetTitle(), ACTIONS::show3DViewer, ACTIONS::showFootprintBrowser, ACTIONS::showFootprintLibTable, PCB_ACTIONS::showFootprintTree, PCB_ACTIONS::showLayersManager, PCB_ACTIONS::textOutlines, ACTIONS::toggleCursorStyle, ACTIONS::toggleGrid, ACTIONS::togglePolarCoords, ACTIONS::undo, unit_mm, ACTIONS::zoomFitScreen, ACTIONS::zoomInCenter, ACTIONS::zoomOutCenter, ACTIONS::zoomRedraw, and ACTIONS::zoomTool.

◆ DoWithAcceptedFiles()

void EDA_BASE_FRAME::DoWithAcceptedFiles ( )
protectedvirtualinherited

Execute action on accepted dropped file.

Called in OnDropFiles and should be populated with the action to execute in inherited classes.

Reimplemented in GERBVIEW_FRAME, KICAD_MANAGER_FRAME, and PL_EDITOR_FRAME.

Definition at line 1178 of file eda_base_frame.cpp.

1179{
1180 for( const wxFileName& file : m_AcceptedFiles )
1181 {
1182 wxString fn = file.GetFullPath();
1183 m_toolManager->RunAction( *m_acceptedExts.at( file.GetExt() ), true, &fn );
1184 }
1185}
std::vector< wxFileName > m_AcceptedFiles

References EDA_BASE_FRAME::m_acceptedExts, EDA_BASE_FRAME::m_AcceptedFiles, TOOLS_HOLDER::m_toolManager, and TOOL_MANAGER::RunAction().

Referenced by EDA_BASE_FRAME::OnDropFiles().

◆ DuplicateFootprint()

bool FOOTPRINT_EDIT_FRAME::DuplicateFootprint ( FOOTPRINT aFootprint)

Definition at line 871 of file footprint_libraries_utils.cpp.

872{
873 LIB_ID fpID = aFootprint->GetFPID();
874 wxString libraryName = fpID.GetLibNickname();
875 wxString footprintName = fpID.GetLibItemName();
876
877 // Legacy libraries are readable, but modifying legacy format is not allowed
878 // So prompt the user if he try to add/replace a footprint in a legacy lib
879 wxString libFullName = Prj().PcbFootprintLibs()->FindRow( libraryName )->GetFullURI();
880
882 {
884 return false;
885 }
886
888 int i = 1;
889 wxString newName = footprintName;
890
891 // Append a number to the name until the name is unique in the library.
892 while( tbl->FootprintExists( libraryName, newName ) )
893 newName.Printf( "%s_%d", footprintName, i++ );
894
895 aFootprint->SetFPID( LIB_ID( libraryName, newName ) );
896
897 if( aFootprint->GetValue() == footprintName )
898 aFootprint->SetValue( newName );
899
900 return SaveFootprintInLibrary( aFootprint, libraryName );
901}
bool SaveFootprintInLibrary(FOOTPRINT *aFootprint, const wxString &aLibraryName)
bool FootprintExists(const wxString &aNickname, const wxString &aFootprintName)
Indicates whether or not the given footprint already exists in the given library.
static const wxString INFO_LEGACY_LIB_WARN_EDIT(_("Writing/modifying legacy libraries (.mod files) is not allowed\n" "Please save the current library to the new .pretty format\n" "and update your footprint lib table\n" "to save your footprint (a .kicad_mod file) in the .pretty library folder"))

References DisplayInfoMessage(), FP_LIB_TABLE::FindRow(), FP_LIB_TABLE::FootprintExists(), FOOTPRINT::GetFPID(), LIB_TABLE_ROW::GetFullURI(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), FOOTPRINT::GetValue(), IO_MGR::GuessPluginTypeFromLibPath(), INFO_LEGACY_LIB_WARN_EDIT(), IO_MGR::LEGACY, PROJECT::PcbFootprintLibs(), KIWAY_HOLDER::Prj(), SaveFootprintInLibrary(), FOOTPRINT::SetFPID(), and FOOTPRINT::SetValue().

Referenced by FOOTPRINT_EDITOR_CONTROL::DuplicateFootprint().

◆ editFootprintProperties()

void FOOTPRINT_EDIT_FRAME::editFootprintProperties ( FOOTPRINT aFootprint)
protected

Run the Footprint Properties dialog and handle changes made in it.

Definition at line 171 of file footprint_editor_utils.cpp.

172{
173 LIB_ID oldFPID = aFootprint->GetFPID();
174
175 DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR dialog( this, aFootprint );
176 dialog.ShowModal();
177
178 // Update library tree and title in case of a name change
179 wxDataViewItem treeItem = m_adapter->FindItem( oldFPID );
180 UpdateLibraryTree( treeItem, aFootprint );
181 UpdateTitle();
182
184}
void UpdateLibraryTree(const wxDataViewItem &treeItem, FOOTPRINT *aFootprint)
Update a single node in the library tree.

References FOOTPRINT::GetFPID(), m_adapter, UpdateLibraryTree(), UpdateMsgPanel(), and UpdateTitle().

Referenced by OnEditItemRequest().

◆ ensureWindowIsOnScreen()

void EDA_BASE_FRAME::ensureWindowIsOnScreen ( )
protectedinherited

Definition at line 659 of file eda_base_frame.cpp.

660{
661 wxDisplay display( wxDisplay::GetFromWindow( this ) );
662 wxRect clientSize = display.GetClientArea();
663 wxPoint pos = GetPosition();
664 wxSize size = GetWindowSize();
665
666 wxLogTrace( traceDisplayLocation,
667 wxS( "ensureWindowIsOnScreen: clientArea (%d, %d) w %d h %d" ), clientSize.x, clientSize.y,
668 clientSize.width, clientSize.height );
669
670 if( pos.y < clientSize.y )
671 {
672 wxLogTrace( traceDisplayLocation,
673 wxS( "ensureWindowIsOnScreen: y pos %d below minimum, setting to %d" ), pos.y,
674 clientSize.y );
675 pos.y = clientSize.y;
676 }
677
678 if( pos.x < clientSize.x )
679 {
680 wxLogTrace( traceDisplayLocation,
681 wxS( "ensureWindowIsOnScreen: x pos %d is off the client rect, setting to %d" ), pos.x,
682 clientSize.x );
683 pos.x = clientSize.x;
684 }
685
686 if( pos.x + size.x - clientSize.x > clientSize.width )
687 {
688 int newWidth = clientSize.width - ( pos.x - clientSize.x );
689 wxLogTrace( traceDisplayLocation,
690 wxS( "ensureWindowIsOnScreen: effective width %d above available %d, setting to %d" ),
691 pos.x + size.x, clientSize.width, newWidth );
692 size.x = newWidth;
693 }
694
695 if( pos.y + size.y - clientSize.y > clientSize.height )
696 {
697 int newHeight = clientSize.height - ( pos.y - clientSize.y );
698 wxLogTrace( traceDisplayLocation,
699 wxS( "ensureWindowIsOnScreen: effective height %d above available %d, setting to %d" ),
700 pos.y + size.y, clientSize.height, newHeight );
701 size.y = newHeight;
702 }
703
704 wxLogTrace( traceDisplayLocation, wxS( "Updating window position (%d, %d) with size (%d, %d)" ),
705 pos.x, pos.y, size.x, size.y );
706
707 SetSize( pos.x, pos.y, size.x, size.y );
708}
wxSize GetWindowSize()
Get the undecorated window size that can be used for restoring the window size.
const wxChar *const traceDisplayLocation
Flag to enable debug output of display positioning logic.

References EDA_BASE_FRAME::GetWindowSize(), and traceDisplayLocation.

Referenced by EDA_BASE_FRAME::OnSize().

◆ EraseMsgBox()

void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

◆ ExecuteRemoteCommand()

virtual void KIWAY_PLAYER::ExecuteRemoteCommand ( const char *  cmdline)
inlinevirtualinherited

Execute a remote command sent via socket (to port KICAD_PCB_PORT_SERVICE_NUMBER, currently 4242).

Subclasses should override to implement actual command handlers.

Reimplemented in SCH_EDIT_FRAME, and PCB_EDIT_FRAME.

Definition at line 182 of file kiway_player.h.

182{}

Referenced by KIWAY_PLAYER::OnSockRequest().

◆ ExportFootprint()

void FOOTPRINT_EDIT_FRAME::ExportFootprint ( FOOTPRINT aFootprint)

Create a file containing only one footprint.

Definition at line 319 of file footprint_libraries_utils.cpp.

320{
321 wxFileName fn;
323
324 if( !aFootprint )
325 return;
326
327 fn.SetName( aFootprint->GetFPID().GetLibItemName() );
328
329 wxString wildcard = KiCadFootprintLibFileWildcard();
330
331 fn.SetExt( KiCadFootprintFileExtension );
332
333 if( !cfg->m_LastImportExportPath.empty() )
334 fn.SetPath( cfg->m_LastImportExportPath );
335 else
336 fn.SetPath( m_mruPath );
337
338 wxFileDialog dlg( this, _( "Export Footprint" ), fn.GetPath(), fn.GetFullName(),
339 wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
340
341 if( dlg.ShowModal() == wxID_CANCEL )
342 return;
343
344 fn = dlg.GetPath();
345 cfg->m_LastImportExportPath = fn.GetPath();
346
347 try
348 {
349 // Export as *.kicad_pcb format, using a strategy which is specifically chosen
350 // as an example on how it could also be used to send it to the system clipboard.
351
353
354 /* This footprint should *already* be "normalized" in a way such that
355 orientation is zero, etc., since it came from the Footprint Editor.
356
357 aFootprint->SetParent( 0 );
358 aFootprint->SetOrientation( 0 );
359 */
360
361 pcb_io.Format( aFootprint );
362
363 FILE* fp = wxFopen( dlg.GetPath(), wxT( "wt" ) );
364
365 if( fp == nullptr )
366 {
367 DisplayErrorMessage( this, wxString::Format( _( "Insufficient permissions to write file '%s'." ),
368 dlg.GetPath() ) );
369 return;
370 }
371
372 fprintf( fp, "%s", pcb_io.GetStringOutput( false ).c_str() );
373 fclose( fp );
374 }
375 catch( const IO_ERROR& ioe )
376 {
377 DisplayError( this, ioe.What() );
378 return;
379 }
380
381 wxString msg = wxString::Format( _( "Footprint exported to file '%s'." ), dlg.GetPath() );
382 DisplayInfoMessage( this, msg );
383}
A PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
Definition: pcb_plugin.h:261
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:325
wxString KiCadFootprintLibFileWildcard()
#define CTL_FOR_LIBRARY
Format output for a footprint library instead of clipboard or BOARD.
Definition: pcb_plugin.h:158

References _, CTL_FOR_LIBRARY, DisplayError(), DisplayErrorMessage(), DisplayInfoMessage(), PCB_PLUGIN::Format(), Format(), FOOTPRINT::GetFPID(), LIB_ID::GetLibItemName(), GetSettings(), PCB_PLUGIN::GetStringOutput(), KiCadFootprintFileExtension, KiCadFootprintLibFileWildcard(), FOOTPRINT_EDITOR_SETTINGS::m_LastImportExportPath, EDA_BASE_FRAME::m_mruPath, and IO_ERROR::What().

Referenced by FOOTPRINT_EDITOR_CONTROL::ExportFootprint().

◆ findDialogs()

std::vector< wxWindow * > EDA_DRAW_FRAME::findDialogs ( )
protectedinherited

Definition at line 925 of file eda_draw_frame.cpp.

926{
927 std::vector<wxWindow*> dialogs;
928
929 for( wxWindow* window : GetChildren() )
930 {
931 if( dynamic_cast<DIALOG_SHIM*>( window ) )
932 dialogs.push_back( window );
933 }
934
935 return dialogs;
936}
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:83

Referenced by PCB_BASE_FRAME::FocusOnItems(), and EDA_DRAW_FRAME::FocusOnLocation().

◆ findQuasiModalDialog()

wxWindow * EDA_BASE_FRAME::findQuasiModalDialog ( )
privateinherited

Definition at line 169 of file eda_base_frame.cpp.

170{
171 for( wxWindow* iter : GetChildren() )
172 {
173 DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( iter );
174
175 if( dlg && dlg->IsQuasiModal() )
176 return dlg;
177 }
178
179 // FIXME: CvPcb is currently implemented on top of KIWAY_PLAYER rather than DIALOG_SHIM,
180 // so we have to look for it separately.
181 if( m_ident == FRAME_SCH )
182 {
183 wxWindow* cvpcb = wxWindow::FindWindowByName( wxS( "CvpcbFrame" ) );
184
185 if( cvpcb )
186 return cvpcb;
187 }
188
189 return nullptr;
190}
bool IsQuasiModal() const
Definition: dialog_shim.h:106
@ FRAME_SCH
Definition: frame_type.h:34

References FRAME_SCH, DIALOG_SHIM::IsQuasiModal(), and EDA_BASE_FRAME::m_ident.

Referenced by EDA_BASE_FRAME::ProcessEvent(), and EDA_BASE_FRAME::windowClosing().

◆ FinishAUIInitialization()

void EDA_BASE_FRAME::FinishAUIInitialization ( )
inherited

Definition at line 846 of file eda_base_frame.cpp.

847{
848#if defined( __WXOSX_MAC__ )
849 m_auimgr.Update();
850#else
851 // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
852 // hiding it.
853 m_auimgr.Update();
854
855 // We don't want the infobar displayed right away
856 m_auimgr.GetPane( wxS( "InfoBar" ) ).Hide();
857 m_auimgr.Update();
858#endif
859}

References EDA_BASE_FRAME::m_auimgr.

Referenced by SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME().

◆ FocusOnItem()

◆ FocusOnItems()

void PCB_BASE_FRAME::FocusOnItems ( std::vector< BOARD_ITEM * >  aItems,
PCB_LAYER_ID  aLayer = UNDEFINED_LAYER 
)
inherited
Todo:
The Boost entropy exception does not exist prior to 1.67. Once the minimum Boost version is raise to 1.67 or greater, this version check can be removed.

Definition at line 307 of file pcb_base_frame.cpp.

308{
309 static std::vector<KIID> lastBrightenedItemIDs;
310
311 BOARD_ITEM* lastItem = nullptr;
312
313 for( KIID lastBrightenedItemID : lastBrightenedItemIDs )
314 {
317 #if BOOST_VERSION >= 106700
318 try
319 {
320 lastItem = GetBoard()->GetItem( lastBrightenedItemID );
321 }
322 catch( const boost::uuids::entropy_error& )
323 {
324 wxLogError( wxT( "A Boost UUID entropy exception was thrown in %s:%s." ),
325 __FILE__, __FUNCTION__ );
326 }
327 #else
328 lastItem = GetBoard()->GetItem( lastBrightenedItemID );
329 #endif
330
331 if( lastItem && lastItem != DELETED_BOARD_ITEM::GetInstance() )
332 {
333 lastItem->ClearBrightened();
334
335 if( lastItem->Type() == PCB_FOOTPRINT_T )
336 {
337 static_cast<FOOTPRINT*>( lastItem )->RunOnChildren(
338 [&]( BOARD_ITEM* child )
339 {
340 child->ClearBrightened();
341 } );
342 }
343 else if( lastItem->Type() == PCB_GROUP_T )
344 {
345 static_cast<PCB_GROUP*>( lastItem )->RunOnChildren(
346 [&]( BOARD_ITEM* child )
347 {
348 child->ClearBrightened();
349 } );
350 }
351
352 GetCanvas()->GetView()->Update( lastItem );
353 lastBrightenedItemID = niluuid;
354 GetCanvas()->Refresh();
355 }
356 }
357
358 lastBrightenedItemIDs.clear();
359
360 if( aItems.empty() )
361 return;
362
363 VECTOR2I focusPt;
364 KIGFX::VIEW* view = GetCanvas()->GetView();
365 SHAPE_POLY_SET viewportPoly( view->GetViewport() );
366
367 for( wxWindow* dialog : findDialogs() )
368 {
369 wxPoint dialogPos = GetCanvas()->ScreenToClient( dialog->GetScreenPosition() );
370 SHAPE_POLY_SET dialogPoly( BOX2D( view->ToWorld( dialogPos, true ),
371 view->ToWorld( dialog->GetSize(), false ) ) );
372
373 try
374 {
375 viewportPoly.BooleanSubtract( dialogPoly, SHAPE_POLY_SET::PM_FAST );
376 }
377 catch( const ClipperLib::clipperException& exc )
378 {
379 // This may be overkill and could be an assertion but we are more likely to
380 // find any clipper errors this way.
381 wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
382 }
383 }
384
385 SHAPE_POLY_SET itemPoly, clippedPoly;
386
387 for( BOARD_ITEM* item : aItems )
388 {
389 if( item && item != DELETED_BOARD_ITEM::GetInstance() )
390 {
391 item->SetBrightened();
392
393 if( item->Type() == PCB_FOOTPRINT_T )
394 {
395 static_cast<FOOTPRINT*>( item )->RunOnChildren(
396 [&]( BOARD_ITEM* child )
397 {
398 child->SetBrightened();
399 });
400 }
401 else if( item->Type() == PCB_GROUP_T )
402 {
403 static_cast<PCB_GROUP*>( item )->RunOnChildren(
404 [&]( BOARD_ITEM* child )
405 {
406 child->SetBrightened();
407 });
408 }
409
410 GetCanvas()->GetView()->Update( item );
411 lastBrightenedItemIDs.push_back( item->m_Uuid );
412
413 // Focus on the object's location. Prefer a visible part of the object to its anchor
414 // in order to keep from scrolling around.
415
416 focusPt = item->GetPosition();
417
418 if( aLayer == UNDEFINED_LAYER )
419 aLayer = item->GetLayerSet().Seq()[0];
420
421 switch( item->Type() )
422 {
423 case PCB_FOOTPRINT_T:
424 try
425 {
426 itemPoly = static_cast<FOOTPRINT*>( item )->GetBoundingHull();
427 }
428 catch( const ClipperLib::clipperException& exc )
429 {
430 // This may be overkill and could be an assertion but we are more likely to
431 // find any clipper errors this way.
432 wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
433 }
434
435 break;
436
437 case PCB_PAD_T:
438 case PCB_MARKER_T:
439 case PCB_VIA_T:
440 FocusOnLocation( item->GetFocusPosition() );
441 GetCanvas()->Refresh();
442 return;
443
444 case PCB_SHAPE_T:
445 case PCB_TEXT_T:
446 case PCB_TEXTBOX_T:
447 case PCB_FP_TEXT_T:
448 case PCB_FP_TEXTBOX_T:
449 case PCB_FP_SHAPE_T:
450 case PCB_FP_ZONE_T:
451 case PCB_TRACE_T:
452 case PCB_ARC_T:
454 case PCB_DIM_LEADER_T:
455 case PCB_DIM_CENTER_T:
456 case PCB_DIM_RADIAL_T:
463 item->TransformShapeToPolygon( itemPoly, aLayer, 0, pcbIUScale.mmToIU( 0.1 ),
464 ERROR_INSIDE );
465 break;
466
467 case PCB_ZONE_T:
468 {
469 ZONE* zone = static_cast<ZONE*>( item );
470 #if 0
471 // Using the filled area shapes to find a Focus point can give good results, but
472 // unfortunately the calculations are highly time consuming, even for not very
473 // large areas (can be easily a few minutes for large areas).
474 // so we used only the zone outline that usually do not have too many vertices.
475 zone->TransformShapeToPolygon( itemPoly, aLayer, 0, pcbIUScale.mmToIU( 0.1 ),
476 ERROR_INSIDE );
477
478 if( itemPoly.IsEmpty() )
479 itemPoly = *zone->Outline();
480 #else
481 // much faster calculation time when using only the zone outlines
482 itemPoly = *zone->Outline();
483 #endif
484
485 break;
486 }
487
488 default:
489 {
490 BOX2I item_bbox = item->GetBoundingBox();
491 itemPoly.NewOutline();
492 itemPoly.Append( item_bbox.GetOrigin() );
493 itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( item_bbox.GetWidth(), 0 ) );
494 itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( 0, item_bbox.GetHeight() ) );
495 itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( item_bbox.GetWidth(),
496 item_bbox.GetHeight() ) );
497 break;
498 }
499 }
500
501 try
502 {
503 clippedPoly.BooleanIntersection( itemPoly, viewportPoly, SHAPE_POLY_SET::PM_FAST );
504 }
505 catch( const ClipperLib::clipperException& exc )
506 {
507 // This may be overkill and could be an assertion but we are more likely to
508 // find any clipper errors this way.
509 wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
510 }
511
512 if( !clippedPoly.IsEmpty() )
513 itemPoly = clippedPoly;
514 }
515 }
516
517 /*
518 * Perform a step-wise deflate to find the visual-center-of-mass
519 */
520
521 BOX2I bbox = itemPoly.BBox();
522 int step = std::min( bbox.GetWidth(), bbox.GetHeight() ) / 10;
523
524 while( !itemPoly.IsEmpty() )
525 {
526 focusPt = itemPoly.BBox().Centre();
527
528 try
529 {
531 }
532 catch( const ClipperLib::clipperException& exc )
533 {
534 // This may be overkill and could be an assertion but we are more likely to
535 // find any clipper errors this way.
536 wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
537 }
538 }
539
540 FocusOnLocation( focusPt );
541
542 GetCanvas()->Refresh();
543}
BOX2< VECTOR2D > BOX2D
Definition: box2.h:848
BOARD_ITEM * GetItem(const KIID &aID) const
Definition: board.cpp:1001
const Vec & GetOrigin() const
Definition: box2.h:183
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetWidth() const
Definition: box2.h:187
Vec Centre() const
Definition: box2.h:70
static DELETED_BOARD_ITEM * GetInstance()
Definition: board_item.h:380
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
std::vector< wxWindow * > findDialogs()
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void ClearBrightened()
Definition: eda_item.h:119
void SetBrightened()
Definition: eda_item.h:116
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:511
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:448
Definition: kiid.h:48
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
Represent a set of closed polygons.
@ CHAMFER_ACUTE_CORNERS
Acute angles are chamfered.
bool IsEmpty() const
void Deflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning,...
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
int NewOutline()
Creates a new hole in a given outline.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
SHAPE_POLY_SET * Outline()
Definition: zone.h:312
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are ap...
Definition: zone.cpp:1320
@ ERROR_INSIDE
KIID niluuid(0)
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
@ PCB_FP_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:95
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:110
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:107
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_FP_TEXTBOX_T
class FP_TEXTBOX, wrapped text in a footprint
Definition: typeinfo.h:93
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:108
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:115
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:91
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:90
@ PCB_FP_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:97
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:104
@ PCB_FP_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:99
@ PCB_FP_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:96
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:106
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
Definition: typeinfo.h:100
@ PCB_FP_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:98
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:109
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::BBox(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::BooleanSubtract(), BOX2< Vec >::Centre(), SHAPE_POLY_SET::CHAMFER_ACUTE_CORNERS, EDA_ITEM::ClearBrightened(), SHAPE_POLY_SET::Deflate(), ERROR_INSIDE, EDA_DRAW_FRAME::findDialogs(), EDA_DRAW_FRAME::FocusOnLocation(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), BOX2< Vec >::GetHeight(), DELETED_BOARD_ITEM::GetInstance(), BOARD::GetItem(), BOX2< Vec >::GetOrigin(), PCB_DRAW_PANEL_GAL::GetView(), KIGFX::VIEW::GetViewport(), BOX2< Vec >::GetWidth(), SHAPE_POLY_SET::IsEmpty(), EDA_IU_SCALE::mmToIU(), SHAPE_POLY_SET::NewOutline(), niluuid, ZONE::Outline(), PCB_ARC_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_FOOTPRINT_T, PCB_FP_DIM_ALIGNED_T, PCB_FP_DIM_CENTER_T, PCB_FP_DIM_LEADER_T, PCB_FP_DIM_ORTHOGONAL_T, PCB_FP_DIM_RADIAL_T, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_FP_TEXTBOX_T, PCB_FP_ZONE_T, PCB_GROUP_T, PCB_MARKER_T, PCB_PAD_T, PCB_SHAPE_T, PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, pcbIUScale, SHAPE_POLY_SET::PM_FAST, EDA_DRAW_PANEL_GAL::Refresh(), EDA_ITEM::SetBrightened(), KIGFX::VIEW::ToWorld(), ZONE::TransformShapeToPolygon(), EDA_ITEM::Type(), UNDEFINED_LAYER, and KIGFX::PCB_VIEW::Update().

Referenced by PCB_BASE_FRAME::FocusOnItem(), and DIALOG_DRC::OnDRCItemSelected().

◆ FocusOnLibID()

void FOOTPRINT_EDIT_FRAME::FocusOnLibID ( const LIB_ID aLibID)

◆ FocusOnLocation()

void EDA_DRAW_FRAME::FocusOnLocation ( const VECTOR2I aPos)
inherited

Useful to focus on a particular location, in find functions.

Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested.

Parameters
aPosis the point to go to.

Definition at line 939 of file eda_draw_frame.cpp.

940{
941 bool centerView = false;
943
944 // Center if we're off the current view, or within 10% of its edge
945 r.Inflate( - (int) r.GetWidth() / 10 );
946
947 if( !r.Contains( aPos ) )
948 centerView = true;
949
950 std::vector<BOX2D> dialogScreenRects;
951
952 for( wxWindow* dialog : findDialogs() )
953 {
954 dialogScreenRects.emplace_back( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
955 dialog->GetSize() );
956 }
957
958 // Center if we're behind an obscuring dialog, or within 10% of its edge
959 for( BOX2D rect : dialogScreenRects )
960 {
961 rect.Inflate( rect.GetWidth() / 10 );
962
963 if( rect.Contains( GetCanvas()->GetView()->ToScreen( aPos ) ) )
964 centerView = true;
965 }
966
967 if( centerView )
968 {
969 try
970 {
971 GetCanvas()->GetView()->SetCenter( aPos, dialogScreenRects );
972 }
973 catch( const ClipperLib::clipperException& exc )
974 {
975 wxLogError( wxT( "Clipper library error '%s' occurred centering object." ),
976 exc.what() );
977 }
978 }
979
981}
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:577

References BOX2< Vec >::Contains(), EDA_DRAW_FRAME::findDialogs(), EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), KIGFX::VIEW::GetViewport(), BOX2< Vec >::GetWidth(), BOX2< Vec >::Inflate(), KIGFX::VIEW::SetCenter(), and KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition().

Referenced by PCB_SELECTION_TOOL::doSyncSelection(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_SELECTION_TOOL::FindItem(), SCH_FIND_REPLACE_TOOL::FindNext(), SCH_EDIT_FRAME::FocusOnItem(), PCB_BASE_FRAME::FocusOnItems(), DIALOG_DRC::OnDRCItemSelected(), and EE_SELECTION_TOOL::SyncSelection().

◆ Get3DViewerFrame()

EDA_3D_VIEWER_FRAME * PCB_BASE_FRAME::Get3DViewerFrame ( )
inherited
Returns
a reference to the child 3D viewer frame, when exists, or NULL

Definition at line 142 of file pcb_base_frame.cpp.

143{
144 wxWindow* frame = FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) );
145 return dynamic_cast<EDA_3D_VIEWER_FRAME*>( frame );
146}
#define QUALIFIED_VIEWER3D_FRAMENAME(parent)

References QUALIFIED_VIEWER3D_FRAMENAME.

Referenced by PCB_BASE_FRAME::canCloseWindow(), PCB_BASE_FRAME::CommonSettingsChanged(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::Update3DView(), and FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME().

◆ GetAboutTitle()

const wxString & EDA_BASE_FRAME::GetAboutTitle ( ) const
inlineinherited

Definition at line 506 of file eda_base_frame.h.

506{ return wxGetTranslation( m_aboutTitle ); }

References EDA_BASE_FRAME::m_aboutTitle.

Referenced by DIALOG_ABOUT::DIALOG_ABOUT(), PGM_SINGLE_TOP::OnPgmInit(), and PGM_KICAD::OnPgmInit().

◆ GetActiveLayer()

virtual PCB_LAYER_ID PCB_BASE_FRAME::GetActiveLayer ( ) const
inlinevirtualinherited

Definition at line 357 of file pcb_base_frame.h.

357{ return GetScreen()->m_Active_Layer; }
PCB_LAYER_ID m_Active_Layer
Definition: pcb_screen.h:42

References PCB_BASE_FRAME::GetScreen(), and PCB_SCREEN::m_Active_Layer.

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), CONVERT_TOOL::CreatePolys(), APPEARANCE_CONTROLS::doApplyLayerPreset(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PCB_SELECTION_TOOL::GetActiveLayer(), PCB_BASE_FRAME::GetCollectorsGuide(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectDRCError(), PCB_CONTROL::LayerAlphaDec(), PCB_CONTROL::LayerAlphaInc(), PCB_CONTROL::LayerNext(), PCB_CONTROL::LayerPrev(), PCB_CONTROL::LayerToggle(), ROUTER_TOOL::MainLoop(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), APPEARANCE_CONTROLS::OnLayerChanged(), APPEARANCE_CONTROLS::OnLayerContextMenu(), DIALOG_CLEANUP_GRAPHICS::OnSelectItem(), PCB_DRAW_PANEL_GAL::OnShow(), OnUpdateLayerSelectBox(), PCB_EDIT_FRAME::OnUpdateLayerSelectBox(), LENGTH_TUNER_TOOL::performTuning(), DRAWING_TOOL::PlaceCharacteristics(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceStackup(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), ROUTER_TOOL::RouteSelected(), PCB_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SetActiveLayer(), PCB_BASE_FRAME::SetDisplayOptions(), PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog(), PCB_BASE_FRAME::SwitchLayer(), PCB_EDIT_FRAME::SwitchLayer(), ROUTER_TOOL::switchLayerOnViaPlacement(), PCB_CONTROL::UpdateMessagePanel(), and PCB_EDIT_FRAME::UpdateUserInterface().

◆ GetAppearancePanel()

◆ GetAutoSaveFilePrefix()

static wxString EDA_BASE_FRAME::GetAutoSaveFilePrefix ( )
inlinestaticprotectedinherited

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inherited

Definition at line 298 of file eda_base_frame.cpp.

299{
300 return Pgm().GetCommonSettings()->m_System.autosave_interval;
301}

References Pgm().

Referenced by EDA_DRAW_FRAME::CommonSettingsChanged(), EDA_BASE_FRAME::onAutoSaveTimer(), and EDA_BASE_FRAME::ProcessEvent().

◆ GetAuxOrigin()

const VECTOR2I & PCB_BASE_FRAME::GetAuxOrigin ( ) const
inherited

◆ GetBoard()

BOARD * PCB_BASE_FRAME::GetBoard ( ) const
inlineinherited

Definition at line 191 of file pcb_base_frame.h.

192 {
193 wxASSERT( m_pcb );
194 return m_pcb;
195 }

References PCB_BASE_FRAME::m_pcb.

Referenced by PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), GRID_CELL_LAYER_SELECTOR::BeginEdit(), DIALOG_BOARD_REANNOTATE::BuildFootprintList(), CanCloseFPFromBoard(), PCB_EDIT_FRAME::canCloseWindow(), canCloseWindow(), Clear_Pcb(), PCB_EDIT_FRAME::Clear_Pcb(), ClearModify(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), CommonSettingsChanged(), PCB_BASE_FRAME::Compile_Ratsnest(), DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), CreateHeaderInfoData(), PCB_BASE_FRAME::CreateNewFootprint(), ZONE_CREATE_HELPER::createNewZone(), PCB_PROPERTIES_PANEL::createPGProperty(), CONVERT_TOOL::CreatePolys(), DIALOG_PRINT_PCBNEW::createPrintout(), FOOTPRINT_EDITOR_CONTROL::CutCopyFootprint(), DIALOG_FOOTPRINT_CHECKER::deleteAllMarkers(), DIALOG_DRC::deleteAllMarkers(), PCB_CONTROL::DeleteItemCursor(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_DRC::DIALOG_DRC(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER(), DIALOG_GENDRILL::DIALOG_GENDRILL(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_NET_INSPECTOR::DIALOG_NET_INSPECTOR(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), FOOTPRINT_VIEWER_FRAME::displayFootprint(), APPEARANCE_CONTROLS::doApplyLayerPreset(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), PCB_EDIT_FRAME::doCloseWindow(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), PCB_EDIT_FRAME::DoGenFootprintsReport(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::DpDimensionsDialog(), GRID_CELL_LAYER_RENDERER::Draw(), DRAWING_TOOL::DrawBoardCharacteristics(), DRAWING_TOOL::DrawSpecificationStackup(), DRAWING_TOOL::DrawVia(), EDIT_TOOL::Duplicate(), FOOTPRINT_EDITOR_CONTROL::DuplicateFootprint(), PCB_EDIT_FRAME::Edit_Zone_Params(), DIALOG_COPPER_ZONE::ensureSelectedNetIsVisible(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), VIA_SIZE_MENU::eventHandler(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), FOOTPRINT_EDITOR_CONTROL::ExportFootprint(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones(), BOARD_EDITOR_CONTROL::ExportSpecctraDSN(), PCB_EDIT_FRAME::ExportSpecctraFile(), PCB_EDIT_FRAME::ExportSVG(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::FindItemsFromSyncSelection(), PCB_BASE_FRAME::FocusOnItems(), PCB_EDIT_FRAME::GenD356File(), PCB_EDIT_FRAME::GenFootprintsReport(), EDA_3D_VIEWER_FRAME::GetBoard(), GetBoard(), PCB_EDIT_FRAME::GetCurrentFileName(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), GetDesignSettings(), GetDocumentExtents(), PCB_LAYER_BOX_SELECTOR::getEnabledLayers(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), PCB_BASE_FRAME::GetItem(), PCB_EDIT_FRAME::GetLastPath(), DIALOG_TRACK_VIA_PROPERTIES::getLayerDepth(), PCB_LAYER_BOX_SELECTOR::getLayerName(), PCB_LAYER_SELECTOR::getLayerName(), GetLoadedFPID(), DISPLAY_FOOTPRINTS_FRAME::GetModel(), GetModel(), FOOTPRINT_VIEWER_FRAME::GetModel(), FOOTPRINT_WIZARD_FRAME::GetModel(), ZONE_SEARCH_HANDLER::GetResultCell(), PCB_BASE_FRAME::GetSeverity(), GRID_CELL_LAYER_SELECTOR::GetValue(), PRIVATE_LAYERS_GRID_TABLE::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), APPEARANCE_CONTROLS::getVisibleLayers(), APPEARANCE_CONTROLS::getVisibleObjects(), PCB_EDITOR_CONDITIONS::hasItemsFunc(), PCB_BASE_FRAME::HideSolderMask(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), ImportFootprint(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), PCB_EDIT_FRAME::ImportSpecctraSession(), EDIT_TOOL::Init(), DIALOG_PLOT::init_Dialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectDRCError(), ARRAY_CREATOR::Invoke(), IsContentModified(), IsCurrentFPFromBoard(), PCB_EDIT_FRAME::IsElementVisible(), PCB_LAYER_SELECTOR::isLayerEnabled(), PCB_EDIT_FRAME::KiwayMailIn(), LoadBoard(), LoadFootprintFromBoard(), DIALOG_IMPORT_NETLIST::loadNetlist(), PCB_EDIT_FRAME::LoadProjectSettings(), BOARD_INSPECTION_TOOL::makeDRCEngine(), CONVERT_TOOL::makePolysFromChainedSegs(), CONVERT_TOOL::makePolysFromClosedGraphics(), CONVERT_TOOL::makePolysFromOpenGraphics(), DIALOG_DRC::OnActivateDlg(), DIALOG_BOARD_REANNOTATE::OnApplyClick(), DIALOG_BOARD_SETUP::onAuxiliaryAction(), APPEARANCE_CONTROLS::OnBoardChanged(), DIALOG_NET_INSPECTOR::onBoardChanged(), PCB_SEARCH_PANE::onBoardChanged(), PCB_EDIT_FRAME::onBoardLoaded(), DIALOG_IMPORT_SETTINGS::OnBrowseClicked(), DIALOG_DRC::OnDRCItemRClick(), DIALOG_DRC::OnDRCItemSelected(), DIALOG_EXPORT_STEP::onExportButton(), PCB_EDIT_FRAME::OnExportHyperlynx(), PCB_EDIT_FRAME::OnExportIDF3(), PCB_EDIT_FRAME::OnExportSTEP(), PCB_EDIT_FRAME::OnExportVRML(), APPEARANCE_CONTROLS::OnLayerContextMenu(), PCB_BASE_FRAME::OnModify(), APPEARANCE_CONTROLS::onNetclassContextMenu(), PCB_EDIT_FRAME::OnNetlistChanged(), APPEARANCE_CONTROLS::onObjectVisibilityChanged(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), PCB_EDIT_FRAME::OnRemoveTeardropTool(), PCB_EDIT_FRAME::OnRunTeardropTool(), PANEL_SETUP_RULES::onScintillaCharAdded(), DIALOG_CLEANUP_GRAPHICS::OnSelectItem(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), FOOTPRINT_VIEWER_FRAME::OnUpdateFootprintButton(), OnUpdateLoadFootprintFromBoard(), OnUpdateSaveFootprintToBoard(), OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_SETUP_BOARD_FINISH::PANEL_SETUP_BOARD_FINISH(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), PANEL_SETUP_CONSTRAINTS::PANEL_SETUP_CONSTRAINTS(), PANEL_SETUP_LAYERS::PANEL_SETUP_LAYERS(), PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE(), PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS(), PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS(), PCB_CONTROL::Paste(), PCB_SEARCH_PANE::PCB_SEARCH_PANE(), DIALOG_UPDATE_PCB::PerformUpdate(), DRAWING_TOOL::PlaceImportedGraphics(), DIALOG_PLOT::Plot(), ROUTER_TOOL::prepareInteractive(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints(), EDIT_TOOL::Properties(), FOOTPRINT_EDITOR_CONTROL::Properties(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), DIALOG_COPPER_ZONE::readNetInformation(), BOARD_REANNOTATE_TOOL::ReannotateDuplicates(), NET_GRID_TABLE::Rebuild(), PCB_BASE_FRAME::rebuildConnectivity(), APPEARANCE_CONTROLS::rebuildLayerContextMenu(), APPEARANCE_CONTROLS::rebuildLayers(), APPEARANCE_CONTROLS::rebuildNets(), PCB_EDIT_FRAME::RecordDRCExclusions(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), PCB_EDIT_FRAME::redrawNetnames(), DIALOG_PLOT::reInitDialog(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), FOOTPRINT_EDITOR_CONTROL::RenameFootprint(), BOARD_INSPECTION_TOOL::reportHeader(), DRC_TOOL::Reset(), PCB_EDIT_FRAME::ResolveDRCExclusions(), ROUTER_TOOL::RouteSelected(), PCB_EDIT_FRAME::RunActionPlugin(), DIALOG_FOOTPRINT_CHECKER::runChecks(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SaveFootprintToBoard(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), DIALOG_FIND::search(), FOOTPRINT_SEARCH_HANDLER::Search(), ZONE_SEARCH_HANDLER::Search(), TEXT_SEARCH_HANDLER::Search(), NETS_SEARCH_HANDLER::Search(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SelectOneLayer(), PCB_BASE_FRAME::SetBoard(), DIALOG_GLOBAL_DELETION::SetCurrentLayer(), PCB_EDIT_FRAME::SetElementVisibility(), PCB_EDIT_FRAME::SetLastPath(), APPEARANCE_CONTROLS::SetObjectVisible(), PCB_EDIT_FRAME::SetPageSettings(), DIALOG_PLOT::SetPlotFormat(), ZONE_CREATE_HELPER::setUniquePriority(), ZONE_SETTINGS::SetupLayersList(), setupTools(), setupUIConditions(), PCB_EDIT_FRAME::setupUIConditions(), APPEARANCE_CONTROLS::setVisibleLayers(), APPEARANCE_CONTROLS::setVisibleObjects(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), APPEARANCE_CONTROLS::showNetclass(), PCB_BASE_FRAME::ShowSolderMask(), DIALOG_COPPER_ZONE::sortNetsByPadCount(), PCB_EDIT_FRAME::SwitchLayer(), TEARDROP_DIALOG::TEARDROP_DIALOG(), DIALOG_SWAP_LAYERS::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow(), PANEL_SETUP_MASK_AND_PASTE::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), DIALOG_SWAP_LAYERS::TransferDataToWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow(), PANEL_SETUP_MASK_AND_PASTE::TransferDataToWindow(), PCB_BASE_EDIT_FRAME::unitsChangeRefresh(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), VIA_SIZE_MENU::update(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_BOARD_STATISTICS::updateDrillGrid(), PCB_CONTROL::UpdateMessagePanel(), DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel(), FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel(), DRC_TOOL::updatePointers(), UpdateTitle(), PCB_EDIT_FRAME::UpdateTitle(), PCB_EDIT_FRAME::UpdateUserInterface(), DISPLAY_FOOTPRINTS_FRAME::updateView(), UpdateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), DIALOG_DRC::writeReport(), DIALOG_FOOTPRINT_CHECKER::~DIALOG_FOOTPRINT_CHECKER(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), and PCB_EDIT_FRAME::~PCB_EDIT_FRAME().

◆ GetBoardBoundingBox()

BOX2I PCB_BASE_FRAME::GetBoardBoundingBox ( bool  aBoardEdgesOnly = false) const
inherited

Calculate the bounding box containing all board items (or board edge segments).

Parameters
aBoardEdgesOnlyis true if we are interested in board edge segments only.
Returns
the board's bounding box.

Definition at line 681 of file pcb_base_frame.cpp.

682{
683 BOX2I area = aBoardEdgesOnly ? m_pcb->GetBoardEdgesBoundingBox() : m_pcb->GetBoundingBox();
684
685 if( area.GetWidth() == 0 && area.GetHeight() == 0 )
686 {
687 wxSize pageSize = GetPageSizeIU();
688
690 {
691 area.SetOrigin( 0, 0 );
692 area.SetEnd( pageSize.x, pageSize.y );
693 }
694 else
695 {
696 area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
697 area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
698 }
699 }
700
701 return area;
702}
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:823
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: board.h:809
void SetOrigin(const Vec &pos)
Definition: box2.h:202
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:255

References BOARD::GetBoardEdgesBoundingBox(), BOARD::GetBoundingBox(), BOX2< Vec >::GetHeight(), PCB_BASE_FRAME::GetPageSizeIU(), BOX2< Vec >::GetWidth(), PCB_BASE_FRAME::m_pcb, EDA_DRAW_FRAME::m_showBorderAndTitleBlock, BOX2< Vec >::SetEnd(), and BOX2< Vec >::SetOrigin().

Referenced by PCB_BASE_FRAME::GetDocumentExtents(), and GetDocumentExtents().

◆ GetCanvas()

PCB_DRAW_PANEL_GAL * PCB_BASE_FRAME::GetCanvas ( ) const
overridevirtualinherited

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

Returns
Pointer to GAL-based canvas.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 1059 of file pcb_base_frame.cpp.

1060{
1061 return static_cast<PCB_DRAW_PANEL_GAL*>( EDA_DRAW_FRAME::GetCanvas() );
1062}

References EDA_DRAW_FRAME::GetCanvas().

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), ActivateGalCanvas(), PCB_BASE_EDIT_FRAME::ActivateGalCanvas(), PCB_EDIT_FRAME::ActivateGalCanvas(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), DIALOG_NET_INSPECTOR::buildNetsList(), PCB_SELECTION_TOOL::canvas(), PCB_TOOL_BASE::canvas(), PCB_VIEWER_TOOLS::canvas(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_WIZARD_FRAME::ClickOnPageList(), PCB_BASE_FRAME::CommonSettingsChanged(), CommonSettingsChanged(), FOOTPRINT_VIEWER_FRAME::CommonSettingsChanged(), PCB_EDIT_FRAME::CommonSettingsChanged(), DIALOG_PRINT_PCBNEW::createPrintout(), PCB_CONTROL::DeleteItemCursor(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), PCB_BASE_FRAME::DisplayGridMsg(), APPEARANCE_CONTROLS::doApplyLayerPreset(), APPEARANCE_CONTROLS::doApplyViewport(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), doCloseWindow(), FOOTPRINT_VIEWER_FRAME::doCloseWindow(), PCB_EDIT_FRAME::doCloseWindow(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PCB_SELECTION_TOOL::doSyncSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PCB_EDIT_FRAME::Edit_Zone_Params(), DIALOG_DRC::ExcludeMarker(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_SELECTION_TOOL::FindItem(), ROUTER_TOOL::finishInteractive(), PCB_CONTROL::FlipPcbView(), PCB_BASE_FRAME::FocusOnItems(), PCB_BASE_FRAME::GetCollectorsGuide(), APPEARANCE_CONTROLS::getVisibleLayers(), APPEARANCE_CONTROLS::getVisibleObjects(), ROUTER_TOOL::handleLayerSwitch(), HardRedraw(), PCB_BASE_FRAME::HideSolderMask(), PCB_EDIT_FRAME::ImportSpecctraSession(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_CONTROL::LayerAlphaDec(), PCB_CONTROL::LayerAlphaInc(), LoadFootprintFromBoard(), LoadFootprintFromLibrary(), PCB_EDIT_FRAME::LoadProjectSettings(), PCB_BASE_FRAME::LoadSettings(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), DIALOG_BOARD_REANNOTATE::OnApplyClick(), PCB_EDIT_FRAME::onBoardLoaded(), APPEARANCE_CONTROLS::OnColorSwatchChanged(), DIALOG_NET_INSPECTOR::onDeleteNet(), DIALOG_DRC::OnDRCItemRClick(), OnEditItemRequest(), PCB_SELECTION_TOOL::OnIdle(), APPEARANCE_CONTROLS::OnLayerContextMenu(), APPEARANCE_CONTROLS::onLayerVisibilityToggled(), DIALOG_GROUP_PROPERTIES::OnMemberSelected(), APPEARANCE_CONTROLS::onNetclassColorChanged(), APPEARANCE_CONTROLS::onNetclassContextMenu(), APPEARANCE_CONTROLS::onNetColorMode(), APPEARANCE_CONTROLS::onNetContextMenu(), PCB_EDIT_FRAME::OnNetlistChanged(), APPEARANCE_CONTROLS::onObjectVisibilityChanged(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), DIALOG_GROUP_PROPERTIES::OnRemoveMember(), PCB_EDIT_FRAME::OnRemoveTeardropTool(), DIALOG_NET_INSPECTOR::onRenameNet(), DIALOG_NET_INSPECTOR::onSelChanged(), DIALOG_CLEANUP_GRAPHICS::OnSelectItem(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), DIALOG_NET_INSPECTOR::onSortingChanged(), FOOTPRINT_TREE_PANE::onUpdateUI(), APPEARANCE_CONTROLS::onViewportChanged(), OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), BOARD_EDITOR_CONTROL::PageSettings(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PCB_BASE_FRAME::PlaceFootprint(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), DRAWING_TOOL::PlaceText(), DIALOG_PAD_PROPERTIES::prepareCanvas(), ROUTER_TOOL::prepareInteractive(), PCB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), FOOTPRINT_EDITOR_CONTROL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), DIALOG_BOARD_REANNOTATE::ReannotateBoard(), NET_GRID_TABLE::Rebuild(), PCB_EDIT_FRAME::RebuildAndRefresh(), PCB_BASE_FRAME::rebuildConnectivity(), APPEARANCE_CONTROLS::rebuildNets(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), PCB_EDIT_FRAME::redrawNetnames(), refreshCallback(), DIALOG_DRC::refreshEditor(), DIALOG_FOOTPRINT_CHECKER::refreshEditor(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), PCB_SELECTION_TOOL::RequestSelection(), PCB_EDIT_FRAME::ResolveDRCExclusions(), PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList(), PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList(), RevertFootprint(), PCB_BASE_EDIT_FRAME::RollbackFromUndo(), ROUTER_TOOL::RouteSelected(), DIALOG_FOOTPRINT_CHECKER::runChecks(), DRC_TOOL::RunTests(), SaveFootprintToBoard(), PCB_EDIT_FRAME::SaveProjectSettings(), DISPLAY_FOOTPRINTS_FRAME::SaveSettings(), FOOTPRINT_VIEWER_FRAME::SaveSettings(), DIALOG_FIND::search(), PCB_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::selectAllConnectedTracks(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), FOOTPRINT_SEARCH_HANDLER::SelectItems(), ZONE_SEARCH_HANDLER::SelectItems(), TEXT_SEARCH_HANDLER::SelectItems(), NETS_SEARCH_HANDLER::SelectItems(), SelectLayer(), PCB_SELECTION_TOOL::selectMultiple(), SetActiveLayer(), PCB_EDIT_FRAME::SetActiveLayer(), DRAWING_TOOL::SetAnchor(), PCB_BASE_FRAME::SetBoard(), PCB_BASE_EDIT_FRAME::SetBoard(), PCB_BASE_FRAME::SetDisplayOptions(), PCB_POINT_EDITOR::setEditedPoint(), PCB_EDIT_FRAME::SetElementVisibility(), PCB_EDIT_FRAME::SetGridColor(), APPEARANCE_CONTROLS::SetLayerVisible(), APPEARANCE_CONTROLS::SetObjectVisible(), PCB_EDIT_FRAME::SetPageSettings(), setupTools(), PCB_EDIT_FRAME::setupTools(), setupUIConditions(), PCB_EDIT_FRAME::setupUIConditions(), APPEARANCE_CONTROLS::setVisibleLayers(), APPEARANCE_CONTROLS::setVisibleObjects(), PCB_BASE_EDIT_FRAME::ShowBitmapPropertiesDialog(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(), PCB_BASE_FRAME::ShowSolderMask(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), SwitchCanvas(), PCB_BASE_FRAME::SwitchLayer(), PCB_EDIT_FRAME::SwitchLayer(), PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), APPEARANCE_CONTROLS::UpdateDisplayOptions(), NET_GRID_TABLE::updateNetColor(), PCB_BASE_FRAME::UpdateStatusBar(), PCB_EDIT_FRAME::UpdateUserInterface(), PCB_BASE_FRAME::UpdateUserUnits(), DISPLAY_FOOTPRINTS_FRAME::updateView(), UpdateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox(), PCB_SELECTION_TOOL::zoomFitSelection(), DIALOG_GROUP_PROPERTIES::~DIALOG_GROUP_PROPERTIES(), DIALOG_IMPORT_NETLIST::~DIALOG_IMPORT_NETLIST(), DIALOG_NET_INSPECTOR::~DIALOG_NET_INSPECTOR(), DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME(), PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME(), and PCB_BASE_FRAME::~PCB_BASE_FRAME().

◆ GetCollectorsGuide()

GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide ( )
inherited
Returns
global configuration options.

Definition at line 795 of file pcb_base_frame.cpp.

796{
798 GetCanvas()->GetView() );
799
800 // account for the globals
801 guide.SetIgnoreMTextsMarkedNoShow( ! m_pcb->IsElementVisible( LAYER_MOD_TEXT_INVISIBLE ) );
802 guide.SetIgnoreMTextsOnBack( ! m_pcb->IsElementVisible( LAYER_MOD_TEXT ) );
803 guide.SetIgnoreMTextsOnFront( ! m_pcb->IsElementVisible( LAYER_MOD_TEXT ) );
804 guide.SetIgnoreModulesOnBack( ! m_pcb->IsElementVisible( LAYER_MOD_BK ) );
805 guide.SetIgnoreModulesOnFront( ! m_pcb->IsElementVisible( LAYER_MOD_FR ) );
806 guide.SetIgnorePadsOnBack( ! m_pcb->IsElementVisible( LAYER_PAD_BK ) );
807 guide.SetIgnorePadsOnFront( ! m_pcb->IsElementVisible( LAYER_PAD_FR ) );
808 guide.SetIgnoreThroughHolePads( ! m_pcb->IsElementVisible( LAYER_PADS_TH ) );
809 guide.SetIgnoreModulesVals( ! m_pcb->IsElementVisible( LAYER_MOD_VALUES ) );
810 guide.SetIgnoreModulesRefs( ! m_pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
811 guide.SetIgnoreThroughVias( ! m_pcb->IsElementVisible( LAYER_VIAS ) );
812 guide.SetIgnoreBlindBuriedVias( ! m_pcb->IsElementVisible( LAYER_VIAS ) );
813 guide.SetIgnoreMicroVias( ! m_pcb->IsElementVisible( LAYER_VIAS ) );
814 guide.SetIgnoreTracks( ! m_pcb->IsElementVisible( LAYER_TRACKS ) );
815
816 return guide;
817}
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:583
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:635
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:326
virtual PCB_LAYER_ID GetActiveLayer() const
@ LAYER_MOD_TEXT_INVISIBLE
text marked as invisible
Definition: layer_ids.h:200
@ LAYER_PAD_FR
smd pads, front layer
Definition: layer_ids.h:202
@ LAYER_MOD_TEXT
Definition: layer_ids.h:198
@ LAYER_TRACKS
Definition: layer_ids.h:212
@ LAYER_MOD_FR
show footprints on front
Definition: layer_ids.h:208
@ LAYER_PAD_BK
smd pads, back layer
Definition: layer_ids.h:203
@ LAYER_MOD_VALUES
show footprints values (when texts are visible)
Definition: layer_ids.h:210
@ LAYER_PADS_TH
multilayer pads, usually with holes
Definition: layer_ids.h:213
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:193
@ LAYER_MOD_BK
show footprints on back
Definition: layer_ids.h:209
@ LAYER_MOD_REFERENCES
show footprints references (when texts are visible)
Definition: layer_ids.h:211

References PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetCanvas(), BOARD::GetVisibleLayers(), BOARD::IsElementVisible(), LAYER_MOD_BK, LAYER_MOD_FR, LAYER_MOD_REFERENCES, LAYER_MOD_TEXT, LAYER_MOD_TEXT_INVISIBLE, LAYER_MOD_VALUES, LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PADS_TH, LAYER_TRACKS, LAYER_VIAS, PCB_BASE_FRAME::m_pcb, GENERAL_COLLECTORS_GUIDE::SetIgnoreBlindBuriedVias(), GENERAL_COLLECTORS_GUIDE::SetIgnoreMicroVias(), GENERAL_COLLECTORS_GUIDE::SetIgnoreModulesOnBack(), GENERAL_COLLECTORS_GUIDE::SetIgnoreModulesOnFront(), GENERAL_COLLECTORS_GUIDE::SetIgnoreModulesRefs(), GENERAL_COLLECTORS_GUIDE::SetIgnoreModulesVals(), GENERAL_COLLECTORS_GUIDE::SetIgnoreMTextsMarkedNoShow(), GENERAL_COLLECTORS_GUIDE::SetIgnoreMTextsOnBack(), GENERAL_COLLECTORS_GUIDE::SetIgnoreMTextsOnFront(), GENERAL_COLLECTORS_GUIDE::SetIgnorePadsOnBack(), GENERAL_COLLECTORS_GUIDE::SetIgnorePadsOnFront(), GENERAL_COLLECTORS_GUIDE::SetIgnoreThroughHolePads(), GENERAL_COLLECTORS_GUIDE::SetIgnoreThroughVias(), and GENERAL_COLLECTORS_GUIDE::SetIgnoreTracks().

Referenced by PCB_CONTROL::DeleteItemCursor(), PAD_TOOL::EnumeratePads(), and BOARD_INSPECTION_TOOL::highlightNet().

◆ GetColorSettings()

COLOR_SETTINGS * FOOTPRINT_EDIT_FRAME::GetColorSettings ( bool  aForceRefresh = false) const
overridevirtual

Helper to retrieve the current color settings.

Reimplemented from PCB_BASE_FRAME.

Definition at line 646 of file footprint_edit_frame.cpp.

647{
648 wxString currentTheme = GetFootprintEditorSettings()->m_ColorTheme;
649 return Pgm().GetSettingsManager().GetColorSettings( currentTheme );
650}
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:190
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const

References PCB_BASE_FRAME::GetFootprintEditorSettings(), APP_SETTINGS_BASE::m_ColorTheme, and Pgm().

Referenced by GetGridColor().

◆ GetCurrentFileName()

virtual wxString EDA_BASE_FRAME::GetCurrentFileName ( ) const
inlinevirtualinherited

Get the full filename + path of the currently opened file in the frame.

If no file is open, an empty string is returned.

Returns
the filename and full path to the open file

Reimplemented in SCH_EDIT_FRAME, KICAD_MANAGER_FRAME, PL_EDITOR_FRAME, and PCB_EDIT_FRAME.

Definition at line 431 of file eda_base_frame.h.

431{ return wxEmptyString; }

Referenced by EDA_BASE_FRAME::SaveSettings().

◆ GetCurrentSelection()

SELECTION & FOOTPRINT_EDIT_FRAME::GetCurrentSelection ( )
overridevirtual

Get the current selection from the canvas area.

Returns
the current selection.

Reimplemented from TOOLS_HOLDER.

Definition at line 359 of file footprint_edit_frame.cpp.

360{
361 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
362}

References TOOL_MANAGER::GetTool(), and TOOLS_HOLDER::m_toolManager.

◆ GetCurrentTreeNode()

LIB_TREE_NODE * FOOTPRINT_EDIT_FRAME::GetCurrentTreeNode ( ) const

◆ GetDesignRulesPath()

wxString PCB_BASE_EDIT_FRAME::GetDesignRulesPath ( )
inherited

Return the absolute path to the design rules file for the currently-loaded board.

Note
There is no guarantee that this file actually exists and can be opened! It only makes sense from PcbNew but is needed in PCB_BASE_EDIT_FRAME::SetBoard.

Definition at line 268 of file pcb_base_edit_frame.cpp.

269{
270 if( !GetBoard() )
271 return wxEmptyString;
272
273 wxFileName fn = GetBoard()->GetFileName();
274 fn.SetExt( DesignRulesFileExtension );
275 return Prj().AbsolutePath( fn.GetFullName() );
276}
const wxString & GetFileName() const
Definition: board.h:302
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
Definition: project.cpp:305
const std::string DesignRulesFileExtension

References PROJECT::AbsolutePath(), DesignRulesFileExtension, PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), and KIWAY_HOLDER::Prj().

Referenced by PCB_EDIT_FRAME::CommonSettingsChanged(), DRAWING_TOOL::DrawVia(), BOARD_INSPECTION_TOOL::makeDRCEngine(), PCB_EDIT_FRAME::onBoardLoaded(), DIALOG_DRC::OnRunDRCClick(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), PANEL_SETUP_RULES::TransferDataFromWindow(), and PANEL_SETUP_RULES::TransferDataToWindow().

◆ GetDesignSettings()

BOARD_DESIGN_SETTINGS & FOOTPRINT_EDIT_FRAME::GetDesignSettings ( ) const
overridevirtual

Returns the BOARD_DESIGN_SETTINGS for the open project.

Reimplemented from PCB_BASE_FRAME.

Definition at line 561 of file footprint_edit_frame.cpp.

562{
563 return GetBoard()->GetDesignSettings();
564}

References PCB_BASE_FRAME::GetBoard(), and BOARD::GetDesignSettings().

Referenced by Clear_Pcb(), LoadSettings(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), and SaveSettings().