KiCad PCB EDA Suite
PCB_EDIT_FRAME Class Reference

The main frame for Pcbnew. More...

#include <pcb_edit_frame.h>

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

Classes

struct  LAYER_TOOLBAR_ICON_VALUES
 Store the previous layer toolbar icon state information. More...
 

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

virtual ~PCB_EDIT_FRAME ()
 
void LoadFootprints (NETLIST &aNetlist, REPORTER &aReporter)
 Load the footprints for each #SCH_COMPONENT in aNetlist from the list of libraries. More...
 
void OnQuit (wxCommandEvent &event)
 
bool IsContentModified () const override
 Get if the current board has been modified but not saved. More...
 
void PythonSyncEnvironmentVariables ()
 Synchronize the environment variables from KiCad's environment into the Python interpreter. More...
 
void PythonSyncProjectName ()
 Synchronize the project name from KiCad's environment into the Python interpreter. More...
 
void UpdateUserInterface ()
 Update the layer manager and other widgets from the board setup (layer and items visibility, colors ...) More...
 
void HardRedraw () override
 Rebuild the GAL and redraws the screen. More...
 
void RebuildAndRefresh ()
 Rebuilds board connectivity, refreshes canvas. More...
 
void ExecuteRemoteCommand (const char *cmdline) override
 Execute a remote command send by Eeschema via a socket, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242). More...
 
void KiwayMailIn (KIWAY_EXPRESS &aEvent) override
 Receive KIWAY_EXPRESS messages from other players. More...
 
std::vector< BOARD_ITEM * > FindItemsFromSyncSelection (std::string syncStr)
 Used to find items by selection synchronization spec string. More...
 
void ShowFindDialog ()
 Show the Find dialog. More...
 
void FindNext ()
 Find the next item using our existing search parameters. More...
 
void ToPlotter (int aID)
 Open a dialog frame to create plot and drill files relative to the current board. More...
 
void ExportSVG (wxCommandEvent &event)
 Show the Export to SVG file dialog. More...
 
void OnUpdateLayerSelectBox (wxUpdateUIEvent &aEvent)
 
bool LayerManagerShown ()
 
bool PropertiesShown ()
 
void OnUpdateSelectViaSize (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectTrackWidth (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectAutoWidth (wxUpdateUIEvent &aEvent)
 
void RunEeschema ()
 
void UpdateTrackWidthSelectBox (wxChoice *aTrackWidthSelectBox, bool aEdit=true)
 
void UpdateViaSizeSelectBox (wxChoice *aViaSizeSelectBox, bool aEdit=true)
 
EDA_ANGLE GetRotationAngle () const override
 Return the angle used for rotate operations. More...
 
COLOR4D GetGridColor () override
 
void SetGridColor (const COLOR4D &aColor) override
 
void SaveProjectSettings () override
 Save changes to the project settings to the project (.pro) file. More...
 
bool LoadProjectSettings ()
 Load the current project's file configuration settings which are pertinent to this PCB_EDIT_FRAME instance. More...
 
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...
 
wxString GetLastPath (LAST_PATH_TYPE aType)
 Get the last path for a particular type. More...
 
void SetLastPath (LAST_PATH_TYPE aType, const wxString &aLastPath)
 Set the path of the last file successfully read. More...
 
void RecordDRCExclusions ()
 Scan existing markers and record data from any that are Excluded. More...
 
void ResolveDRCExclusions ()
 Update markers to match recorded exclusions. More...
 
void Process_Special_Functions (wxCommandEvent &event)
 
void Tracks_and_Vias_Size_Event (wxCommandEvent &event)
 
void ReCreateHToolbar () override
 
void ReCreateAuxiliaryToolbar () override
 
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)
 Recreate the layer box by clearing the old list and building a new one from the new layer names and colors. More...
 
void OnModify () override
 Must be called after a board change to set the modified flag. More...
 
void SetActiveLayer (PCB_LAYER_ID aLayer) override
 Change the currently active layer to aLayer and also update the APPEARANCE_CONTROLS. More...
 
void OnDisplayOptionsChanged () override
 
bool IsElementVisible (GAL_LAYER_ID aElement) const
 Test whether a given element category is visible. More...
 
void SetElementVisibility (GAL_LAYER_ID aElement, bool aNewState)
 Change the visibility of an element category. More...
 
void ActivateGalCanvas () override
 Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD. More...
 
void ShowBoardSetupDialog (const wxString &aInitialPage=wxEmptyString)
 
void PrepareLayerIndicator (bool aForceRebuild=false)
 
void ToggleLayersManager ()
 
void ToggleProperties ()
 
void ToggleSearch ()
 
int DoGenFootprintsPositionFile (const wxString &aFullFileName, bool aUnitsMM, bool aOnlySMD, bool aNoTHItems, bool aTopSide, bool aBottomSide, bool aFormatCSV, bool aUseAuxOrigin, bool aNegateBottomX)
 Create an ASCII footprint position file. More...
 
void GenFootprintsReport (wxCommandEvent &event)
 Call DoGenFootprintsReport to create a footprint report file. More...
 
bool DoGenFootprintsReport (const wxString &aFullFilename, bool aUnitsMM)
 Create an ASCII footprint report file giving some infos on footprints and board outlines. More...
 
void GenD356File (wxCommandEvent &event)
 
void OnFileHistory (wxCommandEvent &event)
 
void OnClearFileHistory (wxCommandEvent &aEvent)
 
void Files_io (wxCommandEvent &event)
 Call Files_io_from_id with the wxCommandEvent id. More...
 
bool Files_io_from_id (int aId)
 Read and write board files according to aId. More...
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl=0) override
 Load a KiCad board (.kicad_pcb) from aFileName. More...
 
bool SavePcbFile (const wxString &aFileName, bool addToHistory=true, bool aChangeProject=true)
 Write the board data structures to a aFileName. More...
 
bool SavePcbCopy (const wxString &aFileName, bool aCreateProject=false)
 Write the board data structures to aFileName. More...
 
bool Clear_Pcb (bool aQuery, bool aFinal=false)
 Delete all and reinitialize the current board. More...
 
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 SetBoard (BOARD *aBoard, bool aBuildConnectivity, PROGRESS_REPORTER *aReporter=nullptr)
 
BOARD_ITEM_CONTAINERGetModel () const override
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
void RecreateCmpFileFromBoard (wxCommandEvent &aEvent)
 Recreates a .cmp file from the current loaded board. More...
 
void ExportFootprintsToLibrary (bool aStoreInNewLib, const wxString &aLibName=wxEmptyString, wxString *aLibPath=nullptr)
 Save footprints in a library: More...
 
void RecreateBOMFileFromBoard (wxCommandEvent &aEvent)
 Create a BOM file from the current loaded board. More...
 
void ExportToGenCAD (wxCommandEvent &event)
 Create a file in GenCAD 1.4 format from the current board. More...
 
void OnExportVRML (wxCommandEvent &event)
 Export the current BOARD to a VRML file. More...
 
bool ExportVRML_File (const wxString &aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, bool aUseRelativePaths, const wxString &a3D_Subdir, double aXRef, double aYRef)
 Create the file(s) exporting current BOARD to a VRML file. More...
 
void OnExportIDF3 (wxCommandEvent &event)
 Export the current BOARD to a IDFv3 board and lib files. More...
 
void OnExportHyperlynx (wxCommandEvent &event)
 Export the current BOARD to a Hyperlynx HYP file. More...
 
void OnRunTeardropTool (wxCommandEvent &event)
 run teardrop tool More...
 
void OnRemoveTeardropTool (wxCommandEvent &event)
 Remove all teardrops. More...
 
bool Export_IDF3 (BOARD *aPcb, const wxString &aFullFileName, bool aUseThou, double aXRef, double aYRef)
 Create an IDF3 compliant BOARD (*.emn) and LIBRARY (*.emp) file. More...
 
void OnExportSTEP (wxCommandEvent &event)
 Export the current BOARD to a STEP assembly. More...
 
bool ExportSpecctraFile (const wxString &aFullFilename)
 Export the current BOARD to a specctra dsn file. More...
 
bool ImportSpecctraSession (const wxString &aFullFilename)
 Import a specctra *.ses file and use it to relocate MODULEs and to replace all vias and tracks in an existing and loaded BOARD. More...
 
void ShowFootprintPropertiesDialog (FOOTPRINT *aFootprint)
 
int ShowExchangeFootprintsDialog (FOOTPRINT *aFootprint, bool aUpdateMode, bool aSelectedMode)
 
void ExchangeFootprint (FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool resetFabricationAttrs=true, bool reset3DModels=true, bool *aUpdated=nullptr)
 Replace aExisting footprint by aNew footprint using the Existing footprint settings (position, orientation, pad netnames ...). More...
 
bool FootprintMatchesLibrary ()
 
void OnEditItemRequest (BOARD_ITEM *aItem) override
 Install the corresponding dialog editor for the given item. More...
 
void SwitchLayer (PCB_LAYER_ID layer) override
 Change the active layer in the editor. More...
 
void SetTrackSegmentWidth (PCB_TRACK *aTrackItem, PICKED_ITEMS_LIST *aItemsListPicker, bool aUseNetclassValue)
 Modify one track segment width or one via diameter (using DRC control). More...
 
void Edit_Zone_Params (ZONE *zone_container)
 Edit params (layer, clearance, ...) for a zone outline. More...
 
void ShowTargetOptionsDialog (PCB_TARGET *aTarget)
 
void InstallNetlistFrame ()
 
bool FetchNetlistFromSchematic (NETLIST &aNetlist, const wxString &aAnnotateMessage)
 
int TestStandalone (void)
 Test if standalone mode. More...
 
bool ReadNetlistFromFile (const wxString &aFilename, NETLIST &aNetlist, REPORTER &aReporter)
 Read a netlist from a file into a NETLIST object. More...
 
void OnNetlistChanged (BOARD_NETLIST_UPDATER &aUpdater, bool *aRunDragCommand)
 Called after netlist is updated. More...
 
void SendSelectItemsToSch (const std::deque< EDA_ITEM * > &aItems, EDA_ITEM *aFocusItem, bool aForce)
 Send a message to the schematic editor to try to find schematic counterparts of specified PCB items and select them. More...
 
void SendCrossProbeItem (BOARD_ITEM *aSyncItem)
 Send a message to the schematic editor so that it may move its cursor to an item with the same reference as the aSyncItem and highlight it. More...
 
void SendCrossProbeNetName (const wxString &aNetName)
 Send a net name to Eeschema for highlighting. More...
 
void ShowChangedLanguage () override
 Redraw the menus and what not in current language. More...
 
void UpdateTitle ()
 Set the main window title bar text. More...
 
void CommonSettingsChanged (bool aEnvVarsChanged, bool aTextVarsChanged) override
 Called after the preferences dialog is run. More...
 
void ThemeChanged () override
 Called when light/dark theme is changed. More...
 
void ProjectChanged () override
 Notification event that the project has changed. More...
 
wxString GetCurrentFileName () const override
 Get the full filename + path of the currently opened file in the frame. More...
 
SELECTIONGetCurrentSelection () override
 Get the current selection from the canvas area. More...
 
TOOL_ACTIONGetExportNetlistAction ()
 
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)
 
COLOR_SETTINGSGetColorSettings (bool aForceRefresh=false) const override
 Helper to retrieve the current color settings. 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...
 
const BOX2I GetDocumentExtents (bool aIncludeAllVisible=true) const override
 Returns bbox of document with option to not include some items. More...
 
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
 
virtual BOARD_DESIGN_SETTINGSGetDesignSettings () const
 Returns the BOARD_DESIGN_SETTINGS for the open project. More...
 
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)
 
virtual const PCB_PLOT_PARAMSGetPlotSettings () const
 Return the PCB_PLOT_PARAMS for the BOARD owned by this frame. More...
 
virtual void SetPlotSettings (const PCB_PLOT_PARAMS &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...
 
virtual void AddFootprintToBoard (FOOTPRINT *aFootprint)
 Add the given footprint to the board. 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 PCB_LAYER_ID GetActiveLayer () const
 
SEVERITY GetSeverity (int aErrorCode) const override
 
PCBNEW_SETTINGSGetPcbNewSettings () const
 
FOOTPRINT_EDITOR_SETTINGSGetFootprintEditorSettings () const
 
virtual PCB_VIEWERS_SETTINGS_BASEGetViewerSettingsBase () const
 
virtual MAGNETIC_SETTINGSGetMagneticItemsSettings ()
 
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 ()
 
bool IsGridVisible () const
 
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 UpdateMsgPanel ()
 Redraw the message panel. 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)
 
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...
 
virtual APP_SETTINGS_BASEconfig () const
 Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. 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...
 
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
 
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...
 
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 wxString SearchPaneName ()
 
static bool GetActionPluginButtonVisible (const wxString &aPluginPath, bool aPluginDefault)
 Return true if button visibility action plugin setting was set to true or it is unset and plugin defaults to true. More...
 
static std::vector< ACTION_PLUGIN * > GetOrderedActionPlugins ()
 Return ordered list of plugins in sequence in which they should appear on toolbar or in settings. More...
 
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...
 

Public Attributes

PCB_LAYER_BOX_SELECTORm_SelLayerBox
 
wxChoice * m_SelTrackWidthBox
 
wxChoice * m_SelViaSizeBox
 
bool m_show_layer_manager_tools
 
bool m_show_properties
 
bool m_show_search
 
bool m_ZoneFillsDirty
 
bool m_probingSchToPcb
 

Protected Member Functions

void doReCreateMenuBar () override
 
void setupTools ()
 
void setupUIConditions () override
 Setup the UI conditions for the various actions and their controls in this frame. More...
 
void SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
 Switch currently used canvas (Cairo / OpenGL). More...
 
void buildActionPluginMenus (ACTION_MENU *aActionMenu)
 Fill action menu with all registered action plugins. More...
 
void AddActionPluginTools ()
 Append action plugin buttons to main toolbar. More...
 
void RunActionPlugin (ACTION_PLUGIN *aActionPlugin)
 Execute action plugin's Run() method and updates undo buffer. More...
 
void OnActionPluginMenu (wxCommandEvent &aEvent)
 Launched by the menu when an action is called. More...
 
void OnActionPluginButton (wxCommandEvent &aEvent)
 Launched by the button when an action is called. More...
 
void onBoardLoaded ()
 Update the state of the GUI after a new board is loaded or created. More...
 
bool doAutoSave () override
 Perform auto save when the board has been modified and not saved within the auto save interval. More...
 
bool importFile (const wxString &aFileName, int aFileType)
 Load the given filename but sets the path to the current project path. More...
 
