KiCad PCB EDA Suite
FOOTPRINT_EDIT_FRAME Class Reference

#include <footprint_edit_frame.h>

Inheritance diagram for FOOTPRINT_EDIT_FRAME:
PCB_BASE_EDIT_FRAME PCB_BASE_FRAME EDA_DRAW_FRAME KIWAY_PLAYER EDA_BASE_FRAME KIWAY_HOLDER

Public Member Functions

 ~FOOTPRINT_EDIT_FRAME ()
 
BOARD_ITEM_CONTAINERGetModel () const override
 > More...
 
bool IsCurrentFPFromBoard () const
 
BOARD_DESIGN_SETTINGSGetDesignSettings () const override
 Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame. More...
 
void SetDesignSettings (const BOARD_DESIGN_SETTINGS &aSettings) override
 
const PCB_PLOT_PARAMSGetPlotSettings () const override
 Function GetPlotSettings returns the PCB_PLOT_PARAMS for the BOARD owned by this frame. More...
 
void SetPlotSettings (const PCB_PLOT_PARAMS &aSettings) override
 
void LoadSettings (wxConfigBase *aCfg) override
 Function LoadSettings loads common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *aCfg) override
 Function SaveSettings saves common frame parameters to a configuration data file. More...
 
double BestZoom () override
 Function BestZoom. More...
 
PARAM_CFG_ARRAYGetConfigurationSettings ()
 Return the footprint editor settings list. More...
 
void OnCloseWindow (wxCloseEvent &Event) override
 
void CloseModuleEditor (wxCommandEvent &Event)
 
virtual void OnSwitchCanvas (wxCommandEvent &aEvent) override
 switches currently used canvas (default / Cairo / OpenGL). More...
 
void UpdateUserInterface ()
 Update the layer manager and other widgets from the board setup (layer and items visibility, colors ...) More...
 
void Process_Special_Functions (wxCommandEvent &event)
 
void ProcessPreferences (wxCommandEvent &event)
 
void RedrawActiveWindow (wxDC *DC, bool EraseBg) override
 Draw the footprint editor BOARD, and others elements such as axis and grid. More...
 
void ReCreateHToolbar () override
 Create the main horizontal toolbar for the footprint editor. More...
 
void ReCreateVToolbar () override
 
void ReCreateOptToolbar () override
 
void OnLeftClick (wxDC *DC, const wxPoint &MousePos) override
 
void OnLeftDClick (wxDC *DC, const wxPoint &MousePos) override
 Handle the double click in the footprint editor. More...
 
bool OnRightClick (const wxPoint &MousePos, wxMenu *PopMenu) override
 Handle the right mouse click in the footprint editor. More...
 
void ReCreateMenuBar () override
 (Re)Create the menubar for the module editor frame More...
 
void setupTools ()
 
void ToolOnRightClick (wxCommandEvent &event) override
 
void OnSelectOptionToolbar (wxCommandEvent &event)
 
void OnConfigurePaths (wxCommandEvent &aEvent)
 
void OnToggleSearchTree (wxCommandEvent &event)
 
void OnSaveFootprintAsPng (wxCommandEvent &event)
 
bool IsSearchTreeShown ()
 
bool SaveLibraryAs (const wxString &aLibraryPath)
 Save a library to a new name and/or library type. More...
 
EDA_HOTKEYGetHotKeyDescription (int aCommand) const override
 > More...
 
bool OnHotKey (wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
 Handle hot key events. More...
 
BOARD_ITEMPrepareItemForHotkey (bool failIfCurrentlyEdited)
 
bool OnHotkeyEditItem (int aIdCommand)
 
bool OnHotkeyDeleteItem (int aIdCommand)
 
bool OnHotkeyMoveItem (int aIdCommand)
 
bool OnHotkeyMoveItemExact ()
 
bool OnHotkeyRotateItem (int aIdCommand)
 
bool OnHotkeyDuplicateItem (int aIdCommand)
 
void Show3D_Frame (wxCommandEvent &event) override
 Display 3D view of the footprint (module) being edited. More...
 
bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
 Perform application specific control using aDC at aPosition in logical units. More...
 
void OnVerticalToolbar (wxCommandEvent &aEvent)
 
void OnUpdateSelectTool (wxUpdateUIEvent &aEvent)
 Handle ID_ZOOM_SELECTION and ID_NO_TOOL_SELECTED tools. More...
 
void OnUpdateVerticalToolbar (wxUpdateUIEvent &aEvent)
 Handle most of tools og the vertical right toolbar ("Tools" toolbar) More...
 
void OnUpdateOptionsToolbar (wxUpdateUIEvent &aEvent)
 
void OnUpdateModuleSelected (wxUpdateUIEvent &aEvent)
 
void OnUpdateModuleTargeted (wxUpdateUIEvent &aEvent)
 
void OnUpdateSave (wxUpdateUIEvent &aEvent)
 
void OnUpdateSaveAs (wxUpdateUIEvent &aEvent)
 
void OnUpdateLoadModuleFromBoard (wxUpdateUIEvent &aEvent)
 
void OnUpdateInsertModuleInBoard (wxUpdateUIEvent &aEvent)
 
void OnEditItemRequest (wxDC *aDC, BOARD_ITEM *aItem) override
 > More...
 
void LoadModuleFromBoard (wxCommandEvent &event)
 Called from the main toolbar to load a footprint from board mainly to edit it. More...
 
void LoadModuleFromLibrary (LIB_ID aFPID)
 
LIB_TREE_MODEL_ADAPTER::PTRGetLibTreeAdapter ()
 Returns the adapter object that provides the stored data. More...
 
bool SaveFootprint (MODULE *aModule)
 Save in an existing library a given footprint. More...
 
bool SaveFootprintAs (MODULE *aModule)
 
bool SaveFootprintToBoard (bool aAddNew)
 
bool RevertFootprint ()
 
virtual void OnModify () override
 Must be called after a footprint change in order to set the "modify" flag of the current screen and prepare, if needed the refresh of the 3D frame showing the footprint do not forget to call the basic OnModify function to update auxiliary info. More...
 
void ToPrinter (wxCommandEvent &event)
 Install the print dialog. More...
 
bool Clear_Pcb (bool aQuery)
 Delete all and reinitialize the current board. More...
 
virtual int BlockCommand (EDA_KEY key) override
 Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse. More...
 
virtual void HandleBlockPlace (wxDC *DC) override
 Handle the BLOCK PLACE command. More...
 
virtual bool HandleBlockEnd (wxDC *DC) override
 Handle the "end" of a block command, i.e. More...
 
BOARD_ITEMModeditLocateAndDisplay (int aHotKeyCode=0)
 
LIB_ID getTargetFPID () const
 Return the LIB_ID of the part selected in the footprint or the part being edited. More...
 
LIB_ID GetLoadedFPID () const
 Return the LIB_ID of the part being edited. More...
 
void RemoveStruct (EDA_ITEM *Item)
 
void Transform (MODULE *module, int transform)
 Perform a geometric transform on the current footprint. More...
 
void Export_Module (MODULE *aModule)
 Create a file containing only one footprint. More...
 
MODULEImport_Module (const wxString &aName=wxT(""))
 Read a file containing only one footprint. More...
 
bool Load_Module_From_BOARD (MODULE *Module)
 Load in Modedit a footprint from the main board. More...
 
MODULESelectFootprintFromBoard (BOARD *aPcb)
 Display the list of modules currently existing on the BOARD. More...
 
void Edit_Edge_Width (EDGE_MODULE *aEdge)
 Change the width of module perimeter lines, EDGE_MODULEs. More...
 
void Edit_Edge_Layer (EDGE_MODULE *Edge)
 Change the EDGE_MODULE Edge layer, (The new layer will be asked) if Edge == NULL change the layer of the entire footprint edges. More...
 
void Delete_Edge_Module (EDGE_MODULE *Edge)
 Delete EDGE_MODULE ddge. More...
 
EDGE_MODULEBegin_Edge_Module (EDGE_MODULE *Edge, wxDC *DC, STROKE_T type_edge)
 Creates a new edge item (line, arc ..). More...
 
void End_Edge_Module (EDGE_MODULE *Edge)
 Terminate a move or create edge function. More...
 
void Start_Move_EdgeMod (EDGE_MODULE *drawitem, wxDC *DC)
 Function to initialize the move function params of a graphic item type DRAWSEGMENT. More...
 
void Place_EdgeMod (EDGE_MODULE *drawitem)
 Function to place a graphic item type EDGE_MODULE currently moved. More...
 
void PushPadProperties (D_PAD *aPad)
 Change pad characteristics for the given footprint or all footprints which look like the given footprint. More...
 
bool DeleteModuleFromLibrary (const LIB_ID &aFPID, bool aConfirm)
 Delete the given module from its library. More...
 
bool IsElementVisible (GAL_LAYER_ID aElement) const
 Test 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...
 
virtual bool IsGridVisible () const override
 
virtual void SetGridVisibility (bool aVisible) override
 It may be overloaded by derived classes if you want to store/retrieve the grid visibility in configuration. More...
 
virtual COLOR4D GetGridColor () override
 
void SetActiveLayer (PCB_LAYER_ID aLayer) override
 > More...
 
void OnUpdateLayerAlpha (wxUpdateUIEvent &aEvent) override
 > More...
 
virtual void UseGalCanvas (bool aEnable) override
 > More...
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl=0) override
 
Load a KiCad board (.kicad_pcb) from aFileName. More...
 
void AddModuleToBoard (MODULE *module) override
 Override from PCB_BASE_EDIT_FRAME which adds a module to the editor's dummy board, NOT to the user's PCB. More...
 
void InstallPreferences (PAGED_DIALOG *aParent) override
 Allows Modedit to install its preferences panel into the preferences dialog. More...
 
void ReFillLayerWidget ()
 
void ShowChangedLanguage () override
 Update visible items after a language change. More...
 
void CommonSettingsChanged () override
 Called after the preferences dialog is run. More...
 
void SyncLibraryTree (bool aProgress)
 Synchronize the footprint library tree to the current state of the footprint library table. More...
 
void UpdateMsgPanel () override
 Redraw the message panel. More...
 
void KiwayMailIn (KIWAY_EXPRESS &mail) override
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. 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 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...
 
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, wxDC *aDC)
 Routine for main window class to launch text properties dialog. More...
 
void InstallGraphicItemPropertiesDialog (BOARD_ITEM *aItem)
 
virtual void SetBoard (BOARD *aBoard) override
 > More...
 
void OnGridSettings (wxCommandEvent &aEvent) override
 
bool InvokeDialogGrid ()
 
EDA_3D_VIEWERGet3DViewerFrame ()
 
bool Update3DView (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...
 
virtual void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPoint & GetAuxOrigin () const override
 Return the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPoint) override
 
const wxPoint & GetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void SetDrawBgColor (COLOR4D aColor) override
 
void * GetDisplayOptions () override
 Function GetDisplayOptions returns the display options current in use Display options are relative to the way tracks, vias, outlines and other things are shown (for instance solid or sketch mode) Must be overloaded in frames which have display options (board editor and footprint editor) More...
 
const ZONE_SETTINGSGetZoneSettings () const
 
void SetZoneSettings (const ZONE_SETTINGS &aSettings)
 
BOARDGetBoard () const
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg) override
 Set the tool command ID to aId and sets the cursor to aCursor. More...
 
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...
 
void UpdateGridSelectBox ()
 
const wxString GetZoomLevelIndicator () const override
 Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs. More...
 
virtual bool CreateAndShow3D_Frame (bool aForceRecreateIfNotOwner)
 Shows the 3D view frame. More...
 
BOARD_ITEMPcbGeneralLocateAndDisplay (int aHotKeyCode=0)
 Function PcbGeneralLocateAndDisplay searches for an item under the mouse cursor. More...
 
void ProcessItemSelection (wxCommandEvent &event)
 
void SetCurItem (BOARD_ITEM *aItem, bool aDisplayInfo=true)
 Function SetCurItem sets the currently selected item and displays it in the MsgPanel. More...
 
BOARD_ITEMGetCurItem ()
 
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 Edit_Module (MODULE *module, wxDC *DC)
 
void Rotate_Module (wxDC *DC, MODULE *module, double angle, bool incremental)
 
void PlaceModule (MODULE *aModule, wxDC *aDC, bool aRecreateRatsnest=true)
 Function PlaceModule places aModule at the current cursor position and updates module coordinates with the new position. More...
 
void RotateTextModule (TEXTE_MODULE *Text, wxDC *DC)
 
void DeleteTextModule (TEXTE_MODULE *Text)
 
void PlaceTexteModule (TEXTE_MODULE *Text, wxDC *DC)
 
void StartMoveTexteModule (TEXTE_MODULE *Text, wxDC *DC)
 
void ResetTextSize (BOARD_ITEM *aItem, wxDC *aDC)
 Function ResetTextSize resets given field text size and width to current settings in Preferences->Dimensions->Texts and Drawings. More...
 
void InstallPadOptionsFrame (D_PAD *pad)
 
void AddPad (MODULE *Module, bool draw)
 
void DeletePad (D_PAD *aPad, bool aQuery=true)
 Function DeletePad Delete the pad aPad. More...
 
void StartMovePad (D_PAD *aPad, wxDC *aDC, bool aDragConnectedTracks)
 Function StartMovePad Initialize a drag or move pad command. More...
 
void PlacePad (D_PAD *Pad, wxDC *DC)
 
void Export_Pad_Settings (D_PAD *aPad)
 
void Import_Pad_Settings (D_PAD *aPad, bool aDraw)
 
void DoPushPadProperties (D_PAD *aPad, bool aSameFootprints, bool aPadShapeFilter, bool aPadOrientFilter, bool aPadLayerFilter, bool aSaveForUndo)
 Function DoPushPadProperties Function to change pad settings for the given footprint or all identical footprints. More...
 
MODULESelectFootprintFromLibTree (bool aUseFootprintViewer=true)
 Function SelectFootprintFromLibTree opens a dialog to select a footprint. More...
 
wxString SelectFootprintFromLibBrowser ()
 Function SelectFootprintFromLibBrowser launches the footprint viewer to select the name of a footprint to load. More...
 
void Compile_Ratsnest (wxDC *aDC, bool aDisplayStatus)
 Function Compile_Ratsnest Create the entire board ratsnest. More...
 
void build_ratsnest_module (MODULE *aModule, wxPoint aMoveVector)
 Function build_ratsnest_module Build a ratsnest relative to one footprint. More...
 
void TraceModuleRatsNest (wxDC *aDC)
 Function TraceModuleRatsNest display the rats nest of a moving footprint, computed by build_ratsnest_module() More...
 
void DrawGeneralRatsnest (wxDC *aDC, int aNetcode=0)
 function Displays the general ratsnest Only ratsnest with the status bit CH_VISIBLE is set are displayed More...
 
void TraceAirWiresToTargets (wxDC *aDC)
 Function TraceAirWiresToTargets This functions shows airwires to nearest connecting points (pads) from the current new track end during track creation Uses data prepared by BuildAirWiresTargetsList() More...
 
void BuildAirWiresTargetsList (BOARD_CONNECTED_ITEM *aItemRef, const wxPoint &aPosition, int aNet)
 Function BuildAirWiresTargetsList Build a list of candidates that can be a coonection point when a track is started. More...
 
void TestNetConnection (wxDC *aDC, int aNetCode)
 Function TestNetConnection tests the connections relative to aNetCode. More...
 
