KiCad PCB EDA Suite
PCB_EDIT_FRAME Class Reference

PCB_EDIT_FRAME is 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

Classes

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

Public Types

enum  FETCH_NETLIST_MODE { NO_ANNOTATION, QUIET_ANNOTATION, ANNOTATION_DIALOG }
 Function FetchNetlistFromSchematic. More...
 
enum  HOLDER_TYPE { DIALOG, FRAME, PANEL }
 

Public Member Functions

virtual ~PCB_EDIT_FRAME ()
 
void LoadFootprints (NETLIST &aNetlist, REPORTER &aReporter)
 Function loadFootprints loads the footprints for each COMPONENT in aNetlist from the list of libraries. More...
 
void OnQuit (wxCommandEvent &event)
 
bool IsContentModified () override
 Get if the current board has been modified but not saved. More...
 
void PythonPluginsReload ()
 Reload the Python plugins if they are newer than the already loaded, and load new plugins if any Do nothing if KICAD_SCRIPTING is not defined. More...
 
void UpdateUserInterface ()
 Update the layer manager and other widgets from the board setup (layer and items visibility, colors ...) 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) this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void KiwayMailIn (KIWAY_EXPRESS &aEvent) override
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
void ToPlotter (int aID)
 Function ToPlotter Open a dialog frame to create plot and drill files relative to the current board. More...
 
void ExportSVG (wxCommandEvent &event)
 Function SVG_Print Shows the Export to SVG file dialog. More...
 
void OnUpdateLayerSelectBox (wxUpdateUIEvent &aEvent)
 
bool LayerManagerShown ()
 
bool MicrowaveToolbarShown ()
 
void OnUpdateSelectViaSize (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectTrackWidth (wxUpdateUIEvent &aEvent)
 
void OnLayerColorChange (wxCommandEvent &aEvent)
 
void RunEeschema ()
 
void UpdateTrackWidthSelectBox (wxChoice *aTrackWidthSelectBox, bool aEdit=true)
 
void UpdateViaSizeSelectBox (wxChoice *aViaSizeSelectBox, bool aEdit=true)
 
COLOR4D GetGridColor () override
 Function GetGridColor() , virtual. More...
 
void SetGridColor (COLOR4D aColor) override
 Function SetGridColor() , virtual. More...
 
void Process_Config (wxCommandEvent &event)
 
void SaveProjectSettings () override
 Function SaveProjectSettings saves 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
 Saves 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 OnCloseWindow (wxCloseEvent &Event) override
 
void Process_Special_Functions (wxCommandEvent &event)
 
void Tracks_and_Vias_Size_Event (wxCommandEvent &event)
 
void ReCreateHToolbar () override
 
void ReCreateAuxiliaryToolbar () override
 
void ReCreateVToolbar () override
 
void ReCreateMicrowaveVToolbar ()
 
void ReCreateOptToolbar () override
 
void ReCreateMenuBar () override
 Recreates the menu bar. More...
 
void ReCreateLayerBox (bool aForceResizeToolbar=true)
 Re create the layer Box by clearing the old list, and building le new one, from the new layers names and cole layers. More...
 
bool SetCurrentNetClass (const wxString &aNetClassName)
 Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter change calls BOARD_DESIGN_SETTINGS::SetCurrentNetClass() and update trace width and via size combo boxes on main toolbar Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar and some others parameters (netclass name ....) More...
 
void OnModify () override
 Function OnModify must be called after a board change to set the modified flag. More...
 
void SetActiveLayer (PCB_LAYER_ID aLayer) override
 Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYER_WIDGET. More...
 
PCB_LAYER_WIDGETGetLayerManager ()
 
void OnUpdateLayerAlpha (wxUpdateUIEvent &aEvent) override
 Update the UI to reflect changes to the current layer's transparency. More...
 
bool IsElementVisible (GAL_LAYER_ID aElement) const
 Function IsElementVisible tests whether a given element category is visible. More...
 
void SetElementVisibility (GAL_LAYER_ID aElement, bool aNewState)
 Function SetElementVisibility changes the visibility of an element category. More...
 
void SetVisibleAlls ()
 Function SetVisibleAlls Set the status of all visible element categories and layers to VISIBLE. More...
 
void ReFillLayerWidget ()
 Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading a new BOARD. More...
 
void SyncRenderStates ()
 Updates the "Render" colors and checkboxes in the layer widget according to current toggle values determined by IsElementVisible(), and is helpful immediately after loading a BOARD which may have state information in it. More...
 
void ActivateGalCanvas () override
 

More...
 
void ShowBoardSetupDialog (const wxString &aInitialPage=wxEmptyString, const wxString &aErrorMsg=wxEmptyString, int aErrorCtrlId=-1, int aErrorLine=-1, int aErrorCol=-1)
 Function ShowBoardSetupDialog. More...
 
void PrepareLayerIndicator (bool aForceRebuild=false)
 
void ToggleLayersManager ()
 
void ToggleMicrowaveToolbar ()
 
int DoGenFootprintsPositionFile (const wxString &aFullFileName, bool aUnitsMM, bool aForceSmdItems, bool aTopSide, bool aBottomSide, bool aFormatCSV=false)
 Function DoGenFootprintsPositionFile Creates an ascii footprint position file. More...
 
void GenFootprintsReport (wxCommandEvent &event)
 Function GenFootprintsReport Calls DoGenFootprintsReport to create a footprint reprot file See DoGenFootprintsReport for file format. More...
 
bool DoGenFootprintsReport (const wxString &aFullFilename, bool aUnitsMM)
 Function DoGenFootprintsReport Creates 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)
 Function Files_io. More...
 
bool Files_io_from_id (int aId)
 Function Files_io_from_id Read and write board files. More...
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl=0) override
 Function OpenProjectFiles (was LoadOnePcbFile) loads a KiCad board (.kicad_pcb) from aFileName. More...
 
bool SavePcbFile (const wxString &aFileName, bool addToHistory=true)
 Function SavePcbFile writes the board data structures to a aFileName Creates backup when requested and update flags (modified and saved flgs) More...
 
bool SavePcbCopy (const wxString &aFileName)
 Function SavePcbCopy writes the board data structures to a aFileName but unlike SavePcbFile, does not make anything else (no backup, borad fliename change, no flag changes ...) Used under a project mgr to save under a new name the current board. More...
 
bool Clear_Pcb (bool aQuery, bool aFinal=false)
 Function Clear_Pcb delete all and reinitialize the current board. More...
 
void SetBoard (BOARD *aBoard) override
 

More...
 
BOARD_ITEM_CONTAINERGetModel () const override
 

More...
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 

More...
 
void RecreateCmpFileFromBoard (wxCommandEvent &aEvent)
 Function RecreateBOMFileFromBoard Recreates a .cmp file from the current loaded board this is the same as created by CvPcb. More...
 
void ArchiveModulesOnBoard (bool aStoreInNewLib, const wxString &aLibName=wxEmptyString, wxString *aLibPath=NULL)
 Function ArchiveModulesOnBoard Save modules in a library: More...
 
void RecreateBOMFileFromBoard (wxCommandEvent &aEvent)
 Function RecreateBOMFileFromBoard Creates a BOM file from the current loaded board. More...
 
void ExportToGenCAD (wxCommandEvent &event)
 Function ExportToGenCAD creates a file in GenCAD 1.4 format from the current board. More...
 
void OnExportVRML (wxCommandEvent &event)
 Function OnExportVRML will export the current BOARD to a VRML file. More...
 
bool ExportVRML_File (const wxString &aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, bool aUseRelativePaths, bool aUsePlainPCB, const wxString &a3D_Subdir, double aXRef, double aYRef)
 Function ExportVRML_File Creates the file(s) exporting current BOARD to a VRML file. More...
 
void OnExportIDF3 (wxCommandEvent &event)
 Function OnExportIDF3 will export the current BOARD to a IDFv3 board and lib files. More...
 
void OnExportHyperlynx (wxCommandEvent &event)
 Function OnExportHyperlynx will export the current BOARD to a Hyperlynx HYP file. More...
 
bool Export_IDF3 (BOARD *aPcb, const wxString &aFullFileName, bool aUseThou, double aXRef, double aYRef)
 Function Export_IDF3 Creates an IDF3 compliant BOARD (*.emn) and LIBRARY (*.emp) file. More...
 
void OnExportSTEP (wxCommandEvent &event)
 Function OnExportSTEP Exports the current BOARD to a STEP assembly. More...
 
bool ExportSpecctraFile (const wxString &aFullFilename)
 Function ExportSpecctraFile will export the current BOARD to a specctra dsn file. More...
 
bool ImportSpecctraSession (const wxString &aFullFilename)
 Function ImportSpecctraSession will 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 InstallFootprintPropertiesDialog (MODULE *Module)
 
int InstallExchangeModuleFrame (MODULE *aModule, bool updateMode, bool selectedMode)
 
void Exchange_Module (MODULE *aSrc, MODULE *aDest, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool reset3DModels=true)
 Function Exchange_Module Replaces OldModule by NewModule, using OldModule settings: position, orientation, pad netnames ...) OldModule is deleted or put in undo list. More...
 
void OnEditItemRequest (BOARD_ITEM *aItem) override
 Function OnEditItemRequest Install the corresponding dialog editor for the given item. More...
 
void SwitchLayer (wxDC *DC, PCB_LAYER_ID layer) override
 
int SetTrackSegmentWidth (TRACK *aTrackItem, PICKED_ITEMS_LIST *aItemsListPicker, bool aUseNetclassValue)
 Function SetTrackSegmentWidth Modify one track segment width or one via diameter (using DRC control). More...
 
void Edit_Zone_Params (ZONE_CONTAINER *zone_container)
 Function Edit_Zone_Params Edit params (layer, clearance, ...) for a zone outline. More...
 
void ShowTargetOptionsDialog (PCB_TARGET *aTarget)
 
void ShowDimensionPropertyDialog (DIMENSION *aDimension)
 
void InstallNetlistFrame ()
 
bool FetchNetlistFromSchematic (NETLIST &aNetlist, FETCH_NETLIST_MODE aMode)
 
void DoUpdatePCBFromNetlist (NETLIST &aNetlist, bool aUseTimestamps)
 Function DoUpdatePCBFromNetlist An automated version of UpdatePCBFromNetlist which skips the UI dialog. More...
 
bool ReadNetlistFromFile (const wxString &aFilename, NETLIST &aNetlist, REPORTER &aReporter)
 Reads 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 LockModule (MODULE *aModule, bool aLocked)
 
void SendMessageToEESCHEMA (BOARD_ITEM *objectToSync)
 Function SendMessageToEESCHEMA sends a message to the schematic editor so that it may move its cursor to a part with the same reference as the objectToSync. More...
 
void SendCrossProbeNetName (const wxString &aNetName)
 Sends a net name to eeschema for highlighting. More...
 
void ShowChangedLanguage () override
 Redraw the menus and what not in current language. More...
 
void UpdateTitle ()
 Function UpdateTitle sets the main window title bar text. More...
 
void On3DShapeLibWizard (wxCommandEvent &event)
 
void InstallPreferences (PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
 Allows Pcbnew to install its preferences panel into the preferences dialog. More...
 
void CommonSettingsChanged (bool aEnvVarsChanged) override
 Called after the preferences dialog is run. More...
 
void SyncToolbars () override
 Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
wxString GetCurrentFileName () const override
 Get the full filename + path of the currently opened file in the frame. More...
 
wxString CreateNewLibrary (const wxString &aLibName=wxEmptyString)
 Function CreateNewLibrary If a library name is given, creates a new footprint library in the project folder with the given name. More...
 
bool AddLibrary (const wxString &aLibName=wxEmptyString)
 Function AddLibrary Add an existing library to either the global or project library table. More...
 
void SaveCopyInUndoList (BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
 Function SaveCopyInUndoList Creates a new entry in undo list of commands. More...
 
void SaveCopyInUndoList (const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
 Function SaveCopyInUndoList Creates a new entry in undo list of commands. More...
 
void RestoreCopyFromRedoList (wxCommandEvent &aEvent)
 Function RestoreCopyFromRedoList Redo the last edit: More...
 
void RestoreCopyFromUndoList (wxCommandEvent &aEvent)
 Function RestoreCopyFromUndoList Undo the last edit: More...
 
void RollbackFromUndo ()
 Performs an undo of the last edit WITHOUT logging a corresponding redo. More...
 
void PutDataInPreviousState (PICKED_ITEMS_LIST *aList, bool aRedoCommand, bool aRebuildRatsnet=true)
 Function PutDataInPreviousState Used in undo or redo command. More...
 
bool UndoRedoBlocked () const
 Function UndoRedoBlocked Checks if the undo and redo operations are currently blocked. More...
 
void UndoRedoBlock (bool aBlock=true)
 Function UndoRedoBlock Enables/disable undo and redo operations. More...
 
void SetGridVisibility (bool aVisible) override
 Function SetGridVisibility() More...
 
int GetRotationAngle () const
 Function GetRotationAngle() Returns the angle used for rotate operations. More...
 
void SetRotationAngle (int aRotationAngle)
 Function SetRotationAngle() Sets the angle used for rotate operations. More...
 
void InstallTextOptionsFrame (BOARD_ITEM *aText)
 Routine for main window class to launch text properties dialog. More...
 
void InstallGraphicItemPropertiesDialog (BOARD_ITEM *aItem)
 
COLOR_SETTINGSGetColorSettings () override
 Helper to retrieve the current color settings. More...
 
EDA_3D_VIEWERGet3DViewerFrame ()
 
virtual void Update3DView (bool aForceReload, const wxString *aTitle=nullptr)
 Update the 3D view, if the viewer is opened by this frame. More...
 
MODULELoadFootprint (const LIB_ID &aFootprintId)
 Function LoadFootprint attempts to load aFootprintId from the footprint library table. More...
 
EDA_RECT GetBoardBoundingBox (bool aBoardEdgesOnly=false) const
 Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge segments). More...
 
const BOX2I GetDocumentExtents () const override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPointGetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
virtual BOARD_DESIGN_SETTINGSGetDesignSettings () const
 Returns the BOARD_DESIGN_SETTINGS for the open project Overloaded in FOOTPRINT_EDIT_FRAME. More...
 
PCBNEW_SETTINGSSettings ()
 
void SetDrawBgColor (COLOR4D aColor) override
 
const PCB_DISPLAY_OPTIONSGetDisplayOptions () const
 Function GetDisplayOptions 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)
 
const ZONE_SETTINGSGetZoneSettings () const
 
void SetZoneSettings (const ZONE_SETTINGS &aSettings)
 
virtual const PCB_PLOT_PARAMSGetPlotSettings () const
 Function GetPlotSettings returns the PCB_PLOT_PARAMS for the BOARD owned by this frame. More...
 
virtual void SetPlotSettings (const PCB_PLOT_PARAMS &aSettings)
 
BOARDGetBoard () const
 
EDA_ITEMGetItem (const KIID &aId) override
 Fetch an item by KIID. More...
 
void FocusOnItem (BOARD_ITEM *aItem)
 
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_VIEWERCreateAndShow3D_Frame ()
 Shows the 3D view frame. More...
 
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide ()
 Function GetCollectorsGuide. More...
 
wxString SelectLibrary (const wxString &aNicknameExisting)
 Function SelectLibrary puts up a dialog and allows the user to pick a library, for unspecified use. More...
 
MODULEGetFootprintFromBoardByReference ()
 Function GetFootprintFromBoardByReference. More...
 
MODULECreateNewModule (const wxString &aModuleName)
 Function CreateNewModule Creates a new module or footprint, at position 0,0 The new module 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 fooprint is placed on a board and a netlist is read. More...
 
void PlaceModule (MODULE *aModule, bool aRecreateRatsnest=true)
 Function PlaceModule places aModule at the current cursor position and updates module coordinates with the new position. More...
 
void InstallPadOptionsFrame (D_PAD *pad)
 
MODULESelectFootprintFromLibTree (LIB_ID aPreselect=LIB_ID())
 Function SelectFootprintFromLibTree opens a dialog to select a footprint. More...
 
virtual void AddModuleToBoard (MODULE *module)
 Adds the given module to the board. More...
 
wxString SelectFootprintFromLibBrowser ()
 Function SelectFootprintFromLibBrowser launches the footprint viewer to select the name of a footprint to load. More...
 
void Compile_Ratsnest (bool aDisplayStatus)
 Function Compile_Ratsnest Create the entire board ratsnest. More...
 
PCB_LAYER_ID SelectLayer (PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
 Install the dialog box for layer selection. More...
 
virtual PCB_LAYER_ID GetActiveLayer () const
 
int GetSeverity (int aErrorCode) const override
 
PCBNEW_SETTINGSGetPcbNewSettings ()
 
FOOTPRINT_EDITOR_SETTINGSGetFootprintEditorSettings ()
 
virtual MAGNETIC_SETTINGSGetMagneticItemsSettings ()
 
void DisplayGridMsg () override
 Function DisplayGridMsg() More...
 
PCB_DRAW_PANEL_GALGetCanvas () const override
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
virtual void SetAutoZoom (bool aAutoZoom)
 Does nothing. More...
 
virtual bool GetAutoZoom ()
 Always returns false. 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...
 
wxFindReplaceData & GetFindReplaceData ()
 
wxArrayString & GetFindHistoryList ()
 
bool GetShowPolarCoords () const
 For those frames that support polar coordinates. More...
 
void SetShowPolarCoords (bool aShow)
 
void ToggleUserUnits () override
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition) const
 Return the nearest aGridSize location to aPosition. More...
 
virtual COLOR4D GetDrawBgColor () const
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
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 combobox. More...
 
void UpdateZoomSelectBox ()
 Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes, etc.) More...
 
void OnUpdateSelectZoom (wxUpdateUIEvent &aEvent)
 Update the checked item in the zoom combobox. 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)
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnMove (wxMoveEvent &aEvent) override
 
virtual void HardRedraw ()
 Rebuild the GAL and redraws the screen. More...
 
virtual void Zoom_Automatique (bool aWarpPointer)
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void FocusOnLocation (const wxPoint &aPos)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
void AddStandardSubMenus (TOOL_MENU &aMenu)
 Function CreateBasicMenu. More...
 
void PrintWorkSheet (RENDER_SETTINGS *aSettings, BASE_SCREEN *aScreen, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Prints the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg) override
 
virtual void OnPageSettingsChange ()
 Called when modifying the page settings. More...
 
void DisplayUnitsMsg ()
 Display current unit pane in the status bar. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
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)
 
virtual void UpdateMsgPanel ()
 Redraw the message panel. More...
 
virtual void PrintPage (RENDER_SETTINGS *aSettings)
 Print the page pointed by current screen, set by the calling print function. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. 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 ckeck tools. More...
 
virtual void ParseArgs (wxCmdLineParser &aParser)
 Handles command-line arguments in a frame-specific way. More...
 
virtual bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool IsModal () const
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
EDA_UNITS GetUserUnits () const
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS aUnits)
 
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 &event)
 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...
 
void OnMaximize (wxMaximizeEvent &aEvent)
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) 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)
 
void PrintMsg (const wxString &text)
 
WX_INFOBARGetInfoBar ()
 
virtual APP_SETTINGS_BASEconfig () const
 Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
void LoadWindowSettings (WINDOW_SETTINGS *aCfg)
 Loads window settings from the given settings object Normally called by LoadSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
void SaveWindowSettings (WINDOW_SETTINGS *aCfg)
 Saves window settings to the given settings object Normally called by SaveSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
virtual WINDOW_SETTINGSGetWindowSettings (APP_SETTINGS_BASE *aCfg)
 Returns a pointer to the window settings for this frame. More...
 
wxString ConfigBaseName () override
 
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 AddStandardHelpMenu (wxMenuBar *aMenuBar)
 Adds the standard KiCad help menu to the menubar. More...
 
bool IsWritable (const wxFileName &aFileName)
 Checks if aFileName can be written. More...
 
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
 
void SetShutdownBlockReason (const wxString &reason)
 Sets the block reason why the window/application is preventing OS shutdown. More...
 