bool canCloseWindow (wxCloseEvent &aCloseEvent) override
 
void doCloseWindow () override
 
 PCB_EDIT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 
void onSize (wxSizeEvent &aEvent)
 
int inferLegacyEdgeClearance (BOARD *aBoard)
 
void redrawNetnames (wxTimerEvent &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...
 
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

LAYER_TOOLBAR_ICON_VALUES m_prevIconVal
 
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

TOOL_ACTIONm_exportNetlistAction
 The export board netlist tool action object. More...
 
DIALOG_FINDm_findDialog
 
BOX2D m_lastViewport
 Keep track of viewport so that track net labels can be adjusted when it changes. More...
 
wxTimer m_redrawNetnamesTimer
 
wxTimer * m_eventCounterTimer
 
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
 
class APPEARANCE_CONTROLS
 

Detailed Description

The main frame for Pcbnew.

See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.

Definition at line 68 of file pcb_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

◆ ~PCB_EDIT_FRAME()

PCB_EDIT_FRAME::~PCB_EDIT_FRAME ( )
virtual

Definition at line 466 of file pcb_edit_frame.cpp.

467{
468 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
469 {
470 // Stop the timer during destruction early to avoid potential event race conditions (that do happen on windows)
471 m_eventCounterTimer->Stop();
472 delete m_eventCounterTimer;
473 }
474
475 // Close modeless dialogs
476 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
477
478 if( open_dlg )
479 open_dlg->Close( true );
480
481 // Shutdown all running tools
482 if( m_toolManager )
484
485 if( GetBoard() )
487
489 delete m_appearancePanel;
491 delete m_propertiesPanel;
492}
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void RemoveAllListeners()
Remove all listeners.
Definition: board.cpp:2046
APPEARANCE_CONTROLS * m_appearancePanel
PANEL_SELECTION_FILTER * m_selectionFilterPanel
PROPERTIES_PANEL * m_propertiesPanel
BOARD * GetBoard() const
TOOL_ACTION * m_exportNetlistAction
The export board netlist tool action object.
wxTimer * m_eventCounterTimer
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...
#define DIALOG_DRC_WINDOW_NAME
Definition: dialog_drc.h:41

References DIALOG_DRC_WINDOW_NAME, PCB_BASE_FRAME::GetBoard(), ADVANCED_CFG::GetCfg(), PCB_BASE_EDIT_FRAME::m_appearancePanel, m_eventCounterTimer, m_exportNetlistAction, PCB_BASE_EDIT_FRAME::m_propertiesPanel, PCB_BASE_EDIT_FRAME::m_selectionFilterPanel, TOOLS_HOLDER::m_toolManager, BOARD::RemoveAllListeners(), and TOOL_MANAGER::ShutdownAllTools().

◆ PCB_EDIT_FRAME()

PCB_EDIT_FRAME::PCB_EDIT_FRAME ( KIWAY aKiway,
wxWindow *  aParent 
)
protected

Member Function Documentation

◆ ActivateGalCanvas()

void PCB_EDIT_FRAME::ActivateGalCanvas ( )
overridevirtual

Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.

Reimplemented from PCB_BASE_EDIT_FRAME.

Definition at line 1133 of file pcb_edit_frame.cpp.

1134{
1137 GetCanvas()->Refresh();
1138}
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 ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void UpdateColors()
Update the color settings in the painter and GAL.

References PCB_BASE_EDIT_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::Refresh(), and PCB_DRAW_PANEL_GAL::UpdateColors().

◆ AddActionPluginTools()

void PCB_EDIT_FRAME::AddActionPluginTools ( )
protected

Append action plugin buttons to main toolbar.

Definition at line 429 of file pcbnew_action_plugins.cpp.

430{
431 bool need_separator = true;
432 const std::vector<ACTION_PLUGIN*>& orderedPlugins = GetOrderedActionPlugins();
433
434 for( ACTION_PLUGIN* ap : orderedPlugins )
435 {
436 if( GetActionPluginButtonVisible( ap->GetPluginPath(), ap->GetShowToolbarButton() ) )
437 {
438 if( need_separator )
439 {
441 need_separator = false;
442 }
443
444 // Add button
445 wxBitmap bitmap;
446
447 if ( ap->iconBitmap.IsOk() )
448 bitmap = KiScaledBitmap( ap->iconBitmap, this );
449 else
450 bitmap = KiScaledBitmap( BITMAPS::puzzle_piece, this );
451
452 wxAuiToolBarItem* button = m_mainToolBar->AddTool( wxID_ANY, wxEmptyString,
453 bitmap, ap->GetName() );
454
455 Connect( button->GetId(), wxEVT_COMMAND_MENU_SELECTED,
456 wxCommandEventHandler( PCB_EDIT_FRAME::OnActionPluginButton ) );
457
458 // Link action plugin to button
459 ACTION_PLUGINS::SetActionButton( ap, button->GetId() );
460 }
461 }
462}
wxBitmap KiScaledBitmap(BITMAPS aBitmap, wxWindow *aWindow, int aHeight, bool aQuantized)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:156
@ puzzle_piece
static void SetActionButton(ACTION_PLUGIN *aAction, int idButton)
Associate a button id to an action plugin.
This is the parent class from where any action plugin class must derive.
Definition: action_plugin.h:39
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
ACTION_TOOLBAR * m_mainToolBar
static std::vector< ACTION_PLUGIN * > GetOrderedActionPlugins()
Return ordered list of plugins in sequence in which they should appear on toolbar or in settings.
void OnActionPluginButton(wxCommandEvent &aEvent)
Launched by the button when an action is called.
static bool GetActionPluginButtonVisible(const wxString &aPluginPath, bool aPluginDefault)
Return true if button visibility action plugin setting was set to true or it is unset and plugin defa...

References ACTION_TOOLBAR::AddScaledSeparator(), GetActionPluginButtonVisible(), GetOrderedActionPlugins(), KiScaledBitmap(), EDA_DRAW_FRAME::m_mainToolBar, OnActionPluginButton(), puzzle_piece, and ACTION_PLUGINS::SetActionButton().

Referenced by ReCreateHToolbar().

◆ AddFootprintToBoard()

void PCB_BASE_FRAME::AddFootprintToBoard ( FOOTPRINT aFootprint)
virtualinherited

Add the given footprint to the board.

Parameters
aDCis the current Device Context, to draw the new footprint (can be NULL ).

Reimplemented in FOOTPRINT_EDIT_FRAME.

Definition at line 231 of file pcb_base_frame.cpp.

232{
233 if( aFootprint )
234 {
235 GetBoard()->Add( aFootprint, ADD_MODE::APPEND );
236
237 aFootprint->SetFlags( IS_NEW );
238 aFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet
239
240 // Put it on FRONT layer (note that it might be stored flipped if the lib is an archive
241 // built from a board)
242 if( aFootprint->IsFlipped() )
243 aFootprint->Flip( aFootprint->GetPosition(), GetPcbNewSettings()->m_FlipLeftRight );
244
245 // Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
246 // it might be stored in another orientation if the lib is an archive built from a board)
247 aFootprint->SetOrientation( ANGLE_0 );
248
249 UpdateUserUnits( aFootprint );
250 }
251}
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:754
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:139
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1671
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1803
bool IsFlipped() const
Definition: footprint.h:324
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1587
VECTOR2I GetPosition() const override
Definition: footprint.h:188
PCBNEW_SETTINGS * GetPcbNewSettings() const
void UpdateUserUnits(BOARD_ITEM *aItem, bool *aSelectedItemsModified=nullptr)
Update any references within aItem (or its descendants) to the user units.
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:423
#define IS_NEW
New item, just created.

References BOARD::Add(), ANGLE_0, APPEND, FOOTPRINT::Flip(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetPcbNewSettings(), FOOTPRINT::GetPosition(), IS_NEW, FOOTPRINT::IsFlipped(), EDA_ITEM::SetFlags(), FOOTPRINT::SetOrientation(), FOOTPRINT::SetPosition(), and PCB_BASE_FRAME::UpdateUserUnits().

Referenced by FOOTPRINT_EDIT_FRAME::AddFootprintToBoard().

◆ 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
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:41
const std::string KiCadFootprintLibPathExtension
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.
#define _(s)

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(), FOOTPRINT_EDIT_FRAME::doReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::doReCreateMenuBar(), and 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}
EDA_MSG_PANEL * m_messagePanel
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().

◆ buildActionPluginMenus()

void PCB_EDIT_FRAME::buildActionPluginMenus ( ACTION_MENU aActionMenu)
protected

Fill action menu with all registered action plugins.

Definition at line 407 of file pcbnew_action_plugins.cpp.

408{
409 if( !actionMenu ) // Should not occur.
410 return;
411
412 for( int ii = 0; ii < ACTION_PLUGINS::GetActionsCount(); ii++ )
413 {
414 wxMenuItem* item;
416 const wxBitmap& bitmap = ap->iconBitmap.IsOk() ? ap->iconBitmap :
418
419 item = AddMenuItem( actionMenu, wxID_ANY, ap->GetName(), ap->GetDescription(), bitmap );
420
421 Connect( item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
422 wxCommandEventHandler( PCB_EDIT_FRAME::OnActionPluginMenu ) );
423
424 ACTION_PLUGINS::SetActionMenu( ii, item->GetId() );
425 }
426}
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
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
Definition: bitmap.cpp:265
static int GetActionsCount()
static ACTION_PLUGIN * GetAction(const wxString &aName)
static void SetActionMenu(int aIndex, int idMenu)
Associate a menu id to an action plugin.
wxBitmap iconBitmap
virtual wxString GetDescription()=0
virtual wxString GetName()=0
void OnActionPluginMenu(wxCommandEvent &aEvent)
Launched by the menu when an action is called.

References AddMenuItem(), ACTION_PLUGINS::GetAction(), ACTION_PLUGINS::GetActionsCount(), ACTION_PLUGIN::GetDescription(), ACTION_PLUGIN::GetName(), ACTION_PLUGIN::iconBitmap, KiBitmap(), OnActionPluginMenu(), puzzle_piece, and ACTION_PLUGINS::SetActionMenu().

Referenced by doReCreateMenuBar().

◆ canCloseWindow()

bool PCB_EDIT_FRAME::canCloseWindow ( wxCloseEvent &  aCloseEvent)
overrideprotectedvirtual

Reimplemented from PCB_BASE_FRAME.

Definition at line 1000 of file pcb_edit_frame.cpp.

1001{
1002 // Shutdown blocks must be determined and vetoed as early as possible
1003 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1004 && IsContentModified() )
1005 {
1006 return false;
1007 }
1008
1010
1011 if( zoneFillerTool->IsBusy() )
1012 {
1013 wxBell();
1014
1015 if( wxWindow* reporter = dynamic_cast<wxWindow*>( zoneFillerTool->GetProgressReporter() ) )
1016 reporter->ShowWithEffect( wxSHOW_EFFECT_EXPAND );
1017
1018 return false;
1019 }
1020
1021 if( Kiface().IsSingle() )
1022 {
1023 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1024
1025 if( fpEditor && !fpEditor->Close() ) // Can close footprint editor?
1026 return false;
1027
1028 auto* fpViewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER, false );
1029
1030 if( fpViewer && !fpViewer->Close() ) // Can close footprint viewer?
1031 return false;
1032
1034
1035 if( fpViewer && !fpViewer->Close() ) // Can close modal footprint viewer?
1036 return false;
1037 }
1038 else
1039 {
1040 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1041
1042 if( fpEditor && fpEditor->IsCurrentFPFromBoard() )
1043 {
1044 if( !fpEditor->CanCloseFPFromBoard( true ) )
1045 return false;
1046 }
1047 }
1048
1049 if( IsContentModified() )
1050 {
1051 wxFileName fileName = GetBoard()->GetFileName();
1052 wxString msg = _( "Save changes to '%s' before closing?" );
1053
1054 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1055 [&]() -> bool
1056 {
1057 return Files_io_from_id( ID_SAVE_BOARD );
1058 } ) )
1059 {
1060 return false;
1061 }
1062 }
1063
1064 // Close modeless dialogs. They're trouble when they get destroyed after the frame and/or
1065 // board.
1066 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
1067
1068 if( open_dlg )
1069 open_dlg->Close( true );
1070
1071 return PCB_BASE_EDIT_FRAME::canCloseWindow( aEvent );
1072}
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
const wxString & GetFileName() const
Definition: board.h:302
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
bool IsContentModified() const override
Get if the current board has been modified but not saved.
Handle actions specific to filling copper zones.
PROGRESS_REPORTER * GetProgressReporter()
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
@ FRAME_FOOTPRINT_VIEWER_MODAL
Definition: frame_type.h:43
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:72
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 _, PCB_BASE_FRAME::canCloseWindow(), DIALOG_DRC_WINDOW_NAME, Format(), FRAME_FOOTPRINT_EDITOR, FRAME_FOOTPRINT_VIEWER, FRAME_FOOTPRINT_VIEWER_MODAL, PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), ZONE_FILLER_TOOL::GetProgressReporter(), TOOL_MANAGER::GetTool(), HandleUnsavedChanges(), ZONE_FILLER_TOOL::IsBusy(), IsContentModified(), Kiface(), KIWAY_HOLDER::Kiway(), TOOLS_HOLDER::m_toolManager, KIWAY::Player(), and KIPLATFORM::APP::SupportsShutdownBlockReason().

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

◆ Clear_Pcb()

bool PCB_EDIT_FRAME::Clear_Pcb ( bool  aQuery,
bool  aFinal = false 
)

Delete all and reinitialize the current board.

Parameters
aQuerytrue to prompt user for confirmation, false to initialize silently.
aFinalif true, we are clearing the board to exit, so don't run more events. Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.

Definition at line 43 of file initpcb.cpp.

44{
45 if( GetBoard() == nullptr )
46 return false;
47
48 if( aQuery && !GetBoard()->IsEmpty() )
49 {
50 if( !IsOK( this, _( "Current Board will be lost and this operation cannot be undone. "
51 "Continue?" ) ) )
52 {
53 return false;
54 }
55 }
56
57 // Release the lock file, if exists
59
60 // Clear undo and redo lists because we want a full deletion
62 GetScreen()->SetContentModified( false );
63
64 if( !aFinal )
65 {
66 // delete the old BOARD and create a new BOARD so that the default
67 // layer names are put into the BOARD.
68 SetBoard( new BOARD() );
69
70 // clear filename, to avoid overwriting an old file
71 GetBoard()->SetFileName( wxEmptyString );
72
74
76
77 // Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
78 GetBoard()->SetEnabledLayers( LSET().set() );
79
80 // Default copper layers count set to 2: double layer board
82
83 // Update display (some options depend on the board setup)
84 GetBoard()->SetVisibleLayers( LSET().set() );
89
90 Zoom_Automatique( false );
91 }
92
93 return true;
94}
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:46
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
void SetFileName(const wxString &aFileName)
Definition: board.h:300
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:589
void ResetNetHighLight()
Reset all high light data to the init state.
Definition: board.cpp:2064
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
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void ReleaseFile()
Release the current file marked in use.
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.
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
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...
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.
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Recreate the layer box by clearing the old list and building a new one from the new layer names and c...
void ReCreateAuxiliaryToolbar() override
void UpdateTitle()
Set the main window title bar text.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:380