PCB_LAYER_ID SelectLayer (PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
 Install the dialog box for layer selection. More...
 
void SelectCopperLayerPair ()
 
virtual void SwitchLayer (wxDC *DC, PCB_LAYER_ID layer)
 
virtual PCB_LAYER_ID GetActiveLayer () const
 Function GetActiveLayer returns the active layer. More...
 
void OnTogglePolarCoords (wxCommandEvent &aEvent)
 
void OnTogglePadDrawMode (wxCommandEvent &aEvent)
 
void OnToggleGraphicDrawMode (wxCommandEvent &aEvent)
 
void OnToggleEdgeDrawMode (wxCommandEvent &aEvent)
 
void OnToggleTextDrawMode (wxCommandEvent &aEvent)
 
void OnUpdateCoordType (wxUpdateUIEvent &aEvent)
 
void OnUpdatePadDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateGraphicDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateEdgeDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateTextDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectZoom (wxUpdateUIEvent &aEvent)
 
void SetFastGrid1 ()
 Function SetFastGrid1() More...
 
void SetFastGrid2 ()
 Function SetFastGrid2() More...
 
void SetNextGrid () override
 Virtual function SetNextGrid() changes the grid size settings to the next one available. More...
 
void SetPrevGrid () override
 Virtual function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void OnUpdateSwitchCanvas (wxUpdateUIEvent &aEvent)
 Update UI called when switches currently used canvas (default / Cairo / OpenGL). More...
 
PCB_GENERAL_SETTINGSSettings ()
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
EDA_UNITS_T GetUserUnits () const override
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS_T aUnits)
 
int GetLastGridSizeId () const
 
void SetLastGridSizeId (int aId)
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Set the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Return the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Return the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Return the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPoint & GetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
virtual EDA_DRAW_PANELGetCanvas () const
 
virtual wxString GetScreenDesc () const
 
virtual void ExecuteRemoteCommand (const char *cmdline)
 Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 After calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Return a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Return the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
wxAuiToolBar * GetOptionsToolBar () const
 
wxAuiToolBar * GetDrawToolBar () const
 
wxAuiToolBar * GetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
wxAuiToolBarItem * GetToolbarTool (int aToolId)
 Checks all the toolbars and returns a reference to the given tool id or nullptr if not found. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual void SetGridColor (COLOR4D aColor)
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
void SetPresetGrid (int aIndex)
 Change the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Set the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Change the zoom to the next one available. More...
 
void SetNextZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the next one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPrevZoom ()
 Change the zoom to the previous one available. More...
 
void SetPreviousZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the previous one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPresetZoom (int aIndex)
 Change zoom to one of the preset values. More...
 
virtual void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
virtual void RedrawScreen2 (const wxPoint &posBefore)
 Put the crosshair back to the screen position it had before zooming. More...
 
virtual void HardRedraw ()
 Rebuild the GAL and redraws the screen. More...
 
virtual void Zoom_Automatique (bool aWarpPointer)
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
virtual void Window_Zoom (EDA_RECT &Rect)
 
void FocusOnLocation (const wxPoint &aPos, bool aWarpCursor=true, bool aCenterView=false)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
double GetZoom ()
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnPageSettingsChange ()
 Called when modifying the page settings. More...
 
virtual void OnActivate (wxActivateEvent &event)
 Called when activating the frame. More...
 
void DisplayUnitsMsg ()
 Display current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Copy the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Push preferences from a parent window to a child window. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL)
 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...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Return the tool manager instance, if any. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
bool GetShowAxis () const
 
bool GetShowGridAxis () const
 
bool GetShowOriginAxis () const
 
virtual const BOX2I GetDocumentExtents () const
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
bool ShowPreferences (EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys, const wxString &aHotkeysNickname)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Static Public Member Functions

static const wxChar * GetFootprintEditorFrameName ()
 Function GetFootprintEditorFrameName (static) More...
 

Public Attributes

PCB_DISPLAY_OPTIONS m_DisplayOptions
 
wxPoint m_UserGridSize
 
int m_FastGrid1
 
int m_FastGrid2
 

Static Public Attributes

static const wxChar AUTO_ZOOM_KEY [] = wxT( "AutoZoom" )
 

Key in KifaceSettings to store the canvas type.

More...
 
static const wxChar ZOOM_KEY [] = wxT( "Zoom" )
 

Protected Member Functions

 FOOTPRINT_EDIT_FRAME (KIWAY *aKiway, wxWindow *aParent, EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend)
 protected so only friend PCB::IFACE::CreateWindow() can act as sole factory. More...
 
void initLibraryTree ()
 Make sure the footprint info list is loaded (with a progress dialog) and then initialize the footprint library tree. More...
 
void updateTitle ()
 Updates window title according to getLibNickName(). More...
 
void updateView ()
 Reloads displayed items and sets view. More...
 
void restoreLastFootprint ()
 
void retainLastFootprint ()
 
TEXTE_MODULECreateTextModule (MODULE *aModule, wxDC *aDC)
 Creates a new text for the footprint. More...
 
void createArray ()
 Function createArray Create an array of the selected item (invokes the dialogue) This function is shared between pcbnew and modedit, as it is virtually the same. More...
 
void duplicateItem (BOARD_ITEM *aItem, bool aIncrement)
 Function duplicateItem Duplicate the specified item This function is shared between pcbnew and modedit, as it is virtually the same. More...
 
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...
 
void updateZoomSelectBox ()
 
MODULEloadFootprint (const LIB_ID &aFootprintId)
 Function loadFootprint attempts to load aFootprintId from the footprint library table. More...
 
virtual void SetScreen (BASE_SCREEN *aScreen)
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory)
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool saveCanvasImageToFile (const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
 
virtual wxString GetCanvasTypeKey ()
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Function autoSaveRequired returns the auto save status of the application. More...
 
virtual bool doAutoSave ()
 Function doAutoSave should be overridden by the derived class to handle the auto save feature. More...
 
virtual wxConfigBase * config ()
 Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual const SEARCH_STACKsys_search ()
 Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual wxString help_name ()
 

Protected Attributes

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

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private Member Functions

void editFootprintProperties (MODULE *aFootprint)
 Run the Footprint Properties dialog and handle changes made in it. More...
 
bool saveFootprintInLibrary (MODULE *aModule, const wxString &aLibraryName)
 
void moveExact ()
 Move the selected item exactly, popping up a dialog to allow the user the enter the move delta. More...
 
void duplicateItems (bool aIncrement) override
 Duplicate the item under the cursor. More...
 

Private Attributes

FOOTPRINT_TREE_PANEm_treePane
 
LIB_TREE_MODEL_ADAPTER::PTR m_adapter
 
std::unique_ptr< MODULEm_copiedModule
 
std::unique_ptr< MODULEm_revertModule
 
wxString m_footprintNameWhenLoaded
 

Friends

struct PCB::IFACE
 

Detailed Description

Definition at line 43 of file footprint_edit_frame.h.

Constructor & Destructor Documentation

◆ ~FOOTPRINT_EDIT_FRAME()

FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME ( )

Definition at line 338 of file footprint_edit_frame.cpp.

References m_Layers, and retainLastFootprint().

339 {
340  // save the footprint in the PROJECT
342 
343  delete m_Layers;
344 }
PCB_LAYER_WIDGET * m_Layers
the layer manager

◆ FOOTPRINT_EDIT_FRAME()

FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME ( KIWAY aKiway,
wxWindow *  aParent,
EDA_DRAW_PANEL_GAL::GAL_TYPE  aBackend 
)
protected

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

Member Function Documentation

◆ 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 511 of file footprint_libraries_utils.cpp.

References DisplayError(), FRAME_PCB_MODULE_EDITOR, FRAME_PCB_MODULE_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().

512 {
513  wxFileName fn( aFilename );
514 
515  if( aFilename.IsEmpty() )
516  {
517  if( !LibraryFileBrowser( true, fn,
519  true ) )
520  {
521  return false;
522  }
523  }
524 
525  wxString libPath = fn.GetFullPath();
526  wxString libName = fn.GetName();
527 
528  if( libName.IsEmpty() )
529  return false;
530 
531  bool saveInGlobalTable = false;
532  bool saveInProjectTable = false;
533  wxArrayString libTableNames;
534 
535  libTableNames.Add( _( "Global" ) );
536  libTableNames.Add( _( "Project" ) );
537 
538  switch( SelectSingleOption( this, _( "Select Library Table" ),
539  _( "Choose the Library Table to add the library to:" ),
540  libTableNames ) )
541  {
542  case 0: saveInGlobalTable = true; break;
543  case 1: saveInProjectTable = true; break;
544  default: return false;
545  }
546 
547  wxString type = IO_MGR::ShowType( IO_MGR::GuessPluginTypeFromLibPath( libPath ) );
548 
549  // try to use path normalized to an environmental variable or project path
550  wxString normalizedPath = NormalizePath( libPath, &Pgm().GetLocalEnvVariables(), &Prj() );
551 
552  if( normalizedPath.IsEmpty() )
553  normalizedPath = libPath;
554 
555  try
556  {
557  if( saveInGlobalTable )
558  {
559  auto row = new FP_LIB_TABLE_ROW( libName, normalizedPath, type, wxEmptyString );
560  GFootprintTable.InsertRow( row );
562  }
563  else if( saveInProjectTable )
564  {
565  auto row = new FP_LIB_TABLE_ROW( libName, normalizedPath, type, wxEmptyString );
566  Prj().PcbFootprintLibs()->InsertRow( row );
567  Prj().PcbFootprintLibs()->Save( Prj().FootprintLibTblName() );
568  }
569  }
570  catch( const IO_ERROR& ioe )
571  {
572  DisplayError( this, ioe.What() );
573  return false;
574  }
575 
576  auto editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, false );
577 
578  if( editor )
579  editor->SyncLibraryTree( true );
580 
581  auto viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
582 
583  if( viewer )
584  viewer->ReCreateLibraryList();
585 
586  return true;
587 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
Class 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.
Component library viewer main window.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
static const wxString ShowType(PCB_FILE_T aFileType)
Function ShowType returns a brief name for a plugin, given aFileType enum.
Definition: io_mgr.cpp:77
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Function GuessPluginTypeFromLibPath returns a plugin type given a footprint library&#39;s libPath...
Definition: io_mgr.cpp:124
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: pcbnew.cpp:326
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:300
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)
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
wxString KiCadFootprintLibPathWildcard()
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:304
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
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:67
static wxString GetGlobalTableFileName()
Function GetGlobalTableFileName.

◆ AddMenuZoomAndGrid()

void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands.

Parameters
aMasterMenu= the menu to populate.

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

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

Referenced by EDA_DRAW_PANEL::OnRightClick().

1560 {
1561  int maxZoomIds;
1562  double zoom;
1563  wxString msg;
1564  BASE_SCREEN* screen = m_canvas->GetScreen();
1565 
1566  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
1567  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
1568  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
1569  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
1570  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
1571  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
1572  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
1573  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
1574  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
1575  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
1576 
1577 
1578  wxMenu* zoom_choice = new wxMenu;
1579  AddMenuItem( MasterMenu, zoom_choice,
1580  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
1581  KiBitmap( zoom_selection_xpm ) );
1582 
1583  zoom = screen->GetZoom();
1585  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
1586  maxZoomIds : screen->m_ZoomList.size();
1587 
1588  // Populate zoom submenu.
1589  for( int i = 0; i < maxZoomIds; i++ )
1590  {
1591  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
1592 
1593  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
1594  wxEmptyString, wxITEM_CHECK );
1595  if( zoom == screen->m_ZoomList[i] )
1596  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
1597  }
1598 
1599  // Create grid submenu as required.
1600  if( screen->GetGridCount() )
1601  {
1602  wxMenu* gridMenu = new wxMenu;
1603  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
1604  _( "Grid" ), KiBitmap( grid_select_xpm ) );
1605 
1606  wxArrayString gridsList;
1607  int icurr = screen->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES );
1608 
1609  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
1610  {
1611  GRID_TYPE& grid = screen->GetGrid( i );
1612  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
1613 
1614  if( (int)i == icurr )
1615  gridMenu->Check( grid.m_CmdId, true );
1616  }
1617  }
1618 
1619  MasterMenu->AppendSeparator();
1620  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
1621 }
virtual BASE_SCREEN * GetScreen()=0
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:108
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:290
Definition: common.h:161
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:118
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Class GRID_TYPE is for grid arrays.
Definition: base_screen.h:45
size_t i
Definition: json11.cpp:597
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int m_CmdId
Definition: base_screen.h:48
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219

◆ AddModuleToBoard()

void FOOTPRINT_EDIT_FRAME::AddModuleToBoard ( MODULE module)
overridevirtual

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

Reimplemented from PCB_BASE_FRAME.

Definition at line 442 of file footprint_edit_frame.cpp.

References PCB_BASE_FRAME::AddModuleToBoard(), MODULE::Clone(), MODULE::GetFPID(), LIB_ID::GetLibItemName(), m_footprintNameWhenLoaded, m_revertModule, and MODULE::SetPadsLocked().

Referenced by Import_Module(), restoreLastFootprint(), and RevertFootprint().

443 {
444  m_revertModule.reset( (MODULE*) aFootprint->Clone() );
445 
446  m_footprintNameWhenLoaded = aFootprint->GetFPID().GetLibItemName();
447 
448  // Pads are always editable in Footprint Editor
449  aFootprint->SetPadsLocked( false );
450 
452 }
virtual void AddModuleToBoard(MODULE *module)
Adds the given module to the board.
std::unique_ptr< MODULE > m_revertModule

◆ AddPad()

void PCB_BASE_FRAME::AddPad ( MODULE Module,
bool  draw 
)
inherited

Definition at line 111 of file pad_edit_functions.cpp.

References MODULE::CalculateBoundingBox(), D_PAD::GetAttribute(), MODULE::GetBoundingBox(), EDA_DRAW_FRAME::GetCrossHairPosition(), PCB_BASE_FRAME::GetDesignSettings(), D_PAD::GetName(), GetNextPadName(), MODULE::GetOrientation(), MODULE::GetPosition(), D_PAD::GetPosition(), PCB_BASE_FRAME::Import_Pad_Settings(), EDA_DRAW_FRAME::m_canvas, BOARD_DESIGN_SETTINGS::m_Pad_Master, PCB_BASE_FRAME::m_Pcb, BOARD::m_Status_Pcb, PAD_ATTRIB_HOLE_NOT_PLATED, MODULE::PadsList(), DLIST< T >::PushBack(), EDA_DRAW_PANEL::RefreshDrawingRect(), RotatePoint(), MODULE::SetLastEditTime(), EDA_DRAW_FRAME::SetMsgPanel(), D_PAD::SetName(), D_PAD::SetPos0(), and D_PAD::SetPosition().

Referenced by OnLeftClick().

112 {
113  m_Pcb->m_Status_Pcb = 0;
114  aModule->SetLastEditTime();
115 
116  D_PAD* pad = new D_PAD( aModule );
117 
118  // Add the new pad to end of the module pad list.
119  aModule->PadsList().PushBack( pad );
120 
121  // Update the pad properties,
122  // and keep NETINFO_LIST::ORPHANED as net info
123  // which is the default when nets cannot be handled.
124  Import_Pad_Settings( pad, false );
125 
127 
128  // Set the relative pad position
129  // ( pad position for module orient, 0, and relative to the module position)
130 
131  wxPoint pos0 = pad->GetPosition() - aModule->GetPosition();
132  RotatePoint( &pos0, -aModule->GetOrientation() );
133  pad->SetPos0( pos0 );
134 
135  /* NPTH pads take empty pad number (since they can't be connected),
136  * other pads get incremented from the last one edited */
137  wxString padName;
138 
141 
142  pad->SetName( padName );
144 
145  aModule->CalculateBoundingBox();
146  SetMsgPanel( pad );
147 
148  if( draw )
149  m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() );
150 }
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:219
virtual void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:412
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12)...
Definition: class_pad.h:182
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:262
const wxString & GetName() const
Definition: class_pad.h:190
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
const wxPoint GetPosition() const override
Definition: class_pad.h:220
static wxString GetNextPadName(wxString aPadName)
void Import_Pad_Settings(D_PAD *aPad, bool aDraw)
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241

◆ AdjustScrollBars()

void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint &  aCenterPosition)
inherited

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

1017 {
1018 }

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

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

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

880 {
881  if( m_messagePanel == NULL )
882  return;
883 
884  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
885 }
int color
Definition: DXF_plotter.cpp:62
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:166
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

◆ Begin_Edge_Module()