void RemoveShutdownBlockReason ()
 Removes any shutdown block reason set. More...
 
bool SupportsShutdownBlockReason ()
 Whether or not the window supports setting a shutdown block reason. More...
 
wxSize GetWindowSize ()
 Get the undecorated window size that can be used for restoring the window size. More...
 
TOOL_MANAGERGetToolManager () const
 Return the MVC controller. More...
 
virtual void PushTool (const std::string &actionName)
 NB: the definition of "tool" is different at the user level. More...
 
virtual void PopTool (const std::string &actionName)
 
bool ToolStackIsEmpty ()
 
std::string CurrentToolName () const
 
bool IsCurrentTool (const TOOL_ACTION &aAction) const
 
bool GetDoImmediateActions () const
 Indicates that hotkeys should perform an immediate action even if another tool is currently active. More...
 
bool GetDragSelects () const
 Indicates that a drag should draw a selection rectangle, even when started over an item. More...
 
bool GetMoveWarpsCursor () const
 Indicates that a move operation should warp the mouse pointer to the origin of the move object. More...
 
HOLDER_TYPE GetType ()
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Public Attributes

PCB_LAYER_BOX_SELECTORm_SelLayerBox
 
wxChoice * m_SelTrackWidthBox
 
wxChoice * m_SelViaSizeBox
 
bool m_show_microwave_tools
 
bool m_show_layer_manager_tools
 
bool m_ZoneFillsDirty
 

Protected Member Functions

void setupTools ()
 
void SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
 switches currently used canvas (Cairo / OpenGL). More...
 
void onBoardLoaded ()
 Updates the state of the GUI after a new board is loaded or created. More...
 
void syncLayerWidgetLayer ()
 Function syncLayerWidgetLayer updates the currently layer "selection" within the PCB_LAYER_WIDGET. More...
 
void syncLayerVisibilities ()
 Function syncLayerVisibilities updates each "Layer" checkbox in the layer widget according to each layer's current visibility determined by IsLayerVisible(), and is helpful immediately after loading a BOARD which may have state information in it. More...
 
bool doAutoSave () override
 Function doAutoSave performs auto save when the board has been modified and not saved within the auto save interval. More...
 
bool isAutoSaveRequired () const override
 Function isautoSaveRequired returns true if the board has been modified. More...
 
bool importFile (const wxString &aFileName, int aFileType)
 Load the given filename but sets the path to the current project path. More...
 
int inferLegacyEdgeClearance (BOARD *aBoard)
 Use the existing edge_cut line thicknesses to infer the edge clearace. More...
 
bool fixEagleNets (const std::unordered_map< wxString, wxString > &aRemap)
 Rematch orphaned zones and vias to schematic nets. More...
 
 PCB_EDIT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 
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...
 
MODULEloadFootprint (const LIB_ID &aFootprintId)
 Function loadFootprint attempts to load aFootprintId from the footprint library table. More...
 
virtual void SetScreen (BASE_SCREEN *aScreen)
 
void InitExitKey ()
 Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id. More...
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Handle the auto save timer event. More...
 

Static Protected Member Functions

static const wxChar * pythonConsoleNameId ()
 Has meaning only if KICAD_SCRIPTING_WXPYTHON option is not defined. More...
 
static wxWindow * findPythonConsole ()
 
static wxString GetBackupSuffix ()
 
static wxString GetAutoSaveFilePrefix ()
 

Protected Attributes

LAYER_TOOLBAR_ICON_VALUES m_prevIconVal
 
int m_rotationAngle
 User defined rotation angle (in tenths of a degree). More...
 
bool m_undoRedoBlocked
 Is undo/redo operation currently blocked? More...
 
PCB_LAYER_WIDGETm_Layers
 Layer manager. It is the responsibility of the child frames to instantiate this. More...
 
PANEL_SELECTION_FILTERm_selectionFilterPanel
 AUI panel for changing the selection tool filter controls. More...
 
BOARDm_Pcb
 
PCB_DISPLAY_OPTIONS m_DisplayOptions
 
PCBNEW_SETTINGSm_Settings
 
wxSocketServer * m_socketServer
 
std::vector< wxSocketBase * > m_sockets
 interprocess communication More...
 
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
 prevents opening same file multiple times. More...
 
bool m_showPageLimits
 
COLOR4D m_gridColor
 
COLOR4D m_drawBgColor
 
int m_UndoRedoCountMax
 
bool m_PolarCoords
 
bool m_showBorderAndTitleBlock
 
long m_firstRunDialogSetting
 
wxChoice * m_gridSelectBox
 
wxChoice * m_zoomSelectBox
 
ACTION_TOOLBARm_mainToolBar
 
ACTION_TOOLBARm_auxiliaryToolBar
 
ACTION_TOOLBARm_drawToolBar
 
ACTION_TOOLBARm_optionsToolBar
 
wxFindReplaceData * m_findReplaceData
 
wxArrayString m_findStringHistoryList
 
wxArrayString m_replaceStringHistoryList
 
EDA_MSG_PANELm_messagePanel
 
int m_MsgFrameHeight
 
COLOR_SETTINGSm_colorSettings
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 The current canvas type. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
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_hasAutoSave
 
bool m_autoSaveState
 
int m_autoSaveInterval
 
wxTimer * m_autoSaveTimer
 
wxString m_mruPath
 
EDA_UNITS m_userUnits
 
TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
TOOL_DISPATCHERm_toolDispatcher
 
std::vector< std::string > m_toolStack
 
bool m_immediateActions
 
bool m_dragSelects
 
bool m_moveWarpsCursor
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private Attributes

ACTION_TOOLBARm_microWaveToolBar
 The auxiliary right vertical tool bar used to access the microwave tools. More...
 

Friends

struct PCB::IFACE
 
class PCB_LAYER_WIDGET
 

Detailed Description

PCB_EDIT_FRAME is the main frame for Pcbnew.

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

Definition at line 84 of file pcb_edit_frame.h.

Member Enumeration Documentation

◆ FETCH_NETLIST_MODE

Function FetchNetlistFromSchematic.

Parameters
aNetlista NETLIST owned by the caller. This function fills it in.
Returns
true if a netlist was fetched.
Enumerator
NO_ANNOTATION 
QUIET_ANNOTATION 
ANNOTATION_DIALOG 

Definition at line 835 of file pcb_edit_frame.h.

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ PCB_EDIT_FRAME()

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

◆ ~PCB_EDIT_FRAME()

PCB_EDIT_FRAME::~PCB_EDIT_FRAME ( )
virtual

Definition at line 359 of file pcb_edit_frame.cpp.

360 {
361  // Shutdown all running tools
362  if( m_toolManager )
364 
365  delete m_selectionFilterPanel;
366  delete m_Layers;
367 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
PCB_LAYER_WIDGET * m_Layers
Layer manager. It is the responsibility of the child frames to instantiate this.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
PANEL_SELECTION_FILTER * m_selectionFilterPanel
AUI panel for changing the selection tool filter controls.

Member Function Documentation

◆ ActivateGalCanvas()

void PCB_EDIT_FRAME::ActivateGalCanvas ( )
overridevirtual

Reimplemented from PCB_BASE_EDIT_FRAME.

Definition at line 625 of file pcb_edit_frame.cpp.

626 {
628  GetCanvas()->UpdateColors();
629  GetCanvas()->Refresh();
630 }
void ActivateGalCanvas() override
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void UpdateColors()
Updates the color settings in the painter and GAL.

References PCB_BASE_EDIT_FRAME::ActivateGalCanvas().

Referenced by Refresh().

◆ AddLibrary()

bool PCB_BASE_EDIT_FRAME::AddLibrary ( const wxString &  aLibName = wxEmptyString)
inherited

Function AddLibrary 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 471 of file footprint_libraries_utils.cpp.

472 {
473  wxFileName fn( aFilename );
474 
475  if( aFilename.IsEmpty() )
476  {
477  if( !LibraryFileBrowser( true, fn,
479  true ) )
480  {
481  return false;
482  }
483  }
484 
485  wxString libPath = fn.GetFullPath();
486  wxString libName = fn.GetName();
487 
488  if( libName.IsEmpty() )
489  return false;
490 
491  bool saveInGlobalTable = false;
492  bool saveInProjectTable = false;
493  wxArrayString libTableNames;
494 
495  libTableNames.Add( _( "Global" ) );
496  libTableNames.Add( _( "Project" ) );
497 
498  switch( SelectSingleOption( this, _( "Select Library Table" ),
499  _( "Choose the Library Table to add the library to:" ),
500  libTableNames ) )
501  {
502  case 0: saveInGlobalTable = true; break;
503  case 1: saveInProjectTable = true; break;
504  default: return false;
505  }
506 
507  wxString type = IO_MGR::ShowType( IO_MGR::GuessPluginTypeFromLibPath( libPath ) );
508 
509  // try to use path normalized to an environmental variable or project path
510  wxString normalizedPath = NormalizePath( libPath, &Pgm().GetLocalEnvVariables(), &Prj() );
511 
512  if( normalizedPath.IsEmpty() )
513  normalizedPath = libPath;
514 
515  try
516  {
517  if( saveInGlobalTable )
518  {
519  auto row = new FP_LIB_TABLE_ROW( libName, normalizedPath, type, wxEmptyString );
520  GFootprintTable.InsertRow( row );
522  }
523  else if( saveInProjectTable )
524  {
525  auto row = new FP_LIB_TABLE_ROW( libName, normalizedPath, type, wxEmptyString );
526  Prj().PcbFootprintLibs()->InsertRow( row );
527  Prj().PcbFootprintLibs()->Save( Prj().FootprintLibTblName() );
528  }
529  }
530  catch( const IO_ERROR& ioe )
531  {
532  DisplayError( this, ioe.What() );
533  return false;
534  }
535 
536  auto editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
537 
538  if( editor )
539  {
540  LIB_ID libID( libName, wxEmptyString );
541  editor->SyncLibraryTree( true );
542  editor->FocusOnLibID( libID );
543  }
544 
545  auto viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER, false );
546 
547  if( viewer )
548  viewer->ReCreateLibraryList();
549 
550  return true;
551 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
FP_LIB_TABLE_ROW.
Definition: fp_lib_table.h:42
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
FP_LIB_TABLE GFootprintTable
!!!!!!!!!!!!!! This code is obsolete because of the merge into pcbnew, don't bother with it.
Component library viewer main window.
static const wxString ShowType(PCB_FILE_T aFileType)
Function ShowType returns a brief name for a plugin, given aFileType enum.
Definition: io_mgr.cpp:80
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Function GuessPluginTypeFromLibPath returns a plugin type given a footprint library's libPath.
Definition: io_mgr.cpp:127
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:342
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:284
wxString KiCadFootprintLibPathWildcard()
#define _(s)
Definition: 3d_actions.cpp:33
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
int SelectSingleOption(wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const wxArrayString &aOptions)
Displays a dialog with radioboxes asking the user to select an option.
Definition: confirm.cpp:293
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
const std::string KiCadFootprintLibPathExtension
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalizes a file path to an environmental variable, if possible.
Definition: env_paths.cpp:68
static wxString GetGlobalTableFileName()
Function GetGlobalTableFileName.

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

Referenced by PCB_BASE_EDIT_FRAME::CreateNewLibrary().

◆ AddModuleToBoard()

void PCB_BASE_FRAME::AddModuleToBoard ( MODULE module)
virtualinherited

Adds the given module to the board.

Parameters
module
aDC(can be NULL ) = the current Device Context, to draw the new footprint

Reimplemented in FOOTPRINT_EDIT_FRAME.

Definition at line 146 of file pcb_base_frame.cpp.

147 {
148  if( module )
149  {
150  GetBoard()->Add( module, ADD_MODE::APPEND );
151 
152  module->SetFlags( IS_NEW );
153  module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet
154 
155  // Put it on FRONT layer (note that it might be stored flipped if the lib is an archive
156  // built from a board)
157  if( module->IsFlipped() )
158  module->Flip( module->GetPosition(), m_Settings->m_FlipLeftRight );
159 
160  // Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
161  // it might be stored in another orientation if the lib is an archive built from a board)
162  module->SetOrientation( 0 );
163  }
164 }
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:288
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
void SetPosition(const wxPoint &aPos) override
PCBNEW_SETTINGS * m_Settings
void SetOrientation(double newangle)
BOARD * GetBoard() const
const wxPoint GetPosition() const override
Definition: class_module.h:206

References BOARD::Add(), APPEND, MODULE::Flip(), PCB_BASE_FRAME::GetBoard(), MODULE::GetPosition(), IS_NEW, MODULE::IsFlipped(), PCBNEW_SETTINGS::m_FlipLeftRight, PCB_BASE_FRAME::m_Settings, EDA_ITEM::SetFlags(), MODULE::SetOrientation(), and MODULE::SetPosition().

Referenced by FOOTPRINT_EDIT_FRAME::AddModuleToBoard().

◆ AddStandardHelpMenu()

void EDA_BASE_FRAME::AddStandardHelpMenu ( wxMenuBar *  aMenuBar)
inherited

Adds the standard KiCad help menu to the menubar.

Definition at line 297 of file eda_base_frame.cpp.

298 {
299  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
300  ACTION_MENU* helpMenu = new ACTION_MENU( false );
301 
302  helpMenu->SetTool( commonControl );
303 
304  helpMenu->Add( ACTIONS::help );
305  helpMenu->Add( ACTIONS::gettingStarted );
306  helpMenu->Add( ACTIONS::listHotKeys );
307  helpMenu->Add( ACTIONS::getInvolved );
308  helpMenu->Add( ACTIONS::reportBug );
309 
310  helpMenu->AppendSeparator();
311  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
312 
313  aMenuBar->Append( helpMenu, _( "&Help" ) );
314 }
static TOOL_ACTION listHotKeys
Definition: actions.h:171
ACTION_MENU.
Definition: action_menu.h:44
static TOOL_ACTION reportBug
Definition: actions.h:173
const BITMAP_OPAQUE about_xpm[1]
Definition: about.cpp:84
COMMON_CONTROL.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION help
Definition: actions.h:170
static TOOL_ACTION getInvolved
Definition: actions.h:172
static TOOL_ACTION gettingStarted
Definition: actions.h:169

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

Referenced by EDA_3D_VIEWER::CreateMenuBar(), LIB_VIEW_FRAME::ReCreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), PL_EDITOR_FRAME::ReCreateMenuBar(), CVPCB_MAINFRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), and ReCreateMenuBar().

◆ AddStandardSubMenus()

void EDA_DRAW_FRAME::AddStandardSubMenus ( TOOL_MENU aMenu)
inherited

Function CreateBasicMenu.

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

Definition at line 431 of file eda_draw_frame.cpp.