References _, EDA_BASE_FRAME::ClearUndoRedoList(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetPageSizeIU(), PCB_BASE_FRAME::GetScreen(), BASE_SCREEN::InitDataPoints(), IsOK(), PCB_BASE_EDIT_FRAME::m_appearancePanel, APPEARANCE_CONTROLS::OnBoardChanged(), ReCreateAuxiliaryToolbar(), ReCreateLayerBox(), EDA_DRAW_FRAME::ReleaseFile(), BOARD::ResetNetHighLight(), SetBoard(), BASE_SCREEN::SetContentModified(), BOARD::SetCopperLayerCount(), BOARD::SetEnabledLayers(), BOARD::SetFileName(), BOARD::SetVisibleLayers(), UpdateTitle(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by doCloseWindow(), Files_io_from_id(), and OpenProjectFiles().

◆ 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 ReCreateMenuBar()
Recreates the menu bar.
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(), 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:58
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(), Edit_Zone_Params(), BOARD_EDITOR_CONTROL::PlaceFootprint(), and PCB_BASE_EDIT_FRAME::RollbackFromUndo().

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

◆ 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
wxAuiManager m_auimgr
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 PCB_EDIT_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged,
bool  aTextVarsChanged 
)
overridevirtual

Called after the preferences dialog is run.

Reimplemented from PCB_BASE_FRAME.

Definition at line 2216 of file pcb_edit_frame.cpp.

2217{
2218 PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
2219
2221
2222 KIGFX::PCB_VIEW* view = GetCanvas()->GetView();
2223 KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
2224 KIGFX::PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
2225
2226 renderSettings->LoadDisplayOptions( GetDisplayOptions() );
2227
2228 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
2229
2231
2232 // Netclass definitions could have changed, either by us or by Eeschema, so we need to
2233 // recompile the implicit rules
2234 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
2235 WX_INFOBAR* infobar = GetInfoBar();
2236
2237 try
2238 {
2239 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
2240
2241 if( infobar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR )
2242 infobar->Dismiss();
2243 }
2244 catch( PARSE_ERROR& )
2245 {
2246 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Edit design rules" ),
2247 wxEmptyString );
2248
2249 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
2250 [&]( wxHyperlinkEvent& aEvent )
2251 {
2252 ShowBoardSetupDialog( _( "Custom Rules" ) );
2253 } ) );
2254
2255 infobar->RemoveAllButtons();
2256 infobar->AddButton( button );
2257 infobar->AddCloseButton();
2258 infobar->ShowMessage( _( "Could not compile custom design rules." ), wxICON_ERROR,
2260 }
2261
2264
2265 // Update the environment variables in the Python interpreter
2266 if( aEnvVarsChanged )
2268
2269 Layout();
2270 SendSizeEvent();
2271}
void OnColorThemeChanged()
Respond to change in OS's DarkMode.
std::shared_ptr< DRC_ENGINE > GetDRCEngine()
Definition: drc_tool.h:78
WX_INFOBAR * GetInfoBar()
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
void ForceRefresh()
Force a redraw.
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:158
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: pcb_painter.h:163
PCB specific render settings.
Definition: pcb_painter.h:72
void LoadDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Load settings related to display options (high-contrast mode, full or outline modes for vias/pads/tra...
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:617
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
APPEARANCE_CONTROLS * GetAppearancePanel()
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
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.
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString)
void SetElementVisibility(GAL_LAYER_ID aElement, bool aNewState)
Change the visibility of an element category.
void PythonSyncEnvironmentVariables()
Synchronize the environment variables from KiCad's environment into the Python interpreter.
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75
@ LAYER_RATSNEST
Definition: layer_ids.h:204
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:49
A filename or source description, a problem input line, a line number, a byte offset,...
Definition: ki_exception.h:119

References _, PCB_BASE_FRAME::CommonSettingsChanged(), WX_INFOBAR::DRC_RULES_ERROR, EDA_DRAW_PANEL_GAL::ForceRefresh(), PCB_BASE_EDIT_FRAME::GetAppearancePanel(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), PCB_BASE_FRAME::GetDisplayOptions(), DRC_TOOL::GetDRCEngine(), EDA_DRAW_FRAME::GetGalDisplayOptions(), EDA_BASE_FRAME::GetInfoBar(), KIGFX::VIEW::GetPainter(), PCB_BASE_FRAME::GetPcbNewSettings(), KIGFX::PCB_PAINTER::GetSettings(), TOOL_MANAGER::GetTool(), PCB_DRAW_PANEL_GAL::GetView(), LAYER_RATSNEST, KIGFX::PCB_RENDER_SETTINGS::LoadDisplayOptions(), TOOLS_HOLDER::m_toolManager, KIGFX::VIEW::MarkTargetDirty(), APPEARANCE_CONTROLS::OnColorThemeChanged(), PythonSyncEnvironmentVariables(), KIGFX::GAL_DISPLAY_OPTIONS::ReadWindowSettings(), SetElementVisibility(), ShowBoardSetupDialog(), and KIGFX::TARGET_NONCACHED.

◆ 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(), ExportToGenCAD(), OnNetlistChanged(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), PCB_BASE_FRAME::PlaceFootprint(), and PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

◆ config()

APP_SETTINGS_BASE * EDA_BASE_FRAME::config ( ) const
virtualinherited

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

Reimplemented in SYMBOL_EDIT_FRAME, KICAD_MANAGER_FRAME, and FOOTPRINT_EDIT_FRAME.

Definition at line 809 of file eda_base_frame.cpp.

810{
811 // KICAD_MANAGER_FRAME overrides this
812 return Kiface().KifaceSettings();
813}
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:93

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

Referenced by GERBVIEW_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::ActivateGalCanvas(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), SIM_PLOT_FRAME::doCloseWindow(), FOOTPRINT_WIZARD_FRAME::doCloseWindow(), SCH_BASE_FRAME::eeconfig(), GERBVIEW_FRAME::GERBVIEW_FRAME(), GetRotationAngle(), GRID_MENU::GRID_MENU(), COMMON_TOOLS::GridFast1(), COMMON_TOOLS::GridFast2(), GERBVIEW_FRAME::gvconfig(), EDA_DRAW_FRAME::IsGridVisible(), SCH_BASE_FRAME::libeditconfig(), EDA_DRAW_FRAME::OnUpdateSelectGrid(), EDA_DRAW_FRAME::OnUpdateSelectZoom(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), GERBVIEW_FRAME::Read_EXCELLON_File(), DIALOG_GRID_SETTINGS::RebuildGridSizes(), EDA_BASE_FRAME::SaveSettings(), PCB_BASE_EDIT_FRAME::SetBoard(), EDA_DRAW_FRAME::SetGridVisibility(), CVPCB_MAINFRAME::setupTools(), SCH_EDIT_FRAME::setupTools(), SYMBOL_VIEWER_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), PL_EDITOR_FRAME::setupTools(), setupTools(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_GRID_SETTINGS::TransferDataToWindow(), GRID_MENU::update(), ZOOM_MENU::update(), EDA_DRAW_FRAME::UpdateGridSelectBox(), EDA_DRAW_FRAME::UpdateZoomSelectBox(), EDA_BASE_FRAME::windowClosing(), and BM2CMP_FRAME::~BM2CMP_FRAME().

◆ 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}
Specialization of the wxAuiPaneInfo class for KiCad panels.
virtual wxWindow * GetToolCanvas() const =0
Canvas access.

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:180
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:214
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:1380
const wxString & GetValue() const
Definition: footprint.h:547
const wxString & GetReference() const
Definition: footprint.h:519
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 ExportFootprintsToLibrary(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), and FOOTPRINT_EDIT_FRAME::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 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().

◆ 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}
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
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 PCB_EDIT_FRAME::doAutoSave ( )
overrideprotectedvirtual

Perform auto save when the board has been modified and not saved within the auto save interval.

Returns
true if the auto save was successful.

Reimplemented from EDA_BASE_FRAME.

Definition at line 1229 of file pcbnew/files.cpp.

1230{
1231 wxFileName tmpFileName;
1232
1233 // Don't run autosave if content has not been modified
1234 if( !IsContentModified() )
1235 return true;
1236
1237 wxString title = GetTitle(); // Save frame title, that can be modified by the save process
1238
1239 if( GetBoard()->GetFileName().IsEmpty() )
1240 {
1241 tmpFileName = wxFileName( PATHS::GetDefaultUserProjectsPath(), NAMELESS_PROJECT,
1243 GetBoard()->SetFileName( tmpFileName.GetFullPath() );
1244 }
1245 else
1246 {
1247 tmpFileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
1248 }
1249
1250 wxFileName autoSaveFileName = tmpFileName;
1251
1252 // Auto save file name is the board file name prepended with autosaveFilePrefix string.
1253 autoSaveFileName.SetName( GetAutoSaveFilePrefix() + autoSaveFileName.GetName() );
1254
1255 if( !autoSaveFileName.IsOk() )
1256 return false;
1257
1258 // If the board file path is not writable, try writing to a platform specific temp file
1259 // path. If that path isn't writable, give up.
1260 if( !autoSaveFileName.IsDirWritable() )
1261 {
1262 autoSaveFileName.SetPath( wxFileName::GetTempDir() );
1263
1264 if( !autoSaveFileName.IsOk() || !autoSaveFileName.IsDirWritable() )
1265 return false;
1266 }
1267
1268 wxLogTrace( traceAutoSave,
1269 wxT( "Creating auto save file <" ) + autoSaveFileName.GetFullPath() + wxT( ">" ) );
1270
1271 if( SavePcbFile( autoSaveFileName.GetFullPath(), false, false ) )
1272 {
1274 GetBoard()->SetFileName( tmpFileName.GetFullPath() );
1275 UpdateTitle();
1276 m_autoSaveRequired = false;
1277 m_autoSavePending = false;
1278
1279 if( !Kiface().IsSingle() &&
1280 GetSettingsManager()->GetCommonSettings()->m_Backup.backup_on_autosave )
1281 {
1283 }
1284
1285 SetTitle( title ); // Restore initial frame title
1286
1287 return true;
1288 }
1289
1290 GetBoard()->SetFileName( tmpFileName.GetFullPath() );
1291
1292 SetTitle( title ); // Restore initial frame title
1293
1294 return false;
1295}
SETTINGS_MANAGER * GetSettingsManager() const
static REPORTER & GetInstance()
Definition: reporter.cpp:117
bool SavePcbFile(const wxString &aFileName, bool addToHistory=true, bool aChangeProject=true)
Write the board data structures to a aFileName.
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
bool TriggerBackupIfNeeded(REPORTER &aReporter) const
Calls BackupProject if a new backup is needed according to the current backup policy.
const std::string KiCadPcbFileExtension
#define NAMELESS_PROJECT
default name for nameless projects
Definition: project.h:42

References PROJECT::AbsolutePath(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), PCB_BASE_FRAME::GetBoard(), PATHS::GetDefaultUserProjectsPath(), NULL_REPORTER::GetInstance(), PCB_BASE_FRAME::GetScreen(), EDA_BASE_FRAME::GetSettingsManager(), IsContentModified(), KiCadPcbFileExtension, Kiface(), EDA_BASE_FRAME::m_autoSavePending, EDA_BASE_FRAME::m_autoSaveRequired, NAMELESS_PROJECT, KIWAY_HOLDER::Prj(), SavePcbFile(), BASE_SCREEN::SetContentModified(), BOARD::SetFileName(), traceAutoSave, SETTINGS_MANAGER::TriggerBackupIfNeeded(), and UpdateTitle().

Referenced by OnExportSTEP().

◆ doCloseWindow()

void PCB_EDIT_FRAME::doCloseWindow ( )
overrideprotectedvirtual

Reimplemented from PCB_BASE_EDIT_FRAME.

Definition at line 1075 of file pcb_edit_frame.cpp.

1076{
1077 // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes
1078 // when closing this frame if a footprint was selected, and the footprint editor called
1079 // to edit this footprint, and when closing pcbnew if this footprint is still selected
1080 // See https://bugs.launchpad.net/kicad/+bug/1655858
1081 // I think this is certainly a OpenGL event fired after frame deletion, so this workaround
1082 // avoid the crash (JPC)
1083 GetCanvas()->SetEvtHandlerEnabled( false );
1084
1086
1087 // Delete the auto save file if it exists.
1088 wxFileName fn = GetBoard()->GetFileName();
1089
1090 // Auto save file name is the normal file name prefixed with 'GetAutoSaveFilePrefix()'.
1091 fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
1092
1093 // When the auto save feature does not have write access to the board file path, it falls
1094 // back to a platform specific user temporary file path.
1095 if( !fn.IsOk() || !fn.IsDirWritable() )
1096 fn.SetPath( wxFileName::GetTempDir() );
1097
1098 wxLogTrace( traceAutoSave, wxT( "Deleting auto save file <" ) + fn.GetFullPath() + wxT( ">" ) );
1099
1100 // Remove the auto save file on a normal close of Pcbnew.
1101 if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
1102 {
1103 wxLogTrace( traceAutoSave, wxT( "The auto save file could not be removed!" ) );
1104 }
1105
1106 // Make sure local settings are persisted
1108
1109 // Do not show the layer manager during closing to avoid flicker
1110 // on some platforms (Windows) that generate useless redraw of items in
1111 // the Layer Manager
1113 {
1114 m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );
1115 m_auimgr.GetPane( wxS( "TabbedPanel" ) ).Show( false );
1116 }
1117
1118 // Unlink the old project if needed
1120
1121 // Delete board structs and undo/redo lists, to avoid crash on exit
1122 // when deleting some structs (mainly in undo/redo lists) too late
1123 Clear_Pcb( false, true );
1124
1125 // do not show the window because ScreenPcb will be deleted and we do not
1126 // want any paint event
1127 Show( false );
1128
1130}
void ClearProject()
Definition: board.cpp:210
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
void doCloseWindow() override
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
bool Clear_Pcb(bool aQuery, bool aFinal=false)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:43
bool m_show_layer_manager_tools