EDGE_MODULE * FOOTPRINT_EDIT_FRAME::Begin_Edge_Module ( EDGE_MODULE Edge,
wxDC *  DC,
STROKE_T  type_edge 
)

Creates a new edge item (line, arc ..).

Parameters
Edge= if NULL: create new edge else terminate edge and create a new edge
DC= current Device Context
type_edge= S_SEGMENT,S_ARC ..
Returns
the new created edge.

Definition at line 294 of file edgemod.cpp.

References Abort_Move_ModuleOutline(), ArcValue, MODULE::CalculateBoundingBox(), EDA_ITEM::ClearFlags(), EDGE_MODULE::Draw(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetBoard(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetDesignSettings(), BOARD_ITEM::GetLayer(), MODULE::GetOrientation(), MODULE::GetPosition(), DRAWSEGMENT::GetShape(), DRAWSEGMENT::GetStart(), EDGE_MODULE::GetStart0(), GR_OR, MODULE::GraphicalItemsList(), DLIST< T >::Insert(), IS_NEW, EDA_DRAW_FRAME::m_canvas, EDGE_MODULE::m_End0, BOARD::m_Modules, EDGE_MODULE::m_Start0, MoveVector, BOARD_ITEM::Next(), OnModify(), DLIST< T >::PushFront(), RotatePoint(), S_ARC, S_SEGMENT, PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), DRAWSEGMENT::SetAngle(), DRAWSEGMENT::SetEnd(), EDGE_MODULE::SetEnd0(), EDA_ITEM::SetFlags(), MODULE::SetLastEditTime(), BOARD_ITEM::SetLayer(), EDA_DRAW_PANEL::SetMouseCapture(), DRAWSEGMENT::SetShape(), DRAWSEGMENT::SetStart(), EDGE_MODULE::SetStart0(), DRAWSEGMENT::SetWidth(), ShowNewEdgeModule(), and UR_CHANGED.

Referenced by OnLeftClick().

297 {
298  MODULE* module = GetBoard()->m_Modules;
299 
300  if( module == NULL )
301  return NULL;
302 
303  if( aEdge == NULL ) // Start a new edge item
304  {
305  SaveCopyInUndoList( module, UR_CHANGED );
306 
307  aEdge = new EDGE_MODULE( module );
308  MoveVector.x = MoveVector.y = 0;
309 
310  // Add the new item to the Drawings list head
311  module->GraphicalItemsList().PushFront( aEdge );
312 
313  // Update characteristics of the segment or arc.
314  aEdge->SetFlags( IS_NEW );
315  aEdge->SetAngle( 0 );
316  aEdge->SetShape( type_edge );
317 
318  if( aEdge->GetShape() == S_ARC )
319  aEdge->SetAngle( ArcValue );
320 
321  aEdge->SetWidth( GetDesignSettings().GetLineThickness( GetActiveLayer() ) );
322  aEdge->SetLayer( GetActiveLayer() );
323 
324  // Initialize the starting point of the new segment or arc
325  aEdge->SetStart( GetCrossHairPosition() );
326 
327  // Initialize the ending point of the new segment or arc
328  aEdge->SetEnd( aEdge->GetStart() );
329 
330  // Initialize the relative coordinates
331  aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
332 
333  RotatePoint( &aEdge->m_Start0, -module->GetOrientation() );
334 
335  aEdge->m_End0 = aEdge->m_Start0;
336  module->CalculateBoundingBox();
338  }
339  /* Segment creation in progress.
340  * The ending coordinate is updated by the function
341  * ShowNewEdgeModule() called on move mouse event
342  * during the segment creation
343  */
344  else
345  {
346  if( type_edge == S_SEGMENT )
347  {
348  if( aEdge->m_Start0 != aEdge->m_End0 )
349  {
350  aEdge->Draw( m_canvas, DC, GR_OR );
351 
352  EDGE_MODULE* newedge = new EDGE_MODULE( *aEdge );
353 
354  // insert _after_ aEdge, which is the same as inserting before aEdge->Next()
355  module->GraphicalItemsList().Insert( newedge, aEdge->Next() );
356  aEdge->ClearFlags();
357 
358  aEdge = newedge; // point now new item
359 
360  aEdge->SetFlags( IS_NEW );
361  aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
362  aEdge->SetStart( GetCrossHairPosition() );
363  aEdge->SetEnd( aEdge->GetStart() );
364 
365  // Update relative coordinate.
366  aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
367 
368  wxPoint pt( aEdge->GetStart0() );
369 
370  RotatePoint( &pt, -module->GetOrientation() );
371 
372  aEdge->SetStart0( pt );
373 
374  aEdge->SetEnd0( aEdge->GetStart0() );
375 
376  module->CalculateBoundingBox();
377  module->SetLastEditTime();
378  OnModify();
379  }
380  }
381  else
382  {
383  wxLogDebug( wxT( "Begin_Edge() error" ) );
384  }
385  }
386 
387  return aEdge;
388 }
double GetOrientation() const
Definition: class_module.h:188
static void Abort_Move_ModuleOutline(EDA_DRAW_PANEL *Panel, wxDC *DC)
Definition: edgemod.cpp:267
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void PushFront(T *aNewElement)
Function PushFront puts aNewElement at front of list sequence.
Definition: dlist.h:240
static wxPoint MoveVector
Definition: edgemod.cpp:58
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
usual segment : line with rounded ends
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
static double ArcValue
Definition: edgemod.cpp:57
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
virtual void OnModify() override
Must be called after a footprint change in order to set the "modify" flag of the current screen and p...
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
Arcs (with rounded ends)
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
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.
Definition: undo_redo.cpp:202
static void ShowNewEdgeModule(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool erase)
Definition: edgemod.cpp:126
Definition: gr_basic.h:38
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
DLIST< MODULE > m_Modules
Definition: class_board.h:249
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165
BOARD * GetBoard() const
const wxPoint GetPosition() const override
Definition: class_module.h:183
void Insert(T *aNewElement, T *aElementAfterMe)
Function Insert puts aNewElement just in front of aElementAfterMe in the list sequence.
Definition: dlist.h:200
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

◆ BestZoom()

double FOOTPRINT_EDIT_FRAME::BestZoom ( )
overridevirtual

Function BestZoom.

Returns
the "best" zoom to show the entire board or footprint on the screen.

Reimplemented from PCB_BASE_FRAME.

Definition at line 526 of file footprint_edit_frame.cpp.

References EDA_DRAW_FRAME::bestZoom(), EDA_RECT::Centre(), PCB_BASE_FRAME::GetBoardBoundingBox(), EDA_RECT::GetHeight(), and EDA_RECT::GetWidth().

527 {
528  EDA_RECT ibbbox = GetBoardBoundingBox();
529 
530  double sizeX = (double) ibbbox.GetWidth();
531  double sizeY = (double) ibbbox.GetHeight();
532 
533  wxPoint centre = ibbbox.Centre();
534 
535  // Reserve a 20% margin around "board" bounding box.
536  double margin_scale_factor = 1.2;
537  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
538 }
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
int GetWidth() const
Definition: eda_rect.h:117
EDA_RECT GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge se...
int GetHeight() const
Definition: eda_rect.h:118
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint Centre() const
Definition: eda_rect.h:60

◆ bestZoom()

double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited

◆ BlockCommand()

int FOOTPRINT_EDIT_FRAME::BlockCommand ( EDA_KEY  aKey)
overridevirtual

Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse.

Parameters
aKey= the key modifiers (Alt, Shift ...)
Returns
the block command id (BLOCK_MOVE, BLOCK_COPY...)

Reimplemented from EDA_DRAW_FRAME.

Definition at line 80 of file block_footprint_editor.cpp.

References BLOCK_DELETE, BLOCK_DUPLICATE, BLOCK_MIRROR_Y, BLOCK_MOVE, BLOCK_PRESELECT_MOVE, BLOCK_ROTATE, BLOCK_ZOOM, EDA_KEY_C, GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, GR_KB_SHIFTCTRL, GR_KEY_INVALID, and MOUSE_MIDDLE.

81 {
82  int cmd;
83 
84  switch( key )
85  {
86  default:
87  cmd = key & 0xFF;
88  break;
89 
90  case EDA_KEY_C( 0xffffffff ): // -1
91  // Historically, -1 has been used as a key, which can cause bit flag
92  // clashes with unaware code. On debug builds, catch any old code that
93  // might still be doing this. TODO: remove if sure all this old code is gone.
94  wxFAIL_MSG( "negative EDA_KEY value should be converted to GR_KEY_INVALID" );
95  // fall through on release builds
96 
97  case GR_KEY_INVALID:
99  break;
100 
101  case 0:
102  cmd = BLOCK_MOVE;
103  break;
104 
105  case GR_KB_ALT:
106  cmd = BLOCK_MIRROR_Y;
107  break;
108 
109  case GR_KB_SHIFTCTRL:
110  cmd = BLOCK_DELETE;
111  break;
112 
113  case GR_KB_SHIFT:
114  cmd = BLOCK_DUPLICATE;
115  break;
116 
117  case GR_KB_CTRL:
118  cmd = BLOCK_ROTATE;
119  break;
120 
121  case MOUSE_MIDDLE:
122  cmd = BLOCK_ZOOM;
123  break;
124  }
125 
126  return cmd;
127 }
#define GR_KB_ALT
#define MOUSE_MIDDLE
#define GR_KB_CTRL
#define EDA_KEY_C
#define GR_KEY_INVALID
#define GR_KB_SHIFT
#define GR_KB_SHIFTCTRL

◆ build_ratsnest_module()

void PCB_BASE_FRAME::build_ratsnest_module ( MODULE aModule,
wxPoint  aMoveVector 
)
inherited

Function build_ratsnest_module Build a ratsnest relative to one footprint.

This is a simplified computation used only in move footprint. It is not optimal, but it is fast and sufficient to help a footprint placement It shows the connections from a pad to the nearest connected pad

Parameters
aMoveVector= move vector of the footprint being moved.
aModule= module to consider.

Definition at line 193 of file ratsnest.cpp.

References PCB_BASE_FRAME::GetBoard(), BOARD::GetConnectivity(), MODULE::Move(), and movedModule.

Referenced by MODULE::DrawOutlinesWhenMoving().

194 {
195  auto connectivity = GetBoard()->GetConnectivity();
196 
197  movedModule = *aModule;
198  movedModule.Move( -aMoveVector );
199  connectivity->ClearDynamicRatsnest();
200  connectivity->BlockRatsnestItems( { aModule } );
201  connectivity->ComputeDynamicRatsnest( { &movedModule } );
202 }
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:297
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
BOARD * GetBoard() const
static MODULE movedModule(nullptr)

◆ BuildAirWiresTargetsList()

void PCB_BASE_FRAME::BuildAirWiresTargetsList ( BOARD_CONNECTED_ITEM aItemRef,
const wxPoint &  aPosition,
int  aNet 
)
inherited

Function BuildAirWiresTargetsList Build a list of candidates that can be a coonection point when a track is started.

This functions prepares data to show airwires to nearest connecting points (pads) from the current new track to candidates during track creation

Parameters
aItemRef= the item connected to the starting point of the new track (track or pad)
aPosition= the position of the new track end (usually the mouse cursor on grid)
aNet= the netcode of the track

Definition at line 182 of file ratsnest.cpp.

References s_CursorPos, s_ref, and s_refNet.

Referenced by PCB_EDIT_FRAME::Begin_Route(), and ShowNewTrackWhenMovingCursor().

184 {
185  s_CursorPos = aPosition; // needed for sort_by_distance
186  s_ref = aItemRef;
187  s_refNet = aNet;
188 }
static wxPoint s_CursorPos
Definition: ratsnest.cpp:169
static int s_refNet
Definition: ratsnest.cpp:180
static BOARD_CONNECTED_ITEM * s_ref
Definition: ratsnest.cpp:179

◆ CheckForAutoSaveFile()

void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName,
const wxString &  aBackupFileExtension 
)
inherited

Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input.

If an auto save file exists for aFileName, the user is prompted if they wish to replace file aFileName with the auto saved file. If the user chooses to replace the file, the backup file of aFileName is removed, aFileName is renamed to the backup file name, and the auto save file is renamed to aFileName. If user chooses to keep the existing version of aFileName, the auto save file is removed.

Parameters
aFileNameA wxFileName object containing the file name to check.
aBackupFileExtensionA wxString object containing the backup file extension used to create the backup file name.

Definition at line 585 of file eda_base_frame.cpp.

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

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

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

◆ Clear_Pcb()

bool FOOTPRINT_EDIT_FRAME::Clear_Pcb ( bool  aQuery)

Delete all and reinitialize the current board.

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

Definition at line 94 of file initpcb.cpp.

References BASE_SCREEN::ClearUndoRedoList(), BASE_SCREEN::ClrModify(), PCB_BASE_FRAME::GetBoard(), GetDesignSettings(), PCB_BASE_FRAME::GetPageSizeIU(), PCB_BASE_FRAME::GetScreen(), HandleUnsavedChanges(), BASE_SCREEN::InitDataPoints(), SaveFootprint(), PCB_BASE_EDIT_FRAME::SetBoard(), PCB_BASE_FRAME::SetCurItem(), BOARD::SetDesignSettings(), BOARD::SetFileName(), BOARD::SynchronizeNetsAndNetClasses(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by OnCloseWindow(), and RevertFootprint().

95 {
96  if( GetBoard() == NULL )
97  return false;
98 
99  if( aQuery && GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
100  {
101  wxSafeYield( this, true ); // Allow frame to come to front before showing warning.
102 
103  if( !HandleUnsavedChanges( this, _( "The current footprint has been modified. Save changes?" ),
104  [&]()->bool { return SaveFootprint( GetBoard()->m_Modules ); } ) )
105  {
106  return false;
107  }
108  }
109 
110  // Clear undo and redo lists because we want a full deletion
112  GetScreen()->ClrModify();
113 
114  BOARD* board = new BOARD;
115 
116  // Transfer current design settings
117  if( GetBoard() )
119 
121  SetBoard( board );
122 
123  SetCurItem( NULL );
124 
125  // clear filename, to avoid overwriting an old file
126  GetBoard()->SetFileName( wxEmptyString );
127 
129 
130  Zoom_Automatique( false );
131 
132  return true;
133 }
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Function HandleUnsavedChanges displays a dialog with Save, Cancel and Discard Changes buttons...
Definition: confirm.cpp:213
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:72
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
Definition: netclass.cpp:155
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...
virtual void ClearUndoRedoList()
Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are del...
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aDesignSettings)
Function SetDesignSettings.
Definition: class_board.h:549
void SetFileName(const wxString &aFileName)
Definition: class_board.h:236
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
virtual void SetBoard(BOARD *aBoard) override
>
bool SaveFootprint(MODULE *aModule)
Save in an existing library a given footprint.
void ClrModify()
Definition: base_screen.h:325
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

◆ ClearMsgPanel()

◆ CloseModuleEditor()

void FOOTPRINT_EDIT_FRAME::CloseModuleEditor ( wxCommandEvent &  Event)

Definition at line 571 of file footprint_edit_frame.cpp.

572 {
573  Close();
574 }

◆ CommonSettingsChanged()

void FOOTPRINT_EDIT_FRAME::CommonSettingsChanged ( )
overridevirtual

Called after the preferences dialog is run.

Reimplemented from EDA_BASE_FRAME.

Definition at line 1045 of file footprint_edit_frame.cpp.

References PCB_BASE_FRAME::CommonSettingsChanged().

1046 {
1048 
1049  Layout();
1050  SendSizeEvent();
1051 }
void CommonSettingsChanged() override
Function CommonSettingsChanged Notification event that some of the common (suite-wide) settings have ...

◆ Compile_Ratsnest()

void PCB_BASE_FRAME::Compile_Ratsnest ( wxDC *  aDC,
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 53 of file ratsnest.cpp.

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

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Duplicate(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), PCB_EDIT_FRAME::Change_Side_Module(), PCB_EDIT_FRAME::Clean_Pcb(), PCB_EDIT_FRAME::Delete_Module(), PCB_EDIT_FRAME::ExportToGenCAD(), DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), PCB_EDIT_FRAME::OnSelectTool(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), PCB_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::RemoveMisConnectedTracks(), PCB_BASE_FRAME::Rotate_Module(), PCB_BASE_FRAME::TestNetConnection(), and PANEL_SETUP_LAYERS::TransferDataFromWindow().

54 {
55  GetBoard()->GetConnectivity()->RecalculateRatsnest();
56 
57  GetBoard()->m_Status_Pcb = 0; // we want a full ratsnest computation, from the scratch
58 
59  if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && aDC )
60  DrawGeneralRatsnest( aDC, 0 );
61 
62  wxString msg;
63 
64  ClearMsgPanel();
65 
66  if( aDisplayStatus )
67  {
68  std::shared_ptr<CONNECTIVITY_DATA> conn = m_Pcb->GetConnectivity();
69 
70  msg.Printf( wxT( " %d" ), conn->GetPadCount() );
71  AppendMsgPanel( _( "Pads" ), msg, RED );
72 
73  msg.Printf( wxT( " %d" ), conn->GetNetCount() - 1 /* Don't include "No Net" in count */ );
74  AppendMsgPanel( _( "Nets" ), msg, CYAN );
75 
76  SetMsgPanel( m_Pcb );
77  }
78 }
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void DrawGeneralRatsnest(wxDC *aDC, int aNetcode=0)
function Displays the general ratsnest Only ratsnest with the status bit CH_VISIBLE is set are displa...
Definition: ratsnest.cpp:88
Definition: colors.h:59
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:297
Definition: colors.h:60
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
BOARD * GetBoard() const
void ClearMsgPanel(void)
Clear all messages from the message panel.
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241