432 {
433  COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>();
434  CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
435 
436  aMenu.AddSeparator( 1000 );
438  aMenu.AddItem( ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways, 1000 );
439  aMenu.AddItem( ACTIONS::zoomOut, SELECTION_CONDITIONS::ShowAlways, 1000 );
441 
442  aMenu.AddSeparator( 1000 );
443 
444  auto zoomMenu = std::make_shared<ZOOM_MENU>( this );
445  zoomMenu->SetTool( commonTools );
446  aToolMenu.AddSubMenu( zoomMenu );
447 
448  auto gridMenu = std::make_shared<GRID_MENU>( this );
449  gridMenu->SetTool( commonTools );
450  aToolMenu.AddSubMenu( gridMenu );
451 
452  aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
453  aMenu.AddMenu( gridMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
454 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
COMMON_TOOLS.
Definition: common_tools.h:38
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
static TOOL_ACTION zoomCenter
Definition: actions.h:92
static TOOL_ACTION zoomIn
Definition: actions.h:88
static TOOL_ACTION zoomOut
Definition: actions.h:89

References CONDITIONAL_MENU::AddSeparator(), TOOL_MENU::AddSubMenu(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::m_toolManager, SELECTION_CONDITIONS::ShowAlways(), ACTIONS::zoomCenter, ACTIONS::zoomFitScreen, ACTIONS::zoomIn, and ACTIONS::zoomOut.

Referenced by PICKER_TOOL::Init(), PL_EDIT_TOOL::Init(), PCB_VIEWER_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), PL_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), and SELECTION_TOOL::Init().

◆ AppendMsgPanel()

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

Append a message to the message panel.

This helper method checks to make sure the message panel exists in the frame and appends a message to it using the message panel AppendMessage() method.

Parameters
textUpper- The message upper text.
textLower- The message lower text.
color- A color ID from the KiCad color list (see colors.h).
pad- Number of spaces to pad between messages (default = 4).

Definition at line 595 of file eda_draw_frame.cpp.

597 {
598  if( m_messagePanel )
599  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
600 }
int color
Definition: DXF_plotter.cpp:61
EDA_MSG_PANEL * m_messagePanel
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, COLOR4D aColor, int aPad=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:110

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

Referenced by PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::LoadSheetFromFile(), SCH_PRINTOUT::OnPrintPage(), DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::SaveEEFile(), SavePcbFile(), and LIB_VIEW_FRAME::updatePreviewSymbol().

◆ ArchiveModulesOnBoard()

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

Function ArchiveModulesOnBoard Save modules in a library:

Parameters
aStoreInNewLibtrue : save modules in a existing lib. Existing footprints will be kept or updated. This lib should be in fp lib table, and is type is .pretty false: save modules in a new lib. It 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 607 of file footprint_libraries_utils.cpp.

609 {
610  if( GetBoard()->GetFirstModule() == NULL )
611  {
612  DisplayInfoMessage( this, _( "No footprints to archive!" ) );
613  return;
614  }
615 
616  wxString footprintName;
617 
618  if( !aStoreInNewLib )
619  {
620  // The footprints are saved in an existing .pretty library in the fp lib table
621  PROJECT& prj = Prj();
622  wxString last_nickname = prj.GetRString( PROJECT::PCB_LIB_NICKNAME );
623  wxString nickname = SelectLibrary( last_nickname );
624 
625  if( !nickname ) // Aborted
626  return;
627 
628  prj.SetRString( PROJECT::PCB_LIB_NICKNAME, nickname );
629 
630  try
631  {
632  FP_LIB_TABLE* tbl = prj.PcbFootprintLibs();
633 
634  for( auto curr_fp : GetBoard()->Modules() )
635  {
636  if( !curr_fp->GetFPID().GetLibItemName().empty() ) // Can happen with old boards.
637  tbl->FootprintSave( nickname, curr_fp, false );
638  }
639  }
640  catch( const IO_ERROR& ioe )
641  {
642  DisplayError( this, ioe.What() );
643  }
644  }
645  else
646  {
647  // The footprints are saved in a new .pretty library.
648  // If this library already exists, all previous footprints will be deleted
649  wxString libPath = CreateNewLibrary( aLibName );
650 
651  if( libPath.IsEmpty() ) // Aborted
652  return;
653 
654 
655  if( aLibPath ) *aLibPath = libPath;
656 
658  PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
659 
660  for( auto curr_fp : GetBoard()->Modules() )
661  {
662  try
663  {
664  if( !curr_fp->GetFPID().GetLibItemName().empty() ) // Can happen with old boards.
665  pi->FootprintSave( libPath, curr_fp );
666  }
667  catch( const IO_ERROR& ioe )
668  {
669  DisplayError( this, ioe.What() );
670  }
671  }
672  }
673 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
PROJECT holds project specific data.
Definition: project.h:61
RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destructor.
Definition: io_mgr.h:579
#define NULL
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
VTBL_ENTRY void SetRString(RSTRING_T aStringId, const wxString &aString)
Function SetRString stores a "retained string", which is any session and project specific string iden...
Definition: project.cpp:206
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:284
wxString CreateNewLibrary(const wxString &aLibName=wxEmptyString)
Function CreateNewLibrary If a library name is given, creates a new footprint library in the project ...
VTBL_ENTRY const wxString & GetRString(RSTRING_T aStringId)
Function GetRString returns a "retained string", which is any session and project specific string ide...
Definition: project.cpp:221
#define _(s)
Definition: 3d_actions.cpp:33
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save,...
Definition: io_mgr.cpp:61
wxString SelectLibrary(const wxString &aNicknameExisting)
Function SelectLibrary puts up a dialog and allows the user to pick a library, for unspecified use.
BOARD * GetBoard() const
SAVE_T FootprintSave(const wxString &aNickname, const MODULE *aFootprint, bool aOverwrite=true)
Function FootprintSave.
PCB_FILE_T
Enum PCB_FILE_T is a set of file types that the IO_MGR knows about, and for which there has been a pl...
Definition: io_mgr.h:54
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:267
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
S-expression Pcbnew file format.
Definition: io_mgr.h:57

References _, PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DisplayError(), DisplayInfoMessage(), FP_LIB_TABLE::FootprintSave(), PCB_BASE_FRAME::GetBoard(), PROJECT::GetRString(), IO_MGR::KICAD_SEXP, NULL, PROJECT::PCB_LIB_NICKNAME, PROJECT::PcbFootprintLibs(), IO_MGR::PluginFind(), KIWAY_HOLDER::Prj(), PCB_BASE_FRAME::SelectLibrary(), PROJECT::SetRString(), and IO_ERROR::What().

Referenced by ArchiveModulesOnBoard(), importFile(), and Process_Special_Functions().

◆ ChangeUserUnits()

void EDA_BASE_FRAME::ChangeUserUnits ( EDA_UNITS  aUnits)
inherited

Definition at line 796 of file eda_base_frame.cpp.

797 {
798  SetUserUnits( aUnits );
800 
801  wxCommandEvent e( UNITS_CHANGED );
802  ProcessEventLocally( e );
803 }
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 EDA_BASE_FRAME::SetUserUnits(), and EDA_BASE_FRAME::unitsChangeRefresh().

Referenced by COMMON_TOOLS::ImperialUnits(), COMMON_TOOLS::MetricUnits(), and COMMON_TOOLS::ToggleUnits().

◆ CheckForAutoSaveFile()

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

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.

Definition at line 743 of file eda_base_frame.cpp.

744 {
745  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
746 
747  wxFileName autoSaveFileName = aFileName;
748 
749  // Check for auto save file.
750  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
751 
752  wxLogTrace( traceAutoSave,
753  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
754 
755  if( !autoSaveFileName.FileExists() )
756  return;
757 
758  wxString msg = wxString::Format( _(
759  "Well this is potentially embarrassing!\n"
760  "It appears that the last time you were editing the file\n"
761  "\"%s\"\n"
762  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
763  GetChars( aFileName.GetFullName() )
764  );
765 
766  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
767 
768  // Make a backup of the current file, delete the file, and rename the auto save file to
769  // the file name.
770  if( response == wxYES )
771  {
772  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
773  {
774  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
775  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
776  }
777  }
778  else
779  {
780  wxLogTrace( traceAutoSave,
781  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
782 
783  // Remove the auto save file when using the previous file as is.
784  wxRemoveFile( autoSaveFileName.GetFullPath() );
785  }
786 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
static wxString GetAutoSaveFilePrefix()
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

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

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

◆ Clear_Pcb()

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

Function Clear_Pcb delete all and reinitialize the current board.

Parameters
aQuery= true to prompt user for confirmation, false to initialize silently
aFinal= if true, we are clearing the board to exit, so don't run more events

Definition at line 42 of file initpcb.cpp.

43 {
44  if( GetBoard() == NULL )
45  return false;
46 
47  if( aQuery && !GetBoard()->IsEmpty() )
48  {
49  if( !IsOK( this,
50  _( "Current Board will be lost and this operation cannot be undone. Continue?" ) ) )
51  return false;
52  }
53 
54  // Release the lock file, if exists
55  ReleaseFile();
56 
57  // Clear undo and redo lists because we want a full deletion
59  GetScreen()->ClrModify();
60 
61  if( !aFinal )
62  {
63  // delete the old BOARD and create a new BOARD so that the default
64  // layer names are put into the BOARD.
65  SetBoard( new BOARD() );
66 
67  // clear filename, to avoid overwriting an old file
68  GetBoard()->SetFileName( wxEmptyString );
69 
71 
73 
74  // Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
75  GetBoard()->SetEnabledLayers( LSET().set() );
76 
77  // Default copper layers count set to 2: double layer board
79 
80  // Update display (some options depend on the board setup)
81  GetBoard()->SetVisibleLayers( LSET().set() );
85  UpdateTitle();
86 
87  Zoom_Automatique( false );
88  }
89 
90  return true;
91 }
void UpdateTitle()
Function UpdateTitle sets the main window title bar text.
void SetCopperLayerCount(int aCount)
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Re create the layer Box by clearing the old list, and building le new one, from the new layers names ...
void ReleaseFile()
Release the current file marked in use.
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:50
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.
void ResetNetHighLight()
Function ResetNetHighLight Reset all high light data to the init state.
#define NULL
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
virtual void ClearUndoRedoList()
Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are del...
Definition: base_screen.cpp:73
void SetFileName(const wxString &aFileName)
Definition: class_board.h:253
void SetBoard(BOARD *aBoard) override
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
#define _(s)
Definition: 3d_actions.cpp:33
void ClrModify()
Definition: base_screen.h:184
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...
BOARD * GetBoard() const
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading a ne...
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:283
void SetEnabledLayers(LSET aLayerMask)
Function SetEnabledLayers is a proxy function that calls the correspondent function in m_BoardSetting...
void ReCreateAuxiliaryToolbar() override

References _, BASE_SCREEN::ClearUndoRedoList(), BASE_SCREEN::ClrModify(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetPageSizeIU(), PCB_BASE_FRAME::GetScreen(), BASE_SCREEN::InitDataPoints(), IsOK(), NULL, ReCreateAuxiliaryToolbar(), ReCreateLayerBox(), ReFillLayerWidget(), EDA_DRAW_FRAME::ReleaseFile(), BOARD::ResetNetHighLight(), SetBoard(), BOARD::SetCopperLayerCount(), BOARD::SetEnabledLayers(), BOARD::SetFileName(), BOARD::SetVisibleLayers(), UpdateTitle(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by 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 640 of file eda_base_frame.cpp.

641 {
642  if( !aFileHistory )
643  aFileHistory = m_fileHistory;
644 
645  wxASSERT( aFileHistory );
646 
647  aFileHistory->ClearFileHistory();
648 
649  // Update the menubar to update the file history menu
650  if( GetMenuBar() )
651  {
652  ReCreateMenuBar();
653  GetMenuBar()->Refresh();
654  }
655 }
void ClearFileHistory()
Clear all entries from the file history.
FILE_HISTORY * m_fileHistory
virtual void ReCreateMenuBar()
Recreates the menu bar.

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

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

◆ ClearMsgPanel()

◆ CommonSettingsChanged()

void PCB_EDIT_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged)
overridevirtual

Called after the preferences dialog is run.

Reimplemented from PCB_BASE_FRAME.

Definition at line 1264 of file pcb_edit_frame.cpp.

1265 {
1266  PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged );
1267 
1269 
1270  Layout();
1271  SendSizeEvent();
1272 }
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.

References PCB_BASE_FRAME::CommonSettingsChanged().

◆ Compile_Ratsnest()

void PCB_BASE_FRAME::Compile_Ratsnest ( bool  aDisplayStatus)
inherited

Function Compile_Ratsnest Create the entire board ratsnest.

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

Parameters
aDC= the current device context (can be NULL)
aDisplayStatus: if true, display the computation results

Definition at line 44 of file pcbnew/ratsnest/ratsnest.cpp.

45 {
46  GetBoard()->GetConnectivity()->RecalculateRatsnest();
47  ClearMsgPanel();
48 
49  if( aDisplayStatus )
50  {
51  std::shared_ptr<CONNECTIVITY_DATA> conn = m_Pcb->GetConnectivity();
52  wxString msg;
53 
54  msg.Printf( wxT( " %d" ), conn->GetPadCount() );
55  AppendMsgPanel( _( "Pads" ), msg, RED );
56 
57  msg.Printf( wxT( " %d" ), conn->GetNetCount() - 1 /* Don't include "No Net" in count */ );
58  AppendMsgPanel( _( "Nets" ), msg, CYAN );
59 
60  SetMsgPanel( m_Pcb );
61  }
62 }
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
Definition: color4d.h:58
virtual void ClearMsgPanel()
Clear all messages from the message panel.
Definition: color4d.h:59
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
#define _(s)
Definition: 3d_actions.cpp:33
BOARD * GetBoard() const

References _, EDA_DRAW_FRAME::AppendMsgPanel(), EDA_DRAW_FRAME::ClearMsgPanel(), CYAN, PCB_BASE_FRAME::GetBoard(), BOARD::GetConnectivity(), PCB_BASE_FRAME::m_Pcb, RED, and EDA_DRAW_FRAME::SetMsgPanel().

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), ExportToGenCAD(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), OpenProjectFiles(), PCBNEW_CONTROL::Paste(), and PANEL_SETUP_LAYERS::TransferDataFromWindow().

◆ 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 KICAD_MANAGER_FRAME.

Definition at line 557 of file eda_base_frame.cpp.

558 {
559  // KICAD_MANAGER_FRAME overrides this
560  return Kiface().KifaceSettings();
561 }
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_i.h:103
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.

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

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), GERBVIEW_FRAME::ActivateGalCanvas(), BM2CMP_FRAME::BM2CMP_FRAME(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), SCH_BASE_FRAME::eeconfig(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), DISPLAY_FOOTPRINTS_FRAME::GetAutoZoom(), GRID_MENU::GRID_MENU(), COMMON_TOOLS::GridFast1(), COMMON_TOOLS::GridFast2(), EDA_DRAW_FRAME::IsGridVisible(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), SCH_BASE_FRAME::libeditconfig(), SIM_PLOT_FRAME::onClose(), FOOTPRINT_WIZARD_FRAME::OnCloseWindow(), EDA_DRAW_FRAME::OnUpdateSelectGrid(), EDA_DRAW_FRAME::OnUpdateSelectZoom(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), DISPLAY_FOOTPRINTS_FRAME::SetAutoZoom(), PCB_BASE_EDIT_FRAME::SetBoard(), EDA_DRAW_FRAME::SetGridVisibility(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), LIB_VIEW_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), LIB_EDIT_FRAME::setupTools(), CVPCB_MAINFRAME::setupTools(), SCH_EDIT_FRAME::setupTools(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_GRID_SETTINGS::TransferDataToWindow(), ZOOM_MENU::update(), GRID_MENU::update(), EDA_DRAW_FRAME::UpdateGridSelectBox(), EDA_DRAW_FRAME::UpdateZoomSelectBox(), EDA_BASE_FRAME::windowClosing(), ZOOM_MENU::ZOOM_MENU(), and BM2CMP_FRAME::~BM2CMP_FRAME().

◆ ConfigBaseName()

wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineoverridevirtualinherited
Returns
a base name prefix used in Load/Save settings to build the full name of keys used in config. This is usually the name of the frame set by CTOR, except for frames shown in multiple modes in which case the m_configName must be set to the base name so that a single config can be used.

Reimplemented from TOOLS_HOLDER.

Definition at line 337 of file eda_base_frame.h.

338  {
339  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
340  return baseCfgName;
341  }
wxString m_configName

References EDA_BASE_FRAME::m_configName.

Referenced by EDA_BASE_FRAME::SaveWindowSettings().

◆ CreateAndShow3D_Frame()

EDA_3D_VIEWER * PCB_BASE_FRAME::CreateAndShow3D_Frame ( )
inherited

Shows the 3D view frame.

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

Definition at line 359 of file pcb_base_frame.cpp.

360 {
361  EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
362 
363  if( !draw3DFrame )
364  draw3DFrame = new EDA_3D_VIEWER( &Kiway(), this, _( "3D Viewer" ) );
365 
366  // Raising the window does not show the window on Windows if iconized. This should work
367  // on any platform.
368  if( draw3DFrame->IsIconized() )
369  draw3DFrame->Iconize( false );
370 
371  draw3DFrame->Raise();
372  draw3DFrame->Show( true );
373 
374  // Raising the window does not set the focus on Linux. This should work on any platform.
375  if( wxWindow::FindFocus() != draw3DFrame )
376  draw3DFrame->SetFocus();
377 
378  return draw3DFrame;
379 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
#define _(s)
Definition: 3d_actions.cpp:33
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
Definition: eda_3d_viewer.h:65
EDA_3D_VIEWER * Get3DViewerFrame()

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

Referenced by PCB_VIEWER_TOOLS::Show3DViewer().

◆ CreateNewLibrary()

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

Function CreateNewLibrary 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.

Returns
wxString - the newly created library path if library was successfully created, else wxEmptyString because user aborted or error.

Definition at line 378 of file footprint_libraries_utils.cpp.

379 {
380  // Kicad cannot write legacy format libraries, only .pretty new format
381  // because the legacy format cannot handle current features.
382  // The footprint library is actually a directory
383 
384  wxString initialPath = wxPathOnly( Prj().GetProjectFullName() );
385  wxFileName fn;
386  bool doAdd = false;
387 
388  if( aLibName.IsEmpty() )
389  {
390  fn = initialPath;
391 
392  if( !LibraryFileBrowser( false, fn,
394  {
395  return wxEmptyString;
396  }
397 
398  doAdd = true;
399  }
400  else
401  {
402  fn = aLibName;
403 
404  if( !fn.IsAbsolute() )
405  {
406  fn.SetName( aLibName );
407  fn.MakeAbsolute( initialPath );
408  }
409 
410  // Enforce the .pretty extension:
411  fn.SetExt( KiCadFootprintLibPathExtension );
412  }
413 
414  // We can save fp libs only using IO_MGR::KICAD_SEXP format (.pretty libraries)
416  wxString libPath = fn.GetFullPath();
417 
418  try
419  {
420  PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
421 
422  bool writable = false;
423  bool exists = false;
424 
425  try
426  {
427  writable = pi->IsFootprintLibWritable( libPath );
428  exists = true; // no exception was thrown, lib must exist.
429  }
430  catch( const IO_ERROR& )
431  { }
432 
433  if( exists )
434  {
435  if( !writable )
436  {
437  wxString msg = wxString::Format( _( "Library \"%s\" is read only, not writable" ),
438  libPath );
439  DisplayError( this, msg );
440  return wxEmptyString;
441  }
442  else
443  {
444  wxString msg = wxString::Format( _( "Library %s already exists." ), libPath );
445  KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
446  dlg.SetOKLabel( _( "Overwrite" ) );
447  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
448 
449  if( dlg.ShowModal() == wxID_CANCEL )
450  return wxEmptyString;
451 
452  pi->FootprintLibDelete( libPath );
453  }
454  }
455 
456  pi->FootprintLibCreate( libPath );
457  }
458  catch( const IO_ERROR& ioe )
459  {
460  DisplayError( this, ioe.What() );
461  return wxEmptyString;
462  }
463 
464  if( doAdd )
465  AddLibrary( libPath );
466 
467  return libPath;
468 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:44
RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destructor.
Definition: io_mgr.h:579
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool AddLibrary(const wxString &aLibName=wxEmptyString)
Function AddLibrary Add an existing library to either the global or project library table.
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
wxString KiCadFootprintLibPathWildcard()
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save,...
Definition: io_mgr.cpp:61
PCB_FILE_T
Enum PCB_FILE_T is a set of file types that the IO_MGR knows about, and for which there has been a pl...
Definition: io_mgr.h:54
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
const std::string KiCadFootprintLibPathExtension
S-expression Pcbnew file format.
Definition: io_mgr.h:57

References _, PCB_BASE_EDIT_FRAME::AddLibrary(), DisplayError(), KIDIALOG::DoNotShowCheckbox(), Format(), IO_MGR::KICAD_SEXP, KiCadFootprintLibPathExtension, KiCadFootprintLibPathWildcard(), EDA_DRAW_FRAME::LibraryFileBrowser(), IO_MGR::PluginFind(), KIWAY_HOLDER::Prj(), KIDIALOG::ShowModal(), and IO_ERROR::What().

Referenced by ArchiveModulesOnBoard().

◆ CreateNewModule()

MODULE * PCB_BASE_FRAME::CreateNewModule ( const wxString &  aModuleName)
inherited

Function CreateNewModule Creates a new module or footprint, at position 0,0 The new module 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 fooprint is placed on a board and a netlist is read.

Parameters
aModuleName= name of the new footprint in library
Returns
a reference to the new module

Definition at line 1002 of file footprint_libraries_utils.cpp.

1003 {
1004  wxString moduleName = aModuleName;
1005 
1006  // Ask for the new module name
1007  if( moduleName.IsEmpty() )
1008  {
1009  WX_TEXT_ENTRY_DIALOG dlg( this, _( "Enter footprint name:" ), _( "New Footprint" ),
1010  moduleName );
1011  dlg.SetTextValidator( MODULE_NAME_CHAR_VALIDATOR( &moduleName ) );
1012 
1013  if( dlg.ShowModal() != wxID_OK )
1014  return NULL; //Aborted by user
1015  }
1016 
1017  moduleName.Trim( true );
1018  moduleName.Trim( false );
1019 
1020  if( moduleName.IsEmpty() )
1021  {
1022  DisplayInfoMessage( this, _( "No footprint name defined." ) );
1023  return NULL;
1024  }
1025 
1026  // Creates the new module and add it to the head of the linked list of modules
1027  MODULE* module = new MODULE( GetBoard() );
1028 
1029  // Update parameters: timestamp ...
1030  module->SetLastEditTime();
1031 
1032  // Update its name in lib
1033  module->SetFPID( LIB_ID( wxEmptyString, moduleName ) );
1034 
1035  PCB_LAYER_ID txt_layer;
1036  wxPoint default_pos;
1038 
1039  module->Reference().SetText( settings.m_DefaultFPTextItems[0].m_Text );
1040  module->Reference().SetVisible( settings.m_DefaultFPTextItems[0].m_Visible );
1041  txt_layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[0].m_Layer;
1042  module->Reference().SetLayer( txt_layer );
1043  default_pos.y -= settings.GetTextSize( txt_layer ).y / 2;
1044  module->Reference().SetPosition( default_pos );
1045  default_pos.y += settings.GetTextSize( txt_layer ).y;
1046 
1047  module->Value().SetText( settings.m_DefaultFPTextItems[1].m_Text );
1048  module->Value().SetVisible( settings.m_DefaultFPTextItems[1].m_Visible );
1049  txt_layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[1].m_Layer;
1050  module->Value().SetLayer( txt_layer );
1051  default_pos.y += settings.GetTextSize( txt_layer ).y / 2;
1052  module->Value().SetPosition( default_pos );
1053  default_pos.y += settings.GetTextSize( txt_layer ).y;
1054 
1055  for( size_t i = 2; i < settings.m_DefaultFPTextItems.size(); ++i )
1056  {
1057  TEXTE_MODULE* textItem = new TEXTE_MODULE( module );
1058  textItem->SetText( settings.m_DefaultFPTextItems[i].m_Text );
1059  textItem->SetVisible( settings.m_DefaultFPTextItems[i].m_Visible );
1060  txt_layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[i].m_Layer;
1061  textItem->SetLayer( txt_layer );
1062  default_pos.y += settings.GetTextSize( txt_layer ).y / 2;
1063  textItem->SetPosition( default_pos );
1064  default_pos.y += settings.GetTextSize( txt_layer ).y;
1065  module->GraphicalItems().push_back( textItem );
1066  }
1067 
1068  if( module->GetReference().IsEmpty() )
1069  module->SetReference( moduleName );
1070 
1071  if( module->GetValue().IsEmpty() )
1072  module->SetValue( moduleName );
1073 
1074  module->RunOnChildren(
1075  [&] ( BOARD_ITEM* aChild )
1076  {
1077  if( aChild->Type() == PCB_MODULE_TEXT_T )
1078  {
1079  TEXTE_MODULE* textItem = static_cast<TEXTE_MODULE*>( aChild );
1080  PCB_LAYER_ID layer = textItem->GetLayer();
1081 
1082  textItem->SetTextThickness( settings.GetTextThickness( layer ) );
1083  textItem->SetTextSize( settings.GetTextSize( layer ) );
1084  textItem->SetItalic( settings.GetTextItalic( layer ) );
1085  textItem->SetKeepUpright( settings.GetTextUpright( layer ) );
1086  }
1087  } );
1088 
1089  SetMsgPanel( module );
1090  return module;
1091 }
void SetKeepUpright(bool aKeepUpright)
TEXTE_MODULE & Reference()
Definition: class_module.h:474
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project Overloaded in FOOTPRINT_EDIT_FRAME.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void SetItalic(bool isItalic)
Definition: eda_text.h:178
void SetVisible(bool aVisible)
Definition: eda_text.h:184
const wxString GetValue() const
Function GetValue.
Definition: class_module.h:458
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:237
DRAWINGS & GraphicalItems()
Definition: class_module.h:179
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
int GetTextThickness(PCB_LAYER_ID aLayer) const
Function GetTextThickness Returns the default text thickness from the layer class for the given layer...
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:433
bool GetTextUpright(PCB_LAYER_ID aLayer) const
bool GetTextItalic(PCB_LAYER_ID aLayer) const
PCB_LAYER_ID
A quick note on layer IDs:
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:116
#define NULL
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:473
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:343
This class provides a custom wxValidator object for limiting the allowable characters when defining f...
Definition: validators.h:63
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:443
virtual void SetPosition(const wxPoint &aPos) override
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
#define _(s)
Definition: 3d_actions.cpp:33
void SetValue(const wxString &aValue)
Function SetValue.
Definition: class_module.h:467
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:157
BOARD * GetBoard() const
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:267
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void SetFPID(const LIB_ID &aFPID)
Definition: class_module.h:216
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Function GetTextSize Returns the default text size from the layer class for the given layer.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, DisplayInfoMessage(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_ITEM::GetLayer(), MODULE::GetReference(), BOARD_DESIGN_SETTINGS::GetTextItalic(), BOARD_DESIGN_SETTINGS::GetTextSize(), BOARD_DESIGN_SETTINGS::GetTextThickness(), BOARD_DESIGN_SETTINGS::GetTextUpright(), MODULE::GetValue(), MODULE::GraphicalItems(), BOARD_DESIGN_SETTINGS::m_DefaultFPTextItems, NULL, PCB_MODULE_TEXT_T, MODULE::Reference(), MODULE::RunOnChildren(), MODULE::SetFPID(), EDA_TEXT::SetItalic(), TEXTE_MODULE::SetKeepUpright(), MODULE::SetLastEditTime(), BOARD_ITEM::SetLayer(), EDA_DRAW_FRAME::SetMsgPanel(), TEXTE_MODULE::SetPosition(), MODULE::SetReference(), EDA_TEXT::SetText(), EDA_TEXT::SetTextSize(), EDA_TEXT::SetTextThickness(), WX_TEXT_ENTRY_DIALOG::SetTextValidator(), MODULE::SetValue(), EDA_TEXT::SetVisible(), EDA_ITEM::Type(), MODULE::Value(), and wxPoint::y.

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

◆ CreateServer()

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

Definition at line 49 of file eda_dde.cpp.

50 {
51  wxIPV4address addr;
52 
53  // Set the port number
54  addr.Service( service );
55 
56  // Listen on localhost only if requested
57  if( local )
58  addr.Hostname( HOSTNAME );
59 
60  delete m_socketServer;
61  m_socketServer = new wxSocketServer( addr );
62 
63  m_socketServer->SetNotify( wxSOCKET_CONNECTION_FLAG );
64  m_socketServer->SetEventHandler( *this, ID_EDA_SOCKET_EVENT_SERV );
65  m_socketServer->Notify( true );
66 }
static const wxString HOSTNAME(wxT("localhost"))
wxSocketServer * m_socketServer

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

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

◆ CurrentToolName()

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

Definition at line 99 of file tools_holder.cpp.

100 {
101  if( m_toolStack.empty() )
102  return ACTIONS::selectionTool.GetName();
103  else
104  return m_toolStack.back();
105 }
std::vector< std::string > m_toolStack
Definition: tools_holder.h:52
static TOOL_ACTION selectionTool
Definition: actions.h:146

References TOOLS_HOLDER::m_toolStack, and ACTIONS::selectionTool.

Referenced by TOOL_MANAGER::processEvent().

◆ Destroy()

◆ DismissModal()

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

Definition at line 160 of file kiway_player.cpp.

161 {
162  m_modal_ret_val = aRetVal;
163  m_modal_string = aResult;
164 
165  if( m_modal_loop )
166  {
167  m_modal_loop->Exit();
168  m_modal_loop = 0; // this marks it as dismissed.
169  }
170 
171  Show( false );
172 }
bool m_modal_ret_val
Definition: kiway_player.h:205
wxString m_modal_string
Definition: kiway_player.h:204
WX_EVENT_LOOP * m_modal_loop
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(), FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint(), LIB_VIEW_FRAME::FinishModal(), LIB_VIEW_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), and FOOTPRINT_WIZARD_FRAME::OnCloseWindow().

◆ DisplayGridMsg()

void PCB_BASE_FRAME::DisplayGridMsg ( )
overridevirtualinherited

Function DisplayGridMsg()

Display the current grid pane on the status bar.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 453 of file pcb_base_frame.cpp.

454 {
455  wxString line;
456  wxString gridformatter;
457 
458  switch( m_userUnits )
459  {
460  case EDA_UNITS::INCHES: gridformatter = "grid X %.6f Y %.6f"; break;
461  case EDA_UNITS::MILLIMETRES: gridformatter = "grid X %.6f Y %.6f"; break;
462  default: gridformatter = "grid X %f Y %f"; break;
463  }
464 
465  double grid_x = To_User_Unit( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().x );
466  double grid_y = To_User_Unit( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().y );
467  line.Printf( gridformatter, grid_x, grid_y );
468 
469  SetStatusText( line, 4 );
470 }
double To_User_Unit(EDA_UNITS aUnit, double aValue, bool aUseMils)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:92
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EDA_UNITS m_userUnits

References PCB_BASE_FRAME::GetCanvas(), INCHES, EDA_BASE_FRAME::m_userUnits, MILLIMETRES, and To_User_Unit().

Referenced by PCB_BASE_FRAME::UpdateStatusBar().

◆ DisplayToolMsg()

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

Reimplemented from TOOLS_HOLDER.

Definition at line 466 of file eda_draw_frame.cpp.

467 {
468  SetStatusText( msg, 6 );
469 }

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

◆ DisplayUnitsMsg()

void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Display current unit pane in the status bar.

Definition at line 494 of file eda_draw_frame.cpp.

495 {
496  wxString msg;
497 
498  switch( m_userUnits )
499  {
500  case EDA_UNITS::INCHES: msg = _( "Inches" ); break;
501  case EDA_UNITS::MILLIMETRES: msg = _( "mm" ); break;
502  default: msg = _( "Units" ); break;
503  }
504 
505  SetStatusText( msg, 5 );
506 }
#define _(s)
Definition: 3d_actions.cpp:33
EDA_UNITS m_userUnits

References _, INCHES, EDA_BASE_FRAME::m_userUnits, and MILLIMETRES.

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

◆ doAutoSave()

bool PCB_EDIT_FRAME::doAutoSave ( )
overrideprotectedvirtual

Function doAutoSave performs 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 854 of file pcbnew/files.cpp.

855 {
856  wxFileName tmpFileName;
857 
858  if( GetBoard()->GetFileName().IsEmpty() )
859  {
860  tmpFileName = wxFileName( wxStandardPaths::Get().GetDocumentsDir(), wxT( "noname" ),
862  GetBoard()->SetFileName( tmpFileName.GetFullPath() );
863  }
864  else
865  {
866  tmpFileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
867  }
868 
869  wxFileName autoSaveFileName = tmpFileName;
870 
871  // Auto save file name is the board file name prepended with autosaveFilePrefix string.
872  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + autoSaveFileName.GetName() );
873 
874  if( !autoSaveFileName.IsOk() )
875  return false;
876 
877  // If the board file path is not writable, try writing to a platform specific temp file
878  // path. If that path isn't writabe, give up.
879  if( !autoSaveFileName.IsDirWritable() )
880  {
881  autoSaveFileName.SetPath( wxFileName::GetTempDir() );
882 
883  if( !autoSaveFileName.IsOk() || !autoSaveFileName.IsDirWritable() )
884  return false;
885  }
886 
887  wxLogTrace( traceAutoSave, "Creating auto save file <" + autoSaveFileName.GetFullPath() + ">" );
888 
889  if( SavePcbFile( autoSaveFileName.GetFullPath(), false ) )
890  {
891  GetScreen()->SetModify();
892  GetBoard()->SetFileName( tmpFileName.GetFullPath() );
893  UpdateTitle();
894  m_autoSaveState = false;
895  return true;
896  }
897 
898  GetBoard()->SetFileName( tmpFileName.GetFullPath() );
899 
900  return false;
901 }
void UpdateTitle()
Function UpdateTitle sets the main window title bar text.
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
bool SavePcbFile(const wxString &aFileName, bool addToHistory=true)
Function SavePcbFile writes the board data structures to a aFileName Creates backup when requested an...
const std::string KiCadPcbFileExtension
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:270
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void SetFileName(const wxString &aFileName)
Definition: class_board.h:253
static wxString GetAutoSaveFilePrefix()
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
BOARD * GetBoard() const
void SetModify()
Definition: base_screen.h:183

References PROJECT::AbsolutePath(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetScreen(), KiCadPcbFileExtension, EDA_BASE_FRAME::m_autoSaveState, KIWAY_HOLDER::Prj(), SavePcbFile(), BOARD::SetFileName(), BASE_SCREEN::SetModify(), traceAutoSave, and UpdateTitle().

Referenced by OnExportSTEP().

◆ DoGenFootprintsPositionFile()

int PCB_EDIT_FRAME::DoGenFootprintsPositionFile ( const wxString &  aFullFileName,
bool  aUnitsMM,
bool  aForceSmdItems,
bool  aTopSide,
bool  aBottomSide,
bool  aFormatCSV = false 
)

Function DoGenFootprintsPositionFile Creates an ascii footprint position file.

Parameters
aFullFileName= the full file name of the file to create
aUnitsMM= false to use inches, true to use mm in coordinates
aForceSmdItems= true to force all footprints with smd pads in list = false to put only footprints with option "INSERT" in list
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
aFormatCSV= true to use a comma separated file (CSV) format; defautl = false
Returns
the number of footprints found on aSide side, or -1 if the file could not be created

Definition at line 474 of file gen_footprints_placefile.cpp.

477 {
478  FILE * file = NULL;
479 
480  if( !aFullFileName.IsEmpty() )
481  {
482  file = wxFopen( aFullFileName, wxT( "wt" ) );
483 
484  if( file == NULL )
485  return -1;
486  }
487 
488  std::string data;
489  PLACE_FILE_EXPORTER exporter( GetBoard(), aUnitsMM, aForceSmdItems, aTopSide, aBottomSide,
490  aFormatCSV );
491  data = exporter.GenPositionData();
492 
493  // if aFullFileName is empty, the file is not created, only the
494  // count of footprints to place is returned
495  if( file )
496  {
497  // Creates a footprint position file
498  // aSide = 0 -> Back (bottom) side)
499  // aSide = 1 -> Front (top) side)
500  // aSide = 2 -> both sides
501  fputs( data.c_str(), file );
502  fclose( file );
503  }
504 
505  return exporter.GetFootprintCount();
506 }
#define NULL
The ASCII format of the kicad place file is:
BOARD * GetBoard() const

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

Referenced by DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles().

◆ DoGenFootprintsReport()

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

Function DoGenFootprintsReport Creates an ascii footprint report file giving some infos on footprints and board outlines.

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

Definition at line 542 of file gen_footprints_placefile.cpp.

543 {
544  FILE* rptfile = wxFopen( aFullFilename, wxT( "wt" ) );
545 
546  if( rptfile == NULL )
547  return false;
548 
549  std::string data;
550  PLACE_FILE_EXPORTER exporter ( GetBoard(), aUnitsMM, false, true, true, false );
551  data = exporter.GenReportData();
552 
553  fputs( data.c_str(), rptfile );
554  fclose( rptfile );
555 
556  return true;
557 }
#define NULL
The ASCII format of the kicad place file is:
BOARD * GetBoard() const

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

Referenced by GenFootprintsReport().

◆ DoUpdatePCBFromNetlist()

void PCB_EDIT_FRAME::DoUpdatePCBFromNetlist ( NETLIST aNetlist,
bool  aUseTimestamps 
)

Function DoUpdatePCBFromNetlist An automated version of UpdatePCBFromNetlist which skips the UI dialog.

Parameters
aNetlist
aUseTimestamps

Definition at line 1102 of file pcb_edit_frame.cpp.

1103 {
1104  BOARD_NETLIST_UPDATER updater( this, GetBoard() );
1105  updater.SetLookupByTimestamp( aUseTimestamps );
1106  updater.SetDeleteUnusedComponents( false );
1107  updater.SetReplaceFootprints( true );
1108  updater.SetDeleteSinglePadNets( false );
1109  updater.SetWarnPadNoNetInNetlist( false );
1110  updater.UpdateNetlist( aNetlist );
1111 }
BOARD_NETLIST_UPDATER updates the BOARD with a new netlist.
BOARD * GetBoard() const

References GetBoard(), BOARD_NETLIST_UPDATER::SetDeleteSinglePadNets(), BOARD_NETLIST_UPDATER::SetDeleteUnusedComponents(), BOARD_NETLIST_UPDATER::SetLookupByTimestamp(), BOARD_NETLIST_UPDATER::SetReplaceFootprints(), BOARD_NETLIST_UPDATER::SetWarnPadNoNetInNetlist(), and BOARD_NETLIST_UPDATER::UpdateNetlist().

Referenced by importFile().

◆ Edit_Zone_Params()

void PCB_EDIT_FRAME::Edit_Zone_Params ( ZONE_CONTAINER zone_container)

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

Definition at line 48 of file zones_by_polygon.cpp.

49 {
50  int dialogResult;
51  ZONE_SETTINGS zoneInfo = GetZoneSettings();
52 
53  BOARD_COMMIT commit( this );
54 
55  // Save initial zones configuration, for undo/redo, before adding new zone
56  // note the net name and the layer can be changed, so we must save all zones
60 
61  if( aZone->GetIsKeepout() )
62  {
63  // edit a keepout area on a copper layer
64  zoneInfo << *aZone;
65  dialogResult = InvokeKeepoutAreaEditor( this, &zoneInfo );
66  }
67  else if( IsCopperLayer( aZone->GetLayer() ) )
68  {
69  // edit a zone on a copper layer
70  zoneInfo << *aZone;
71  dialogResult = InvokeCopperZonesEditor( this, &zoneInfo );
72  }
73  else
74  {
75  zoneInfo << *aZone;
76  dialogResult = InvokeNonCopperZonesEditor( this, &zoneInfo );
77  }
78 
79  if( dialogResult == wxID_CANCEL )
80  {
83  return;
84  }
85 
86  SetZoneSettings( zoneInfo );
87  OnModify();
88 
89  if( dialogResult == ZONE_EXPORT_VALUES )
90  {
92  commit.Stage( s_PickedList );
93  commit.Push( _( "Modify zone properties" ) );
94  s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
95  return;
96  }
97 
98  wxBusyCursor dummy;
99 
100  // Undraw old zone outlines
101  for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
102  {
103  ZONE_CONTAINER* edge_zone = GetBoard()->GetArea( ii );
104  GetCanvas()->GetView()->Update( edge_zone );
105  }
106 
107  zoneInfo.ExportSetting( *aZone );
108 
109  NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection );
110 
111  if( net ) // net == NULL should not occur
112  aZone->SetNetCode( net->GetNet() );
113 
114  // Combine zones if possible
116 
118 
119  // refill zones with the new properties applied
120  std::vector<ZONE_CONTAINER*> zones_to_refill;
121 
122  for( unsigned i = 0; i < s_PickedList.GetCount(); ++i )
123  {
124  ZONE_CONTAINER* zone = dyn_cast<ZONE_CONTAINER*>( s_PickedList.GetPickedItem( i ) );
125 
126  if( zone == nullptr )
127  {
128  wxASSERT_MSG( false, "Expected a zone after zone properties edit" );
129  continue;
130  }
131 
132  // aZone won't be filled if the layer set was modified, but it needs to be updated
133  if( zone->IsFilled() || zone == aZone )
134  zones_to_refill.push_back( zone );
135  }
136 
137  if( zones_to_refill.size() )
138  {
139  ZONE_FILLER filler ( GetBoard() );
140  wxString title = wxString::Format( _( "Refill %d Zones" ), (int) zones_to_refill.size() );
141  filler.InstallNewProgressReporter( this, title, 4 );
142  filler.Fill( zones_to_refill );
143  }
144 
145  commit.Stage( s_PickedList );
146  commit.Push( _( "Modify zone properties" ) );
147  GetBoard()->GetConnectivity()->RecalculateRatsnest();
148 
149  s_PickedList.ClearItemsList(); // s_ItemsListPicker is no longer owner of picked items
150 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
bool IsFilled() const
Definition: class_zone.h:185
int InvokeKeepoutAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeKeepoutAreaEditor invokes up a modal dialog window for copper zone editing.
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
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...
bool OnAreaPolygonModified(PICKED_ITEMS_LIST *aModifiedZonesList, ZONE_CONTAINER *modified_area)
Function OnAreaPolygonModified Process an area that has been modified, by normalizing its polygon and...
int InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings)
Function InvokeNonCopperZonesEditor invokes up a modal dialog window for non-copper zone editing.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
#define ZONE_EXPORT_VALUES
Definition: zones.h:37
unsigned GetCount() const
Function GetCount.
static PICKED_ITEMS_LIST s_AuxiliaryList
int SaveCopyOfZones(PICKED_ITEMS_LIST &aPickList, BOARD *aPcb, int aNetCode, LAYER_NUM aLayer)
Function SaveCopyOfZones creates a copy of zones having a given netcode on a given layer,...
int m_NetcodeSelection
Net code selection for the current zone.
Definition: zone_settings.h:93
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:919
const ZONE_SETTINGS & GetZoneSettings() const
void SetNetCode(int aNetCode)
Definition: netinfo.h:225
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
void ExportSetting(ZONE_CONTAINER &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:67
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
#define _(s)
Definition: 3d_actions.cpp:33
static PICKED_ITEMS_LIST s_PickedList
void ClearItemsList()
Function ClearItemsList deletes only the list of pickers, NOT the picked data itself.
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:884
BOARD * GetBoard() const
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes the list of pickers, AND the data pointed by m_PickedItem or...

References _, PICKED_ITEMS_LIST::ClearItemsList(), PICKED_ITEMS_LIST::ClearListAndDeleteItems(), dummy(), ZONE_SETTINGS::ExportSetting(), ZONE_FILLER::Fill(), BOARD::FindNet(), Format(), BOARD::GetArea(), BOARD::GetAreaCount(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), BOARD::GetConnectivity(), PICKED_ITEMS_LIST::GetCount(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::GetLayer(), NETINFO_ITEM::GetNet(), PICKED_ITEMS_LIST::GetPickedItem(), PCB_DRAW_PANEL_GAL::GetView(), PCB_BASE_FRAME::GetZoneSettings(), ZONE_FILLER::InstallNewProgressReporter(), InvokeCopperZonesEditor(), InvokeKeepoutAreaEditor(), InvokeNonCopperZonesEditor(), IsCopperLayer(), ZONE_CONTAINER::IsFilled(), ZONE_SETTINGS::m_NetcodeSelection, BOARD::OnAreaPolygonModified(), OnModify(), BOARD_COMMIT::Push(), s_AuxiliaryList, s_PickedList, SaveCopyOfZones(), BOARD_CONNECTED_ITEM::SetNetCode(), PCB_BASE_FRAME::SetZoneSettings(), BOARD_COMMIT::Stage(), UNDEFINED_LAYER, KIGFX::PCB_VIEW::Update(), UpdateCopyOfZonesList(), and ZONE_EXPORT_VALUES.

Referenced by OnEditItemRequest().

◆ EraseMsgBox()

void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

Definition at line 223 of file eda_draw_frame.cpp.

224 {
225  if( m_messagePanel )
227 }
EDA_MSG_PANEL * m_messagePanel
void EraseMsgBox()
Definition: msgpanel.cpp:216

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

Referenced by GERBVIEW_CONTROL::UpdateMessagePanel().

◆ Exchange_Module()

void PCB_EDIT_FRAME::Exchange_Module ( MODULE aSrc,
MODULE aDest,
BOARD_COMMIT aCommit,
bool  deleteExtraTexts = true,
bool  resetTextLayers = true,
bool  resetTextEffects = true,
bool  reset3DModels = true 
)

Function Exchange_Module Replaces OldModule by NewModule, using OldModule settings: position, orientation, pad netnames ...) OldModule is deleted or put in undo list.

Parameters
aSrc= footprint to replace
aDest= footprint to put
aCommit= commit that should store the changes

Definition at line 459 of file dialog_exchange_footprints.cpp.

462 {
463  aDest->SetParent( GetBoard() );
464 
465  PlaceModule( aDest, false );
466 
467  // PlaceModule will move the module to the cursor position, which we don't want. Copy
468  // the original position across.
469  aDest->SetPosition( aSrc->GetPosition() );
470 
471  if( aDest->GetLayer() != aSrc->GetLayer() )
472  aDest->Flip( aDest->GetPosition(), m_Settings->m_FlipLeftRight );
473 
474  if( aDest->GetOrientation() != aSrc->GetOrientation() )
475  aDest->SetOrientation( aSrc->GetOrientation() );
476 
477  aDest->SetLocked( aSrc->IsLocked() );
478 
479  for( D_PAD* pad : aDest->Pads() )
480  {
481  D_PAD* oldPad = aSrc->FindPadByName( pad->GetName() );
482 
483  if( oldPad )
484  {
486  pad->SetNetCode( oldPad->GetNetCode() );
487  pad->SetPinFunction( oldPad->GetPinFunction() );
488  }
489  }
490 
491  // Copy reference
492  processTextItem( aSrc->Reference(), aDest->Reference(),
493  // never reset reference text
494  false,
495  resetTextLayers, resetTextEffects );
496 
497  // Copy value
498  processTextItem( aSrc->Value(), aDest->Value(),
499  // reset value text only when it is a proxy for the footprint ID
500  // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
501  aSrc->GetValue() == aSrc->GetFPID().GetLibItemName(),
502  resetTextLayers, resetTextEffects );
503 
504  // Copy fields in accordance with the reset* flags
505  for( BOARD_ITEM* item : aSrc->GraphicalItems() )
506  {
507  TEXTE_MODULE* srcItem = dyn_cast<TEXTE_MODULE*>( item );
508 
509  if( srcItem )
510  {
511  TEXTE_MODULE* destItem = getMatchingTextItem( srcItem, aDest );
512 
513  if( destItem )
514  processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects );
515  else if( !deleteExtraTexts )
516  aDest->Add( new TEXTE_MODULE( *srcItem ) );
517  }
518  }
519 
520  // Copy 3D model settings in accordance with the reset* flag
521  if( !reset3DModels )
522  aDest->Models() = aSrc->Models(); // Linked list of 3D models.
523 
524  // Updating other parameters
525  const_cast<KIID&>( aDest->m_Uuid ) = aSrc->m_Uuid;
526  aDest->SetPath( aSrc->GetPath() );
527  aDest->CalculateBoundingBox();
528 
529  aCommit.Remove( aSrc );
530  aCommit.Add( aDest );
531 
532  aDest->ClearFlags();
533 }
double GetOrientation() const
Definition: class_module.h:211
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
TEXTE_MODULE & Reference()
Definition: class_module.h:474
int GetNetCode() const
Function GetNetCode.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
PADS & Pads()
Definition: class_module.h:169
const wxString GetValue() const
Function GetValue.
Definition: class_module.h:458
bool GetLocalRatsnestVisible() const
const LIB_ID & GetFPID() const
Definition: class_module.h:215
void SetLocalRatsnestVisible(bool aVisible)
const KIID_PATH & GetPath() const
Definition: class_module.h:224
DRAWINGS & GraphicalItems()
Definition: class_module.h:179
const wxString & GetPinFunction() const
Definition: class_pad.h:134
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
D_PAD * FindPadByName(const wxString &aPadName) const
Function FindPadByName returns a D_PAD* with a matching name.
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:473
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
COMMIT & Remove(EDA_ITEM *aItem)
Removes a new item from the model
Definition: commit.h:90
void SetPosition(const wxPoint &aPos) override
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:297
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
const KIID m_Uuid
Definition: base_struct.h:162
TEXTE_MODULE * getMatchingTextItem(TEXTE_MODULE *aRefItem, MODULE *aModule)
PCBNEW_SETTINGS * m_Settings
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:201
void SetLocked(bool isLocked) override
Function SetLocked sets the MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: class_module.h:307
void SetOrientation(double newangle)
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
void processTextItem(const TEXTE_MODULE &aSrc, TEXTE_MODULE &aDest, bool resetText, bool resetTextLayers, bool resetTextEffects)
void SetPath(const KIID_PATH &aPath)
Definition: class_module.h:225
BOARD * GetBoard() const
void PlaceModule(MODULE *aModule, bool aRecreateRatsnest=true)
Function PlaceModule places aModule at the current cursor position and updates module coordinates wit...
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
const wxPoint GetPosition() const override
Definition: class_module.h:206

References COMMIT::Add(), MODULE::Add(), MODULE::CalculateBoundingBox(), EDA_ITEM::ClearFlags(), MODULE::FindPadByName(), MODULE::Flip(), PCB_BASE_FRAME::GetBoard(), MODULE::GetFPID(), BOARD_ITEM::GetLayer(), LIB_ID::GetLibItemName(), BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible(), getMatchingTextItem(), BOARD_CONNECTED_ITEM::GetNetCode(), MODULE::GetOrientation(), MODULE::GetPath(), D_PAD::GetPinFunction(), MODULE::GetPosition(), MODULE::GetValue(), MODULE::GraphicalItems(), MODULE::IsLocked(), PCBNEW_SETTINGS::m_FlipLeftRight, PCB_BASE_FRAME::m_Settings, EDA_ITEM::m_Uuid, MODULE::Models(), MODULE::Pads(), PCB_BASE_FRAME::PlaceModule(), processTextItem(), MODULE::Reference(), COMMIT::Remove(), BOARD_CONNECTED_ITEM::SetLocalRatsnestVisible(), MODULE::SetLocked(), MODULE::SetOrientation(), EDA_ITEM::SetParent(), MODULE::SetPath(), MODULE::SetPosition(), and MODULE::Value().

Referenced by DIALOG_EXCHANGE_FOOTPRINTS::processModule(), BOARD_NETLIST_UPDATER::replaceComponent(), 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
cmdline= received command from socket

Reimplemented from EDA_DRAW_FRAME.

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

66 {
67  char line[1024];
68  wxString msg;
69  wxString modName;
70  char* idcmd;
71  char* text;
72  int netcode = -1;
73  bool multiHighlight = false;
74  MODULE* module = NULL;
75  D_PAD* pad = NULL;
76  BOARD* pcb = GetBoard();
77 
78  CROSS_PROBING_SETTINGS& crossProbingSettings = GetPcbNewSettings()->m_CrossProbing;
79 
81  KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();
82 
83  strncpy( line, cmdline, sizeof(line) - 1 );
84  line[sizeof(line) - 1] = 0;
85 
86  idcmd = strtok( line, " \n\r" );
87  text = strtok( NULL, "\"\n\r" );
88 
89  if( idcmd == NULL )
90  return;
91 
92  if( strcmp( idcmd, "$NET:" ) == 0 )
93  {
94  if( !crossProbingSettings.auto_highlight )
95  return;
96 
97  wxString net_name = FROM_UTF8( text );
98 
99  NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
100 
101  if( netinfo )
102  {
103  netcode = netinfo->GetNet();
104 
105  MSG_PANEL_ITEMS items;
106  netinfo->GetMsgPanelInfo( this, items );
107  SetMsgPanel( items );
108  }
109  }
110  if( strcmp( idcmd, "$NETS:" ) == 0 )
111  {
112  if( !crossProbingSettings.auto_highlight )
113  return;
114 
115  wxStringTokenizer netsTok = wxStringTokenizer( FROM_UTF8( text ), "," );
116  bool first = true;
117 
118  while( netsTok.HasMoreTokens() )
119  {
120  NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken() );
121 
122  if( netinfo )
123  {
124  if( first )
125  {
126  // TODO: Once buses are included in netlist, show bus name
127  MSG_PANEL_ITEMS items;
128  netinfo->GetMsgPanelInfo( this, items );
129  SetMsgPanel( items );
130  first = false;
131 
132  pcb->SetHighLightNet( netinfo->GetNet() );
133  renderSettings->SetHighlight( true, netinfo->GetNet() );
134  multiHighlight = true;
135  }
136  else
137  {
138  pcb->SetHighLightNet( netinfo->GetNet(), true );
139  renderSettings->SetHighlight( true, netinfo->GetNet(), true );
140  }
141  }
142  }
143 
144  netcode = -1;
145  }
146  else if( strcmp( idcmd, "$PIN:" ) == 0 )
147  {
148  wxString pinName = FROM_UTF8( text );
149 
150  text = strtok( NULL, " \n\r" );
151 
152  if( text && strcmp( text, "$PART:" ) == 0 )
153  text = strtok( NULL, "\"\n\r" );
154 
155  modName = FROM_UTF8( text );
156 
157  module = pcb->FindModuleByReference( modName );
158 
159  if( module )
160  pad = module->FindPadByName( pinName );
161 
162  if( pad )
163  netcode = pad->GetNetCode();
164 
165  if( module == NULL )
166  msg.Printf( _( "%s not found" ), modName );
167  else if( pad == NULL )
168  msg.Printf( _( "%s pin %s not found" ), modName, pinName );
169  else
170  msg.Printf( _( "%s pin %s found" ), modName, pinName );
171 
172  SetStatusText( msg );
173  }
174  else if( strcmp( idcmd, "$PART:" ) == 0 )
175  {
176  pcb->ResetNetHighLight();
177 
178  modName = FROM_UTF8( text );
179 
180  module = pcb->FindModuleByReference( modName );
181 
182  if( module )
183  msg.Printf( _( "%s found" ), modName );
184  else
185  msg.Printf( _( "%s not found" ), modName );
186 
187  SetStatusText( msg );
188  }
189  else if( strcmp( idcmd, "$SHEET:" ) == 0 )
190  {
191  msg.Printf( _( "Selecting all from sheet \"%s\"" ), FROM_UTF8( text ) );
192  wxString sheetUIID( FROM_UTF8( text ) );
193  SetStatusText( msg );
195  static_cast<void*>( &sheetUIID ) );
196  return;
197  }
198  else if( strcmp( idcmd, "$CLEAR" ) == 0 )
199  {
200  renderSettings->SetHighlight( false );
201  view->UpdateAllLayersColor();
202 
203  pcb->ResetNetHighLight();
204  SetMsgPanel( pcb );
205 
206  GetCanvas()->Refresh();
207  return;
208  }
209 
210  BOX2I bbox = { { 0, 0 }, { 0, 0 } };
211 
212  if( module )
213  {
214  bbox = module->GetBoundingBox();
215 
216  if( pad )
217  m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) pad );
218  else
219  m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) module );
220  }
221  else if( netcode > 0 || multiHighlight )
222  {
223  if( !multiHighlight )
224  {
225  renderSettings->SetHighlight( ( netcode >= 0 ), netcode );
226  pcb->SetHighLightNet( netcode );
227  }
228  else
229  {
230  // Just pick the first one for area calculation
231  netcode = *pcb->GetHighLightNetCodes().begin();
232  }
233 
234  pcb->HighLightON();
235 
236  auto merge_area = [netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
237  {
238  if( aItem->GetNetCode() == netcode )
239  {
240  if( bbox.GetWidth() == 0 )
241  bbox = aItem->GetBoundingBox();
242  else
243  bbox.Merge( aItem->GetBoundingBox() );
244  }
245  };
246 
247  if( crossProbingSettings.center_on_items )
248  {
249  for( auto zone : pcb->Zones() )
250  merge_area( zone );
251 
252  for( auto track : pcb->Tracks() )
253  merge_area( track );
254 
255  for( auto mod : pcb->Modules() )
256  for( auto mod_pad : mod->Pads() )
257  merge_area( mod_pad );
258  }
259  }
260  else
261  {
262  renderSettings->SetHighlight( false );
263  }
264 
265  if( crossProbingSettings.center_on_items && bbox.GetWidth() > 0 && bbox.GetHeight() > 0 )
266  {
267  auto bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
268  auto screenSize = view->ToWorld( GetCanvas()->GetClientSize(), false );
269  screenSize.x = std::max( 10.0, screenSize.x );
270  screenSize.y = std::max( 10.0, screenSize.y );
271  double ratio = std::max( fabs( bbSize.x / screenSize.x ),
272  fabs( bbSize.y / screenSize.y ) );
273 
274  // Try not to zoom on every cross-probe; it gets very noisy
275  if( crossProbingSettings.zoom_to_fit && ( ratio < 0.1 || ratio > 1.0 ) )
276  view->SetScale( view->GetScale() / ratio );
277 
278  view->SetCenter( bbox.Centre() );
279  }
280 
281  view->UpdateAllLayersColor();
282  // Ensure the display is refreshed, because in some installs the refresh is done only
283  // when the gal canvas has the focus, and that is not the case when crossprobing from
284  // Eeschema:
285  GetCanvas()->Refresh();
286 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:284
int GetNetCode() const
Function GetNetCode.
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:114
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
static TOOL_ACTION highlightItem
Definition: pcb_actions.h:409
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
PCBNEW_SETTINGS * GetPcbNewSettings()
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
Cross-probing behavior.
Definition: app_settings.h:30
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
D_PAD * FindPadByName(const wxString &aPadName) const
Function FindPadByName returns a D_PAD* with a matching name.
void ResetNetHighLight()
Function ResetNetHighLight Reset all high light data to the init state.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
#define NULL
MODULES & Modules()
Definition: class_board.h:266
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
coord_type GetWidth() const
Definition: box2.h:196
void SetHighLightNet(int aNetCode, bool aMulti=false)
Function SetHighLightNet Select the netcode to be highlighted.
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
Definition: box2.h:385
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:33
const std::set< int > & GetHighLightNetCodes() const
Function GetHighLightNetCode.
Definition: class_board.h:397
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:34
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:301
ZONE_CONTAINERS & Zones()
Definition: class_board.h:280
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specifie...
Vec Centre() const
Definition: box2.h:78
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
static TOOL_ACTION selectOnSheetFromEeschema
Selects all components on sheet from Eeschema crossprobing.
Definition: pcb_actions.h:83
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
#define _(s)
Definition: 3d_actions.cpp:33
coord_type GetHeight() const
Definition: box2.h:197
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:74
BOARD * GetBoard() const
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:141
VIEW.
Definition: view.h:61
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo returns the information about the NETINFO_ITEM in aList to display in the me...
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:798
double GetScale() const
Function GetScale()
Definition: view.h:257
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:32
TRACKS & Tracks()
Definition: class_board.h:257

References _, CROSS_PROBING_SETTINGS::auto_highlight, CROSS_PROBING_SETTINGS::center_on_items, BOX2< Vec >::Centre(), BOARD::FindModuleByReference(), BOARD::FindNet(), MODULE::FindPadByName(), FROM_UTF8(), PCB_BASE_FRAME::GetBoard(), MODULE::GetBoundingBox(), PCB_BASE_FRAME::GetCanvas(), BOX2< Vec >::GetHeight(), BOARD::GetHighLightNetCodes(), NETINFO_ITEM::GetMsgPanelInfo(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetCode(), KIGFX::VIEW::GetPainter(), PCB_BASE_FRAME::GetPcbNewSettings(), KIGFX::VIEW::GetScale(), KIGFX::PAINTER::GetSettings(), TOOLS_HOLDER::GetToolManager(), TOOL_MANAGER::GetView(), BOX2< Vec >::GetWidth(), PCB_ACTIONS::highlightItem, BOARD::HighLightON(), BOX2< Vec >::Inflate(), APP_SETTINGS_BASE::m_CrossProbing, TOOLS_HOLDER::m_toolManager, BOX2< Vec >::Merge(), BOARD::Modules(), NULL, EDA_DRAW_PANEL_GAL::Refresh(), BOARD::ResetNetHighLight(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectOnSheetFromEeschema, KIGFX::VIEW::SetCenter(), KIGFX::RENDER_SETTINGS::SetHighlight(), BOARD::SetHighLightNet(), EDA_DRAW_FRAME::SetMsgPanel(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::ToWorld(), BOARD::Tracks(), KIGFX::VIEW::UpdateAllLayersColor(), VECTOR2< T >::x, 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 
)

Function Export_IDF3 Creates an IDF3 compliant BOARD (*.emn) and LIBRARY (*.emp) file.

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

Parameters
aPcb= a pointer to the board to be exported to IDF
aFullFileName= the full filename of the export file
aUseThou= set to true if the desired IDF unit is thou (mil)
aXRef= the board Reference Point in mm, X value
aYRef= the board Reference Point in mm, Y value
Returns
true if OK

Definition at line 577 of file pcbnew/exporters/export_idf.cpp.

579 {
580  IDF3_BOARD idfBoard( IDF3::CAD_ELEC );
581 
582  // Switch the locale to standard C (needed to print floating point numbers)
583  LOCALE_IO toggle;
584 
585  resolver = Prj().Get3DCacheManager()->GetResolver();
586 
587  bool ok = true;
588  double scale = MM_PER_IU; // we must scale internal units to mm for IDF
589  IDF3::IDF_UNIT idfUnit;
590 
591  if( aUseThou )
592  {
593  idfUnit = IDF3::UNIT_THOU;
594  idfBoard.SetUserPrecision( 1 );
595  }
596  else
597  {
598  idfUnit = IDF3::UNIT_MM;
599  idfBoard.SetUserPrecision( 5 );
600  }
601 
602  wxFileName brdName = aPcb->GetFileName();
603 
604  idfBoard.SetUserScale( scale );
605  idfBoard.SetBoardThickness( aPcb->GetDesignSettings().GetBoardThickness() * scale );
606  idfBoard.SetBoardName( TO_UTF8( brdName.GetFullName() ) );
607  idfBoard.SetBoardVersion( 0 );
608  idfBoard.SetLibraryVersion( 0 );
609 
610  std::ostringstream ostr;
611  ostr << "KiCad " << TO_UTF8( GetBuildVersion() );
612  idfBoard.SetIDFSource( ostr.str() );
613 
614  try
615  {
616  // set up the board reference point
617  idfBoard.SetUserOffset( -aXRef, aYRef );
618 
619  // Export the board outline
620  idf_export_outline( aPcb, idfBoard );
621 
622  // Output the drill holes and module (library) data.
623  for( auto module : aPcb->Modules() )
624  idf_export_module( aPcb, module, idfBoard );
625 
626  if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) )
627  {
628  wxString msg;
629  msg << _( "IDF Export Failed:\n" ) << FROM_UTF8( idfBoard.GetError().c_str() );
630  wxMessageBox( msg );
631 
632  ok = false;
633  }
634  }
635  catch( const IO_ERROR& ioe )
636  {
637  wxString msg;
638  msg << _( "IDF Export Failed:\n" ) << ioe.What();
639  wxMessageBox( msg );
640 
641  ok = false;
642  }
643  catch( const std::exception& e )
644  {
645  wxString msg;
646  msg << _( "IDF Export Failed:\n" ) << FROM_UTF8( e.what() );
647  wxMessageBox( msg );
648  ok = false;
649  }
650 
651  return ok;
652 }
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:114
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:216
static void idf_export_module(BOARD *aPcb, MODULE *aModule, IDF3_BOARD &aIDFBoard)
Function idf_export_module retrieves information from all board modules, adds drill holes to the DRIL...
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
static FILENAME_RESOLVER * resolver
static void idf_export_outline(BOARD *aPcb, IDF3_BOARD &aIDFBoard)
Function idf_export_outline retrieves line segment information from the edge layer and compiles the d...
const wxString & GetFileName() const
Definition: class_board.h:255
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
MODULES & Modules()
Definition: class_board.h:266
wxString GetBuildVersion()
Get the full KiCad version string.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const int scale
#define _(s)
Definition: 3d_actions.cpp:33
#define TO_UTF8(wxstring)
#define UNIT_MM
Definition: units_scales.h:31
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76

References _, FROM_UTF8(), BOARD_DESIGN_SETTINGS::GetBoardThickness(), GetBuildVersion(), BOARD::GetDesignSettings(), BOARD::GetFileName(), idf_export_module(), idf_export_outline(), BOARD::Modules(), KIWAY_HOLDER::Prj(), resolver, scale, TO_UTF8, UNIT_MM, and IO_ERROR::What().

Referenced by OnExportIDF3().

◆ ExportSpecctraFile()

bool PCB_EDIT_FRAME::ExportSpecctraFile ( const wxString &  aFullFilename)

Function ExportSpecctraFile will 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 82 of file specctra_export.cpp.

83 {
84  SPECCTRA_DB db;
85  bool ok = true;
86  wxString errorText;
87 
88  BASE_SCREEN* screen = GetScreen();
89  bool wasModified = screen->IsModify();
90 
91  db.SetPCB( SPECCTRA_DB::MakePCB() );
92 
93  LOCALE_IO toggle; // Switch the locale to standard C
94 
95  // DSN Images (=KiCad MODULES and pads) must be presented from the
96  // top view. So we temporarily flip any modules which are on the back
97  // side of the board to the front, and record this in the MODULE's flag field.
98  db.FlipMODULEs( GetBoard() );
99 
100  try
101  {
103  db.FromBOARD( GetBoard() );
104  db.ExportPCB( aFullFilename, true );
105 
106  // if an exception is thrown by FromBOARD or ExportPCB(), then
107  // ~SPECCTRA_DB() will close the file.
108  }
109  catch( const IO_ERROR& ioe )
110  {
111  ok = false;
112 
113  // copy the error string to safe place, ioe is in this scope only.
114  errorText = ioe.What();
115  }
116 
117  // done assuredly, even if an exception was thrown and caught.
118  db.RevertMODULEs( GetBoard() );
119 
120  // The two calls below to MODULE::Flip(), both set the
121  // modified flag, yet their actions cancel each other out, so it should
122  // be ok to clear the modify flag.
123  if( !wasModified )
124  screen->ClrModify();
125 
126  if( ok )
127  {
128  SetStatusText( wxString( _( "BOARD exported OK." ) ) );
129  }
130  else
131  {
132  DisplayErrorMessage( this,
133  _( "Unable to export, please fix and try again" ),
134  errorText );
135  }
136 
137  return ok;
138 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:216
void SetPCB(PCB *aPcb)
Function SetPCB deletes any existing PCB and replaces it with the given one.
Definition: specctra.h:3884
void FlipMODULEs(BOARD *aBoard)
Function FlipMODULEs flips the modules which are on the back side of the board to the front.
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:44
bool IsModify() const
Definition: base_screen.h:187
SPECCTRA_DB holds a DSN data tree, usually coming from a DSN file.
Definition: specctra.h:3607
void RevertMODULEs(BOARD *aBoard)
Function RevertMODULEs flips the modules which were on the back side of the board back to the back.
void FromBOARD(BOARD *aBoard)
Function FromBOARD adds the entire BOARD to the PCB but does not write it out.
void ExportPCB(const wxString &aFilename, bool aNameChange=false)
Function ExportPCB writes the internal PCB instance out as a SPECTRA DSN format file.
Definition: specctra.cpp:3442
#define _(s)
Definition: 3d_actions.cpp:33
void ClrModify()
Definition: base_screen.h:184
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
BOARD * GetBoard() const
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76

References _, BASE_SCREEN::ClrModify(), DisplayErrorMessage(), DSN::SPECCTRA_DB::ExportPCB(), DSN::SPECCTRA_DB::FlipMODULEs(), DSN::SPECCTRA_DB::FromBOARD(), GetBoard(), BASE_SCREEN::IsModify(), DSN::SPECCTRA_DB::MakePCB(), DSN::SPECCTRA_DB::RevertMODULEs(), DSN::SPECCTRA_DB::SetPCB(), BOARD::SynchronizeNetsAndNetClasses(), and IO_ERROR::What().

Referenced by ExportSpecctraDSN().

◆ ExportSVG()

void PCB_EDIT_FRAME::ExportSVG ( wxCommandEvent &  event)

Function SVG_Print Shows the Export to SVG file dialog.

Definition at line 896 of file pcb_edit_frame.cpp.

897 {
898  InvokeExportSVG( this, GetBoard() );
899 }
bool InvokeExportSVG(PCB_EDIT_FRAME *aCaller, BOARD *aBoard)
Function InvokeExportSVG shows the Export SVG dialog.
BOARD * GetBoard() const

References GetBoard(), and InvokeExportSVG().

◆ ExportToGenCAD()

void PCB_EDIT_FRAME::ExportToGenCAD ( wxCommandEvent &  event)

Function ExportToGenCAD creates a file in GenCAD 1.4 format from the current board.

Definition at line 238 of file export_gencad.cpp.

239 {
240  // Build default output file name
241  wxString path = GetLastPath( LAST_PATH_GENCAD );
242 
243  if( path.IsEmpty() )
244  {
245  wxFileName brdFile = GetBoard()->GetFileName();
246  brdFile.SetExt( "cad" );
247  path = brdFile.GetFullPath();
248  }
249 
250  DIALOG_GENCAD_EXPORT_OPTIONS optionsDialog( this, path );
251 
252  if( optionsDialog.ShowModal() == wxID_CANCEL )
253  return;
254 
255  path = optionsDialog.GetFileName();
256  SetLastPath( LAST_PATH_GENCAD, path );
257  FILE* file = wxFopen( path, "wt" );
258 
259  if( !file )
260  {
261  DisplayError( this, wxString::Format( _( "Unable to create \"%s\"" ),
262  optionsDialog.GetFileName() ) );
263  return;
264  }
265 
266  // Get options
267  flipBottomPads = optionsDialog.GetOption( FLIP_BOTTOM_PADS );
268  uniquePins = optionsDialog.GetOption( UNIQUE_PIN_NAMES );
269  individualShapes = optionsDialog.GetOption( INDIVIDUAL_SHAPES );
270  storeOriginCoords = optionsDialog.GetOption( STORE_ORIGIN_COORDS );
271 
272  // Switch the locale to standard C (needed to print floating point numbers)
273  LOCALE_IO toggle;
274 
275  // Update some board data, to ensure a reliable gencad export
277 
278  // Save the auxiliary origin for the rest of the module
280  GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.x : 0;
281  GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.y : 0;
282 
283  // No idea on *why* this should be needed... maybe to fix net names?
284  Compile_Ratsnest( true );
285 
286  /* Temporary modification of footprints that are flipped (i.e. on bottom
287  * layer) to convert them to non flipped footprints.
288  * This is necessary to easily export shapes to GenCAD,
289  * that are given as normal orientation (non flipped, rotation = 0))
290  * these changes will be undone later
291  */
292  BOARD* pcb = GetBoard();
293 
294  for( auto module : pcb->Modules() )
295  {
296  module->SetFlag( 0 );
297 
298  if( module->GetLayer() == B_Cu )
299  {
300  module->Flip( module->GetPosition(), Settings().m_FlipLeftRight );
301  module->SetFlag( 1 );
302  }
303  }
304 
305  /* Gencad has some mandatory and some optional sections: some importer
306  * need the padstack section (which is optional) anyway. Also the
307  * order of the section *is* important */
308 
309  CreateHeaderInfoData( file, this ); // Gencad header
310  CreateBoardSection( file, pcb ); // Board perimeter
311 
312  CreatePadsShapesSection( file, pcb ); // Pads and padstacks
313  CreateArtworksSection( file ); // Empty but mandatory
314 
315  /* Gencad splits a component info in shape, component and device.
316  * We don't do any sharing (it would be difficult since each module is
317  * customizable after placement) */
318  CreateShapesSection( file, pcb );
319  CreateComponentsSection( file, pcb );
320  CreateDevicesSection( file, pcb );
321 
322  // In a similar way the netlist is split in net, track and route
323  CreateSignalsSection( file, pcb );
324  CreateTracksInfoData( file, pcb );
325  CreateRoutesSection( file, pcb );
326 
327  fclose( file );
328 
329  // Undo the footprints modifications (flipped footprints)
330  for( auto module : pcb->Modules() )
331  {
332  if( module->GetFlag() )
333  {
334  module->Flip( module->GetPosition(), Settings().m_FlipLeftRight );
335  module->SetFlag( 0 );
336  }
337  }
338 
339  componentShapes.clear();
340  shapeNames.clear();
341 }
static void CreateBoardSection(FILE *aFile, BOARD *aPcb)
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
static void CreateShapesSection(FILE *aFile, BOARD *aPcb)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:216
void Compile_Ratsnest(bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
static void CreateRoutesSection(FILE *aFile, BOARD *aPcb)
static void CreateSignalsSection(FILE *aFile, BOARD *aPcb)
static bool uniquePins
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
static int GencadOffsetY
static bool flipBottomPads
const wxString & GetFileName() const
Definition: class_board.h:255
static void CreateTracksInfoData(FILE *aFile, BOARD *aPcb)
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
static void CreateArtworksSection(FILE *aFile)
static void CreateComponentsSection(FILE *aFile, BOARD *aPcb)
static bool individualShapes
MODULES & Modules()
Definition: class_board.h:266
static void CreatePadsShapesSection(FILE *aFile, BOARD *aPcb)
static bool storeOriginCoords
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static bool CreateHeaderInfoData(FILE *aFile, PCB_EDIT_FRAME *frame)
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
static void CreateDevicesSection(FILE *aFile, BOARD *aPcb)
#define _(s)
Definition: 3d_actions.cpp:33
PCBNEW_SETTINGS & Settings()
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Function ComputeBoundingBox calculates the bounding box containing all board items (or board edge seg...
static int GencadOffsetX
BOARD * GetBoard() const
static std::map< MODULE *, int > componentShapes
static std::map< int, wxString > shapeNames
wxPoint m_AuxOrigin
origin for plot exports
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.

References _, B_Cu, PCB_BASE_FRAME::Compile_Ratsnest(), componentShapes, BOARD::ComputeBoundingBox(), CreateArtworksSection(), CreateBoardSection(), CreateComponentsSection(), CreateDevicesSection(), CreateHeaderInfoData(), CreatePadsShapesSection(), CreateRoutesSection(), CreateShapesSection(), CreateSignalsSection(), CreateTracksInfoData(), DisplayError(), FLIP_BOTTOM_PADS, flipBottomPads, Format(), GencadOffsetX, GencadOffsetY, PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignSettings(), DIALOG_GENCAD_EXPORT_OPTIONS::GetFileName(), BOARD::GetFileName(), GetLastPath(), DIALOG_GENCAD_EXPORT_OPTIONS::GetOption(), INDIVIDUAL_SHAPES, individualShapes, LAST_PATH_GENCAD, BOARD_DESIGN_SETTINGS::m_AuxOrigin, PCBNEW_SETTINGS::m_FlipLeftRight, PCB_BASE_FRAME::m_Pcb, BOARD::Modules(), SetLastPath(), PCB_BASE_FRAME::Settings(), shapeNames, STORE_ORIGIN_COORDS, storeOriginCoords, UNIQUE_PIN_NAMES, uniquePins, USE_AUX_ORIGIN, wxPoint::x, and wxPoint::y.

◆ ExportVRML_File()

bool PCB_EDIT_FRAME::ExportVRML_File ( const wxString &  aFullFileName,
double  aMMtoWRMLunit,
bool  aExport3DFiles,
bool  aUseRelativePaths,
bool  aUsePlainPCB,
const wxString &  a3D_Subdir,
double  aXRef,
double  aYRef 
)

Function ExportVRML_File Creates the file(s) exporting current BOARD to a VRML file.

Note
When copying 3D shapes files, the new filename is build from the full path name, changing the separators by underscore. This is needed because files with the same shortname can exist in different directories
ExportVRML_File generates coordinates in board units (BIU) inside the file.
Todo:
Use mm inside the file. A general scale transform is applied to the whole file (1.0 to have the actual WRML unit im mm, 0.001 to have the actual WRML unit in meters.
Note
For 3D models built by a 3D modeler, the unit is 0,1 inches. A specific scale is applied to 3D models to convert them to internal units.
Parameters
aFullFileName= the full filename of the file to create
aMMtoWRMLunit= the VRML scaling factor: 1.0 to export in mm. 0.001 for meters
aExport3DFiles= true to copy 3D shapes in the subir a3D_Subdir
aUseRelativePathsset to true to use relative paths instead of absolute paths in the board VRML file URLs.
aUsePlainPCBset to true to export a board with no copper or silkskreen; this is useful for generating a VRML file which can be converted to a STEP model.
a3D_Subdir= sub directory where 3D shapes files are copied. This is only used when aExport3DFiles == true
aXRef= X value of PCB (0,0) reference point
aYRef= Y value of PCB (0,0) reference point
Returns
true if Ok.

Definition at line 1582 of file export_vrml.cpp.

1586 {
1587  BOARD* pcb = GetBoard();
1588  bool ok = true;
1589 
1590  USE_INLINES = aExport3DFiles;
1591  USE_DEFS = true;
1592  USE_RELPATH = aUseRelativePaths;
1593 
1594  cache = Prj().Get3DCacheManager();
1595  PROJ_DIR = Prj().GetProjectPath();
1596  SUBDIR_3D = a3D_Subdir;
1597  MODEL_VRML model3d;
1598  model_vrml = &model3d;
1599  model3d.SetScale( aMMtoWRMLunit );
1600 
1601  if( USE_INLINES )
1602  {
1603  BOARD_SCALE = MM_PER_IU / 2.54;
1604  model3d.SetOffset( -aXRef / 2.54, aYRef / 2.54 );
1605  }
1606  else
1607  {
1608  BOARD_SCALE = MM_PER_IU;
1609  model3d.SetOffset( -aXRef, aYRef );
1610  }
1611 
1612  // plain PCB or else PCB with copper and silkscreen
1613  model3d.m_plainPCB = aUsePlainPCB;
1614 
1615  try
1616  {
1617 
1618  // Preliminary computation: the z value for each layer
1619  compute_layer_Zs(model3d, pcb);
1620 
1621  // board edges and cutouts
1622  export_vrml_board(model3d, pcb);
1623 
1624  // Drawing and text on the board
1625  if( !aUsePlainPCB )
1626  export_vrml_drawings( model3d, pcb );
1627 
1628  // Export vias and trackage
1629  export_vrml_tracks( model3d, pcb );
1630 
1631  // Export zone fills
1632  if( !aUsePlainPCB )
1633  export_vrml_zones( model3d, pcb);
1634 
1635  if( USE_INLINES )
1636  {
1637  // check if the 3D Subdir exists - create if not
1638  wxFileName subdir( SUBDIR_3D, "" );
1639 
1640  if( ! subdir.DirExists() )
1641  {
1642  if( !wxDir::Make( subdir.GetFullPath() ) )
1643  throw( std::runtime_error( "Could not create 3D model subdirectory" ) );
1644  }
1645 
1646  OPEN_OSTREAM( output_file, TO_UTF8( aFullFileName ) );
1647 
1648  if( output_file.fail() )
1649  {
1650  std::ostringstream ostr;
1651  ostr << "Could not open file '" << TO_UTF8( aFullFileName ) << "'";
1652  throw( std::runtime_error( ostr.str().c_str() ) );
1653  }
1654 
1655  output_file.imbue( std::locale( "C" ) );
1656 
1657  // Begin with the usual VRML boilerplate
1658  wxString fn = aFullFileName;
1659  fn.Replace( "\\" , "/" );
1660  output_file << "#VRML V2.0 utf8\n";
1661  output_file << "WorldInfo {\n";
1662  output_file << " title \"" << TO_UTF8( fn ) << " - Generated by Pcbnew\"\n";
1663  output_file << "}\n";
1664  output_file << "Transform {\n";
1665  output_file << " scale " << std::setprecision( PRECISION );
1666  output_file << WORLD_SCALE << " ";
1667  output_file << WORLD_SCALE << " ";
1668  output_file << WORLD_SCALE << "\n";
1669  output_file << " children [\n";
1670 
1671  // Export footprints
1672  for( auto module : pcb->Modules() )
1673  export_vrml_module( model3d, pcb, module, &output_file );
1674 
1675  // write out the board and all layers
1676  write_layers( model3d, pcb, TO_UTF8( aFullFileName ), &output_file );
1677 
1678  // Close the outer 'transform' node
1679  output_file << "]\n}\n";
1680 
1681  CLOSE_STREAM( output_file );
1682  }
1683  else
1684  {
1685  // Export footprints
1686  for( auto module : pcb->Modules() )
1687  export_vrml_module( model3d, pcb, module, NULL );
1688 
1689  // write out the board and all layers
1690  write_layers( model3d, pcb, TO_UTF8( aFullFileName ), NULL );
1691  }
1692  }
1693  catch( const std::exception& e )
1694  {
1695  wxString msg;
1696  msg << _( "IDF Export Failed:\n" ) << FROM_UTF8( e.what() );
1697  wxMessageBox( msg );
1698 
1699  ok = false;
1700  }
1701 
1702  return ok;
1703 }
static double BOARD_SCALE
Definition: export_vrml.cpp:70
static S3D_CACHE * cache
Definition: export_vrml.cpp:65
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:114
static double WORLD_SCALE
Definition: export_vrml.cpp:69
static bool USE_INLINES
Definition: export_vrml.cpp:66
static MODEL_VRML * model_vrml
void SetOffset(double aXoff, double aYoff)
static void compute_layer_Zs(MODEL_VRML &aModel, BOARD *pcb)
bool SetScale(double aWorldScale)
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:122
static void export_vrml_module(MODEL_VRML &aModel, BOARD *aPcb, MODULE *aModule, std::ostream *aOutputFile)
#define NULL
MODULES & Modules()
Definition: class_board.h:266
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
static bool USE_RELPATH
Definition: export_vrml.cpp:68
#define OPEN_OSTREAM(var, name)
static wxString SUBDIR_3D
Definition: export_vrml.cpp:72
static void export_vrml_tracks(MODEL_VRML &aModel, BOARD *pcb)
static void export_vrml_board(MODEL_VRML &aModel, BOARD *aPcb)
static void export_vrml_drawings(MODEL_VRML &aModel, BOARD *pcb)
static void write_layers(MODEL_VRML &aModel, BOARD *aPcb, const char *aFileName, OSTREAM *aOutputFile)
static wxString PROJ_DIR
Definition: export_vrml.cpp:73
static void export_vrml_zones(MODEL_VRML &aModel, BOARD *aPcb)
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
#define _(s)
Definition: 3d_actions.cpp:33
#define TO_UTF8(wxstring)
static const int PRECISION
Definition: export_vrml.cpp:71
static bool USE_DEFS
Definition: export_vrml.cpp:67
#define CLOSE_STREAM(var)
BOARD * GetBoard() const

References _, BOARD_SCALE, cache, CLOSE_STREAM, compute_layer_Zs(), export_vrml_board(), export_vrml_drawings(), export_vrml_module(), export_vrml_tracks(), export_vrml_zones(), FROM_UTF8(), PCB_BASE_FRAME::GetBoard(), PROJECT::GetProjectPath(), MODEL_VRML::m_plainPCB, model_vrml, BOARD::Modules(), NULL, OPEN_OSTREAM, PRECISION, KIWAY_HOLDER::Prj(), PROJ_DIR, MODEL_VRML::SetOffset(), MODEL_VRML::SetScale(), SUBDIR_3D, TO_UTF8, USE_DEFS, USE_INLINES, USE_RELPATH, WORLD_SCALE, and write_layers().

Referenced by OnExportVRML().

◆ FetchNetlistFromSchematic()

bool PCB_EDIT_FRAME::FetchNetlistFromSchematic ( NETLIST aNetlist,
FETCH_NETLIST_MODE  aMode 
)

Definition at line 1035 of file pcb_edit_frame.cpp.

1036 {
1037  if( Kiface().IsSingle() )
1038  {
1039  DisplayError( this, _( "Cannot update the PCB because Pcbnew is opened in stand-alone "
1040  "mode. In order to create or update PCBs from schematics, you "
1041  "must launch the KiCad project manager and create a project." ) );
1042  return false;
1043  }
1044 
1045  // Update PCB requires a netlist. Therefore the schematic editor must be running
1046  // If this is not the case, open the schematic editor
1047  KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
1048 
1049  if( !frame->IsShown() )
1050  {
1051  wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(),
1053 
1054  // Maybe the file hasn't been converted to the new s-expression file format so
1055  // see if the legacy schematic file is still in play.
1056  if( !fn.FileExists() )
1057  {
1058  fn.SetExt( LegacySchematicFileExtension );
1059 
1060  if( !fn.FileExists() )
1061  {
1062  DisplayError( this, _( "The schematic for this board cannot be found." ) );
1063  return false;
1064  }
1065  }
1066 
1067  frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1068 
1069  // we show the schematic editor frame, because do not show is seen as
1070  // a not yet opened schematic by Kicad manager, which is not the case
1071  frame->Show( true );
1072 
1073  // bring ourselves back to the front
1074  Raise();
1075  }
1076 
1077  std::string payload;
1078 
1079  if( aMode == NO_ANNOTATION )
1080  payload = "no-annotate";
1081  else if( aMode == QUIET_ANNOTATION )
1082  payload = "quiet-annotate";
1083 
1084  Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_GET_NETLIST, payload, this );
1085 
1086  try
1087  {
1088  auto lineReader = new STRING_LINE_READER( payload, _( "Eeschema netlist" ) );
1089  KICAD_NETLIST_READER netlistReader( lineReader, &aNetlist );
1090  netlistReader.LoadNetlist();
1091  }
1092  catch( const IO_ERROR& )
1093  {
1094  assert( false ); // should never happen
1095  return false;
1096  }
1097 
1098  return true;
1099 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList.
Definition: kiway_player.h:118
KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of ...
Definition: kiway_player.h:59
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
KICAD_NETLIST_READER read the new s-expression based KiCad netlist format.
Fetch a netlist from schematics.
Definition: mail_type.h:46
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:342
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
const std::string LegacySchematicFileExtension
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:428
#define _(s)
Definition: 3d_actions.cpp:33
const std::string KiCadSchematicFileExtension
STRING_LINE_READER is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:254
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76

References _, DisplayError(), KIWAY::ExpressMail(), FRAME_SCH, KiCadSchematicFileExtension, Kiface(), Kiway, LegacySchematicFileExtension, KICAD_NETLIST_READER::LoadNetlist(), MAIL_SCH_GET_NETLIST, KIWAY_PLAYER::OpenProjectFiles(), KIWAY::Player(), and Prj().

Referenced by importFile(), DRC::RunTests(), and PCB_EDITOR_CONTROL::UpdatePCBFromSchematic().

◆ Files_io()

void PCB_EDIT_FRAME::Files_io ( wxCommandEvent &  event)

Function Files_io.

Parameters
eventis the command event handler. do nothing else than call Files_io_from_id with the wxCommandEvent id

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

221 {
222  int id = event.GetId();
223  Files_io_from_id( id );
224 }
bool Files_io_from_id(int aId)
Function Files_io_from_id Read and write board files.

References Files_io_from_id().

◆ Files_io_from_id()

bool PCB_EDIT_FRAME::Files_io_from_id ( int  aId)

Function Files_io_from_id Read and write board files.

Parameters
aIdis an event ID ciming from file command events: ID_LOAD_FILE ID_MENU_RECOVER_BOARD_AUTOSAVE ID_NEW_BOARD ID_SAVE_BOARD ID_COPY_BOARD_AS ID_SAVE_BOARD_AS Files_io_from_id prepare parameters and calls the specialized function

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

228 {
229  wxString msg;
230 
231  switch( id )
232  {
233  case ID_LOAD_FILE:
234  {
235  int open_ctl = 0;
236  wxString fileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
237 
238  return AskLoadBoardFileName( this, &open_ctl, &fileName, true )
239  && OpenProjectFiles( std::vector<wxString>( 1, fileName ), open_ctl );
240  }
241 
243  {
244  int open_ctl = 1;
245  wxString fileName; // = Prj().AbsolutePath( GetBoard()->GetFileName() );
246 
247  return AskLoadBoardFileName( this, &open_ctl, &fileName, false )
248  && OpenProjectFiles( std::vector<wxString>( 1, fileName ), open_ctl );
249  }
250 
252  {
253  wxFileName currfn = Prj().AbsolutePath( GetBoard()->GetFileName() );
254  wxFileName fn = currfn;
255 
256  wxString rec_name = GetAutoSaveFilePrefix() + fn.GetName();
257  fn.SetName( rec_name );
258 
259  if( !fn.FileExists() )
260  {
261  msg.Printf( _( "Recovery file \"%s\" not found." ), fn.GetFullPath() );
262  DisplayInfoMessage( this, msg );
263  return false;
264  }
265 
266  msg.Printf( _( "OK to load recovery file \"%s\"" ), fn.GetFullPath() );
267 
268  if( !IsOK( this, msg ) )
269  return false;
270 
271  GetScreen()->ClrModify(); // do not prompt the user for changes
272 
273  if( OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) ) )
274  {
275  // Re-set the name since name or extension was changed
276  GetBoard()->SetFileName( currfn.GetFullPath() );
277  UpdateTitle();
278  return true;
279  }
280  return false;
281  }
282 
283  case ID_NEW_BOARD:
284  {
285  if( IsContentModified() )
286  {
287  wxFileName fileName = GetBoard()->GetFileName();
288  wxString saveMsg =
289  _( "Current board will be closed, save changes to \"%s\" before continuing?" );
290 
291  if( !HandleUnsavedChanges( this, wxString::Format( saveMsg, fileName.GetFullName() ),
292  [&]()->bool { return Files_io_from_id( ID_SAVE_BOARD ); } ) )
293  return false;
294  }
295  else if( !GetBoard()->IsEmpty() )
296  {
297  if( !IsOK( this, _( "Current Board will be closed. Continue?" ) ) )
298  return false;
299  }
300 
302 
303  mgr->SaveProject( mgr->Prj().GetProjectFullName() );
304  mgr->UnloadProject( &mgr->Prj() );
305 
306  GetBoard()->ClearProject();
307 
308  wxFileName fn( wxStandardPaths::Get().GetDocumentsDir(), wxT( "noname" ),
310 
311  mgr->LoadProject( fn.GetFullPath() );
312 
314 
315  if( !Clear_Pcb( false ) )
316  return false;
317 
318  onBoardLoaded();
319 
320  OnModify();
321  return true;
322  }
323 
324  case ID_SAVE_BOARD:
325  if( !GetBoard()->GetFileName().IsEmpty() )
326  return SavePcbFile( Prj().AbsolutePath( GetBoard()->GetFileName() ) );
327 
329 
330  case ID_COPY_BOARD_AS:
331  case ID_SAVE_BOARD_AS:
332  {
333  wxString orig_name;
334  wxFileName::SplitPath( GetBoard()->GetFileName(),
335  nullptr, nullptr, &orig_name, nullptr );
336 
337  if( orig_name.IsEmpty() )
338  orig_name = _( "noname" );
339 
340  wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
341  wxFileName fn( pro_dir, orig_name, KiCadPcbFileExtension );
342  wxString filename = fn.GetFullPath();
343 
344  if( AskSaveBoardFileName( this, &filename ) )
345  {
346  if( id == ID_COPY_BOARD_AS )
347  return SavePcbCopy( filename );
348  else
349  return SavePcbFile( filename, false );
350  }
351  return false;
352  }
353 
354  default:
355  wxLogDebug( wxT( "File_io Internal Error" ) );
356  return false;
357  }
358 }
void UpdateTitle()
Function UpdateTitle sets the main window title bar text.
void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
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:201
#define KI_FALLTHROUGH
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
SETTINGS_MANAGER * GetSettingsManager() const
const std::string ProjectFileExtension
bool SavePcbCopy(const wxString &aFileName)
Function SavePcbCopy writes the board data structures to a aFileName but unlike SavePcbFile,...
bool LoadProjectSettings()
Load the current project's file configuration settings which are pertinent to this PCB_EDIT_FRAME ins...
bool SavePcbFile(const wxString &aFileName, bool addToHistory=true)
Function SavePcbFile writes the board data structures to a aFileName Creates backup when requested an...
const std::string KiCadPcbFileExtension
const wxString & GetFileName() const
Definition: class_board.h:255
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:270
bool IsContentModified() override
Get if the current board has been modified but not saved.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Function OpenProjectFiles (was LoadOnePcbFile) loads a KiCad board (.kicad_pcb) from aFileName.
void onBoardLoaded()
Updates the state of the GUI after a new board is loaded or created.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool AskLoadBoardFileName(wxWindow *aParent, int *aCtl, wxString *aFileName, bool aKicadFilesOnly)
Function AskLoadBoardFileName puts up a wxFileDialog asking for a BOARD filename to open.
void SetFileName(const wxString &aFileName)
Definition: class_board.h:253
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:116
void ClearProject()
static wxString GetAutoSaveFilePrefix()
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Saves, unloads and unregisters the given PROJECT.
bool AskSaveBoardFileName(wxWindow *aParent, wxString *aFileName)
Function AskSaveBoardFileName puts up a wxFileDialog asking for a BOARD filename to save.
bool SaveProject(const wxString &aFullPath=wxEmptyString)
Saves a loaded project.
void ClrModify()
Definition: base_screen.h:184
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool Files_io_from_id(int aId)
Function Files_io_from_id Read and write board files.
BOARD * GetBoard() const
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:267
bool Clear_Pcb(bool aQuery, bool aFinal=false)
Function Clear_Pcb delete all and reinitialize the current board.
Definition: initpcb.cpp:42
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:283
bool IsEmpty() const
Definition: class_board.h:311

References _, PROJECT::AbsolutePath(), AskLoadBoardFileName(), AskSaveBoardFileName(), Clear_Pcb(), BOARD::ClearProject(), BASE_SCREEN::ClrModify(), DisplayInfoMessage(), Format(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), PROJECT::GetProjectFullName(), PCB_BASE_FRAME::GetScreen(), EDA_BASE_FRAME::GetSettingsManager(), HandleUnsavedChanges(), ID_COPY_BOARD_AS, ID_IMPORT_NON_KICAD_BOARD, ID_LOAD_FILE, ID_MENU_RECOVER_BOARD_AUTOSAVE, ID_NEW_BOARD, ID_SAVE_BOARD, ID_SAVE_BOARD_AS, IsContentModified(), BOARD::IsEmpty(), IsOK(), KI_FALLTHROUGH, KiCadPcbFileExtension, SETTINGS_MANAGER::LoadProject(), LoadProjectSettings(), onBoardLoaded(), OnModify(), OpenProjectFiles(), KIWAY_HOLDER::Prj(), SETTINGS_MANAGER::Prj(), ProjectFileExtension, SavePcbCopy(), SavePcbFile(), SETTINGS_MANAGER::SaveProject(), BOARD::SetFileName(), SETTINGS_MANAGER::UnloadProject(), and UpdateTitle().

Referenced by Files_io(), PCB_EDITOR_CONTROL::New(), PCB_EDITOR_CONTROL::Open(), PCB_EDITOR_CONTROL::Save(), PCB_EDITOR_CONTROL::SaveAs(), and PCB_EDITOR_CONTROL::SaveCopyAs().

◆ findPythonConsole()

static wxWindow* PCB_EDIT_FRAME::findPythonConsole ( )
inlinestaticprotected
Returns
a pointer to the python console frame, or NULL if not exist

Definition at line 185 of file pcb_edit_frame.h.

186  {
187  return FindWindowByName( pythonConsoleNameId() );
188  }
static const wxChar * pythonConsoleNameId()
Has meaning only if KICAD_SCRIPTING_WXPYTHON option is not defined.

References pythonConsoleNameId().

Referenced by ReCreateMenuBar(), and SyncToolbars().

◆ fixEagleNets()

bool PCB_EDIT_FRAME::fixEagleNets ( const std::unordered_map< wxString, wxString > &  aRemap)
protected

Rematch orphaned zones and vias to schematic nets.

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

1032 {
1033  bool result = true;
1034  BOARD* board = GetBoard();
1035 
1036  // perform netlist matching to prevent orphaned zones.
1037  for( auto zone : board->Zones() )
1038  {
1039  auto it = aRemap.find( zone->GetNet()->GetNetname() );
1040 
1041  if( it != aRemap.end() )
1042  {
1043  NETINFO_ITEM* net = board->FindNet( it->second );
1044 
1045  if( !net )
1046  {
1047  wxFAIL;
1048  result = false;
1049  continue;
1050  }
1051 
1052  zone->SetNet( net );
1053  }
1054  }
1055 
1056 
1057  // perform netlist matching to prevent orphaned tracks/vias.
1058  for( auto track : board->Tracks() )
1059  {
1060  auto it = aRemap.find( track->GetNet()->GetNetname() );
1061 
1062  if( it != aRemap.end() )
1063  {
1064  NETINFO_ITEM* net = board->FindNet( it->second );
1065 
1066  if( !net )
1067  {
1068  wxFAIL;
1069  result = false;
1070  continue;
1071  }
1072 
1073  track->SetNet( net );
1074  }
1075  }
1076 
1077  return result;
1078 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
ZONE_CONTAINERS & Zones()
Definition: class_board.h:280
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
BOARD * GetBoard() const
TRACKS & Tracks()
Definition: class_board.h:257

References BOARD::FindNet(), PCB_BASE_FRAME::GetBoard(), BOARD::Tracks(), and BOARD::Zones().

Referenced by importFile().

◆ FocusOnItem()

void PCB_BASE_FRAME::FocusOnItem ( BOARD_ITEM aItem)
inherited

Definition at line 173 of file pcb_base_frame.cpp.

174 {
175  static KIID lastBrightenedItemID( niluuid );
176 
177  BOARD_ITEM* lastItem = GetBoard()->GetItem( lastBrightenedItemID );
178 
179  if( lastItem && lastItem != aItem )
180  {
181  lastItem->ClearBrightened();
182 
183  if( lastItem->Type() == PCB_MODULE_T )
184  {
185  static_cast<MODULE*>( lastItem )->RunOnChildren( [&] ( BOARD_ITEM* child )
186  {
187  child->ClearBrightened();
188  });
189  }
190 
191  GetCanvas()->GetView()->Update( lastItem );
192  lastBrightenedItemID = niluuid;
193  GetCanvas()->Refresh();
194  }
195 
196  if( aItem )
197  {
198  aItem->SetBrightened();
199 
200  if( aItem->Type() == PCB_MODULE_T )
201  {
202  static_cast<MODULE*>( aItem )->RunOnChildren( [&] ( BOARD_ITEM* child )
203  {
204  child->SetBrightened();
205  });
206  }
207 
208  GetCanvas()->GetView()->Update( aItem );
209  lastBrightenedItemID = aItem->m_Uuid;
210  FocusOnLocation( aItem->GetFocusPosition() );
211  GetCanvas()->Refresh();
212  }
213 }
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual const wxPoint GetFocusPosition() const
Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rath...
Definition: base_struct.h:344
void SetBrightened()
Definition: base_struct.h:209
BOARD_ITEM * GetItem(const KIID &aID)
void ClearBrightened()
Definition: base_struct.h:212
Definition: common.h:68
class MODULE, a footprint
Definition: typeinfo.h:89
KIID niluuid(0)
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const KIID m_Uuid
Definition: base_struct.h:162
BOARD * GetBoard() const
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References EDA_ITEM::ClearBrightened(), EDA_DRAW_FRAME::FocusOnLocation(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), EDA_ITEM::GetFocusPosition(), BOARD::GetItem(), PCB_DRAW_PANEL_GAL::GetView(), EDA_ITEM::m_Uuid, niluuid, PCB_MODULE_T, EDA_DRAW_PANEL_GAL::Refresh(), EDA_ITEM::SetBrightened(), EDA_ITEM::Type(), and KIGFX::PCB_VIEW::Update().

Referenced by SELECTION_TOOL::Main(), DIALOG_DRC::OnCancelClick(), DIALOG_DRC::OnDRCItemSelected(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), DIALOG_CLEANUP_GRAPHICS::OnSelectItem(), and DIALOG_DRC::~DIALOG_DRC().

◆ FocusOnLocation()

void EDA_DRAW_FRAME::FocusOnLocation ( const wxPoint aPos)
inherited

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

Parameters
aPosis the point to go to.

Definition at line 771 of file eda_draw_frame.cpp.

772 {
773  bool centerView = false;
774  BOX2D r = GetCanvas()->GetView()->GetViewport();
775 
776  // Center if we're off the current view, or within 10% of its edge
777  r.Inflate( - (int) r.GetWidth() / 10 );
778 
779  if( !r.Contains( aPos ) )
780  centerView = true;
781 
782  // Center if we're behind an obscuring dialog, or within 10% of its edge
783  wxWindow* dialog = findDialog( GetChildren() );
784 
785  if( dialog )
786  {
787  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
788  dialog->GetSize() );
789  dialogRect.Inflate( dialogRect.GetWidth() / 10 );
790 
791  if( dialogRect.Contains( (wxPoint) GetCanvas()->GetView()->ToScreen( aPos ) ) )
792  centerView = true;
793  }
794 
795  if( centerView )
796  {
797  // If a dialog partly obscures the window, then center on the uncovered area.
798  if( dialog )
799  {
800  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
801  dialog->GetSize() );
802  GetCanvas()->GetView()->SetCenter( aPos, dialogRect );
803  }
804  else
805  GetCanvas()->GetView()->SetCenter( aPos );
806  }
807 
809 }
BOX2D GetViewport() const
Function GetViewport() Returns the current viewport visible area rectangle.
Definition: view.cpp:538
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
coord_type GetWidth() const
Definition: box2.h:196
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:150
wxWindow * findDialog(wxWindowList &aList)
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:301

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

Referenced by SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindNext(), PCB_BASE_FRAME::FocusOnItem(), SCH_EDIT_FRAME::FocusOnItem(), and DIALOG_FIND::search().

◆ GenD356File()

void PCB_EDIT_FRAME::GenD356File ( wxCommandEvent &  event)

Definition at line 363 of file export_d356.cpp.

364 {
365  wxFileName fn = GetBoard()->GetFileName();
366  wxString msg, ext, wildcard;
367 
368  ext = IpcD356FileExtension;
369  wildcard = IpcD356FileWildcard();
370  fn.SetExt( ext );
371 
372  wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
373 
374  wxFileDialog dlg( this, _( "Export D-356 Test File" ), pro_dir,
375  fn.GetFullName(), wildcard,
376  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
377 
378  if( dlg.ShowModal() == wxID_CANCEL )
379  return;
380 
381  IPC356D_WRITER writer( GetBoard(), this );
382 
383  writer.Write( dlg.GetPath() );
384 }
const wxString & GetFileName() const
Definition: class_board.h:255
Wrapper to expose an API for writing IPC-D356 files.
Definition: export_d356.h:53
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const std::string IpcD356FileExtension
wxString IpcD356FileWildcard()
#define _(s)
Definition: 3d_actions.cpp:33
BOARD * GetBoard() const

References _, PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), IpcD356FileExtension, IpcD356FileWildcard(), KIWAY_HOLDER::Prj(), and IPC356D_WRITER::Write().

Referenced by PCB_EDITOR_CONTROL::GenerateFabFiles().

◆ GenFootprintsReport()

void PCB_EDIT_FRAME::GenFootprintsReport ( wxCommandEvent &  event)

Function GenFootprintsReport Calls DoGenFootprintsReport to create a footprint reprot file See DoGenFootprintsReport for file format.

Definition at line 509 of file gen_footprints_placefile.cpp.

510 {
511  wxFileName fn;
512 
513  wxString boardFilePath = ( (wxFileName) GetBoard()->GetFileName() ).GetPath();
514  wxDirDialog dirDialog( this, _( "Select Output Directory" ), boardFilePath );
515 
516  if( dirDialog.ShowModal() == wxID_CANCEL )
517  return;
518 
519  fn = GetBoard()->GetFileName();
520  fn.SetPath( dirDialog.GetPath() );
521  fn.SetExt( wxT( "rpt" ) );
522 
523  bool unitMM = GetUserUnits() != EDA_UNITS::INCHES;
524  bool success = DoGenFootprintsReport( fn.GetFullPath(), unitMM );
525 
526  wxString msg;
527  if( success )
528  {
529  msg.Printf( _( "Footprint report file created:\n\"%s\"" ), fn.GetFullPath() );
530  wxMessageBox( msg, _( "Footprint Report" ), wxICON_INFORMATION );
531  }
532 
533  else
534  {
535  msg.Printf( _( "Unable to create \"%s\"" ), fn.GetFullPath() );
536  DisplayError( this, msg );
537  }
538 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
const wxString & GetFileName() const
Definition: class_board.h:255
bool DoGenFootprintsReport(const wxString &aFullFilename, bool aUnitsMM)
Function DoGenFootprintsReport Creates an ascii footprint report file giving some infos on footprints...
#define _(s)
Definition: 3d_actions.cpp:33
BOARD * GetBoard() const
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References _, DisplayError(), DoGenFootprintsReport(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), EDA_BASE_FRAME::GetUserUnits(), and INCHES.

Referenced by PCB_EDITOR_CONTROL::GenerateFabFiles().

◆ Get3DViewerFrame()

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

Definition at line 77 of file pcb_base_frame.cpp.

78 {
79  return dynamic_cast<EDA_3D_VIEWER*>( FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) ) );
80 }
#define QUALIFIED_VIEWER3D_FRAMENAME(parent)
Definition: eda_3d_viewer.h:51

References QUALIFIED_VIEWER3D_FRAMENAME.

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

◆ GetAboutTitle()

const wxString& EDA_BASE_FRAME::GetAboutTitle ( ) const
inlineinherited

Definition at line 488 of file eda_base_frame.h.

488 { return m_AboutTitle; }
wxString m_AboutTitle

References EDA_BASE_FRAME::m_AboutTitle.

Referenced by DIALOG_ABOUT::DIALOG_ABOUT(), and COMMON_CONTROL::ReportBug().

◆ GetActiveLayer()

◆ GetAutoSaveFilePrefix()

static wxString EDA_BASE_FRAME::GetAutoSaveFilePrefix ( )
inlinestaticprotectedinherited
Returns
the string to prepend to a file name for automatic save.

Definition at line 165 of file eda_base_frame.h.

166  {
167  return wxT( "_autosave-" );
168  }

Referenced by EDA_BASE_FRAME::CheckForAutoSaveFile(), SCH_EDIT_FRAME::doAutoSave(), doAutoSave(), Files_io_from_id(), SCH_EDIT_FRAME::OnCloseWindow(), OnExportSTEP(), SCH_EDIT_FRAME::SaveEEFile(), and SavePcbFile().

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 259 of file eda_base_frame.h.

259 { return m_autoSaveInterval; }

References EDA_BASE_FRAME::m_autoSaveInterval.

◆ GetAutoZoom()

virtual bool PCB_BASE_FRAME::GetAutoZoom ( )
inlinevirtualinherited

Always returns false.

Should be overriden in derived classes which support autozoom.

Reimplemented in DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 405 of file pcb_base_frame.h.

405 { return false; }

◆ GetBackupSuffix()

static wxString EDA_BASE_FRAME::GetBackupSuffix ( )
inlinestaticprotectedinherited
Returns
the suffix to be appended to the file extension on backup

Definition at line 157 of file eda_base_frame.h.

158  {
159  return wxT( "-bak" );
160  }

◆ GetBoard()

BOARD* PCB_BASE_FRAME::GetBoard ( ) const
inlineinherited

Definition at line 197 of file pcb_base_frame.h.

198  {
199  wxASSERT( m_Pcb );
200  return m_Pcb;
201  }

References PCB_BASE_FRAME::m_Pcb.

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_FRAME::AddModuleToBoard(), PCB_LAYER_WIDGET::AddRightClickMenuItems(), DIALOG_PLOT::applyPlotSettings(), ArchiveModulesOnBoard(), GRID_CELL_LAYER_SELECTOR::BeginEdit(), DIALOG_COPPER_ZONE::buildAvailableListOfNets(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), Clear_Pcb(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), PCB_BASE_FRAME::Compile_Ratsnest(), DIALOG_TEXT_PROPERTIES::convertKIIDsToReferences(), DIALOG_TEXT_PROPERTIES::convertReferencesToKIIDs(), DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), CreateHeaderInfoData(), PCB_BASE_FRAME::CreateNewModule(), DIALOG_PRINT_PCBNEW::createPrintout(), PANEL_MODEDIT_COLOR_SETTINGS::createSwatches(), PANEL_PCBNEW_COLOR_SETTINGS::createSwatches(), FOOTPRINT_EDITOR_TOOLS::CutCopyFootprint(), PCBNEW_CONTROL::DeleteItemCursor(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_DRC::DIALOG_DRC(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_GENDRILL::DIALOG_GENDRILL(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), doAutoSave(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), DoGenFootprintsPositionFile(), DoGenFootprintsReport(), ROUTER_TOOL::DpDimensionsDialog(), GRID_CELL_LAYER_RENDERER::Draw(), DRAWING_TOOL::DrawVia(), EDIT_TOOL::Duplicate(), Edit_Zone_Params(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), Exchange_Module(), ExecuteRemoteCommand(), FOOTPRINT_EDITOR_TOOLS::ExportFootprint(), DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones(), PCB_EDITOR_CONTROL::ExportSpecctraDSN(), ExportToGenCAD(), ExportVRML_File(), Files_io_from_id(), fixEagleNets(), PCB_BASE_FRAME::FocusOnItem(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GenD356File(), GenFootprintsReport(), GetBoard(), EDA_3D_VIEWER::GetBoard(), VECTOR_DRC_ITEMS_PROVIDER::GetCount(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), FOOTPRINT_EDIT_FRAME::GetDesignSettings(), FOOTPRINT_EDIT_FRAME::GetDocumentExtents(), PCB_LAYER_BOX_SELECTOR::getEnabledLayers(), PCB_BASE_FRAME::GetItem(), PCB_LAYER_SELECTOR::getLayerName(), PCB_LAYER_BOX_SELECTOR::getLayerName(), FOOTPRINT_EDIT_FRAME::GetLoadedFPID(), FOOTPRINT_VIEWER_FRAME::GetModel(), FOOTPRINT_EDIT_FRAME::GetModel(), DISPLAY_FOOTPRINTS_FRAME::GetModel(), FOOTPRINT_WIZARD_FRAME::GetModel(), DISPLAY_FOOTPRINTS_FRAME::GetModule(), PCB_BASE_FRAME::GetSeverity(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), GRID_CELL_LAYER_SELECTOR::GetValue(), FOOTPRINT_EDIT_FRAME::Import_Module(), importFile(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), DIALOG_PLOT::init_Dialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), ARRAY_CREATOR::Invoke(), FOOTPRINT_EDIT_FRAME::IsContentModified(), FOOTPRINT_EDIT_FRAME::IsCurrentFPFromBoard(), FOOTPRINT_EDIT_FRAME::IsElementVisible(), PCB_LAYER_SELECTOR::isLayerEnabled(), PCB_LAYER_BOX_SELECTOR::isLayerEnabled(), KiwayMailIn(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), DIALOG_NETLIST::loadNetlist(), DIALOG_DRC::OnActivateDlg(), DIALOG_SELECT_NET_FROM_LIST::onBoardChanged(), DIALOG_IMPORT_SETTINGS::OnBrowseClicked(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), DIALOG_NETLIST::OnCompileRatsnestClick(), DIALOG_DRC::OnDRCItemRClick(), DIALOG_DRC::OnDRCItemSelected(), DIALOG_EXPORT_STEP::onExportButton(), OnExportIDF3(), OnExportSTEP(), OnExportVRML(), PCB_LAYER_WIDGET::OnLayerVisible(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), PCB_LAYER_WIDGET::OnRenderEnable(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), DIALOG_CLEANUP_GRAPHICS::OnSelectItem(), DIALOG_NETLIST::OnTestFootprintsClick(), FOOTPRINT_VIEWER_FRAME::OnUpdateFootprintButton(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected(), DIALOG_NETLIST::OnUpdatePCB(), OpenProjectFiles(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), PANEL_SETUP_FEATURE_CONSTRAINTS::PANEL_SETUP_FEATURE_CONSTRAINTS(), PANEL_SETUP_LAYERS::PANEL_SETUP_LAYERS(), PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE(), PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES(), PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS(), PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS(), PCBNEW_CONTROL::Paste(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PLOT::Plot(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules(), FOOTPRINT_EDITOR_TOOLS::Properties(), RecreateCmpFileFromBoard(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), PCB_LAYER_WIDGET::ReFill(), PCB_LAYER_WIDGET::ReFillRender(), Refresh(), DIALOG_PLOT::reInitDialog(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), DRC::Reset(), DRC::RunTests(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SavePcbCopy(), SavePcbFile(), DIALOG_BOARD_STATISTICS::saveReportClicked(), DIALOG_FIND::search(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SelectLayer(), DIALOG_GLOBAL_DELETION::SetCurrentLayer(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), DIALOG_PLOT::SetPlotFormat(), VECTOR_DRC_ITEMS_PROVIDER::SetSeverities(), ZONE_SETTINGS::SetupLayersList(), FOOTPRINT_EDIT_FRAME::setupTools(), DRC_ITEM::ShowHtml(), GLOBAL_EDIT_TOOL::SwapLayers(), SwitchLayer(), PCB_LAYER_WIDGET::SyncLayerVisibilities(), FOOTPRINT_EDIT_FRAME::SyncToolbars(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_SWAP_LAYERS::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SWAP_LAYERS::TransferDataToWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), DIALOG_BOARD_STATISTICS::updateDrillGrid(), PCBNEW_CONTROL::UpdateMessagePanel(), DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel(), FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel(), DRC::updatePointers(), FOOTPRINT_EDIT_FRAME::updateTitle(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::updateView(), DIALOG_DRC::writeReport(), and DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME().

◆ GetBoardBoundingBox()

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

Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge segments).

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

Definition at line 314 of file pcb_base_frame.cpp.

315 {
316  wxASSERT( m_Pcb );
317 
318  EDA_RECT area = aBoardEdgesOnly ? m_Pcb->GetBoardEdgesBoundingBox() : m_Pcb->GetBoundingBox();
319 
320  if( area.GetWidth() == 0 && area.GetHeight() == 0 )
321  {
322  wxSize pageSize = GetPageSizeIU();
323 
325  {
326  area.SetOrigin( 0, 0 );
327  area.SetEnd( pageSize.x, pageSize.y );
328  }
329  else
330  {
331  area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
332  area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
333  }
334  }
335 
336  return area;
337 }
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: class_board.h:781
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:793
int GetWidth() const
Definition: eda_rect.h:119
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
bool m_showBorderAndTitleBlock
void SetEnd(int x, int y)
Definition: eda_rect.h:192
int GetHeight() const
Definition: eda_rect.h:120
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...

References BOARD::GetBoardEdgesBoundingBox(), BOARD::GetBoundingBox(), EDA_RECT::GetHeight(), PCB_BASE_FRAME::GetPageSizeIU(), EDA_RECT::GetWidth(), PCB_BASE_FRAME::m_Pcb, EDA_DRAW_FRAME::m_showBorderAndTitleBlock, EDA_RECT::SetEnd(), and EDA_RECT::SetOrigin().

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

◆ GetCanvas()

PCB_DRAW_PANEL_GAL * PCB_BASE_FRAME::GetCanvas ( ) const
overridevirtualinherited

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

Returns
Pointer to GAL-based canvas.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 712 of file pcb_base_frame.cpp.

713 {
714  return static_cast<PCB_DRAW_PANEL_GAL*>( EDA_DRAW_FRAME::GetCanvas() );
715 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.

References EDA_DRAW_FRAME::GetCanvas().

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), PCB_BASE_EDIT_FRAME::ActivateGalCanvas(), FOOTPRINT_EDIT_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::ActivateGalCanvas(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::ClickOnLibList(), FOOTPRINT_WIZARD_FRAME::ClickOnPageList(), DIALOG_PRINT_PCBNEW::createPrintout(), PCB_BASE_FRAME::DisplayGridMsg(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), Edit_Zone_Params(), PAD_TOOL::EnumeratePads(), ExecuteRemoteCommand(), SELECTION_TOOL::findCallback(), PCB_BASE_FRAME::FocusOnItem(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), PCB_BASE_FRAME::GetCollectorsGuide(), FOOTPRINT_EDIT_FRAME::HardRedraw(), DIALOG_SELECT_NET_FROM_LIST::highlightNetOnBoard(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), ROUTER_TOOL::InlineDrag(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), EDIT_TOOL::Move(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), DIALOG_DRC::OnDRCItemSelected(), PCB_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerSelect(), PCB_LAYER_WIDGET::OnLayerVisible(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), PCB_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), DIALOG_CLEANUP_GRAPHICS::OnSelectItem(), FOOTPRINT_TREE_PANE::onUpdateUI(), OpenProjectFiles(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DIALOG_PAD_PROPERTIES::prepareCanvas(), Process_Special_Functions(), FOOTPRINT_EDITOR_TOOLS::Properties(), EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_INSPECTION_TOOL::ratsnestTimer(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), ReCreateMenuBar(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), Refresh(), DIALOG_DRC::refreshBoardEditor(), refreshCallback(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), SELECTION_TOOL::RequestSelection(), FOOTPRINT_EDIT_FRAME::RevertFootprint(), DRC::RunTests(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), DISPLAY_FOOTPRINTS_FRAME::SaveSettings(), FOOTPRINT_VIEWER_FRAME::SaveSettings(), DIALOG_FIND::search(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), DRAWING_TOOL::SetAnchor(), PCB_BASE_EDIT_FRAME::SetBoard(), POINT_EDITOR::setEditedPoint(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), FOOTPRINT_EDIT_FRAME::setupTools(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), FOOTPRINT_EDIT_FRAME::SwitchCanvas(), PCB_BASE_FRAME::SwitchLayer(), SwitchLayer(), PANEL_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EDIT_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_PCBNEW_COLOR_SETTINGS::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateStatusBar(), FOOTPRINT_EDIT_FRAME::UpdateUserInterface(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::updateView(), SELECTION_TOOL::zoomFitSelection(), DIALOG_NETLIST::~DIALOG_NETLIST(), DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME(), PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME(), and PCB_BASE_FRAME::~PCB_BASE_FRAME().

◆ GetCollectorsGuide()

GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide ( )
inherited

Function GetCollectorsGuide.

Returns
GENERAL_COLLECTORS_GUIDE - that considers the global configuration options.

Definition at line 425 of file pcb_base_frame.cpp.

426 {
428  GetCanvas()->GetView() );
429 
430  // account for the globals
432  guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
433  guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
434  guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_BK ) );
435  guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_FR ) );
436  guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( LAYER_PAD_BK ) );
437  guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
438  guide.SetIgnoreThroughHolePads( ! m_Pcb->IsElementVisible( LAYER_PADS_TH ) );
439  guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
440  guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
441  guide.SetIgnoreThroughVias( ! m_Pcb->IsElementVisible( LAYER_VIA_THROUGH ) );
442  guide.SetIgnoreBlindBuriedVias( ! m_Pcb->IsElementVisible( LAYER_VIA_BBLIND ) );
443  guide.SetIgnoreMicroVias( ! m_Pcb->IsElementVisible( LAYER_VIA_MICROVIA ) );
444  guide.SetIgnoreTracks( ! m_Pcb->IsElementVisible( LAYER_TRACKS ) );
445 
446  return guide;
447 }
to draw blind/buried vias
multilayer pads, usually with holes
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
show modules values (when texts are visibles)
show modules on front
virtual PCB_LAYER_ID GetActiveLayer() const
to draw usual through hole vias
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:541
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
smd pads, front layer
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:385
show modules references (when texts are visibles)

References PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetCanvas(), PCB_DRAW_PANEL_GAL::GetView(), BOARD::GetVisibleLayers(), BOARD::IsElementVisible(), LAYER_MOD_BK, LAYER_MOD_FR, LAYER_MOD_REFERENCES, LAYER_MOD_TEXT_BK, LAYER_MOD_TEXT_FR, LAYER_MOD_TEXT_INVISIBLE, LAYER_MOD_VALUES, LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PADS_TH, LAYER_TRACKS, LAYER_VIA_BBLIND, LAYER_VIA_MICROVIA, LAYER_VIA_THROUGH, PCB_BASE_FRAME::m_Pcb, and GENERAL_COLLECTORS_GUIDE::SetIgnoreMTextsMarkedNoShow().

Referenced by PCBNEW_CONTROL::DeleteItemCursor(), PAD_TOOL::EnumeratePads(), and PCB_INSPECTION_TOOL::highlightNet().

◆ GetColorSettings()

COLOR_SETTINGS * PCB_BASE_EDIT_FRAME::GetColorSettings ( )
overridevirtualinherited

Helper to retrieve the current color settings.

Returns
a pointer to the active COLOR_SETTINGS

Reimplemented from PCB_BASE_FRAME.

Definition at line 138 of file pcb_base_edit_frame.cpp.

139 {
140  return Pgm().GetSettingsManager().GetColorSettings( GetPcbNewSettings()->m_ColorTheme );
141 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
PCBNEW_SETTINGS * GetPcbNewSettings()

References PCB_BASE_FRAME::GetPcbNewSettings(), and Pgm().

Referenced by PrepareLayerIndicator(), and DIALOG_PRINT_PCBNEW::saveSettings().

◆ GetCurrentFileName()

wxString PCB_EDIT_FRAME::GetCurrentFileName ( ) const
overridevirtual

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

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

Returns
the filename and full path to the open file

Reimplemented from EDA_BASE_FRAME.

Definition at line 1323 of file pcb_edit_frame.cpp.

1324 {
1325  return GetBoard()->GetFileName();
1326 }
const wxString & GetFileName() const
Definition: class_board.h:255
BOARD * GetBoard() const

References GetBoard(), and BOARD::GetFileName().

◆ GetDesignSettings()

◆ GetDisplayOptions()

◆ GetDocumentExtents()

const BOX2I PCB_BASE_FRAME::GetDocumentExtents ( ) const
inlineoverridevirtualinherited

Reimplemented from EDA_DRAW_FRAME.

Reimplemented in FOOTPRINT_EDIT_FRAME.

Definition at line 135 of file pcb_base_frame.h.

136  {
137  return GetBoardBoundingBox( false );
138  }
EDA_RECT GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge se...

References PCB_BASE_FRAME::GetBoardBoundingBox().

◆ GetDoImmediateActions()

bool TOOLS_HOLDER::GetDoImmediateActions ( ) const
inline<