References Clear_Pcb(), BOARD::ClearProject(), PCB_BASE_EDIT_FRAME::doCloseWindow(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), BOARD::GetFileName(), EDA_BASE_FRAME::m_auimgr, m_show_layer_manager_tools, SaveProjectSettings(), EDA_DRAW_PANEL_GAL::StopDrawing(), and traceAutoSave.

◆ DoGenFootprintsPositionFile()

int PCB_EDIT_FRAME::DoGenFootprintsPositionFile ( const wxString &  aFullFileName,
bool  aUnitsMM,
bool  aOnlySMD,
bool  aNoTHItems,
bool  aTopSide,
bool  aBottomSide,
bool  aFormatCSV,
bool  aUseAuxOrigin,
bool  aNegateBottomX 
)

Create an ASCII footprint position file.

Parameters
aFullFileNamethe full file name of the file to create.
aUnitsMMfalse to use inches, true to use mm in coordinates.
aOnlySMDtrue to force only footprints flagged smd to be in the list
aNoTHItemstrue to include only footprints with no TH pads no matter the footprint flag
aTopSidetrue to list footprints on front (top) side.
aBottomSidetrue to list footprints on back (bottom) side, if aTopSide and aTopSide are true, list footprints on both sides.
aFormatCSVtrue to use a comma separated file (CSV) format; default = false
aUseAuxOrigintrue to use auxiliary axis as an origin for the position data
aNegateBottomXtrue to negate X coordinates for bottom side of the placement file
Returns
the number of footprints found on aSide side or -1 if the file could not be created.

Definition at line 511 of file dialog_gen_footprint_position.cpp.

515{
516 FILE * file = nullptr;
517
518 if( !aFullFileName.IsEmpty() )
519 {
520 file = wxFopen( aFullFileName, wxT( "wt" ) );
521
522 if( file == nullptr )
523 return -1;
524 }
525
526 std::string data;
527 PLACE_FILE_EXPORTER exporter( GetBoard(), aUnitsMM, aOnlySMD, aNoTHItems, aTopSide, aBottomSide,
528 aFormatCSV, aUseAuxOrigin, aNegateBottomX );
529 data = exporter.GenPositionData();
530
531 // if aFullFileName is empty, the file is not created, only the
532 // count of footprints to place is returned
533 if( file )
534 {
535 // Creates a footprint position file
536 // aSide = 0 -> Back (bottom) side)
537 // aSide = 1 -> Front (top) side)
538 // aSide = 2 -> both sides
539 fputs( data.c_str(), file );
540 fclose( file );
541 }
542
543 return exporter.GetFootprintCount();
544}
The ASCII format of the kicad place file is:

References PLACE_FILE_EXPORTER::GenPositionData(), PCB_BASE_FRAME::GetBoard(), and PLACE_FILE_EXPORTER::GetFootprintCount().

Referenced by DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles().

◆ DoGenFootprintsReport()

bool PCB_EDIT_FRAME::DoGenFootprintsReport ( const wxString &  aFullFilename,
bool  aUnitsMM 
)

Create an ASCII footprint report file giving some infos on footprints and board outlines.

Parameters
aFullFilenamethe full file name of the file to create
aUnitsMMfalse to use inches, true to use mm in coordinates
Returns
true if OK, false if error

Definition at line 580 of file dialog_gen_footprint_position.cpp.

581{
582 FILE* rptfile = wxFopen( aFullFilename, wxT( "wt" ) );
583
584 if( rptfile == nullptr )
585 return false;
586
587 std::string data;
588 PLACE_FILE_EXPORTER exporter( GetBoard(), aUnitsMM,
589 false, false, // SMD aOnlySMD, aNoTHItems
590 true, true, // aTopSide, aBottomSide
591 false, true, false // aFormatCSV, aUseAuxOrigin, aNegateBottomX
592 );
593 data = exporter.GenReportData();
594
595 fputs( data.c_str(), rptfile );
596 fclose( rptfile );
597
598 return true;
599}

References PLACE_FILE_EXPORTER::GenReportData(), and PCB_BASE_FRAME::GetBoard().

Referenced by GenFootprintsReport().

◆ doReCreateMenuBar()

void PCB_EDIT_FRAME::doReCreateMenuBar ( )
overrideprotectedvirtual

Reimplemented from PCB_BASE_FRAME.

Definition at line 43 of file menubar_pcb_editor.cpp.