◆ config()

wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited

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

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 360 of file eda_base_frame.cpp.

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

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

361 {
362  // KICAD_MANAGER_FRAME overrides this
363  wxConfigBase* ret = Kiface().KifaceSettings();
364  //wxASSERT( ret );
365  return ret;
366 }
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52

◆ ConfigBaseName()

wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited

Function ConfigBaseName.

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

Definition at line 269 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

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

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

◆ CopyToClipboard()

void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)
inherited

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

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

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

1664 {
1665  DrawPageOnClipboard( this );
1666 
1667  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
1668  {
1669  // fixme-gal
1670  //if( GetScreen()->IsBlockActive() )
1671  //m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
1672 
1674  }
1675 }
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126

◆ CreateAndShow3D_Frame()

bool PCB_BASE_FRAME::CreateAndShow3D_Frame ( bool  aForceRecreateIfNotOwner)
virtualinherited

Shows the 3D view frame.

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

Parameters
aForceRecreateIfNotOwner= true to recreate the 3D frame viewer, when the owner is not me
Returns
true if it is shown with me as owner

Definition at line 436 of file pcb_base_frame.cpp.

References KIWAY_PLAYER::Destroy(), PCB_BASE_FRAME::Get3DViewerFrame(), KIWAY_HOLDER::Kiway(), and EDA_3D_VIEWER::Parent().

Referenced by DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), and Show3D_Frame().

437 {
438  EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
439 
440  // Ensure the viewer was created by me, and not by another editor:
441  PCB_BASE_FRAME* owner = draw3DFrame ? draw3DFrame->Parent() : nullptr;
442 
443  // if I am not the owner, do not use the current viewer instance
444  if( draw3DFrame && this != owner )
445  {
446  if( aForceRecreateIfNotOwner )
447  {
448  draw3DFrame->Destroy();
449  draw3DFrame = nullptr;
450  }
451  else
452  return false;
453  }
454 
455  if( !draw3DFrame )
456  {
457  draw3DFrame = new EDA_3D_VIEWER( &Kiway(), this, _( "3D Viewer" ) );
458  draw3DFrame->Raise(); // Needed with some Window Managers
459  draw3DFrame->Show( true );
460  return true;
461  }
462 
463  // Raising the window does not show the window on Windows if iconized.
464  // This should work on any platform.
465  if( draw3DFrame->IsIconized() )
466  draw3DFrame->Iconize( false );
467 
468  draw3DFrame->Raise();
469 
470  // Raising the window does not set the focus on Linux. This should work on any platform.
471  if( wxWindow::FindFocus() != draw3DFrame )
472  draw3DFrame->SetFocus();
473 
474  return true;
475 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
PCB_BASE_FRAME * Parent() const
Definition: eda_3d_viewer.h:60
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard. ...
Definition: eda_3d_viewer.h:49
EDA_3D_VIEWER * Get3DViewerFrame()
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...

◆ createArray()

void PCB_BASE_EDIT_FRAME::createArray ( )
protectedinherited

Function createArray Create an array of the selected item (invokes the dialogue) This function is shared between pcbnew and modedit, as it is virtually the same.

Definition at line 1667 of file edit.cpp.

References ARRAY_CREATOR::Invoke().

Referenced by PCB_EDIT_FRAME::Process_Special_Functions().

1668 {
1669  LEGACY_ARRAY_CREATOR array_creator( *this );
1670 
1671  array_creator.Invoke();
1672 }

◆ 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 418 of file footprint_libraries_utils.cpp.

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

Referenced by PCB_EDIT_FRAME::ArchiveModulesOnBoard().

419 {
420  // Kicad cannot write legacy format libraries, only .pretty new format
421  // because the legacy format cannot handle current features.
422  // The footprint library is actually a directory
423 
424  wxString initialPath = wxPathOnly( Prj().GetProjectFullName() );
425  wxFileName fn;
426  bool doAdd = false;
427 
428  if( aLibName.IsEmpty() )
429  {
430  fn = initialPath;
431 
432  if( !LibraryFileBrowser( false, fn,
434  true ) )
435  {
436  return wxEmptyString;
437  }
438 
439  doAdd = true;
440  }
441  else
442  {
443  fn = aLibName;
444 
445  if( !fn.IsAbsolute() )
446  {
447  fn.SetName( aLibName );
448  fn.MakeAbsolute( initialPath );
449  }
450 
451  // Enforce the .pretty extension:
452  fn.SetExt( KiCadFootprintLibPathExtension );
453  }
454 
455  // We can save fp libs only using IO_MGR::KICAD_SEXP format (.pretty libraries)
457  wxString libPath = fn.GetFullPath();
458 
459  try
460  {
461  PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
462 
463  bool writable = false;
464  bool exists = false;
465 
466  try
467  {
468  writable = pi->IsFootprintLibWritable( libPath );
469  exists = true; // no exception was thrown, lib must exist.
470  }
471  catch( const IO_ERROR& )
472  { }
473 
474  if( exists )
475  {
476  if( !writable )
477  {
478  wxString msg = wxString::Format( FMT_LIB_READ_ONLY, libPath );
479  DisplayError( this, msg );
480  return wxEmptyString;
481  }
482  else
483  {
484  wxString msg = wxString::Format( _( "Library %s already exists." ), libPath );
485  KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
486  dlg.SetOKLabel( _( "Overwrite" ) );
487  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
488 
489  if( dlg.ShowModal() == wxID_CANCEL )
490  return wxEmptyString;
491 
492  pi->FootprintLibDelete( libPath );
493  }
494  }
495 
496  pi->FootprintLibCreate( libPath );
497  }
498  catch( const IO_ERROR& ioe )
499  {
500  DisplayError( this, ioe.What() );
501  return wxEmptyString;
502  }
503 
504  if( doAdd )
505  AddLibrary( libPath );
506 
507  return libPath;
508 }
Helper class to create more flexible dialogs, including &#39;do not show again&#39; checkbox handling...
Definition: confirm.h:44
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:568
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)
#define FMT_LIB_READ_ONLY
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
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
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 DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
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

◆ 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 1027 of file footprint_libraries_utils.cpp.

References DisplayInfoMessage(), FMT_MOD_CREATE, FMT_MOD_REF, FMT_NO_REF_ABORTED, PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetTextItalic(), BOARD_DESIGN_SETTINGS::GetTextSize(), BOARD_DESIGN_SETTINGS::GetTextThickness(), BOARD_DESIGN_SETTINGS::GetTextUpright(), BOARD_DESIGN_SETTINGS::m_RefDefaultlayer, BOARD_DESIGN_SETTINGS::m_RefDefaultText, BOARD_DESIGN_SETTINGS::m_RefDefaultVisibility, BOARD_DESIGN_SETTINGS::m_ValueDefaultlayer, BOARD_DESIGN_SETTINGS::m_ValueDefaultText, BOARD_DESIGN_SETTINGS::m_ValueDefaultVisibility, MODULE::Reference(), MODULE::SetFPID(), EDA_TEXT::SetItalic(), TEXTE_MODULE::SetKeepUpright(), MODULE::SetLastEditTime(), BOARD_ITEM::SetLayer(), EDA_DRAW_FRAME::SetMsgPanel(), TEXTE_MODULE::SetPosition(), MODULE::SetReference(), EDA_TEXT::SetTextSize(), WX_TEXT_ENTRY_DIALOG::SetTextValidator(), EDA_TEXT::SetThickness(), MODULE::SetValue(), EDA_TEXT::SetVisible(), ToLAYER_ID(), and MODULE::Value().

Referenced by MWAVE::CreateMicrowaveInductor(), and PCB_EDIT_FRAME::CreateMuWaveBaseFootprint().

1028 {
1029  // Creates a new footprint at position 0,0 which contains the minimal items:
1030  // the reference and the value.
1031  // Value : initialized to the footprint name.
1032  // put on fab layer (front side)
1033  // Reference : initialized to a default value (REF**).
1034  // put on silkscreen layer (front side)
1035 
1036  wxString moduleName = aModuleName;
1037 
1038  // Ask for the new module name
1039  if( moduleName.IsEmpty() )
1040  {
1041  WX_TEXT_ENTRY_DIALOG dlg( this, FMT_MOD_REF, FMT_MOD_CREATE, moduleName );
1042  dlg.SetTextValidator( FILE_NAME_CHAR_VALIDATOR( &moduleName ) );
1043 
1044  if( dlg.ShowModal() != wxID_OK )
1045  return NULL; //Aborted by user
1046  }
1047 
1048  moduleName.Trim( true );
1049  moduleName.Trim( false );
1050 
1051  if( moduleName.IsEmpty() )
1052  {
1054  return NULL;
1055  }
1056 
1057  // Creates the new module and add it to the head of the linked list of modules
1058  MODULE* module = new MODULE( GetBoard() );
1059 
1060  // Update parameters: timestamp ...
1061  module->SetLastEditTime();
1062 
1063  // Update its name in lib
1064  module->SetFPID( LIB_ID( wxEmptyString, moduleName ) );
1065 
1066  wxPoint default_pos;
1068 
1069  // Update reference:
1070  if( settings.m_RefDefaultText.IsEmpty() )
1071  module->SetReference( moduleName );
1072  else
1073  module->SetReference( settings.m_RefDefaultText );
1074 
1075  PCB_LAYER_ID layer = ToLAYER_ID( settings.m_RefDefaultlayer );
1076  module->Reference().SetThickness( settings.GetTextThickness( layer ) );
1077  module->Reference().SetTextSize( settings.GetTextSize( layer ) );
1078  module->Reference().SetItalic( settings.GetTextItalic( layer ) );
1079  module->Reference().SetKeepUpright( settings.GetTextUpright( layer ) );
1080  default_pos.y = GetDesignSettings().GetTextSize( layer ).y / 2;
1081  module->Reference().SetPosition( default_pos );
1082  module->Reference().SetLayer( layer );
1083  module->Reference().SetVisible( settings.m_RefDefaultVisibility );
1084 
1085  // Set the value field to a default value
1086  if( settings.m_ValueDefaultText.IsEmpty() )
1087  module->SetValue( moduleName );
1088  else
1089  module->SetValue( settings.m_ValueDefaultText );
1090 
1091  layer = ToLAYER_ID( settings.m_ValueDefaultlayer );
1092  module->Value().SetThickness( settings.GetTextThickness( layer ) );
1093  module->Value().SetTextSize( settings.GetTextSize( layer ) );
1094  module->Value().SetItalic( settings.GetTextItalic( layer ) );
1095  module->Value().SetKeepUpright( settings.GetTextUpright( layer ) );
1096  default_pos.y = -default_pos.y;
1097  module->Value().SetPosition( default_pos );
1098  module->Value().SetLayer( layer );
1099  module->Value().SetVisible( settings.m_ValueDefaultVisibility );
1100 
1101  SetMsgPanel( module );
1102  return module;
1103 }
wxString m_RefDefaultText
Default ref text on fp creation.
bool m_ValueDefaultVisibility
Default value text visibility on fp creation.
void SetKeepUpright(bool aKeepUpright)
TEXTE_MODULE & Reference()
Definition: class_module.h:512
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetItalic(bool isItalic)
Definition: eda_text.h:182
void SetVisible(bool aVisible)
Definition: eda_text.h:188
int m_ValueDefaultlayer
Default value text layer on fp creation.
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:227
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...
Class FILE_NAME_CHAR_VALIDATOR.
Definition: validators.h:63
bool GetTextUpright(PCB_LAYER_ID aLayer) const
bool GetTextItalic(PCB_LAYER_ID aLayer) const
#define FMT_NO_REF_ABORTED
PCB_LAYER_ID
A quick note on layer IDs:
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:511
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:472
virtual void SetPosition(const wxPoint &aPos) override
wxString m_ValueDefaultText
Default value text on fp creation.
void SetValue(const wxString &aValue)
Function SetValue.
Definition: class_module.h:505
int m_RefDefaultlayer
Default ref text layer on fp creation.
BOARD * GetBoard() const
#define FMT_MOD_CREATE
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:277
bool m_RefDefaultVisibility
Default ref text visibility on fp creation.
void SetFPID(const LIB_ID &aFPID)
Definition: class_module.h:193
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:813
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Function GetTextSize Returns the default text size from the layer class for the given layer...
void SetThickness(int aNewThickness)
Function SetThickness sets pen width.
Definition: eda_text.h:161
#define FMT_MOD_REF
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

◆ CreateServer()

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

Definition at line 49 of file eda_dde.cpp.

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

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

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

◆ CreateTextModule()

TEXTE_MODULE * FOOTPRINT_EDIT_FRAME::CreateTextModule ( MODULE aModule,
wxDC *  aDC 
)
protected

Creates a new text for the footprint.

Parameters
aModuleis the owner of the text
aDCis the current DC (can be NULL )
Returns
a pointer to the new text, or NULL if aborted

Definition at line 66 of file edtxtmod.cpp.

References LSET::AllTechMask(), EDA_ITEM::ClearFlags(), TEXTE_MODULE::Draw(), PCB_BASE_FRAME::GetActiveLayer(), EDA_TEXT::GetText(), GR_OR, MODULE::GraphicalItemsList(), PCB_BASE_EDIT_FRAME::InstallTextOptionsFrame(), IS_NEW, EDA_DRAW_FRAME::m_canvas, DLIST< T >::PushFront(), EDA_ITEM::SetFlags(), BOARD_ITEM::SetLayer(), and EDA_DRAW_FRAME::SetMsgPanel().

Referenced by OnLeftClick().

67 {
68  TEXTE_MODULE* text = new TEXTE_MODULE( aModule );
69 
70  text->SetFlags( IS_NEW );
71 
72  if( LSET::AllTechMask().test( GetActiveLayer() ) ) // i.e. a possible layer for a text
73  text->SetLayer( GetActiveLayer() );
74 
75  InstallTextOptionsFrame( text, NULL );
76 
77  if( text->GetText().IsEmpty() )
78  {
79  delete text;
80  return NULL;
81  }
82 
83  // Add the new text object to the beginning of the footprint draw list.
84  if( aModule )
85  aModule->GraphicalItemsList().PushFront( text );
86 
87  text->ClearFlags();
88 
89  if( aDC )
90  text->Draw( m_canvas, aDC, GR_OR );
91 
92  SetMsgPanel( text );
93 
94  return text;
95 }
void PushFront(T *aNewElement)
Function PushFront puts aNewElement at front of list sequence.
Definition: dlist.h:240
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side...
Definition: lset.cpp:746
void InstallTextOptionsFrame(BOARD_ITEM *aText, wxDC *aDC)
Routine for main window class to launch text properties dialog.
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw Draw the text according to the footprint pos and orient.
Definition: gr_basic.h:38
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165