44{
46 // wxWidgets handles the Mac Application menu behind the scenes, but that means
47 // we always have to start from scratch with a new wxMenuBar.
48 wxMenuBar* oldMenuBar = GetMenuBar();
49 WX_MENUBAR* menuBar = new WX_MENUBAR();
50
51 // Recreate all menus:
52
53 //-- File menu -----------------------------------------------------------
54 //
55 ACTION_MENU* fileMenu = new ACTION_MENU( false, selTool );
56 static ACTION_MENU* openRecentMenu;
57
58 if( Kiface().IsSingle() ) // not when under a project mgr
59 {
60 FILE_HISTORY& fileHistory = GetFileHistory();
61
62 // Create the menu if it does not exist. Adding a file to/from the history
63 // will automatically refresh the menu.
64 if( !openRecentMenu )
65 {
66 openRecentMenu = new ACTION_MENU( false, selTool );
67 openRecentMenu->SetIcon( BITMAPS::recent );
68
69 fileHistory.UseMenu( openRecentMenu );
70 fileHistory.AddFilesToMenu();
71 }
72
73 // Ensure the title is up to date after changing language
74 openRecentMenu->SetTitle( _( "Open Recent" ) );
75 fileHistory.UpdateClearText( openRecentMenu, _( "Clear Recent Files" ) );
76
77 fileMenu->Add( ACTIONS::doNew );
78 fileMenu->Add( ACTIONS::open );
79
80 wxMenuItem* item = fileMenu->Add( openRecentMenu->Clone() );
81
82 // Add the file menu condition here since it needs the item ID for the submenu
84 cond.Enable( FILE_HISTORY::FileHistoryNotEmpty( fileHistory ) );
85 RegisterUIUpdateHandler( item->GetId(), cond );
86 }
87
88 fileMenu->Add( PCB_ACTIONS::appendBoard );
89 fileMenu->AppendSeparator();
90
91 fileMenu->Add( ACTIONS::save );
92
93 // Save as menu:
94 // under a project mgr we do not want to modify the board filename
95 // to keep consistency with the project mgr which expects files names same as prj name
96 // for main files
97 if( Kiface().IsSingle() )
98 fileMenu->Add( ACTIONS::saveAs );
99 else
100 fileMenu->Add( ACTIONS::saveCopy );
101
102 fileMenu->Add( ACTIONS::revert );
103
104 fileMenu->AppendSeparator();
105 fileMenu->Add( _( "Resc&ue" ),
106 _( "Clear board and get last rescue file automatically saved by PCB editor" ),
109
110 // Import submenu
111 ACTION_MENU* submenuImport = new ACTION_MENU( false, selTool );
112 submenuImport->SetTitle( _( "Import" ) );
113 submenuImport->SetIcon( BITMAPS::import );
114
115 submenuImport->Add( PCB_ACTIONS::importNetlist, ACTION_MENU::NORMAL, _( "Netlist..." ) );
116 submenuImport->Add( PCB_ACTIONS::importSpecctraSession, ACTION_MENU::NORMAL, _( "Specctra Session..." ) );
117 submenuImport->Add( PCB_ACTIONS::placeImportedGraphics, ACTION_MENU::NORMAL, _( "Graphics..." ) );
118 submenuImport->Add( _( "Non-KiCad Board File..." ),
119 _( "Import board file from other applications" ),
121
122 fileMenu->AppendSeparator();
123 fileMenu->Add( submenuImport );
124
125 // Export submenu
126 ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
127 submenuExport->SetTitle( _( "Export" ) );
128 submenuExport->SetIcon( BITMAPS::export_file );
129
130 submenuExport->Add( PCB_ACTIONS::exportSpecctraDSN, ACTION_MENU::NORMAL, _( "Specctra DSN..." ) );
131 submenuExport->Add( _( "GenCAD..." ), _( "Export GenCAD board representation" ),
133 submenuExport->Add( _( "VRML..." ), _( "Export VRML 3D board representation" ),
135 submenuExport->Add( _( "IDFv3..." ), _( "Export IDF 3D board representation" ),
137 submenuExport->Add( _( "STEP..." ), _( "Export STEP 3D board representation" ),
139 submenuExport->Add( _( "SVG..." ), _( "Export SVG board representation" ),
141 submenuExport->Add( _( "Footprint Association (.cmp) File..." ),
142 _( "Export footprint association file (*.cmp) for schematic back annotation" ),
144 submenuExport->Add( _( "Hyperlynx..." ), wxEmptyString,
146
147 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist && m_exportNetlistAction )
148 submenuExport->Add( *m_exportNetlistAction );
149
150 submenuExport->AppendSeparator();
151 submenuExport->Add( _( "Footprints to Library..." ),
152 _( "Add footprints used on board to an existing footprint library\n"
153 "(does not remove other footprints from this library)" ),
155
156 submenuExport->Add( _( "Footprints to New Library..." ),
157 _( "Create a new footprint library containing the footprints used on board\n"
158 "(if the library already exists it will be replaced)" ),
160
161 fileMenu->Add( submenuExport );
162
163 // Fabrication Outputs submenu
164 ACTION_MENU* submenuFabOutputs = new ACTION_MENU( false, selTool );
165 submenuFabOutputs->SetTitle( _( "Fabrication Outputs" ) );
166 submenuFabOutputs->SetIcon( BITMAPS::fabrication );
167
168 submenuFabOutputs->Add( PCB_ACTIONS::generateGerbers );
169 submenuFabOutputs->Add( PCB_ACTIONS::generateDrillFiles );
170 submenuFabOutputs->Add( PCB_ACTIONS::generatePosFile );
171 submenuFabOutputs->Add( PCB_ACTIONS::generateReportFile );
172 submenuFabOutputs->Add( PCB_ACTIONS::generateD356File );
173 submenuFabOutputs->Add( PCB_ACTIONS::generateBOM );
174 fileMenu->Add( submenuFabOutputs );
175
176 fileMenu->AppendSeparator();
177 fileMenu->Add( PCB_ACTIONS::boardSetup );
178
179 fileMenu->AppendSeparator();
180 fileMenu->Add( ACTIONS::pageSettings );
181 fileMenu->Add( ACTIONS::print );
182 fileMenu->Add( ACTIONS::plot );
183
184 fileMenu->AppendSeparator();
185 fileMenu->AddQuitOrClose( &Kiface(), _( "PCB Editor" ) );
186
187 //-- Edit menu -----------------------------------------------------------
188 //
189 ACTION_MENU* editMenu = new ACTION_MENU( false, selTool );
190
191 editMenu->Add( ACTIONS::undo );
192 editMenu->Add( ACTIONS::redo );
193
194 editMenu->AppendSeparator();
195 editMenu->Add( ACTIONS::cut );
196 editMenu->Add( ACTIONS::copy );
197 editMenu->Add( ACTIONS::paste );
198 editMenu->Add( ACTIONS::pasteSpecial );
199 editMenu->Add( ACTIONS::doDelete );
200
201 editMenu->AppendSeparator();
202 editMenu->Add( ACTIONS::selectAll );
203
204 editMenu->AppendSeparator();
205 editMenu->Add( ACTIONS::find );
206
207 editMenu->AppendSeparator();
211 editMenu->Add( PCB_ACTIONS::swapLayers );
212
213 editMenu->AppendSeparator();
214 editMenu->Add( PCB_ACTIONS::zoneFillAll );
215 editMenu->Add( PCB_ACTIONS::zoneUnfillAll );
216
217 editMenu->AppendSeparator();
218 editMenu->Add( ACTIONS::deleteTool );
220
221
222 //----- View menu -----------------------------------------------------------
223 //
224 ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool );
225
227
229
231 viewMenu->Add( ACTIONS::show3DViewer );
232
233 viewMenu->AppendSeparator();
234 viewMenu->Add( ACTIONS::zoomInCenter );
235 viewMenu->Add( ACTIONS::zoomOutCenter );
236 viewMenu->Add( ACTIONS::zoomFitScreen );
237 viewMenu->Add( ACTIONS::zoomFitObjects );
238 viewMenu->Add( ACTIONS::zoomTool );
239 viewMenu->Add( ACTIONS::zoomRedraw );
240
241 viewMenu->AppendSeparator();
243 viewMenu->Add( ACTIONS::gridProperties );
245
246 // Units submenu
247 ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool );
248 unitsSubMenu->SetTitle( _( "&Units" ) );
249 unitsSubMenu->SetIcon( BITMAPS::unit_mm );
251 unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK );
253 viewMenu->Add( unitsSubMenu );
254
256
257 viewMenu->AppendSeparator();
260
261 viewMenu->AppendSeparator();
262 // Drawing Mode Submenu
263 ACTION_MENU* drawingModeSubMenu = new ACTION_MENU( false, selTool );
264 drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
265 drawingModeSubMenu->SetIcon( BITMAPS::add_zone );
266
269
270 if( ADVANCED_CFG::GetCfg().m_ExtraZoneDisplayModes )
271 {
274 }
275
276 drawingModeSubMenu->AppendSeparator();
277 drawingModeSubMenu->Add( PCB_ACTIONS::padDisplayMode, ACTION_MENU::CHECK );
278 drawingModeSubMenu->Add( PCB_ACTIONS::viaDisplayMode, ACTION_MENU::CHECK );
280
281 drawingModeSubMenu->AppendSeparator();
283 drawingModeSubMenu->Add( PCB_ACTIONS::textOutlines, ACTION_MENU::CHECK );
284
285 viewMenu->Add( drawingModeSubMenu );
286
287 // Contrast Mode Submenu
288 ACTION_MENU* contrastModeSubMenu = new ACTION_MENU( false, selTool );
289 contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
290 contrastModeSubMenu->SetIcon( BITMAPS::contrast_mode );
291
292 contrastModeSubMenu->Add( ACTIONS::highContrastMode, ACTION_MENU::CHECK );
293 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaDec );
294 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaInc );
295 viewMenu->Add( contrastModeSubMenu );
296
298
299 viewMenu->AppendSeparator();
301
302#ifdef __APPLE__
303 viewMenu->AppendSeparator();
304#endif
305
306 //-- Place Menu ----------------------------------------------------------
307 //
308 ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
309
310 placeMenu->Add( PCB_ACTIONS::placeFootprint );
311 placeMenu->Add( PCB_ACTIONS::drawVia );
312 placeMenu->Add( PCB_ACTIONS::drawZone );
313 placeMenu->Add( PCB_ACTIONS::drawRuleArea );
314
315 ACTION_MENU* muwaveSubmenu = new ACTION_MENU( false, selTool );
316 muwaveSubmenu->SetTitle( _( "Add Microwave Shape" ) );
317 muwaveSubmenu->SetIcon( BITMAPS::mw_add_line );
318 muwaveSubmenu->Add( PCB_ACTIONS::microwaveCreateLine );
319 muwaveSubmenu->Add( PCB_ACTIONS::microwaveCreateGap );
320 muwaveSubmenu->Add( PCB_ACTIONS::microwaveCreateStub );
323 placeMenu->Add( muwaveSubmenu );
324
325 placeMenu->AppendSeparator();
326 placeMenu->Add( PCB_ACTIONS::drawLine );
327 placeMenu->Add( PCB_ACTIONS::drawArc );
328 placeMenu->Add( PCB_ACTIONS::drawRectangle );
329 placeMenu->Add( PCB_ACTIONS::drawCircle );
330 placeMenu->Add( PCB_ACTIONS::drawPolygon );
331 placeMenu->Add( PCB_ACTIONS::placeImage );
332 placeMenu->Add( PCB_ACTIONS::placeText );
333 placeMenu->Add( PCB_ACTIONS::drawTextBox );
334
335 placeMenu->AppendSeparator();
340 placeMenu->Add( PCB_ACTIONS::drawLeader );
341
342 placeMenu->AppendSeparator();
344 placeMenu->Add( PCB_ACTIONS::placeStackup );
345
346 placeMenu->AppendSeparator();
347 placeMenu->Add( PCB_ACTIONS::drillOrigin );
348 placeMenu->Add( ACTIONS::gridSetOrigin );
349
350 placeMenu->AppendSeparator();
351
352 ACTION_MENU* autoplaceSubmenu = new ACTION_MENU( false, selTool );
353 autoplaceSubmenu->SetTitle( _( "Auto-Place Footprints" ) );
354 autoplaceSubmenu->SetIcon( BITMAPS::mode_module );
355
358
359 placeMenu->Add( autoplaceSubmenu );
360
361
362 //-- Route Menu ----------------------------------------------------------
363 //
364 ACTION_MENU* routeMenu = new ACTION_MENU( false, selTool );
365
366 routeMenu->Add( PCB_ACTIONS::selectLayerPair );
367
368 routeMenu->AppendSeparator();
370 routeMenu->Add( PCB_ACTIONS::routeDiffPair );
371
372 routeMenu->AppendSeparator();
376
377 routeMenu->AppendSeparator();
379
380
381 //-- Inspect Menu --------------------------------------------------------
382 //
383 ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
384
385 inspectMenu->Add( PCB_ACTIONS::listNets );
386 inspectMenu->Add( PCB_ACTIONS::boardStatistics );
387 inspectMenu->Add( ACTIONS::measureTool );
388
389 inspectMenu->AppendSeparator();
390 inspectMenu->Add( PCB_ACTIONS::runDRC );
391 inspectMenu->Add( ACTIONS::prevMarker );
392 inspectMenu->Add( ACTIONS::nextMarker );
393 inspectMenu->Add( ACTIONS::excludeMarker );
394
395 inspectMenu->AppendSeparator();
396 inspectMenu->Add( PCB_ACTIONS::inspectClearance );
397 inspectMenu->Add( PCB_ACTIONS::inspectConstraints );
398
399
400 //-- Tools menu ----------------------------------------------------------
401 //
402 ACTION_MENU* toolsMenu = new ACTION_MENU( false, selTool );
403
404 wxMenuItem* update = toolsMenu->Add( ACTIONS::updatePcbFromSchematic );
405 update->Enable( !Kiface().IsSingle() );
406
407 toolsMenu->Add( PCB_ACTIONS::showEeschema );
408
409 toolsMenu->AppendSeparator();
410 toolsMenu->Add( ACTIONS::showFootprintEditor );
412
413 // Add/remove teardrops menuitems:
414 toolsMenu->AppendSeparator();
415 toolsMenu->Add( _( "Add Teardrops..." ), "", ID_RUN_TEARDROP_TOOL, BITMAPS::via );
416 toolsMenu->Add( _( "Remove Teardrops" ), "", ID_REMOVE_TEARDROP_TOOL, BITMAPS::via );
417
418 toolsMenu->AppendSeparator();
421 toolsMenu->Add( PCB_ACTIONS::cleanupGraphics );
422 toolsMenu->Add( PCB_ACTIONS::repairBoard );
423
424 toolsMenu->AppendSeparator();
425 toolsMenu->Add( PCB_ACTIONS::boardReannotate );
426 update = toolsMenu->Add( ACTIONS::updateSchematicFromPcb );
427 update->Enable( !Kiface().IsSingle() );
428
429 if( SCRIPTING::IsWxAvailable() )
430 {
431 toolsMenu->AppendSeparator();
433 }
434
435 ACTION_MENU* submenuActionPlugins = new ACTION_MENU( false, selTool );
436 submenuActionPlugins->SetTitle( _( "External Plugins" ) );
437 submenuActionPlugins->SetIcon( BITMAPS::puzzle_piece );
438
439 submenuActionPlugins->Add( PCB_ACTIONS::pluginsReload );
440 submenuActionPlugins->Add( PCB_ACTIONS::pluginsShowFolder );
441
442 // Populate the Action Plugin sub-menu: Must be done before Add
443 // Since the object is cloned by Add
444 submenuActionPlugins->AppendSeparator();
445 buildActionPluginMenus( submenuActionPlugins );
446
447 toolsMenu->AppendSeparator();
448 toolsMenu->Add( submenuActionPlugins );
449
450 //-- Preferences menu ----------------------------------------------------
451 //
452 ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool );
453
454 prefsMenu->Add( ACTIONS::configurePaths );
456
457 // We can't use ACTIONS::showPreferences yet because wxWidgets moves this on
458 // Mac, and it needs the wxID_PREFERENCES id to find it.
459 prefsMenu->Add( _( "Preferences..." ) + wxT( "\tCtrl+," ),
460 _( "Show preferences for all open tools" ),
461 wxID_PREFERENCES,
463
464 prefsMenu->AppendSeparator();
465 AddMenuLanguageList( prefsMenu, selTool );
466
467
468 //--MenuBar -----------------------------------------------------------
469 //
470 menuBar->Append( fileMenu, _( "&File" ) );
471 menuBar->Append( editMenu, _( "&Edit" ) );
472 menuBar->Append( viewMenu, _( "&View" ) );
473 menuBar->Append( placeMenu, _( "&Place" ) );
474 menuBar->Append( routeMenu, _( "Ro&ute" ) );
475 menuBar->Append( inspectMenu, _( "&Inspect" ) );
476 menuBar->Append( toolsMenu, _( "&Tools" ) );
477 menuBar->Append( prefsMenu, _( "P&references" ) );
478 AddStandardHelpMenu( menuBar );
479
480 SetMenuBar( menuBar );
481 delete oldMenuBar;
482
483}
@ library_archive_as
@ contrast_mode
@ import_brd_file
@ library_archive
static TOOL_ACTION gridProperties
Definition: actions.h:144
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:167
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION excludeMarker
Definition: actions.h:89
static TOOL_ACTION nextMarker
Definition: actions.h:88
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 copy
Definition: actions.h:68
static TOOL_ACTION pasteSpecial
Definition: actions.h:70
static TOOL_ACTION milsUnits
Definition: actions.h:148
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:181
static TOOL_ACTION plot
Definition: actions.h:58
static TOOL_ACTION open
Definition: actions.h:50
static TOOL_ACTION pageSettings
Definition: actions.h:56
static TOOL_ACTION showSearch
Definition: actions.h:77
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION prevMarker
Definition: actions.h:87
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 zoomFitScreen
Definition: actions.h:98
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION deleteTool
Definition: actions.h:74
static TOOL_ACTION zoomTool
Definition: actions.h:101
static TOOL_ACTION updateSchematicFromPcb
Definition: actions.h:168
static TOOL_ACTION showFootprintEditor
Definition: actions.h:166
static TOOL_ACTION print
Definition: actions.h:57
static TOOL_ACTION doNew
Definition: actions.h:47
static TOOL_ACTION zoomFitObjects
Definition: actions.h:99
static TOOL_ACTION zoomInCenter
Definition: actions.h:95
static TOOL_ACTION saveCopy
Definition: actions.h:53
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 TOOL_ACTION find
Definition: actions.h:78
void AddQuitOrClose(KIFACE_BASE *aKiface, wxString aAppname="")
Add either a standard Quit or Close item to the menu.
static constexpr bool CHECK
Definition: action_menu.h:189
ACTION_MENU * Clone() const
Create a deep, recursive copy of this ACTION_MENU.
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.
FILE_HISTORY & GetFileHistory()
Get the frame's main file history.
virtual void RegisterUIUpdateHandler(int aID, const ACTION_CONDITIONS &aConditions) override
Register a UI update handler for the control with ID aID.
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Adds the standard KiCad help menu to the menubar.
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: file_history.h:43
static SELECTION_CONDITION FileHistoryNotEmpty(const FILE_HISTORY &aHistory)
Create a SELECTION_CONDITION that can be used to enable a menu item when the file history has items i...
void UpdateClearText(wxMenu *aMenu, wxString aClearText)
Update the text displayed on the menu item that clears the entire menu.
void AddFilesToMenu() override
Add the files to all registered menus.
Definition: file_history.h:98
static TOOL_ACTION editTracksAndVias
Definition: pcb_actions.h:359
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:185
static TOOL_ACTION microwaveCreateGap
Definition: pcb_actions.h:455
static TOOL_ACTION placeText
Definition: pcb_actions.h:176
static TOOL_ACTION swapLayers
Definition: pcb_actions.h:368
static TOOL_ACTION generateBOM
Definition: pcb_actions.h:381
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:181
static TOOL_ACTION listNets
Definition: pcb_actions.h:383
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:172
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:280
static TOOL_ACTION routerSettingsDialog
Activation of the Push and Shove settings dialogs.
Definition: pcb_actions.h:231
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:275
static TOOL_ACTION zoneFillAll
Definition: pcb_actions.h:344
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:389
static TOOL_ACTION generateDrillFiles
Definition: pcb_actions.h:377
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:173
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
Definition: pcb_actions.h:211
static TOOL_ACTION placeImage
Definition: pcb_actions.h:175
static TOOL_ACTION generateD356File
Definition: pcb_actions.h:380
static TOOL_ACTION exportSpecctraDSN
Definition: pcb_actions.h:374
static TOOL_ACTION routerTuneDiffPair
Activation of the Push and Shove router (diff pair tuning mode)
Definition: pcb_actions.h:217
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 zoneDisplayFilled
Definition: pcb_actions.h:282
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:180
static TOOL_ACTION showProperties
Definition: pcb_actions.h:390
static TOOL_ACTION routerTuneDiffPairSkew
Activation of the Push and Shove router (skew tuning mode)
Definition: pcb_actions.h:220
static TOOL_ACTION cleanupTracksAndVias
Definition: pcb_actions.h:362
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:281
static TOOL_ACTION editTextAndGraphics
Definition: pcb_actions.h:360
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:182
static TOOL_ACTION placeCharacteristics
Definition: pcb_actions.h:188
static TOOL_ACTION pluginsShowFolder
Definition: pcb_actions.h:355
static TOOL_ACTION autoplaceOffboardComponents
Definition: pcb_actions.h:516
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:324
static TOOL_ACTION inspectConstraints
Definition: pcb_actions.h:493
static TOOL_ACTION generatePosFile
Definition: pcb_actions.h:378
static TOOL_ACTION globalDeletions
Definition: pcb_actions.h:361
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:484
static TOOL_ACTION routerTuneSingleTrace
Activation of the Push and Shove router (tune single line mode)
Definition: pcb_actions.h:214
static TOOL_ACTION repairBoard
Definition: pcb_actions.h:490
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:279
static TOOL_ACTION selectLayerPair
Definition: pcb_actions.h:161
static TOOL_ACTION microwaveCreateStubArc
Definition: pcb_actions.h:459
static TOOL_ACTION generateGerbers
Definition: pcb_actions.h:376
static TOOL_ACTION inspectClearance
Definition: pcb_actions.h:492
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:285
static TOOL_ACTION generateReportFile
Definition: pcb_actions.h:379
static TOOL_ACTION updateFootprints
Definition: pcb_actions.h:365
static TOOL_ACTION autoplaceSelectedComponents
Definition: pcb_actions.h:517
static TOOL_ACTION placeImportedGraphics
Definition: pcb_actions.h:191
static TOOL_ACTION removeUnusedPads
Definition: pcb_actions.h:369
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:284
static TOOL_ACTION drawVia
Definition: pcb_actions.h:184
static TOOL_ACTION drawArc
Definition: pcb_actions.h:174
static TOOL_ACTION runDRC
Definition: pcb_actions.h:384
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:438
static TOOL_ACTION importNetlist
Definition: pcb_actions.h:371
static TOOL_ACTION pluginsReload
Scripting Actions.
Definition: pcb_actions.h:354
static TOOL_ACTION changeFootprints
Definition: pcb_actions.h:367
static TOOL_ACTION boardSetup
Definition: pcb_actions.h:358
static TOOL_ACTION showEeschema
Definition: pcb_actions.h:487
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:179
static TOOL_ACTION zoneUnfillAll
Definition: pcb_actions.h:347
static TOOL_ACTION appendBoard
Definition: pcb_actions.h:486
static TOOL_ACTION microwaveCreateStub
Definition: pcb_actions.h:457
static TOOL_ACTION microwaveCreateLine
Definition: pcb_actions.h:463
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:330
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:283
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:276
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:441
static TOOL_ACTION microwaveCreateFunctionShape
Definition: pcb_actions.h:461
static TOOL_ACTION boardReannotate
Definition: pcb_actions.h:489
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:190
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
Definition: pcb_actions.h:208
static TOOL_ACTION boardStatistics
Definition: pcb_actions.h:488
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:391
static TOOL_ACTION drawLine
Definition: pcb_actions.h:170
static TOOL_ACTION placeStackup
Definition: pcb_actions.h:189
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:363
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:178
static TOOL_ACTION drawZone
Definition: pcb_actions.h:183
static TOOL_ACTION importSpecctraSession
Definition: pcb_actions.h:373
void buildActionPluginMenus(ACTION_MENU *aActionMenu)
Fill action menu with all registered action plugins.
The selection tool: currently supports:
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:46
@ ID_GEN_PLOT_SVG
Definition: id.h:95
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_GEN_EXPORT_FILE_HYPERLYNX
Definition: pcbnew_id.h:88
@ ID_IMPORT_NON_KICAD_BOARD
Definition: pcbnew_id.h:19
@ ID_MENU_RECOVER_BOARD_AUTOSAVE
Definition: pcbnew_id.h:81
@ ID_RUN_TEARDROP_TOOL
Definition: pcbnew_id.h:119
@ ID_PCB_GEN_CMP_FILE
Definition: pcbnew_id.h:93
@ ID_MENU_EXPORT_FOOTPRINTS_TO_NEW_LIBRARY
Definition: pcbnew_id.h:83
@ ID_MENU_EXPORT_FOOTPRINTS_TO_LIBRARY
Definition: pcbnew_id.h:82
@ ID_GEN_EXPORT_FILE_VRML
Definition: pcbnew_id.h:86
@ ID_REMOVE_TEARDROP_TOOL
Definition: pcbnew_id.h:120
@ ID_GEN_EXPORT_FILE_STEP
Definition: pcbnew_id.h:87
@ ID_GEN_EXPORT_FILE_IDF3
Definition: pcbnew_id.h:85
@ ID_GEN_EXPORT_FILE_GENCADFORMAT
Definition: pcbnew_id.h:89
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
ACTION_CONDITIONS & Enable(const SELECTION_CONDITION &aCondition)

References _, ACTION_MENU::Add(), add_zone, FILE_HISTORY::AddFilesToMenu(), AddMenuLanguageList(), ACTION_MENU::AddQuitOrClose(), EDA_BASE_FRAME::AddStandardHelpMenu(), PCB_ACTIONS::appendBoard, PCB_ACTIONS::autoplaceOffboardComponents, PCB_ACTIONS::autoplaceSelectedComponents, PCB_ACTIONS::boardReannotate, PCB_ACTIONS::boardSetup, PCB_ACTIONS::boardStatistics, buildActionPluginMenus(), PCB_ACTIONS::changeFootprints, ACTION_MENU::CHECK, PCB_ACTIONS::cleanupGraphics, PCB_ACTIONS::cleanupTracksAndVias, ACTION_MENU::Clone(), ACTIONS::configurePaths, contrast_mode, ACTIONS::copy, ACTIONS::cut, ACTIONS::deleteTool, ACTIONS::doDelete, ACTIONS::doNew, 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, PCB_ACTIONS::drawVia, PCB_ACTIONS::drawZone, PCB_ACTIONS::drillOrigin, PCB_ACTIONS::editTextAndGraphics, PCB_ACTIONS::editTracksAndVias, ACTION_CONDITIONS::Enable(), ACTIONS::excludeMarker, export3d, export_cmp, export_file, export_idf, export_step, export_svg, PCB_ACTIONS::exportSpecctraDSN, fabrication, FILE_HISTORY::FileHistoryNotEmpty(), ACTIONS::find, PCB_ACTIONS::flipBoard, PCB_ACTIONS::generateBOM, PCB_ACTIONS::generateD356File, PCB_ACTIONS::generateDrillFiles, PCB_ACTIONS::generateGerbers, PCB_ACTIONS::generatePosFile, PCB_ACTIONS::generateReportFile, ADVANCED_CFG::GetCfg(), EDA_BASE_FRAME::GetFileHistory(), TOOL_MANAGER::GetTool(), PCB_ACTIONS::globalDeletions, PCB_ACTIONS::graphicsOutlines, ACTIONS::gridProperties, ACTIONS::gridSetOrigin, ACTIONS::highContrastMode, ID_GEN_EXPORT_FILE_GENCADFORMAT, ID_GEN_EXPORT_FILE_HYPERLYNX, ID_GEN_EXPORT_FILE_IDF3, ID_GEN_EXPORT_FILE_STEP, ID_GEN_EXPORT_FILE_VRML, ID_GEN_PLOT_SVG, ID_IMPORT_NON_KICAD_BOARD, ID_MENU_EXPORT_FOOTPRINTS_TO_LIBRARY, ID_MENU_EXPORT_FOOTPRINTS_TO_NEW_LIBRARY, ID_MENU_RECOVER_BOARD_AUTOSAVE, ID_PCB_GEN_CMP_FILE, ID_REMOVE_TEARDROP_TOOL, ID_RUN_TEARDROP_TOOL, import, import_brd_file, PCB_ACTIONS::importNetlist, PCB_ACTIONS::importSpecctraSession, ACTIONS::inchesUnits, PCB_ACTIONS::inspectClearance, PCB_ACTIONS::inspectConstraints, Kiface(), PCB_ACTIONS::layerAlphaDec, PCB_ACTIONS::layerAlphaInc, library_archive, library_archive_as, PCB_ACTIONS::listNets, m_exportNetlistAction, TOOLS_HOLDER::m_toolManager, ACTIONS::measureTool, PCB_ACTIONS::microwaveCreateFunctionShape, PCB_ACTIONS::microwaveCreateGap, PCB_ACTIONS::microwaveCreateLine, PCB_ACTIONS::microwaveCreateStub, PCB_ACTIONS::microwaveCreateStubArc, ACTIONS::millimetersUnits, ACTIONS::milsUnits, mode_module, mw_add_line, ACTIONS::nextMarker, ACTION_MENU::NORMAL, ACTIONS::open, PCB_ACTIONS::padDisplayMode, ACTIONS::pageSettings, ACTIONS::paste, ACTIONS::pasteSpecial, PCB_ACTIONS::placeCharacteristics, PCB_ACTIONS::placeFootprint, PCB_ACTIONS::placeImage, PCB_ACTIONS::placeImportedGraphics, PCB_ACTIONS::placeStackup, PCB_ACTIONS::placeText, ACTIONS::plot, PCB_ACTIONS::pluginsReload, PCB_ACTIONS::pluginsShowFolder, post_gencad, preference, ACTIONS::prevMarker, ACTIONS::print, puzzle_piece, PCB_ACTIONS::ratsnestLineMode, recent, ACTIONS::redo, EDA_BASE_FRAME::RegisterUIUpdateHandler(), PCB_ACTIONS::removeUnusedPads, PCB_ACTIONS::repairBoard, rescue, ACTIONS::revert, PCB_ACTIONS::routeDiffPair, PCB_ACTIONS::routerSettingsDialog, PCB_ACTIONS::routerTuneDiffPair, PCB_ACTIONS::routerTuneDiffPairSkew, PCB_ACTIONS::routerTuneSingleTrace, PCB_ACTIONS::routeSingleTrack, PCB_ACTIONS::runDRC, ACTIONS::save, ACTIONS::saveAs, ACTIONS::saveCopy, ACTIONS::selectAll, PCB_ACTIONS::selectLayerPair, ACTION_MENU::SetIcon(), ACTION_MENU::SetTitle(), ACTIONS::show3DViewer, PCB_ACTIONS::showEeschema, ACTIONS::showFootprintBrowser, ACTIONS::showFootprintEditor, ACTIONS::showFootprintLibTable, PCB_ACTIONS::showLayersManager, PCB_ACTIONS::showProperties, PCB_ACTIONS::showPythonConsole, PCB_ACTIONS::showRatsnest, ACTIONS::showSearch, PCB_ACTIONS::swapLayers, PCB_ACTIONS::textOutlines, ACTIONS::toggleCursorStyle, ACTIONS::toggleGrid, ACTIONS::togglePolarCoords, PCB_ACTIONS::trackDisplayMode, ACTIONS::undo, unit_mm, FILE_HISTORY::UpdateClearText(), PCB_ACTIONS::updateFootprints, ACTIONS::updatePcbFromSchematic, ACTIONS::updateSchematicFromPcb, via, PCB_ACTIONS::viaDisplayMode, PCB_ACTIONS::zoneDisplayFilled, PCB_ACTIONS::zoneDisplayFractured, PCB_ACTIONS::zoneDisplayOutline, PCB_ACTIONS::zoneDisplayTriangulated, PCB_ACTIONS::zoneFillAll, PCB_ACTIONS::zoneUnfillAll, ACTIONS::zoomFitObjects, 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
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associates files extensions with action to execute.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142

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

◆ Edit_Zone_Params()

void PCB_EDIT_FRAME::Edit_Zone_Params ( ZONE zone_container)

Edit params (layer, clearance, ...) for a zone outline.

Definition at line 40 of file edit_zone_helpers.cpp.

41{
42 int dialogResult;
43 ZONE_SETTINGS zoneInfo = GetZoneSettings();
44 PICKED_ITEMS_LIST pickedList; // zones for undo/redo command
45 PICKED_ITEMS_LIST deletedList; // zones that have been deleted when combined
46 BOARD_COMMIT commit( this );
47
48 // Save initial zones configuration, for undo/redo, before adding new zone
49 // note the net name and the layer can be changed, so we must save all zones
50 SaveCopyOfZones( pickedList, GetBoard() );
51
52 if( aZone->GetIsRuleArea() )
53 {
54 // edit a rule area on a copper layer
55 zoneInfo << *aZone;
56 dialogResult = InvokeRuleAreaEditor( this, &zoneInfo );
57 }
58 else if( IsCopperLayer( aZone->GetFirstLayer() ) )
59 {
60 // edit a zone on a copper layer
61 zoneInfo << *aZone;
62 dialogResult = InvokeCopperZonesEditor( this, &zoneInfo );
63 }
64 else
65 {
66 zoneInfo << *aZone;
67 dialogResult = InvokeNonCopperZonesEditor( this, &zoneInfo );
68 }
69
70 if( dialogResult == wxID_CANCEL )
71 {
72 ClearListAndDeleteItems( &deletedList );
73 ClearListAndDeleteItems( &pickedList );
74 return;
75 }
76
77 SetZoneSettings( zoneInfo );
78 OnModify();
79
80 if( dialogResult == ZONE_EXPORT_VALUES )
81 {
82 UpdateCopyOfZonesList( pickedList, deletedList, GetBoard() );
83 commit.Stage( pickedList );
84 commit.Push( _( "Modify zone properties" ) );
85 pickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
86 return;
87 }
88
89 wxBusyCursor dummy;
90
91 // Undraw old zone outlines
92 for( ZONE* zone : GetBoard()->Zones() )
93 GetCanvas()->GetView()->Update( zone );
94
95 zoneInfo.ExportSetting( *aZone );
96
97 NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection );
98
99 if( net ) // net == NULL should not occur
100 aZone->SetNetCode( net->GetNetCode() );
101
102 UpdateCopyOfZonesList( pickedList, deletedList, GetBoard() );
103
104 commit.Stage( pickedList );
105
106 commit.Push( _( "Modify zone properties" ), SKIP_CONNECTIVITY );
108
109 pickedList.ClearItemsList(); // s_ItemsListPicker is no longer owner of picked items
110}
#define SKIP_CONNECTIVITY
Definition: board_commit.h:42
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1460
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
Handle the data for a net.
Definition: netinfo.h:67
void SetNetCode(int aNetCode)
Definition: netinfo.h:115
int GetNetCode() const
Definition: netinfo.h:114
const ZONE_SETTINGS & GetZoneSettings() const
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
void OnModify() override
Must be called after a board change to set the modified flag.
void ClearItemsList()
Delete only the list of pickers NOT the picked data itself.
ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:70
int m_NetcodeSelection
Definition: zone_settings.h:95
void ExportSetting(ZONE &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings, CONVERT_SETTINGS *aConvertSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.
int InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings, CONVERT_SETTINGS *aConvertSettings)
Function InvokeNonCopperZonesEditor invokes up a modal dialog window for non-copper zone editing.
int InvokeRuleAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aZoneSettings, CONVERT_SETTINGS *aConvertSettings)
Function InvokeRuleAreaEditor invokes up a modal dialog window for copper zone editing.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:825
std::vector< FAB_LAYER_COLOR > dummy
#define ZONE_EXPORT_VALUES
Definition: zones.h:44
void UpdateCopyOfZonesList(PICKED_ITEMS_LIST &aPickList, PICKED_ITEMS_LIST &aAuxiliaryList, BOARD *aPcb)
Function UpdateCopyOfZonesList Check a pick list to remove zones identical to their copies and set th...
void SaveCopyOfZones(PICKED_ITEMS_LIST &aPickList, BOARD *aPcb)
Function SaveCopyOfZones creates a copy of zones having a given netcode on a given layer,...

References _, PICKED_ITEMS_LIST::ClearItemsList(), PCB_BASE_EDIT_FRAME::ClearListAndDeleteItems(), dummy, ZONE_SETTINGS::ExportSetting(), BOARD::FindNet(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), ZONE::GetFirstLayer(), ZONE::GetIsRuleArea(), NETINFO_ITEM::GetNetCode(), PCB_DRAW_PANEL_GAL::GetView(), PCB_BASE_FRAME::GetZoneSettings(), InvokeCopperZonesEditor(), InvokeNonCopperZonesEditor(), InvokeRuleAreaEditor(), IsCopperLayer(), ZONE_SETTINGS::m_NetcodeSelection, OnModify(), BOARD_COMMIT::Push(), PCB_BASE_FRAME::rebuildConnectivity(), SaveCopyOfZones(), BOARD_CONNECTED_ITEM::SetNetCode(), PCB_BASE_FRAME::SetZoneSettings(), SKIP_CONNECTIVITY, BOARD_COMMIT::Stage(), KIGFX::PCB_VIEW::Update(), UpdateCopyOfZonesList(), and ZONE_EXPORT_VALUES.

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

◆ ExchangeFootprint()

void PCB_EDIT_FRAME::ExchangeFootprint ( FOOTPRINT aExisting,
FOOTPRINT aNew,
BOARD_COMMIT aCommit,
bool  deleteExtraTexts = true,
bool  resetTextLayers = true,
bool  resetTextEffects = true,
bool  resetFabricationAttrs = true,
bool  reset3DModels = true,
bool *  aUpdated = nullptr 
)

Replace aExisting footprint by aNew footprint using the Existing footprint settings (position, orientation, pad netnames ...).

The aExisting footprint is deleted or put in undo list.

Parameters
aExistingfootprint to replace.
aNewfootprint to put.
aCommitcommit that should store the changes.

Definition at line 2084 of file pcb_edit_frame.cpp.

2089{
2090 PCB_GROUP* parentGroup = aExisting->GetParentGroup();
2091 bool dummyBool = false;
2092
2093 if( !aUpdated )
2094 aUpdated = &dummyBool;
2095
2096 if( parentGroup )
2097 {
2098 parentGroup->RemoveItem( aExisting );
2099 parentGroup->AddItem( aNew );
2100 }
2101
2102 aNew->SetParent( GetBoard() );
2103
2104 PlaceFootprint( aNew, false );
2105
2106 // PlaceFootprint will move the footprint to the cursor position, which we don't want. Copy
2107 // the original position across.
2108 aNew->SetPosition( aExisting->GetPosition() );
2109
2110 if( aNew->GetLayer() != aExisting->GetLayer() )
2111 aNew->Flip( aNew->GetPosition(), GetPcbNewSettings()->m_FlipLeftRight );
2112
2113 if( aNew->GetOrientation() != aExisting->GetOrientation() )
2114 aNew->SetOrientation( aExisting->GetOrientation() );
2115
2116 aNew->SetLocked( aExisting->IsLocked() );
2117
2118 // Now transfer the net info from "old" pads to the new footprint
2119 for( PAD* pad : aNew->Pads() )
2120 {
2121 PAD* pad_model = nullptr;
2122
2123 // Pads with no copper are never connected to a net
2124 if( !pad->IsOnCopperLayer() )
2125 {
2126 pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
2127 continue;
2128 }
2129
2130 // Pads with no numbers are never connected to a net
2131 if( pad->GetNumber().IsEmpty() )
2132 {
2133 pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
2134 continue;
2135 }
2136
2137 // Search for a similar pad on a copper layer, to reuse net info
2138 PAD* last_pad = nullptr;
2139
2140 while( true )
2141 {
2142 pad_model = aExisting->FindPadByNumber( pad->GetNumber(), last_pad );
2143
2144 if( !pad_model )
2145 break;
2146
2147 if( pad_model->IsOnCopperLayer() ) // a candidate is found
2148 break;
2149
2150 last_pad = pad_model;
2151 }
2152
2153 if( pad_model )
2154 {
2155 pad->SetLocalRatsnestVisible( pad_model->GetLocalRatsnestVisible() );
2156 pad->SetPinFunction( pad_model->GetPinFunction() );
2157 pad->SetPinType( pad_model->GetPinType() );
2158 }
2159
2160 pad->SetNetCode( pad_model ? pad_model->GetNetCode() : NETINFO_LIST::UNCONNECTED );
2161 }
2162
2163 // Copy reference
2164 processTextItem( aExisting->Reference(), aNew->Reference(),
2165 // never reset reference text
2166 false,
2167 resetTextLayers, resetTextEffects, aUpdated );
2168
2169 // Copy value
2170 processTextItem( aExisting->Value(), aNew->Value(),
2171 // reset value text only when it is a proxy for the footprint ID
2172 // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
2173 aExisting->GetValue() == aExisting->GetFPID().GetLibItemName(),
2174 resetTextLayers, resetTextEffects, aUpdated );
2175
2176 // Copy fields in accordance with the reset* flags
2177 for( BOARD_ITEM* item : aExisting->GraphicalItems() )
2178 {
2179 FP_TEXT* srcItem = dyn_cast<FP_TEXT*>( item );
2180
2181 if( srcItem )
2182 {
2183 FP_TEXT* destItem = getMatchingTextItem( srcItem, aNew );
2184
2185 if( destItem )
2186 {
2187 processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects,
2188 aUpdated );
2189 }
2190 else if( !deleteExtraTexts )
2191 {
2192 aNew->Add( new FP_TEXT( *srcItem ) );
2193 }
2194 }
2195 }
2196
2197 if( !resetFabricationAttrs )
2198 aNew->SetAttributes( aExisting->GetAttributes() );
2199
2200 // Copy 3D model settings in accordance with the reset* flag
2201 if( !reset3DModels )
2202 aNew->Models() = aExisting->Models(); // Linked list of 3D models.
2203
2204 // Updating other parameters
2205 const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
2206 aNew->SetProperties( aExisting->GetProperties() );
2207 aNew->SetPath( aExisting->GetPath() );
2208
2209 aCommit.Remove( aExisting );
2210 aCommit.Add( aNew );
2211
2212 aNew->ClearFlags();
2213}
bool GetLocalRatsnestVisible() const
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:72
COMMIT & Remove(EDA_ITEM *aItem)
Notify observers that aItem has been removed.
Definition: commit.h:90
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
Definition: commit.h:78
const KIID m_Uuid
Definition: eda_item.h:492
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:350
EDA_ANGLE GetOrientation() const
Definition: footprint.h:191
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:225
int GetAttributes() const
Definition: footprint.h:250
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:200
PADS & Pads()
Definition: footprint.h:170
const LIB_ID & GetFPID() const
Definition: footprint.h:212
bool IsLocked() const override
Definition: footprint.h:340
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:567
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:184
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: footprint.h:575
const KIID_PATH & GetPath() const
Definition: footprint.h:224
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1175
const std::map< wxString, wxString > & GetProperties() const
Definition: footprint.h:574
Definition: kiid.h:48
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:382
Definition: pad.h:59
const wxString & GetPinType() const
Definition: pad.h:152
const wxString & GetPinFunction() const
Definition: pad.h:146
bool IsOnCopperLayer() const override
Definition: pad.h:242
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
Definition: pcb_group.cpp:95
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:80

References FOOTPRINT::Add(), COMMIT::Add(), PCB_GROUP::AddItem(), EDA_ITEM::ClearFlags(), FOOTPRINT::FindPadByNumber(), FOOTPRINT::Flip(), FOOTPRINT::GetAttributes(), PCB_BASE_FRAME::GetBoard(), FOOTPRINT::GetFPID(), FOOTPRINT::GetLayer(), LIB_ID::GetLibItemName(), BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible(), BOARD_CONNECTED_ITEM::GetNetCode(), FOOTPRINT::GetOrientation(), BOARD_ITEM::GetParentGroup(), FOOTPRINT::GetPath(), PCB_BASE_FRAME::GetPcbNewSettings(), PAD::GetPinFunction(), PAD::GetPinType(), FOOTPRINT::GetPosition(), FOOTPRINT::GetProperties(), FOOTPRINT::GetValue(), FOOTPRINT::GraphicalItems(), FOOTPRINT::IsLocked(), PAD::IsOnCopperLayer(), EDA_ITEM::m_Uuid, FOOTPRINT::Models(), pad, FOOTPRINT::Pads(), PCB_BASE_FRAME::PlaceFootprint(), FOOTPRINT::Reference(), COMMIT::Remove(), PCB_GROUP::RemoveItem(), FOOTPRINT::SetAttributes(), FOOTPRINT::SetLocked(), FOOTPRINT::SetOrientation(), EDA_ITEM::SetParent(), FOOTPRINT::SetPath(), FOOTPRINT::SetPosition(), FOOTPRINT::SetProperties(), NETINFO_LIST::UNCONNECTED, and FOOTPRINT::Value().

Referenced by DIALOG_EXCHANGE_FOOTPRINTS::processFootprint(), BOARD_NETLIST_UPDATER::replaceFootprint(), and FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard().

◆ ExecuteRemoteCommand()

void PCB_EDIT_FRAME::ExecuteRemoteCommand ( const char *  cmdline)
overridevirtual

Execute a remote command send by Eeschema via a socket, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242).

This is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().

Parameters
cmdlineis the received command from socket.

Reimplemented from KIWAY_PLAYER.

Definition at line 67 of file pcbnew/cross-probing.cpp.

68{
69 char line[1024];
70 wxString msg;
71 wxString modName;
72 char* idcmd;
73 char* text;
74 int netcode = -1;
75 bool multiHighlight = false;
76 FOOTPRINT* footprint = nullptr;
77 PAD* pad = nullptr;
78 BOARD* pcb = GetBoard();
79
81
83 KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();
84
85 strncpy( line, cmdline, sizeof(line) - 1 );
86 line[sizeof(line) - 1] = 0;
87
88 idcmd = strtok( line, " \n\r" );
89 text = strtok( nullptr, "\"\n\r" );
90
91 if( idcmd == nullptr )
92 return;
93
94 if( strcmp( idcmd, "$NET:" ) == 0 )
95 {
96 if( !crossProbingSettings.auto_highlight )
97 return;
98
99 wxString net_name = FROM_UTF8( text );
100
101 NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
102
103 if( netinfo )
104 {
105 netcode = netinfo->GetNetCode();
106
107 std::vector<MSG_PANEL_ITEM> items;
108 netinfo->GetMsgPanelInfo( this, items );
109 SetMsgPanel( items );
110 }
111 }
112
113 if( strcmp( idcmd, "$NETS:" ) == 0 )
114 {
115 if( !crossProbingSettings.auto_highlight )
116 return;
117
118 wxStringTokenizer netsTok = wxStringTokenizer( FROM_UTF8( text ), wxT( "," ) );
119 bool first = true;
120
121 while( netsTok.HasMoreTokens() )
122 {
123 NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken() );
124
125 if( netinfo )
126 {
127 if( first )
128 {
129 // TODO: Once buses are included in netlist, show bus name
130 std::vector<MSG_PANEL_ITEM> items;
131 netinfo->GetMsgPanelInfo( this, items );
132 SetMsgPanel( items );
133 first = false;
134
135 pcb->SetHighLightNet( netinfo->GetNetCode() );
136 renderSettings->SetHighlight( true, netinfo->GetNetCode() );
137 multiHighlight = true;
138 }
139 else
140 {
141 pcb->SetHighLightNet( netinfo->GetNetCode(), true );
142 renderSettings->SetHighlight( true, netinfo->GetNetCode(), true );
143 }
144 }
145 }
146
147 netcode = -1;
148 }
149 else if( strcmp( idcmd, "$CLEAR" ) == 0 )
150 {
151 if( renderSettings->IsHighlightEnabled() )
152 {
153 renderSettings->SetHighlight( false );
154 view->UpdateAllLayersColor();
155 }
156
157 if( pcb->IsHighLightNetON() )
158 {
159 pcb->ResetNetHighLight();
160 SetMsgPanel( pcb );
161 }
162
163 GetCanvas()->Refresh();
164 return;
165 }
166
167 BOX2I bbox;
168
169 if( footprint )
170 {
171 bbox = footprint->GetBoundingBox( true, false ); // No invisible text in bbox calc
172
173 if( pad )
175 else
176 m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) footprint );
177 }
178 else if( netcode > 0 || multiHighlight )
179 {
180 if( !multiHighlight )
181 {
182 renderSettings->SetHighlight( ( netcode >= 0 ), netcode );
183 pcb->SetHighLightNet( netcode );
184 }
185 else
186 {
187 // Just pick the first one for area calculation
188 netcode = *pcb->GetHighLightNetCodes().begin();
189 }
190
191 pcb->HighLightON();
192
193 auto merge_area =
194 [netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
195 {
196 if( aItem->GetNetCode() == netcode )
197 bbox.Merge( aItem->GetBoundingBox() );
198 };
199
200 if( crossProbingSettings.center_on_items )
201 {
202 for( ZONE* zone : pcb->Zones() )
203 merge_area( zone );
204
205 for( PCB_TRACK* track : pcb->Tracks() )
206 merge_area( track );
207
208 for( FOOTPRINT* fp : pcb->Footprints() )
209 {
210 for( PAD* p : fp->Pads() )
211 merge_area( p );
212 }
213 }
214 }
215 else
216 {
217 renderSettings->SetHighlight( false );
218 }
219
220 if( crossProbingSettings.center_on_items && bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
221 {
222 if( crossProbingSettings.zoom_to_fit )
223 GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->ZoomFitCrossProbeBBox( bbox );
224
225 FocusOnLocation( bbox.Centre() );
226 }
227
228 view->UpdateAllLayersColor();
229
230 // Ensure the display is refreshed, because in some installs the refresh is done only
231 // when the gal canvas has the focus, and that is not the case when crossprobing from
232 // Eeschema:
233 GetCanvas()->Refresh();
234}
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:173
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
const std::set< int > & GetHighLightNetCodes() const
Definition: board.h:472
ZONES & Zones()
Definition: board.h:313
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition: board.cpp:2073
FOOTPRINTS & Footprints()
Definition: board.h:307
TRACKS & Tracks()
Definition: board.h:304
bool IsHighLightNetON() const
Definition: board.h:488
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2086
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetWidth() const
Definition: box2.h:187
Vec Centre() const
Definition: box2.h:70
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:805
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
bool IsHighlightEnabled() const
Return current highlight setting.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:761
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Return the information about the NETINFO_ITEM in aList to display in the message panel.
static TOOL_ACTION highlightItem
Definition: pcb_actions.h:501
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:285
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
Cross-probing behavior.
Definition: app_settings.h:31
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:34
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:33
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:35

References CROSS_PROBING_SETTINGS::auto_highlight, CROSS_PROBING_SETTINGS::center_on_items, BOX2< Vec >::Centre(), BOARD::FindNet(), EDA_DRAW_FRAME::FocusOnLocation(), BOARD::Footprints(), FROM_UTF8(), PCB_BASE_FRAME::GetBoard(), FOOTPRINT::GetBoundingBox(), PCB_BASE_FRAME::GetCanvas(), BOX2< Vec >::GetHeight(), BOARD::GetHighLightNetCodes(), NETINFO_ITEM::GetMsgPanelInfo(), NETINFO_ITEM::GetNetCode(), KIGFX::VIEW::GetPainter(), PCB_BASE_FRAME::GetPcbNewSettings(), KIGFX::PAINTER::GetSettings(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::GetToolManager(), TOOL_MANAGER::GetView(), BOX2< Vec >::GetWidth(), PCB_ACTIONS::highlightItem, BOARD::HighLightON(), KIGFX::RENDER_SETTINGS::IsHighlightEnabled(), BOARD::IsHighLightNetON(), APP_SETTINGS_BASE::m_CrossProbing, TOOLS_HOLDER::m_toolManager, BOX2< Vec >::Merge(), pad, EDA_DRAW_PANEL_GAL::Refresh(), BOARD::ResetNetHighLight(), TOOL_MANAGER::RunAction(), KIGFX::RENDER_SETTINGS::SetHighlight(), BOARD::SetHighLightNet(), EDA_DRAW_FRAME::SetMsgPanel(), text, BOARD::Tracks(), KIGFX::VIEW::UpdateAllLayersColor(), BOARD::Zones(), and CROSS_PROBING_SETTINGS::zoom_to_fit.

Referenced by KiwayMailIn().

◆ Export_IDF3()

bool PCB_EDIT_FRAME::Export_IDF3 ( BOARD aPcb,
const wxString &  aFullFileName,
bool  aUseThou,
double  aXRef,
double  aYRef 
)

Create an IDF3 compliant BOARD (*.emn) and LIBRARY (*.emp) file.

Generate IDFv3 compliant board (*.emn) and library (*.emp) files representing the user's PCB design.

Parameters
aPcba pointer to the board to be exported to IDF.
aFullFileNamethe full filename of the export file.
aUseThouset to true if the desired IDF unit is thou (mil).
aXRefthe board Reference Point in mm, X value.
aYRefthe board Reference Point in mm, Y value.
Returns
true if OK.

Definition at line 603 of file export_idf.cpp.

605{
606 IDF3_BOARD idfBoard( IDF3::CAD_ELEC );
607
608 // Switch the locale to standard C (needed to print floating point numbers)
609 LOCALE_IO toggle;
610
611 resolver = Prj().Get3DCacheManager()->GetResolver();
612
613 bool ok = true;
614 double scale = pcbIUScale.MM_PER_IU; // we must scale internal units to mm for IDF
615 IDF3::IDF_UNIT idfUnit;
616
617 if( aUseThou )
618 {
619 idfUnit = IDF3::UNIT_THOU;
620 idfBoard.SetUserPrecision( 1 );
621 }
622 else
623 {
624 idfUnit = IDF3::UNIT_MM;
625 idfBoard.SetUserPrecision( 5 );
626 }
627
628 wxFileName brdName = aPcb->GetFileName();
629
630 idfBoard.SetUserScale( scale );
631 idfBoard.SetBoardThickness( aPcb->GetDesignSettings().GetBoardThickness() * scale );
632 idfBoard.SetBoardName( TO_UTF8( brdName.GetFullName() ) );
633 idfBoard.SetBoardVersion( 0 );
634 idfBoard.SetLibraryVersion( 0 );
635
636 std::ostringstream ostr;
637 ostr << "KiCad " << TO_UTF8( GetBuildVersion() );
638 idfBoard.SetIDFSource( ostr.str() );
639
640 try
641 {
642 // set up the board reference point
643 idfBoard.SetUserOffset( -aXRef, aYRef );
644
645 // Export the board outline
646 idf_export_outline( aPcb, idfBoard );
647
648 // Output the drill holes and footprint (library) data.
649 for( FOOTPRINT* footprint : aPcb->Footprints() )
650 idf_export_footprint( aPcb, footprint, idfBoard );
651
652 if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) )
653 {
654 wxString msg;
655 msg << _( "IDF Export Failed:\n" ) << FROM_UTF8( idfBoard.GetError().c_str() );
656 wxMessageBox( msg );
657
658 ok = false;
659 }
660 }
661 catch( const IO_ERROR& ioe )
662 {
663 wxString msg;
664 msg << _( "IDF Export Failed:\n" ) << ioe.What();
665 wxMessageBox( msg );
666
667 ok = false;
668 }
669 catch( const std::exception& e )
670 {
671 wxString msg;
672 msg << _( "IDF Export Failed:\n" ) << FROM_UTF8( e.what() );
673 wxMessageBox( msg );
674 ok = false;
675 }
676
677 return ok;
678}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
wxString GetBuildVersion()
Get the full KiCad version string.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:686
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41
static void idf_export_outline(BOARD *aPcb, IDF3_BOARD &aIDFBoard)
Retrieve line segment information from the edge layer and compiles the data into a form which can be ...
Definition: export_idf.cpp:59
static void idf_export_footprint(BOARD *aPcb, FOOTPRINT *aFootprint, IDF3_BOARD &aIDFBoard)
Retrieve information from all board footprints, adds drill holes to the DRILLED_HOLES or BOARD_OUTLIN...
Definition: export_idf.cpp:274
static FILENAME_RESOLVER * resolver
Definition: export_idf.cpp:52
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
const int scale
const double MM_PER_IU
Definition: base_units.h:79
#define UNIT_MM
Definition: units_scales.h:34

References _, BOARD::Footprints(), FROM_UTF8(), BOARD_DESIGN_SETTINGS::GetBoardThickness(), GetBuildVersion(), BOARD::GetDesignSettings(), BOARD::GetFileName(), idf_export_footprint(), idf_export_outline(), EDA_IU_SCALE::MM_PER_IU, pcbIUScale, KIWAY_HOLDER::Prj(), resolver, scale, TO_UTF8, UNIT_MM, and IO_ERROR::What().

Referenced by OnExportIDF3().

◆ ExportFootprintsToLibrary()

void PCB_EDIT_FRAME::ExportFootprintsToLibrary ( bool  aStoreInNewLib,
const wxString &  aLibName = wxEmptyString,
wxString *  aLibPath = nullptr 
)

Save footprints in a library:

Parameters
aStoreInNewLibtrue to save footprints in a existing library. Existing footprints will be kept or updated. This library should be in fp lib table, and is type is .pretty. False to save footprints in a new library. If it is an existing lib, previous footprints will be removed.
aLibNameoptional library name to create, stops dialog call. Must be called with aStoreInNewLib as true.

Definition at line 673 of file footprint_libraries_utils.cpp.

675{
676 if( GetBoard()->GetFirstFootprint() == nullptr )
677 {
678 DisplayInfoMessage( this, _( "No footprints to export!" ) );
679 return;
680 }
681
682 wxString footprintName;
683
684 auto resetReference =
685 []( FOOTPRINT* aFootprint )
686 {
687 aFootprint->SetReference( "REF**" );
688 };
689
690 if( !aStoreInNewLib )
691 {
692 // The footprints are saved in an existing .pretty library in the fp lib table
693 PROJECT& prj = Prj();
694 wxString last_nickname = prj.GetRString( PROJECT::PCB_LIB_NICKNAME );
695 wxString nickname = SelectLibrary( last_nickname );
696
697 if( !nickname ) // Aborted
698 return;
699
700 bool map = IsOK( this, wxString::Format( _( "Update footprints on board to refer to %s?" ),
701 nickname ) );
702
703 prj.SetRString( PROJECT::PCB_LIB_NICKNAME, nickname );
704
705 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
706 {
707 try
708 {
709 FP_LIB_TABLE* tbl = prj.PcbFootprintLibs();
710
711 if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards.
712 {
713 FOOTPRINT* fpCopy = static_cast<FOOTPRINT*>( footprint->Duplicate() );
714
715 resetReference( fpCopy );
716 tbl->FootprintSave( nickname, fpCopy, true );
717
718 delete fpCopy;
719 }
720 }
721 catch( const IO_ERROR& ioe )
722 {
723 DisplayError( this, ioe.What() );
724 }
725
726 if( map )
727 {
728 LIB_ID id = footprint->GetFPID();
729 id.SetLibNickname( nickname );
730 footprint->SetFPID( id );
731 }
732 }
733 }
734 else
735 {
736 // The footprints are saved in a new .pretty library.
737 // If this library already exists, all previous footprints will be deleted
738 wxString libPath = CreateNewLibrary( aLibName );
739
740 if( libPath.IsEmpty() ) // Aborted
741 return;
742
743 if( aLibPath )
744 *aLibPath = libPath;
745
746 wxString libNickname;
747 bool map = IsOK( this, _( "Update footprints on board to refer to new library?" ) );
748
749 if( map )
750 {
751 const LIB_TABLE_ROW* row = Prj().PcbFootprintLibs()->FindRowByURI( libPath );
752
753 if( row )
754 libNickname = row->GetNickName();
755 }
756
758 PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
759
760 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
761 {
762 try
763 {
764 if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards.
765 {
766 FOOTPRINT* fpCopy = static_cast<FOOTPRINT*>( footprint->Duplicate() );
767
768 resetReference( fpCopy );
769 pi->FootprintSave( libPath, fpCopy );
770
771 delete fpCopy;
772 }
773 }
774 catch( const IO_ERROR& ioe )
775 {
776 DisplayError( this, ioe.What() );
777 }
778
779 if( map )
780 {
781 LIB_ID id = footprint->GetFPID();
782 id.SetLibNickname( libNickname );
783 footprint->SetFPID( id );
784 }
785 }
786 }
787}
SAVE_T FootprintSave(const wxString &aNickname, const FOOTPRINT *aFootprint, bool aOverwrite=true)
Write aFootprint to an existing library given by aNickname.
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:98
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
const wxString & GetNickName() const
const LIB_TABLE_ROW * FindRowByURI(const wxString &aURI)
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...
wxString SelectLibrary(const wxString &aNicknameExisting)
Put up a dialog and allows the user to pick a library, for unspecified use.
Container for project specific data.
Definition: project.h:64
@ PCB_LIB_NICKNAME
Definition: project.h:173
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
Definition: project.cpp:254
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
Definition: project.cpp:265