◆ Delete_Edge_Module()

void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module ( EDGE_MODULE Edge)

Delete EDGE_MODULE ddge.

Parameters
Edge= edge to delete

Definition at line 244 of file edgemod.cpp.

References MODULE::CalculateBoundingBox(), BOARD_ITEM::DeleteStructure(), BOARD_ITEM::GetParent(), OnModify(), PCB_MODULE_EDGE_T, MODULE::SetLastEditTime(), and EDA_ITEM::Type().

245 {
246  if( aEdge == NULL )
247  return;
248 
249  if( aEdge->Type() != PCB_MODULE_EDGE_T )
250  {
251  wxLogDebug( wxT( "StructType error: PCB_MODULE_EDGE_T expected" ) );
252  return;
253  }
254 
255  MODULE* module = (MODULE*) aEdge->GetParent();
256 
257  // Delete segment.
258  aEdge->DeleteStructure();
259  module->SetLastEditTime();
260  module->CalculateBoundingBox();
261  OnModify();
262 }
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void DeleteStructure()
Function DeleteStructure deletes this object after UnLink()ing it from its owner if it has one...
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
virtual void OnModify() override
Must be called after a footprint change in order to set the "modify" flag of the current screen and p...
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
BOARD_ITEM_CONTAINER * GetParent() const

◆ DeleteModuleFromLibrary()

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

Delete the given module from its library.

Definition at line 590 of file footprint_libraries_utils.cpp.

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

Referenced by SaveFootprint().