References _, PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DisplayError(), DisplayInfoMessage(), LIB_TABLE::FindRowByURI(), PLUGIN::FootprintSave(), FP_LIB_TABLE::FootprintSave(), Format(), PCB_BASE_FRAME::GetBoard(), LIB_TABLE_ROW::GetNickName(), PROJECT::GetRString(), IsOK(), IO_MGR::KICAD_SEXP, PROJECT::PCB_LIB_NICKNAME, PROJECT::PcbFootprintLibs(), IO_MGR::PluginFind(), KIWAY_HOLDER::Prj(), PCB_BASE_FRAME::SelectLibrary(), LIB_ID::SetLibNickname(), PROJECT::SetRString(), and IO_ERROR::What().

Referenced by ExportFootprintsToLibrary(), and Process_Special_Functions().

◆ ExportSpecctraFile()

bool PCB_EDIT_FRAME::ExportSpecctraFile ( const wxString &  aFullFilename)

Export the current BOARD to a specctra dsn file.

See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the specification.

Returns
true if OK

Definition at line 81 of file specctra_export.cpp.

82{
83 BASE_SCREEN* screen = GetScreen();
84 bool wasModified = screen->IsContentModified();
85 wxString errorText;
86 bool ok = true;
87
88 try
89 {
90 ExportBoardToSpecctraFile( GetBoard(), aFullFilename );
91 }
92 catch( const IO_ERROR& ioe )
93 {
94 ok = false;
95
96 // copy the error string to safe place, ioe is in this scope only.
97 errorText = ioe.What();
98 }
99
100 // The two calls to FOOTPRINT::Flip() in ExportBoardToSpecctraFile both set the modified flag,
101 // yet their actions cancel each other out, so it should be ok to clear the flag.
102 if( !wasModified )
103 screen->SetContentModified( false );
104
105 if( ok )
106 SetStatusText( wxString( _( "BOARD exported OK." ) ) );
107 else
108 DisplayErrorMessage( this, _( "Unable to export, please fix and try again" ), errorText );
109
110 return ok;
111}
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
bool IsContentModified() const
Definition: base_screen.h:60
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:325
void ExportBoardToSpecctraFile(BOARD *aBoard, const wxString &aFullFilename)
Helper method to export board to DSN file.

References _, DisplayErrorMessage(), ExportBoardToSpecctraFile(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetScreen(), BASE_SCREEN::IsContentModified(), BASE_SCREEN::SetContentModified(), and IO_ERROR::What().

Referenced by ExportSpecctraDSN().

◆ ExportSVG()

void PCB_EDIT_FRAME::ExportSVG ( wxCommandEvent &  event)

Show the Export to SVG file dialog.

Definition at line 1536 of file pcb_edit_frame.cpp.

1537{
1538 InvokeExportSVG( this, GetBoard() );
1539}
bool InvokeExportSVG(PCB_EDIT_FRAME *aCaller, BOARD *aBoard)
Function InvokeExportSVG shows the Export SVG dialog.

References PCB_BASE_FRAME::GetBoard(), and InvokeExportSVG().

◆ ExportToGenCAD()

void PCB_EDIT_FRAME::ExportToGenCAD ( wxCommandEvent &  event)

Create a file in GenCAD 1.4 format from the current board.

Definition at line 234 of file export_gencad.cpp.

235{
236 // Build default output file name
237 wxString path = GetLastPath( LAST_PATH_GENCAD );
238
239 if( path.IsEmpty() )
240 {
241 wxFileName brdFile = GetBoard()->GetFileName();
242 brdFile.SetExt( wxT( "cad" ) );
243 path = brdFile.GetFullPath();
244 }
245
246 DIALOG_GENCAD_EXPORT_OPTIONS optionsDialog( this, path );
247
248 if( optionsDialog.ShowModal() == wxID_CANCEL )
249 return;
250
251 path = optionsDialog.GetFileName();
253 FILE* file = wxFopen( path, wxT( "wt" ) );
254
255 if( !file )
256 {
257 DisplayError( this, wxString::Format( _( "Failed to create file '%s'." ),
258 optionsDialog.GetFileName() ) );
259 return;
260 }
261
262 // Get options
263 flipBottomPads = optionsDialog.GetOption( FLIP_BOTTOM_PADS );
264 uniquePins = optionsDialog.GetOption( UNIQUE_PIN_NAMES );
265 individualShapes = optionsDialog.GetOption( INDIVIDUAL_SHAPES );
266 storeOriginCoords = optionsDialog.GetOption( STORE_ORIGIN_COORDS );
267
268 // Switch the locale to standard C (needed to print floating point numbers)
269 LOCALE_IO toggle;
270
271 // Update some board data, to ensure a reliable gencad export
273
274 // Save the auxiliary origin for the rest of the footprint
276 GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.x : 0;
277 GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.y : 0;
278
279 // No idea on *why* this should be needed... maybe to fix net names?
280 Compile_Ratsnest( true );
281
282 /* Temporary modification of footprints that are flipped (i.e. on bottom
283 * layer) to convert them to non flipped footprints.
284 * This is necessary to easily export shapes to GenCAD,
285 * that are given as normal orientation (non flipped, rotation = 0))
286 * these changes will be undone later
287 */
288 BOARD* pcb = GetBoard();
289
290 for( FOOTPRINT* footprint : pcb->Footprints() )
291 {
292 footprint->SetFlag( 0 );
293
294 if( footprint->GetLayer() == B_Cu )
295 {
296 footprint->Flip( footprint->GetPosition(), false );
297 footprint->SetFlag( 1 );
298 }
299 }
300
301 /* Gencad has some mandatory and some optional sections: some importer
302 * need the padstack section (which is optional) anyway. Also the
303 * order of the section *is* important */
304
305 CreateHeaderInfoData( file, this ); // Gencad header
306 CreateBoardSection( file, pcb ); // Board perimeter
307
308 CreatePadsShapesSection( file, pcb ); // Pads and padstacks
309 CreateArtworksSection( file ); // Empty but mandatory
310
311 /* Gencad splits a component info in shape, component and device.
312 * We don't do any sharing (it would be difficult since each module is
313 * customizable after placement) */
314 CreateShapesSection( file, pcb );
315 CreateComponentsSection( file, pcb );
316 CreateDevicesSection( file, pcb );
317
318 // In a similar way the netlist is split in net, track and route
319 CreateSignalsSection( file, pcb );
320