591 {
592  if( !aFPID.IsValid() )
593  return false;
594 
595  wxString nickname = aFPID.GetLibNickname();
596  wxString fpname = aFPID.GetLibItemName();
597 
598  // Legacy libraries are readable, but modifying legacy format is not allowed
599  // So prompt the user if he try to delete a footprint from a legacy lib
600  wxString libfullname = Prj().PcbFootprintLibs()->FindRow( nickname )->GetFullURI();
601 
602  if( IO_MGR::GuessPluginTypeFromLibPath( libfullname ) == IO_MGR::LEGACY )
603  {
605  return false;
606  }
607 
608  if( !Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname ) )
609  {
610  wxString msg = wxString::Format( _( "Library \"%s\" is read only" ), nickname );
611  DisplayError( this, msg );
612  return false;
613  }
614 
615  // Confirmation
616  wxString msg = wxString::Format( FMT_OK_DELETE, fpname.GetData(), nickname.GetData() );
617 
618  if( aConfirm && !IsOK( this, msg ) )
619  return false;
620 
621  try
622  {
623  Prj().PcbFootprintLibs()->FootprintDelete( nickname, fpname );
624  }
625  catch( const IO_ERROR& ioe )
626  {
627  DisplayError( this, ioe.What() );
628  return false;
629  }
630 
631  msg.Printf( FMT_MOD_DELETED, fpname.GetData(), nickname.GetData() );
632 
633  SetStatusText( msg );
634 
635  return true;
636 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
bool IsValid() const
Definition: lib_id.h:171
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Function GuessPluginTypeFromLibPath returns a plugin type given a footprint library&#39;s libPath...
Definition: io_mgr.cpp:124
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
#define FMT_MOD_DELETED
#define FMT_OK_DELETE
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.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName)
Function FindRow.
Legacy Pcbnew file formats prior to s-expression.
Definition: io_mgr.h:56
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void FootprintDelete(const wxString &aNickname, const wxString &aFootprintName)
Function FootprintDelete.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:277
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
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
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:295
static const wxString INFO_LEGACY_LIB_WARN_DELETE(_("Modifying legacy libraries (.mod files) is not allowed\ "Please save the current library under the new .pretty format\" "and update your footprint lib table\" "before deleting a footprint"))

◆ DeletePad()

void PCB_BASE_FRAME::DeletePad ( D_PAD aPad,
bool  aQuery = true 
)
inherited

Function DeletePad Delete the pad aPad.

Refresh the modified screen area Refresh modified parameters of the parent module (bounding box, last date)

Parameters
aPad= the pad to delete
aQuery= true to prompt for confirmation, false to delete silently

Definition at line 153 of file pad_edit_functions.cpp.

References MODULE::CalculateBoundingBox(), Format(), PCB_BASE_FRAME::GetBoard(), MODULE::GetBoundingBox(), D_PAD::GetParent(), MODULE::GetReference(), MODULE::GetValue(), IsOK(), EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::m_Pcb, BOARD::m_Status_Pcb, PCB_BASE_FRAME::OnModify(), BOARD::PadDelete(), EDA_DRAW_PANEL::RefreshDrawingRect(), and MODULE::SetLastEditTime().

Referenced by PCB_EDIT_FRAME::Process_Special_Functions().

154 {
155  if( aPad == NULL )
156  return;
157 
158  MODULE* module = aPad->GetParent();
159  module->SetLastEditTime();
160 
161  // aQuery = true to prompt for confirmation, false to delete silently
162  if( aQuery )
163  {
164  wxString msg = wxString::Format( _( "Delete pad (footprint %s %s)?" ),
165  module->GetReference(),
166  module->GetValue() );
167 
168  if( !IsOK( this, msg ) )
169  return;
170  }
171 
172  // Stores the initial bounding box to refresh the old area
173  EDA_RECT bbox = module->GetBoundingBox();
174 
175  m_Pcb->m_Status_Pcb = 0;
176 
177  GetBoard()->PadDelete( aPad );
178 
179  // Update the bounding box
180  module->CalculateBoundingBox();
181 
182  // Refresh the modified screen area, using the initial bounding box
183  // which is perhaps larger than the new bounding box
184  m_canvas->RefreshDrawingRect( bbox );
185 
186  OnModify();
187 }
void PadDelete(D_PAD *aPad)
Function PadDelete deletes a given bad from the BOARD by removing it from its module and from the m_N...
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
virtual void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:462
MODULE * GetParent() const
Definition: class_pad.h:162
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
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
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const wxString & GetValue() const
Function GetValue.
Definition: class_module.h:496
BOARD * GetBoard() const
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:295
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241

◆ DeleteTextModule()

void PCB_BASE_FRAME::DeleteTextModule ( TEXTE_MODULE Text)
inherited

Definition at line 126 of file edtxtmod.cpp.

References BOARD_ITEM::DeleteStructure(), FRAME_PCB, TEXTE_MODULE::GetBoundingBox(), EDA_ITEM::GetFlags(), BOARD_ITEM::GetParent(), TEXTE_MODULE::GetType(), EDA_BASE_FRAME::IsType(), EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::OnModify(), EDA_DRAW_PANEL::RefreshDrawingRect(), PCB_BASE_FRAME::SaveCopyInUndoList(), MODULE::SetLastEditTime(), TEXTE_MODULE::TEXT_is_DIVERS, and UR_CHANGED.

Referenced by PCB_EDIT_FRAME::Process_Special_Functions().

127 {
128  MODULE* module;
129 
130  if( aText == NULL )
131  return;
132 
133  module = static_cast<MODULE*>( aText->GetParent() );
134 
135  if( aText->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
136  {
137  if( module && module->GetFlags() == 0 && aText->GetFlags() == 0 && IsType( FRAME_PCB ) )
138  SaveCopyInUndoList( module, UR_CHANGED );
139 
140  m_canvas->RefreshDrawingRect( aText->GetBoundingBox() );
141  aText->DeleteStructure();
142  OnModify();
143  module->SetLastEditTime();
144  }
145 }
virtual void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
bool IsType(FRAME_T aType) const
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258

◆ Destroy()

◆ DismissModal()

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

◆ DisplayToolMsg()

◆ DisplayUnitsMsg()

void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Display current unit pane on the status bar.

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

References INCHES, EDA_DRAW_FRAME::m_UserUnits, and MILLIMETRES.

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

625 {
626  wxString msg;
627 
628  switch( m_UserUnits )
629  {
630  case INCHES: msg = _( "Inches" ); break;
631  case MILLIMETRES: msg = _( "mm" ); break;
632  default: msg = _( "Units" ); break;
633  }
634 
635  SetStatusText( msg, 4 );
636 }
Definition: common.h:161
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:123

◆ doAutoSave()

bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

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

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 223 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

224 {
225  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
226 }

◆ DoPushPadProperties()

void PCB_BASE_FRAME::DoPushPadProperties ( D_PAD aPad,
bool  aSameFootprints,
bool  aPadShapeFilter,
bool  aPadOrientFilter,
bool  aPadLayerFilter,
bool  aSaveForUndo 
)
inherited

Function DoPushPadProperties Function to change pad settings for the given footprint or all identical footprints.

Parameters
aPadis the pattern. The given footprint is the parent of this pad
aSameFootprintsif true, make changes on all identical footprints
aPadShapeFilterif true, make changes only on pads having the same shape as aPad
aPadOrientFilterif true, make changes only on pads having the same orientation as aPad
aPadLayerFilterif true, make changes only on pads having the same layers as aPad
aSaveForUndoif true: create an entry in the Undo/Redo list (usually: true in Schematic editor, false in Module editor)

Definition at line 265 of file pad_edit_functions.cpp.

References DO_NOT_DRAW, MODULE::GetFPID(), D_PAD::GetLayerSet(), MODULE::GetOrientation(), D_PAD::GetOrientation(), D_PAD::GetParent(), D_PAD::GetShape(), EDA_DRAW_FRAME::m_canvas, BOARD::m_Modules, PCB_BASE_FRAME::m_Pcb, MODULE::Next(), D_PAD::Next(), PCB_BASE_FRAME::OnModify(), PICKED_ITEMS_LIST::PushItem(), EDA_DRAW_PANEL::RefreshDrawingRect(), PCB_BASE_FRAME::SaveCopyInUndoList(), and UR_CHANGED.

Referenced by PushPadProperties(), and PCB_EDIT_FRAME::PushPadProperties().

270 {
271  MODULE* Module_Ref = aPad->GetParent();
272  double pad_orient = aPad->GetOrientation() - Module_Ref->GetOrientation();
273 
274  // Prepare an undo list:
275  if( aSaveForUndo )
276  {
277  PICKED_ITEMS_LIST itemsList;
278 
279  if( aSameFootprints )
280  {
281  for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
282  {
283  if( module->GetFPID() == Module_Ref->GetFPID() )
284  {
285  ITEM_PICKER itemWrapper( module, UR_CHANGED );
286  itemsList.PushItem( itemWrapper );
287  }
288  }
289  }
290  else
291  {
292  ITEM_PICKER itemWrapper( Module_Ref, UR_CHANGED );
293  itemsList.PushItem( itemWrapper );
294  }
295 
296  SaveCopyInUndoList( itemsList, UR_CHANGED );
297  }
298 
299  // Update the current module and same others modules if requested.
300  for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
301  {
302  if( !aSameFootprints && (module != Module_Ref) )
303  continue;
304 
305  if( module->GetFPID() != Module_Ref->GetFPID() )
306  continue;
307 
308  // Erase module on screen
309  module->SetFlags( DO_NOT_DRAW );
310  m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
311  module->ClearFlags( DO_NOT_DRAW );
312 
313  for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
314  {
315  if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) )
316  continue;
317 
318  double currpad_orient = pad->GetOrientation() - module->GetOrientation();
319 
320  if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
321  continue;
322 
323  if( aPadLayerFilter && ( pad->GetLayerSet() != aPad->GetLayerSet() ) )
324  continue;
325 
326  // Do not copy pad to itself, it can create issues with custom pad primitives.
327  if( pad == aPad )
328  continue;
329 
330  pad->ImportSettingsFromMaster( *aPad );
331  }
332 
333  module->CalculateBoundingBox();
334  m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
335  }
336 
337  OnModify();
338 }
D_PAD * Next() const
Definition: class_pad.h:160
double GetOrientation() const
Definition: class_module.h:188
virtual void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
const LIB_ID & GetFPID() const
Definition: class_module.h:192
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:409
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
MODULE * GetParent() const
Definition: class_pad.h:162
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
DLIST< MODULE > m_Modules
Definition: class_board.h:249
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:389
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
MODULE * Next() const
Definition: class_module.h:122
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:126

◆ DrawGeneralRatsnest()

void PCB_BASE_FRAME::DrawGeneralRatsnest ( wxDC *  aDC,
int  aNetcode = 0 
)
inherited

function Displays the general ratsnest Only ratsnest with the status bit CH_VISIBLE is set are displayed

function DrawGeneralRatsnest Only ratsnest items with the status bit CH_VISIBLE set are displayed

Parameters
aDC= the current device context (can be NULL)
aNetcodeif > 0, Display only the ratsnest relative to the corresponding net_code
aDC= the current device context (can be NULL)
aNetcodeif > 0, Display only the ratsnest relative to the corresponding net_code

Definition at line 88 of file ratsnest.cpp.

References color, PCB_GENERAL_SETTINGS::Colors(), DO_NOT_SHOW_GENERAL_RASTNEST, EDA_DRAW_PANEL::GetClipBox(), BOARD::GetConnectivity(), RN_NET::GetEdges(), COLORS_DESIGN_SETTINGS::GetItemColor(), GRLine(), i, LAYER_RATSNEST, EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::m_Pcb, BOARD::m_Status_Pcb, and PCB_BASE_FRAME::Settings().

Referenced by Abort_MoveOrCopyModule(), PCB_EDIT_FRAME::Change_Side_Module(), PCB_BASE_FRAME::Compile_Ratsnest(), PCB_EDIT_FRAME::Delete_net(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::RedrawActiveWindow(), PCB_EDIT_FRAME::Remove_One_Track(), PCB_BASE_FRAME::Rotate_Module(), and PCB_EDIT_FRAME::StartMoveModule().

89 {
91  {
92  return;
93  }
94 
95  if( aDC == NULL )
96  return;
97 
98  auto connectivity = m_Pcb->GetConnectivity();
99 
100  std::unique_lock<std::mutex> lock( connectivity->GetLock(), std::try_to_lock );
101 
102  if( !lock )
103  return;
104 
106 
107  for( int i = 1 /* skip "No Net" at [0] */; i < connectivity->GetNetCount(); ++i )
108  {
109  RN_NET* net = connectivity->GetRatsnestForNet( i );
110 
111  if( !net )
112  continue;
113 
114  if( ( aNetcode <= 0 ) || ( aNetcode == i ) )
115  {
116  for( const auto& edge : net->GetEdges() )
117  {
118  auto s = edge.GetSourcePos();
119  auto d = edge.GetTargetPos();
120  auto sn = edge.GetSourceNode();
121  auto dn = edge.GetTargetNode();
122 
123  if( !sn->Valid() || !dn->Valid() )
124  continue;
125 
126  bool enable = !sn->GetNoLine() && !dn->GetNoLine();
127  bool show = sn->Parent()->GetLocalRatsnestVisible()
128  || dn->Parent()->GetLocalRatsnestVisible();
129 
130  if( enable && show )
131  GRLine( m_canvas->GetClipBox(), aDC, wxPoint( s.x, s.y ), wxPoint( d.x,
132  d.y ), 0, color );
133  }
134  }
135  }
136 }
int color
Definition: DXF_plotter.cpp:62
virtual EDA_RECT * GetClipBox()
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
PCB_GENERAL_SETTINGS & Settings()
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:297
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:285
COLORS_DESIGN_SETTINGS & Colors()
const std::vector< CN_EDGE > & GetEdges() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
size_t i
Definition: json11.cpp:597
Class RN_NET Describes ratsnest for a single net.
Definition: ratsnest_data.h:59
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

◆ DrawWorkSheet()

void EDA_DRAW_FRAME::DrawWorkSheet ( wxDC *  aDC,
BASE_SCREEN aScreen,
int  aLineWidth,
double  aScale,
const wxString &  aFilename,
const wxString &  aSheetLayer = wxEmptyString 
)
inherited

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

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

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

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

Referenced by PLEDITOR_PRINTOUT::DrawPage(), SCH_PRINTOUT::DrawPage(), PL_EDITOR_FRAME::PrintPage(), SCH_EDIT_FRAME::PrintPage(), PL_EDITOR_FRAME::RedrawActiveWindow(), RedrawActiveWindow(), GERBVIEW_FRAME::RedrawActiveWindow(), and PCB_EDIT_FRAME::RedrawActiveWindow().

1815 {
1817  return;
1818 
1819  const PAGE_INFO& pageInfo = GetPageSettings();
1820  wxSize pageSize = pageInfo.GetSizeMils();
1821 
1822  // if not printing, draw the page limits:
1823  if( !aScreen->m_IsPrinting && m_showPageLimits )
1824  {
1825  GRSetDrawMode( aDC, GR_COPY );
1826  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
1827  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
1829  }
1830 
1831  TITLE_BLOCK t_block = GetTitleBlock();
1832  COLOR4D color = COLOR4D( RED );
1833 
1834  wxPoint origin = aDC->GetDeviceOrigin();
1835 
1836  if( aScreen->m_IsPrinting && origin.y > 0 )
1837  {
1838  aDC->SetDeviceOrigin( 0, 0 );
1839  aDC->SetAxisOrientation( true, false );
1840  }
1841 
1842  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
1843  GetScreenDesc(), aFilename, t_block,
1844  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
1845  aLineWidth, aScalar, color, color, aSheetLayer );
1846 
1847  if( aScreen->m_IsPrinting && origin.y > 0 )
1848  {
1849  aDC->SetDeviceOrigin( origin.x, origin.y );
1850  aDC->SetAxisOrientation( true, true );
1851  }
1852 }
int m_ScreenNumber
Definition: base_screen.h:216
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
virtual const TITLE_BLOCK & GetTitleBlock() const =0
int color
Definition: DXF_plotter.cpp:62
virtual EDA_RECT * GetClipBox()
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:116
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
virtual const PAGE_INFO & GetPageSettings() const =0
void DrawPageLayout(wxDC *aDC, EDA_RECT *aClipBox, const PAGE_INFO &aPageInfo, const wxString &aFullSheetName, const wxString &aFileName, TITLE_BLOCK &aTitleBlock, int aSheetCount, int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor, COLOR4D aAltColor, const wxString &aSheetLayer)
Function DrawPageLayout is a core function to draw the page layout with the frame and the basic inscr...
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1003
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:146
Definition: colors.h:60
const wxSize & GetSizeMils() const
Definition: page_info.h:142
bool m_IsPrinting
Definition: base_screen.h:220
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:114
Definition: colors.h:49
int m_NumberOfScreens
Definition: base_screen.h:217
virtual wxString GetScreenDesc() const
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

◆ duplicateItem()

void PCB_BASE_EDIT_FRAME::duplicateItem ( BOARD_ITEM aItem,
bool  aIncrement 
)
protectedinherited

Function duplicateItem Duplicate the specified item This function is shared between pcbnew and modedit, as it is virtually the same.

Parameters
aItemthe item to duplicate
aIncrement(has meaning only for pads in footprint editor): increment pad name if appropriate

Definition at line 1583 of file edit.cpp.

References BLOCK_DUPLICATE, BLOCK_DUPLICATE_AND_INCREMENT, EDA_DRAW_FRAME::GetCrossHairPosition(), BLOCK_SELECTOR::GetItems(), PCB_BASE_FRAME::GetScreen(), EDA_ITEM::GetState(), EDA_DRAW_FRAME::HandleBlockBegin(), EDA_DRAW_FRAME::HandleBlockEnd(), INSTALL_UNBUFFERED_DC, BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::MoveCursorToCrossHair(), PICKED_ITEMS_LIST::PushItem(), EDA_RECT::SetEnd(), ITEM_PICKER::SetItem(), BLOCK_SELECTOR::SetLastCursorPosition(), STATE_NO_BLOCK, and UR_UNSPECIFIED.

Referenced by PCB_EDIT_FRAME::duplicateItems(), and duplicateItems().

1584 {
1585  if( !aItem )
1586  return;
1587 
1588  // The easiest way to handle a duplicate item command
1589  // is to simulate a block copy command, which gives us the undo management
1590  // for free
1591  if( GetScreen()->m_BlockLocate.GetState() == STATE_NO_BLOCK )
1592  {
1594 
1596 
1597  wxPoint crossHairPos = GetCrossHairPosition();
1598 
1599  const BLOCK_COMMAND_T blockType = aIncrement ? BLOCK_DUPLICATE_AND_INCREMENT : BLOCK_DUPLICATE;
1600 
1601  if( !HandleBlockBegin( &dc, blockType, crossHairPos ) )
1602  return;
1603 
1604  // Add the item to the block copy pick list:
1606  ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
1607 
1608  picker.SetItem ( aItem );
1609  itemsList.PushItem( picker );
1610 
1611  // Set 2 coordinates updated by the mouse, because our simulation
1612  // does not use the mouse to call HandleBlockEnd()
1613  GetScreen()->m_BlockLocate.SetLastCursorPosition( crossHairPos );
1614  GetScreen()->m_BlockLocate.SetEnd( crossHairPos );
1615  HandleBlockEnd( &dc );
1616  }
1617 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
BLOCK_COMMAND_T
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Initialize a block command.
void SetEnd(int x, int y)
Definition: eda_rect.h:134
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
virtual bool HandleBlockEnd(wxDC *DC)
Handle the "end" of a block command, i.e.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
#define INSTALL_UNBUFFERED_DC(name, parent)
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PICKED_ITEMS_LIST & GetItems()
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
int GetState(int type) const
Definition: base_struct.h:240
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

◆ duplicateItems()

void FOOTPRINT_EDIT_FRAME::duplicateItems ( bool  aIncrement)
overrideprivatevirtual

Duplicate the item under the cursor.

Parameters
aIncrementincrement the number of pad (if that is what is selected)

Implements PCB_BASE_EDIT_FRAME.

Definition at line 871 of file footprint_editor_utils.cpp.

References PCB_BASE_EDIT_FRAME::duplicateItem().

872 {
873  BOARD_ITEM* item = GetScreen()->GetCurItem();
874 
875  PCB_BASE_EDIT_FRAME::duplicateItem( item, aIncrement );
876 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
BOARD_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: pcb_screen.h:72
void duplicateItem(BOARD_ITEM *aItem, bool aIncrement)
Function duplicateItem Duplicate the specified item This function is shared between pcbnew and modedi...
Definition: edit.cpp:1583
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.

◆ Edit_Edge_Layer()

void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer ( EDGE_MODULE Edge)

Change the EDGE_MODULE Edge layer, (The new layer will be asked) if Edge == NULL change the layer of the entire footprint edges.

Parameters
Edge= edge to edit, or NULL

Definition at line 186 of file edgemod.cpp.

References MODULE::CalculateBoundingBox(), dyn_cast(), Edge_Cuts, F_SilkS, PCB_BASE_FRAME::GetBoard(), BOARD_ITEM::GetLayer(), MODULE::GraphicalItemsList(), IsCopperLayer(), IsOK(), BOARD::m_Modules, BOARD_ITEM::Next(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), PCB_BASE_FRAME::SelectLayer(), MODULE::SetLastEditTime(), BOARD_ITEM::SetLayer(), and UR_CHANGED.

187 {
188  // note: if aEdge == NULL, all outline segments will be modified
189 
190  MODULE* module = GetBoard()->m_Modules;
191  PCB_LAYER_ID layer = F_SilkS;
192  bool modified = false;
193 
194  if( aEdge )
195  layer = aEdge->GetLayer();
196 
197  // Ask for the new layer
198  PCB_LAYER_ID new_layer = SelectLayer( layer, Edge_Cuts );
199 
200  if( layer < 0 )
201  return;
202 
203  if( IsCopperLayer( new_layer ) )
204  {
205  // an edge is put on a copper layer, and it is very dangerous.
206  // A confirmation is requested
207  if( !IsOK( this,
208  _( "The graphic item will be on a copper layer.\n"
209  "This is very dangerous. Are you sure?" ) ) )
210  return;
211  }
212 
213  if( !aEdge )
214  {
215  for( BOARD_ITEM *item = module->GraphicalItemsList() ; item != NULL;
216  item = item->Next() )
217  {
218  aEdge = dyn_cast<EDGE_MODULE*>( item );
219 
220  if( aEdge && (aEdge->GetLayer() != new_layer) )
221  {
222  if( ! modified ) // save only once
223  SaveCopyInUndoList( module, UR_CHANGED );
224  aEdge->SetLayer( new_layer );
225  modified = true;
226  }
227  }
228  }
229  else if( aEdge->GetLayer() != new_layer )
230  {
231  SaveCopyInUndoList( module, UR_CHANGED );
232  aEdge->SetLayer( new_layer );
233  modified = true;
234  }
235 
236  if( modified )
237  {
238  module->CalculateBoundingBox();
239  module->SetLastEditTime();
240  }
241 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
PCB_LAYER_ID
A quick note on layer IDs:
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
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.
Definition: undo_redo.cpp:202
BOARD_ITEM * Next() const
DLIST< MODULE > m_Modules
Definition: class_board.h:249
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165
BOARD * GetBoard() const
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:295
PCB_LAYER_ID SelectLayer(PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
Install the dialog box for layer selection.
Definition: sel_layer.cpp:205

◆ Edit_Edge_Width()

void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width ( EDGE_MODULE aEdge)

Change the width of module perimeter lines, EDGE_MODULEs.

param ModuleSegmentWidth (global) = new width

Parameters
aEdge= edge to edit, or NULL. If aEdge == NULL change the width of all footprint's edges

Definition at line 159 of file edgemod.cpp.

References MODULE::CalculateBoundingBox(), dyn_cast(), PCB_BASE_FRAME::GetBoard(), GetDesignSettings(), BOARD_ITEM::GetLayer(), MODULE::GraphicalItemsList(), BOARD::m_Modules, BOARD_ITEM::Next(), OnModify(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), MODULE::SetLastEditTime(), DRAWSEGMENT::SetWidth(), and UR_CHANGED.

160 {
161  MODULE* module = GetBoard()->m_Modules;
162 
163  SaveCopyInUndoList( module, UR_CHANGED );
164 
165  if( aEdge == NULL )
166  {
167  for( BOARD_ITEM *item = module->GraphicalItemsList(); item; item = item->Next() )
168  {
169  aEdge = dyn_cast<EDGE_MODULE*>( item );
170 
171  if( aEdge )
172  aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
173  }
174  }
175  else
176  {
177  aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
178  }
179 
180  OnModify();
181  module->CalculateBoundingBox();
182  module->SetLastEditTime();
183 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
virtual void OnModify() override
Must be called after a footprint change in order to set the "modify" flag of the current screen and p...
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
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.
Definition: undo_redo.cpp:202
BOARD_ITEM * Next() const
DLIST< MODULE > m_Modules
Definition: class_board.h:249
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165
BOARD * GetBoard() const
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void SetWidth(int aWidth)

◆ Edit_Module()

void PCB_BASE_FRAME::Edit_Module ( MODULE module,
wxDC *  DC 
)
inherited

◆ editFootprintProperties()

void FOOTPRINT_EDIT_FRAME::editFootprintProperties ( MODULE aFootprint)
private

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

Definition at line 820 of file footprint_editor_utils.cpp.

References MODULE::GetFPID().

Referenced by OnEditItemRequest().

821 {
822  LIB_ID oldFPID = aModule->GetFPID();
823 
824  DIALOG_FOOTPRINT_FP_EDITOR dialog( this, aModule );
825  dialog.ShowModal();
826 
828 
829  updateTitle(); // in case of a name change...
830 }
BOARD_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: pcb_screen.h:72
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void updateTitle()
Updates window title according to getLibNickName().
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257

◆ End_Edge_Module()

void FOOTPRINT_EDIT_FRAME::End_Edge_Module ( EDGE_MODULE Edge)

Terminate a move or create edge function.

Definition at line 391 of file edgemod.cpp.

References MODULE::CalculateBoundingBox(), EDA_ITEM::ClearFlags(), BOARD_ITEM::DeleteStructure(), PCB_BASE_FRAME::GetBoard(), DRAWSEGMENT::GetEnd(), DRAWSEGMENT::GetStart(), EDA_DRAW_FRAME::m_canvas, BOARD::m_Modules, OnModify(), MODULE::SetLastEditTime(), and EDA_DRAW_PANEL::SetMouseCapture().

Referenced by OnLeftClick(), and OnLeftDClick().

392 {
393  MODULE* module = GetBoard()->m_Modules;
394 
395  if( aEdge )
396  {
397  aEdge->ClearFlags();
398 
399  // If last segment length is 0: remove it
400  if( aEdge->GetStart() == aEdge->GetEnd() )
401  aEdge->DeleteStructure();
402  }
403 
404  module->CalculateBoundingBox();
405  module->SetLastEditTime();
406  OnModify();
407  m_canvas->SetMouseCapture( NULL, NULL );
408 }
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
virtual void OnModify() override
Must be called after a footprint change in order to set the "modify" flag of the current screen and p...
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
DLIST< MODULE > m_Modules
Definition: class_board.h:249
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
BOARD * GetBoard() const

◆ EraseMsgBox()

void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

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

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

Referenced by GERBVIEW_FRAME::SetCurItem().

309 {
310  if( m_messagePanel )
312 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:166
void EraseMsgBox()
Definition: msgpanel.cpp:216

◆ ExecuteRemoteCommand()

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

Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest().

this is a virtual function becuse the actual commands depends on the application. the basic function do nothing

Parameters
cmdline= received command from socket

Reimplemented in SCH_EDIT_FRAME, and PCB_EDIT_FRAME.

Definition at line 414 of file draw_frame.h.

Referenced by EDA_DRAW_FRAME::OnSockRequest().

414 {}

◆ Export_Module()

void FOOTPRINT_EDIT_FRAME::Export_Module ( MODULE aModule)

Create a file containing only one footprint.

Used to export a footprint Exported files have the standard ext .emp This is the same format as .mod files but restricted to only one footprint So Create a new lib (which will contains one module) and export a footprint is basically the same thing

Parameters
aModule= the module to export

Definition at line 343 of file footprint_libraries_utils.cpp.

References CTL_FOR_LIBRARY, DisplayError(), DisplayInfoMessage(), EXPORT_IMPORT_LASTPATH_KEY, FMT_EXPORT_MODULE, FMT_EXPORTED, PCB_IO::Format(), Format(), GetChars(), MODULE::GetFPID(), LIB_ID::GetLibItemName(), PCB_IO::GetStringOutput(), KiCadFootprintFileExtension, KiCadFootprintLibFileWildcard(), Kiface(), KIFACE_I::KifaceSettings(), EDA_BASE_FRAME::m_mruPath, and IO_ERROR::What().

344 {
345  wxFileName fn;
346  wxConfigBase* cfg = Kiface().KifaceSettings();
347 
348  if( !aModule )
349  return;
350 
351  fn.SetName( aModule->GetFPID().GetLibItemName() );
352 
353  wxString wildcard = KiCadFootprintLibFileWildcard();
354 
355  fn.SetExt( KiCadFootprintFileExtension );
356 
357  if( cfg )
358  {
359  wxString path;
360  cfg->Read( EXPORT_IMPORT_LASTPATH_KEY, &path, m_mruPath );
361  fn.SetPath( path );
362  }
363 
364  wxFileDialog dlg( this, FMT_EXPORT_MODULE, fn.GetPath(), fn.GetFullName(),
365  wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
366 
367  if( dlg.ShowModal() == wxID_CANCEL )
368  return;
369 
370  fn = dlg.GetPath();
371 
372  if( cfg ) // Save file path
373  {
374  cfg->Write( EXPORT_IMPORT_LASTPATH_KEY, fn.GetPath() );
375  }
376 
377  try
378  {
379  // Export as *.kicad_pcb format, using a strategy which is specifically chosen
380  // as an example on how it could also be used to send it to the system clipboard.
381 
382  PCB_IO pcb_io( CTL_FOR_LIBRARY );
383 
384  /* This module should *already* be "normalized" in a way such that
385  orientation is zero, etc., since it came from module editor.
386 
387  module->SetTimeStamp( 0 );
388  module->SetParent( 0 );
389  module->SetOrientation( 0 );
390  */
391 
392  pcb_io.Format( aModule );
393 
394  FILE* fp = wxFopen( dlg.GetPath(), wxT( "wt" ) );
395 
396  if( fp == NULL )
397  {
398  wxMessageBox( wxString::Format(
399  _( "Unable to create or write file \"%s\"" ),
400  GetChars( dlg.GetPath() ) ) );
401  return;
402  }
403 
404  fprintf( fp, "%s", pcb_io.GetStringOutput( false ).c_str() );
405  fclose( fp );
406  }
407  catch( const IO_ERROR& ioe )
408  {
409  DisplayError( this, ioe.What() );
410  return;
411  }
412 
413  wxString msg = wxString::Format( FMT_EXPORTED, GetChars( dlg.GetPath() ) );
414  DisplayInfoMessage( this, msg );
415 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
Class PCB_IO is a PLUGIN derivation for saving and loading Pcbnew s-expression formatted files...
wxString m_mruPath
Most recently used path.
const std::string KiCadFootprintFileExtension
#define EXPORT_IMPORT_LASTPATH_KEY
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
const LIB_ID & GetFPID() const
Definition: class_module.h:192
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
#define FMT_EXPORT_MODULE
#define CTL_FOR_LIBRARY
Format output for a footprint library instead of clipboard or BOARD.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define FMT_EXPORTED
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:277
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
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
wxString KiCadFootprintLibFileWildcard()

◆ Export_Pad_Settings()

void PCB_BASE_FRAME::Export_Pad_Settings ( D_PAD aPad)
inherited

Definition at line 45 of file pad_edit_functions.cpp.

References PCB_BASE_FRAME::GetDesignSettings(), D_PAD::ImportSettingsFromMaster(), BOARD_DESIGN_SETTINGS::m_Pad_Master, and EDA_DRAW_FRAME::SetMsgPanel().

Referenced by PCB_EDIT_FRAME::Process_Special_Functions().

46 {
47  if( aPad == NULL )
48  return;
49 
50  SetMsgPanel( aPad );
51 
52  D_PAD& masterPad = GetDesignSettings().m_Pad_Master;
53 
54  masterPad.ImportSettingsFromMaster( *aPad );
55 }
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void ImportSettingsFromMaster(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1443
D_PAD m_Pad_Master
A dummy pad to store all default parameters.

◆ ExportHotkeyConfigToFile()

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

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

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

Definition at line 738 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), EDA_BASE_FRAME::GetMruPath(), Prj(), EDA_BASE_FRAME::SetMruPath(), and EDA_BASE_FRAME::WriteHotkeyConfig().

Referenced by PANEL_HOTKEYS_EDITOR::installButtons().

740 {
741  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
742  wxString mask = wxT( "*." ) + ext;
743 
744 #if 0
745  wxString path = wxPathOnly( Prj().GetProjectFullName() );
746 #else
747  wxString path = GetMruPath();
748 #endif
749  wxFileName fn( aDefaultShortname );
750  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
751 
752  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
753  path,
754  fn.GetFullPath(),
755  ext,
756  mask,
757  this,
758  wxFD_SAVE,
759  true );
760 
761  if( filename.IsEmpty() )
762  return;
763 
764  WriteHotkeyConfig( aDescList, &filename );
765  SetMruPath( wxFileName( filename ).GetPath() );
766 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:292
wxString GetMruPath() const
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34

◆ FocusOnLocation()

void EDA_DRAW_FRAME::FocusOnLocation ( const wxPoint &  aPos,
bool  aWarpCursor = true,
bool  aCenterView = false 
)
inherited

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

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

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

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

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

1637 {
1638  if( aCenterView )
1639  {
1640  wxWindow* dialog = findDialog( GetChildren() );
1641 
1642  // If a dialog partly obscures the window, then center on the uncovered area.
1643  if( dialog )
1644  {
1645  wxRect dialogRect( GetGalCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
1646  dialog->GetSize() );
1647  GetGalCanvas()->GetView()->SetCenter( aPos, dialogRect );
1648  }
1649  else
1650  GetGalCanvas()->GetView()->SetCenter( aPos );
1651  }
1652 
1653  if( aWarpCursor )
1655  else
1657 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:934
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:601
wxWindow * findDialog(wxWindowList &aList)
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.

◆ GeneralControl()

bool FOOTPRINT_EDIT_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint &  aPosition,
EDA_KEY  aHotKey = 0 
)
overridevirtual

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

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

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

Reimplemented from EDA_DRAW_FRAME.

Definition at line 738 of file footprint_edit_frame.cpp.

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

739 {
740  // Filter out the 'fake' mouse motion after a keyboard movement
741  if( !aHotKey && m_movingCursorWithKeyboard )
742  {
744  return false;
745  }
746 
747  // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
748  // for next cursor position
749  // ( shift or ctrl key down are PAN command with mouse wheel)
750  bool snapToGrid = true;
751 
752  if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
753  snapToGrid = false;
754 
755  wxPoint oldpos = GetCrossHairPosition();
756  wxPoint pos = aPosition;
757  bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
758 
759  SetCrossHairPosition( pos, snapToGrid );
760  RefreshCrossHair( oldpos, aPosition, aDC );
761 
762  if( aHotKey && OnHotKey( aDC, aHotKey, aPosition ) )
763  {
764  keyHandled = true;
765  }
766 
767  UpdateStatusBar();
768 
769  return keyHandled;
770 }
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Handle the common part of GeneralControl dedicated to global cursor keys (i.e.
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
Move and refresh the crosshair after movement and call the mouse capture function.
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Handle hot key events.
virtual void UpdateStatusBar() override
Update the status bar information.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:176
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

◆ GeneralControlKeyMovement()

bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint *  aPos,
bool  aSnapToGrid 
)
protectedinherited

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

cursor movement by keyboard)

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

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

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

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

1238 {
1239  bool key_handled = false;
1240 
1241  // If requested snap the current position to the grid
1242  if( aSnapToGrid )
1243  *aPos = GetNearestGridPosition( *aPos );
1244 
1245  switch( aHotKey )
1246  {
1247  // All these keys have almost the same treatment
1248  case GR_KB_CTRL | WXK_NUMPAD8:
1249  case GR_KB_CTRL | WXK_UP:
1250  case GR_KB_CTRL | WXK_NUMPAD2:
1251  case GR_KB_CTRL | WXK_DOWN:
1252  case GR_KB_CTRL | WXK_NUMPAD4:
1253  case GR_KB_CTRL | WXK_LEFT:
1254  case GR_KB_CTRL | WXK_NUMPAD6:
1255  case GR_KB_CTRL | WXK_RIGHT:
1256  case WXK_NUMPAD8:
1257  case WXK_UP:
1258  case WXK_NUMPAD2:
1259  case WXK_DOWN:
1260  case WXK_NUMPAD4:
1261  case WXK_LEFT:
1262  case WXK_NUMPAD6:
1263  case WXK_RIGHT:
1264  key_handled = true;
1265  {
1266  /* Here's a tricky part: when doing cursor key movement, the
1267  * 'previous' point should be taken from memory, *not* from the
1268  * freshly computed position in the event. Otherwise you can't do
1269  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1270  * the automatic motion event generated by cursor warping */
1271  wxRealPoint gridSize = GetScreen()->GetGridSize();
1272  *aPos = GetCrossHairPosition();
1273 
1274  // Bonus: ^key moves faster (x10)
1275  switch( aHotKey )
1276  {
1277  case GR_KB_CTRL|WXK_NUMPAD8:
1278  case GR_KB_CTRL|WXK_UP:
1279  aPos->y -= KiROUND( 10 * gridSize.y );
1280  break;
1281 
1282  case GR_KB_CTRL|WXK_NUMPAD2:
1283  case GR_KB_CTRL|WXK_DOWN:
1284  aPos->y += KiROUND( 10 * gridSize.y );
1285  break;
1286 
1287  case GR_KB_CTRL|WXK_NUMPAD4:
1288  case GR_KB_CTRL|WXK_LEFT:
1289  aPos->x -= KiROUND( 10 * gridSize.x );
1290  break;
1291 
1292  case GR_KB_CTRL|WXK_NUMPAD6:
1293  case GR_KB_CTRL|WXK_RIGHT:
1294  aPos->x += KiROUND( 10 * gridSize.x );
1295  break;
1296 
1297  case WXK_NUMPAD8:
1298  case WXK_UP:
1299  aPos->y -= KiROUND( gridSize.y );
1300  break;
1301 
1302  case WXK_NUMPAD2:
1303  case WXK_DOWN:
1304  aPos->y += KiROUND( gridSize.y );
1305  break;
1306 
1307  case WXK_NUMPAD4:
1308  case WXK_LEFT:
1309  aPos->x -= KiROUND( gridSize.x );
1310  break;
1311 
1312  case WXK_NUMPAD6:
1313  case WXK_RIGHT:
1314  aPos->x += KiROUND( gridSize.x );
1315  break;
1316 
1317  default: /* Can't happen since we entered the statement */
1318  break;
1319  }
1320 
1321  m_canvas->MoveCursor( *aPos );
1323  }
1324  break;
1325 
1326  default:
1327  break;
1328  }
1329 
1330  return key_handled;
1331 }
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
#define GR_KB_CTRL
virtual void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:403
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:176
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

◆ Get3DViewerFrame()

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

Definition at line 139 of file pcb_base_frame.cpp.

References VIEWER3D_FRAMENAME.

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

140 {
141  // return the 3D viewer frame, when exists, or NULL
142  return static_cast<EDA_3D_VIEWER*>
143  ( wxWindow::FindWindowByName( VIEWER3D_FRAMENAME ) );
144 }
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard. ...
Definition: eda_3d_viewer.h:49
#define VIEWER3D_FRAMENAME
Definition: eda_3d_viewer.h:44

◆ GetActiveLayer()

virtual PCB_LAYER_ID PCB_BASE_FRAME::GetActiveLayer ( ) const
inlinevirtualinherited

Function GetActiveLayer returns the active layer.

Definition at line 557 of file pcb_base_frame.h.

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

Referenced by PCB_EDIT_FRAME::Begin_DrawSegment(), Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), PCB_EDIT_FRAME::CreateTextePcb(), CreateTextModule(), PCB_EDIT_FRAME::Delete_Segment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::drawZone(), PCB_EDIT_FRAME::EditDimension(), PCB_BASE_FRAME::GetCollectorsGuide(), DRAWING_TOOL::getDrawingLayer(), PCBNEW_CONTROL::HighContrastMode(), PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCBNEW_CONTROL::LayerToggle(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnLeftClick(), PCB_LAYER_WIDGET::onPopupSelection(), PCB_DRAW_PANEL_GAL::OnShow(), PCB_EDIT_FRAME::OnUpdateLayerSelectBox(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), PCB_EDIT_FRAME::PrepareLayerIndicator(), PCB_EDIT_FRAME::Process_Special_Functions(), PCB_BASE_FRAME::SwitchLayer(), PCB_EDIT_FRAME::SwitchLayer(), ROUTER_TOOL::switchLayerOnViaPlacement(), and UpdateUserInterface().

558  {
559  return GetScreen()->m_Active_Layer;
560  }
PCB_LAYER_ID m_Active_Layer
Definition: pcb_screen.h:44
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 217 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

217 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.

◆ GetAuxiliaryToolBar()

wxAuiToolBar* EDA_DRAW_FRAME::GetAuxiliaryToolBar ( ) const
inlineinherited

Definition at line 484 of file draw_frame.h.

References EDA_DRAW_FRAME::m_auxiliaryToolBar.

484 { return m_auxiliaryToolBar; }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:156

◆ GetAuxOrigin()

const wxPoint & PCB_BASE_FRAME::GetAuxOrigin ( ) const
overridevirtualinherited

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

Implements EDA_DRAW_FRAME.

Definition at line 276 of file pcb_base_frame.cpp.

References BOARD::GetAuxOrigin(), and PCB_BASE_FRAME::m_Pcb.

Referenced by PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), PCB_EDIT_FRAME::ExportToGenCAD(), EDIT_TOOL::MoveExact(), PCB_EDIT_FRAME::moveExact(), PCB_EDIT_FRAME::OnLeftClick(), and DIALOG_GENDRILL::SetParams().

277 {
278  wxASSERT( m_Pcb );
279  return m_Pcb->GetAuxOrigin();
280 }
const wxPoint & GetAuxOrigin() const
Definition: class_board.h:350

◆ GetBoard()

BOARD* PCB_BASE_FRAME::GetBoard ( ) const
inlineinherited

Definition at line 188 of file pcb_base_frame.h.

References PCB_BASE_FRAME::m_Pcb.

Referenced by Abort_Create_Track(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), PCB_EDIT_FRAME::Add45DegreeSegment(), PCB_BASE_FRAME::AddModuleToBoard(), PCB_EDIT_FRAME::AppendBoardFile(), DIALOG_PLOT::applyPlotSettings(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), PCB_EDIT_FRAME::Attribut_net(), PCB_EDIT_FRAME::Attribut_Track(), PCB_EDIT_FRAME::Begin_DrawSegment(), Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), GRID_CELL_LAYER_SELECTOR::BeginEdit(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), PCB_BASE_FRAME::build_ratsnest_module(), DIALOG_COPPER_ZONE::buildAvailableListOfNets(), PCB_EDIT_FRAME::Change_Side_Module(), PCB_EDIT_FRAME::Check_All_Zones(), PCB_EDIT_FRAME::Clean_Pcb(), Clear_Pcb(), PCB_EDIT_FRAME::Clear_Pcb(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), PCB_BASE_FRAME::Compile_Ratsnest(), PCB_EDIT_FRAME::Create_MuWaveComponent(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), DIALOG_GEN_FOOTPRINT_POSITION::CreateFiles(), CreateHeaderInfoData(), PCB_BASE_FRAME::CreateNewModule(), PCB_EDIT_FRAME::createPopupMenuForTracks(), DIALOG_PRINT_PCBNEW::createPrintout(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), PCB_EDIT_FRAME::Delete_Drawings_All_Layer(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Module(), PCB_EDIT_FRAME::Delete_net(), PCB_EDIT_FRAME::Delete_OldZone_Fill(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Zone_Contour(), PCB_BASE_FRAME::DeletePad(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS(), 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(), PCB_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), PCB_EDIT_FRAME::DoGenFootprintsReport(), DIALOG_DRC_CONTROL::doSelectionMenu(), ROUTER_TOOL::DpDimensionsDialog(), GRID_CELL_LAYER_RENDERER::Draw(), DrawMovingBlockOutlines(), drawPickedItems(), DRC::DRC(), EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::duplicateZone(), Edit_Edge_Layer(), Edit_Edge_Width(), PCB_EDIT_FRAME::Edit_Track_Width(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::End_Zone(), PCB_EDIT_FRAME::EraseRedundantTrack(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), PCB_EDIT_FRAME::Exchange_Module(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::fixEagleNets(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), PCB_EDIT_FRAME::GenFootprintsReport(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), GetBoard(), EDA_3D_VIEWER::GetBoard(), GAL_ARRAY_CREATOR::getBoard(), LEGACY_ARRAY_CREATOR::getBoard(), GetDesignSettings(), PCB_LAYER_BOX_SELECTOR::getEnabledLayers(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), PCB_LAYER_SELECTOR::GetLayerName(), PCB_LAYER_BOX_SELECTOR::GetLayerName(), GetLoadedFPID(), GetModel(), GAL_ARRAY_CREATOR::getModule(), PCB_EDIT_FRAME::GetProjectFileParameters(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), GRID_CELL_LAYER_SELECTOR::GetValue(), HandleBlockEnd(), PCB_EDIT_FRAME::HandleBlockEnd(), HandleBlockPlace(), PCB_EDIT_FRAME::HandleBlockPlace(), PCB_EDIT_FRAME::HighLight(), Import_Module(), PCB_EDIT_FRAME::importFile(), DIALOG_PLOT::init_Dialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), DIALOG_GENDRILL::InitDisplayParams(), PCB_EDIT_FRAME::InstallNetlistFrame(), InvokeDialogImportGfxBoard(), IsCurrentFPFromBoard(), IsElementVisible(), PCB_LAYER_SELECTOR::IsLayerEnabled(), PCB_LAYER_BOX_SELECTOR::IsLayerEnabled(), PCB_EDIT_FRAME::KiwayMailIn(), Load_Module_From_BOARD(), Magnetize(), DIALOG_DRC_CONTROL::OnActivateDlg(), DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked(), DIALOG_IMPORT_SETTINGS::OnBrowseClicked(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), OnCloseWindow(), DIALOG_NETLIST::OnCompileRatsnestClick(), DIALOG_EXPORT_STEP::onExportButton(), PCB_EDIT_FRAME::OnExportIDF3(), PCB_EDIT_FRAME::OnExportSTEP(), PCB_EDIT_FRAME::OnExportVRML(), DIALOG_GENDRILL::OnGenReportFile(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_LAYER_WIDGET::OnLayerVisible(), OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_LAYER_WIDGET::OnRenderEnable(), PCB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnSelectTool(), DIALOG_DRC_CONTROL::OnStartdrcClick(), DIALOG_NETLIST::OnTestFootprintsClick(), PCB_BASE_FRAME::OnTogglePadDrawMode(), OnUpdateInsertModuleInBoard(), OnUpdateLoadModuleFromBoard(), OnUpdateModuleSelected(), DIALOG_NETLIST::OnUpdatePCB(), OnUpdateSave(), PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest(), OnUpdateVerticalToolbar(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::Other_Layer_Route(), 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(), DIALOG_UPDATE_PCB::PerformUpdate(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), DIALOG_PLOT::Plot(), PCB_EDIT_FRAME::Process_Special_Functions(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow(), RedrawActiveWindow(), FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow(), FOOTPRINT_WIZARD_FRAME::RedrawActiveWindow(), PCB_EDIT_FRAME::RedrawActiveWindow(), PCB_LAYER_WIDGET::ReFill(), PCB_LAYER_WIDGET::ReFillRender(), Refresh(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), PCB_EDIT_FRAME::Remove_One_Track(), PCB_EDIT_FRAME::Remove_Zone_Corner(), PCB_EDIT_FRAME::RemoveMisConnectedTracks(), PCB_EDIT_FRAME::RemoveStruct(), PCB_BASE_FRAME::Rotate_Module(), DRC::RunTests(), SaveFootprintToBoard(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SelectCopperLayerPair(), PCB_EDIT_FRAME::SelectHighLight(), PCB_BASE_FRAME::SelectLayer(), DIALOG_GLOBAL_DELETION::SetCurrentLayer(), SetDesignSettings(), DIALOG_DRC_CONTROL::SetDrcParmeters(), SetElementVisibility(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), ZONE_SETTINGS::SetupLayersList(), setupTools(), PCB_EDIT_FRAME::Show_1_Ratsnest(), Show_New_Edge_While_Move_Mouse(), PCB_EDIT_FRAME::SpreadFootprints(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), PCB_EDIT_FRAME::Swap_Layers(), PCB_EDIT_FRAME::SwitchLayer(), PCB_LAYER_WIDGET::SyncLayerVisibilities(), DRC::testDisabledLayers(), DRC::TestZoneToZoneOutline(), PCB_BASE_FRAME::TraceAirWiresToTargets(), PCB_BASE_FRAME::TraceModuleRatsNest(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_SWAP_LAYERS::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), DIALOG_SWAP_LAYERS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), FOOTPRINT_VIEWER_FRAME::UpdateMsgPanel(), DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel(), FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel(), UpdateMsgPanel(), DRC::updatePointers(), updateTitle(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), updateView(), DIALOG_NETLIST::verifyFootprints(), and DIALOG_DRC_CONTROL::writeReport().

189  {
190  wxASSERT( m_Pcb );
191  return m_Pcb;
192  }

◆ 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 367 of file pcb_base_frame.cpp.

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 BestZoom(), and PCB_BASE_FRAME::BestZoom().

368 {
369  wxASSERT( m_Pcb );
370 
371  EDA_RECT area = aBoardEdgesOnly ? m_Pcb->GetBoardEdgesBoundingBox() : m_Pcb->GetBoundingBox();
372 
373  if( area.GetWidth() == 0 && area.GetHeight() == 0 )
374  {
375  wxSize pageSize = GetPageSizeIU();
376 
378  {
379  area.SetOrigin( 0, 0 );
380  area.SetEnd( pageSize.x, pageSize.y );
381  }
382  else
383  {
384  area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
385  area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
386  }
387  }
388 
389  return area;
390 }
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: class_board.h:798
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:810
int GetWidth() const
Definition: eda_rect.h:117
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:146
void SetEnd(int x, int y)
Definition: eda_rect.h:134
int GetHeight() const
Definition: eda_rect.h:118
Class 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...

◆ GetCanvas()

virtual EDA_DRAW_PANEL* EDA_DRAW_FRAME::GetCanvas ( ) const
inlinevirtualinherited

Reimplemented in SCH_BASE_FRAME.

Definition at line 394 of file draw_frame.h.

References EDA_DRAW_FRAME::m_canvas.

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

394 { return m_canvas; }
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126

◆ GetCanvasTypeKey()

virtual wxString EDA_DRAW_FRAME::GetCanvasTypeKey ( )
inlineprotectedvirtualinherited
Returns
the key in KifaceSettings to store the canvas type. the base version returns only CanvasTypeKeyBase. Can be overriden to return a key specific of a frame name

Definition at line 240 of file draw_frame.h.

References CanvasTypeKeyBase.

Referenced by EDA_DRAW_FRAME::LoadCanvasTypeSetting(), and EDA_DRAW_FRAME::saveCanvasTypeSetting().

241  {
242  return CanvasTypeKeyBase;
243  }
#define CanvasTypeKeyBase
The key to store the canvas type in config.
Definition: draw_frame.h:73

◆ GetCollectorsGuide()

GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide ( )
inherited

Function GetCollectorsGuide.

Returns
GENERAL_COLLECTORS_GUIDE - that considers the global configuration options.

Definition at line 766 of file pcb_base_frame.cpp.

References PCB_BASE_FRAME::GetActiveLayer(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_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 PCB_EDIT_FRAME::createPopUpMenuForZones(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), and PCB_EDIT_FRAME::SelectHighLight().

767 {
769  GetGalCanvas()->GetView() );
770 
771  // account for the globals
773  guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
774  guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
775  guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_BK ) );
776  guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_FR ) );
777  guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( LAYER_PAD_BK ) );
778  guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
779  guide.SetIgnoreThroughHolePads( ! m_Pcb->IsElementVisible( LAYER_PADS_TH ) );
780  guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
781  guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
782  guide.SetIgnoreThroughVias( ! m_Pcb->IsElementVisible( LAYER_VIA_THROUGH ) );
783  guide.SetIgnoreBlindBuriedVias( ! m_Pcb->IsElementVisible( LAYER_VIA_BBLIND ) );
784  guide.SetIgnoreMicroVias( ! m_Pcb->IsElementVisible( LAYER_VIA_MICROVIA ) );
785  guide.SetIgnoreTracks( ! m_Pcb->IsElementVisible( LAYER_TRACKS ) );
786 
787  return guide;
788 }
to draw blind/buried vias
multilayer pads, usually with holes
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:934
show modules on back
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
show modules values (when texts are visibles)
smd pads, back layer
show modules on front
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
to draw usual through hole vias
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:547
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
smd pads, front layer
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:391
show modules references (when texts are visibles)

◆ GetConfigurationSettings()

PARAM_CFG_ARRAY & FOOTPRINT_EDIT_FRAME::GetConfigurationSettings ( )

Return the footprint editor settings list.

Currently, only the settings that are needed at start up by the main window are defined here. There are other locally used settings that are scattered throughout the Pcbnew source code. If you need to define a configuration setting that needs to be loaded at run time, this is the place to define it.

Returns
- Reference to the list of applications settings.

Definition at line 83 of file footprint_editor_options.cpp.

References DEFAULT_COPPER_TEXT_SIZE, DEFAULT_COPPER_TEXT_WIDTH, DEFAULT_SILK_LINE_WIDTH, DEFAULT_SILK_TEXT_SIZE, DEFAULT_SILK_TEXT_WIDTH, DEFAULT_TEXT_SIZE, DEFAULT_TEXT_WIDTH, F_Fab, F_SilkS, FILLED, GetDesignSettings(), PCB_BASE_FRAME::GetDisplayOptions(), LAYER_CLASS_COPPER, LAYER_CLASS_COURTYARD, LAYER_CLASS_EDGES, LAYER_CLASS_OTHERS, LAYER_CLASS_SILK, m_configParams, BOARD_DESIGN_SETTINGS::m_LineThickness, BOARD_DESIGN_SETTINGS::m_RefDefaultlayer, BOARD_DESIGN_SETTINGS::m_RefDefaultText, BOARD_DESIGN_SETTINGS::m_RefDefaultVisibility, BOARD_DESIGN_SETTINGS::m_TextItalic, BOARD_DESIGN_SETTINGS::m_TextSize, BOARD_DESIGN_SETTINGS::m_TextThickness, BOARD_DESIGN_SETTINGS::m_ValueDefaultlayer, BOARD_DESIGN_SETTINGS::m_ValueDefaultText, BOARD_DESIGN_SETTINGS::m_ValueDefaultVisibility, TEXTS_MAX_SIZE, TEXTS_MAX_WIDTH, and TEXTS_MIN_SIZE.

Referenced by LoadSettings(), and SaveSettings().

84 {
85  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
87 
88  // Update everything
89  m_configParams.clear(); // boost::ptr_vector destroys the pointers inside
90 
91  // Display options:
92  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
93  &displ_opts->m_DisplayPolarCood, false ) );
94  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
95  &displ_opts->m_DisplayPadFill, true ) );
96  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
97  &displ_opts->m_DisplayModEdgeFill, FILLED ) );
98  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
99  &displ_opts->m_DisplayModTextFill, FILLED ) );
100  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
101  &displ_opts->m_DisplayModTextFill, FILLED ) );
102  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
103  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
104 
105  // design settings
106  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkLineWidth" ),
107  &settings.m_LineThickness[ LAYER_CLASS_SILK ],
108  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
109  nullptr, 1/IU_PER_MM, wxT( "FpEditorGrlineWidth" ) ) );
110 
111  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextSizeH" ),
112  &settings.m_TextSize[ LAYER_CLASS_SILK ].x,
114  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultSizeH" ) ) );
115 
116  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextSizeV" ),
117  &settings.m_TextSize[ LAYER_CLASS_SILK ].y,
119  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultSizeV" ) ) );
120 
121  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextThickness" ),
122  &settings.m_TextThickness[ LAYER_CLASS_SILK ],
123  Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
124  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultThickness" ) ) );
125 
126  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorSilkTextItalic" ),
127  &settings.m_TextItalic[ LAYER_CLASS_SILK ] ) );
128 
129  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperLineWidth" ),
130  &settings.m_LineThickness[ LAYER_CLASS_COPPER ],
131  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
132  nullptr, MM_PER_IU ) );
133 
134  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextSizeV" ),
135  &settings.m_TextSize[ LAYER_CLASS_COPPER ].y,
137  nullptr, MM_PER_IU ) );
138 
139  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextSizeH" ),
140  &settings.m_TextSize[ LAYER_CLASS_COPPER ].x,
142  nullptr, MM_PER_IU ) );
143 
144  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextThickness" ),
145  &settings.m_TextThickness[ LAYER_CLASS_COPPER ],
146  Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
147  nullptr, MM_PER_IU ) );
148 
149  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorCopperTextItalic" ),
150  &settings.m_TextItalic[ LAYER_CLASS_COPPER ] ) );
151 
152  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorEdgeCutLineWidth" ),
153  &settings.m_LineThickness[ LAYER_CLASS_EDGES ],
154  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
155  nullptr, MM_PER_IU ) );
156 
157  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCourtyardLineWidth" ),
159  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
160  nullptr, MM_PER_IU ) );
161 
162  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersLineWidth" ),
163  &settings.m_LineThickness[ LAYER_CLASS_OTHERS ],
164  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
165  nullptr, MM_PER_IU ) );
166 
167  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeV" ),
168  &settings.m_TextSize[ LAYER_CLASS_OTHERS ].x,
170  nullptr, MM_PER_IU ) );
171 
172  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeH" ),
173  &settings.m_TextSize[ LAYER_CLASS_OTHERS ].y,
175  nullptr, MM_PER_IU ) );
176 
177  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeThickness" ),
178  &settings.m_TextThickness[ LAYER_CLASS_OTHERS ],
179  Millimeter2iu( DEFAULT_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
180  nullptr, MM_PER_IU ) );
181 
182  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorOthersTextItalic" ),
183  &settings.m_TextItalic[ LAYER_CLASS_OTHERS ] ) );
184 
185  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorRefDefaultText" ),
186  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
187 
188  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorRefDefaultVisibility" ),
189  &settings.m_RefDefaultVisibility, true ) );
190 
191  m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
192  &settings.m_RefDefaultlayer,
193  int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
194 
195  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
196  &settings.m_ValueDefaultText, wxT( "" ) ) );
197 
198  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorValueDefaultVisibility" ),
199  &settings.m_ValueDefaultVisibility, true ) );
200 
201  m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
202  &settings.m_ValueDefaultlayer,
203  int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
204 
205  return m_configParams;
206 }
#define DEFAULT_SILK_TEXT_WIDTH
wxString m_RefDefaultText
Default ref text on fp creation.
PARAM_CFG_ARRAY m_configParams
List of footprint editor configuration parameters.
bool m_ValueDefaultVisibility
Default value text visibility on fp creation.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
#define TEXTS_MAX_WIDTH
Maximum text width in internal units (10 inches)
Definition: pcbnew.h:69
int m_ValueDefaultlayer
Default value text layer on fp creation.
Configuration parameter - Integer Class with unit conversion.
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
#define DEFAULT_TEXT_WIDTH
wxSize m_TextSize[LAYER_CLASS_COUNT]
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
#define DEFAULT_SILK_TEXT_SIZE
int m_TextThickness[LAYER_CLASS_COUNT]
#define DEFAULT_SILK_LINE_WIDTH
Configuration parameter - Integer Class.
bool m_TextItalic[LAYER_CLASS_COUNT]
Configuration parameter - Boolean Class.
#define TEXTS_MAX_SIZE
Maximum text size in internal units (10 inches)
Definition: pcbnew.h:68
wxString m_ValueDefaultText
Default value text on fp creation.
int m_LineThickness[LAYER_CLASS_COUNT]
Configuration parameter - wxString Class.
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
Definition: pcbnew.h:67
int m_RefDefaultlayer
Default ref text layer on fp creation.
#define DEFAULT_COPPER_TEXT_WIDTH
#define DEFAULT_COPPER_TEXT_SIZE
#define DEFAULT_TEXT_SIZE
bool m_RefDefaultVisibility
Default ref text visibility on fp creation.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

◆ GetCrossHairPosition()

wxPoint EDA_DRAW_FRAME::GetCrossHairPosition ( bool  aInvertY = false) const
inherited

Return the current cross hair position in logical (drawing) coordinates.

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

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

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

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

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

◆ GetCrossHairScreenPosition()

wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition ( ) const
inherited

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

Returns
The current cross hair position.

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

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

1172 {
1173  BASE_SCREEN* screen = GetScreen(); // virtual call
1174  return screen->getCrossHairScreenPosition();
1175 }
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units...
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:403

◆ GetCurItem()