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...
 
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 ()
 Function GetConfigurationSettings returns the footpr�int editor settings list. More...
 
void InstallOptionsFrame (const wxPoint &pos)
 
void OnCloseWindow (wxCloseEvent &Event) override
 
void CloseModuleEditor (wxCommandEvent &Event)
 
void Process_Special_Functions (wxCommandEvent &event)
 
void ProcessPreferences (wxCommandEvent &event)
 
void RedrawActiveWindow (wxDC *DC, bool EraseBg) override
 Function RedrawActiveWindoow draws the footprint editor BOARD, and others elements such as axis and grid. More...
 
void ReCreateHToolbar () override
 Function ReCreateHToolbar create the main horizontal toolbar for the footprint editor. More...
 
void ReCreateVToolbar () override
 
void ReCreateOptToolbar () override
 
void ReCreateAuxiliaryToolbar () override
 
void OnLeftClick (wxDC *DC, const wxPoint &MousePos) override
 
void OnLeftDClick (wxDC *DC, const wxPoint &MousePos) override
 Function OnLeftDClick handles the double click in the footprint editor: If the double clicked item is editable: call the corresponding editor. More...
 
bool OnRightClick (const wxPoint &MousePos, wxMenu *PopMenu) override
 Function OnRightClick handles the right mouse click in the footprint editor: Create the pop up menu After this menu is built, the standard ZOOM menu is added. 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 OnSaveLibraryAs (wxCommandEvent &aEvent)
 Function OnSaveLibraryAs saves the current 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
 Function OnHotKey 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
 Function Show3D_Frame displays 3D view of the footprint (module) being edited. More...
 
bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
 Function GeneralControl performs application specific control using aDC at aPosition in logical units. More...
 
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 OnUpdateLibSelected (wxUpdateUIEvent &aEvent)
 
void OnUpdateModuleSelected (wxUpdateUIEvent &aEvent)
 
void OnUpdateLoadModuleFromBoard (wxUpdateUIEvent &aEvent)
 
void OnUpdateInsertModuleInBoard (wxUpdateUIEvent &aEvent)
 
void OnUpdateReplaceModuleInBoard (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectCurrentLib (wxUpdateUIEvent &aEvent)
 
void OnEditItemRequest (wxDC *aDC, BOARD_ITEM *aItem) override
 > More...
 
void LoadModuleFromBoard (wxCommandEvent &event)
 Function LoadModuleFromBoard called from the main toolbar to load a footprint from board mainly to edit it. More...
 
bool SaveFootprintInLibrary (wxString activeLibrary, MODULE *aModule)
 Function SaveFootprintInLibrary Save in an existing library a given footprint. More...
 
virtual void OnModify () override
 Virtual Function OnModify() 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)
 Function ToPrinter Install the print dialog. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMaskLayer, bool aPrintMirrorMode, void *aData=NULL) override
 Function PrintPage is used to print a page. More...
 
bool Clear_Pcb (bool aQuery)
 Function Clear_Pcb delete all and reinitialize the current board. More...
 
virtual int BlockCommand (EDA_KEY key) override
 Function BlockCommand Returns 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
 Function HandleBlockPlace handles the BLOCK PLACE command Last routine for block operation for: More...
 
virtual bool HandleBlockEnd (wxDC *DC) override
 Function HandleBlockEnd( ) Handle the "end" of a block command, i.e. More...
 
BOARD_ITEMModeditLocateAndDisplay (int aHotKeyCode=0)
 
const wxString GetCurrentLib () const
 Return the current library nickname. More...
 
void RemoveStruct (EDA_ITEM *Item)
 
void Transform (MODULE *module, int transform)
 Function Transform performs a geometric transform on the current footprint. More...
 
void Export_Module (MODULE *aModule)
 Function Export_Module Create a file containing only one footprint. More...
 
MODULEImport_Module (const wxString &aName=wxT(""))
 Function Import_Module Read a file containing only one footprint. More...
 
bool SaveCurrentModule (const wxString *aLibPath=NULL)
 Function SaveCurrentModule saves the module which is currently being edited into aLibPath or into the currently selected library if aLibPath is NULL. More...
 
bool Load_Module_From_BOARD (MODULE *Module)
 Function Load_Module_From_BOARD load in Modedit a footprint from the main board. More...
 
MODULESelectFootprint (BOARD *aPcb)
 Function SelectFootprint Display the list of modules currently existing on the BOARD. More...
 
void Edit_Edge_Width (EDGE_MODULE *aEdge)
 Function Edit_Edge_Width changes the width of module perimeter lines, EDGE_MODULEs. More...
 
void Edit_Edge_Layer (EDGE_MODULE *Edge)
 Function Edit_Edge_Layer changes 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)
 Function Delete_Edge_Module deletes EDGE_MODULE Edge. More...
 
EDGE_MODULEBegin_Edge_Module (EDGE_MODULE *Edge, wxDC *DC, STROKE_T type_edge)
 Function Begin_Edge_Module creates a new edge item (line, arc ..). More...
 
void End_Edge_Module (EDGE_MODULE *Edge)
 Function End_Edge_Module terminates a move or create edge function. More...
 
void Enter_Edge_Width (EDGE_MODULE *aEdge)
 Function Enter_Edge_Width Edition of width of module outlines Ask for a new width. 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 InstallFootprintBodyItemPropertiesDlg (EDGE_MODULE *aItem)
 Function InstallFootprintBodyItemPropertiesDlg Install a dialog to edit a graphic item of a footprint body. More...
 
void DlgGlobalChange_PadSettings (D_PAD *aPad)
 Function DlgGlobalChange_PadSettings changes pad characteristics for the given footprint or all footprints which look like the given footprint. More...
 
bool DeleteModuleFromCurrentLibrary ()
 Function DeleteModuleFromCurrentLibrary prompts user for footprint name, then deletes it from current library. More...
 
bool IsElementVisible (GAL_LAYER_ID aElement) const
 Function IsElementVisible tests whether a given element category is visible. More...
 
void SetElementVisibility (GAL_LAYER_ID aElement, bool aNewState)
 Function SetElementVisibility changes the visibility of an element category. More...
 
virtual bool IsGridVisible () const override
 Function IsGridVisible() , virtual. More...
 
virtual void SetGridVisibility (bool aVisible) override
 Function SetGridVisibility() , virtual It may be overloaded by derived classes if you want to store/retrieve the grid visibility in configuration. More...
 
virtual COLOR4D GetGridColor () override
 Function GetGridColor() , virtual. More...
 
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
 Function OpenProjectFiles (was LoadOnePcbFile) loads a KiCad board (.kicad_pcb) from aFileName. More...
 
int GetIconScale () override
 Function GetIconScale. More...
 
void UpdateMsgPanel () override
 redraws the message panel. 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...
 
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 edition: More...
 
void RestoreCopyFromUndoList (wxCommandEvent &aEvent)
 Function RestoreCopyFromUndoList Undo the last edition: 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...
 
virtual void SetBoard (BOARD *aBoard) override
 > More...
 
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...
 
bool CheckFootprint (const LIB_ID &aFootprintId)
 Check to see if a footprint is available Note that this is more strict than LoadFootprint as it also checks to see that the footprint's library is enabled in the fpTable. 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
 Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPointGetAuxOrigin () const override
 Function GetAuxOrigin returns the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPoint) override
 
const wxPointGetGridOrigin () const override
 Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void * 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 ShowChangedLanguage () override
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg) override
 Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void UpdateStatusBar () override
 Function UpdateStatusBar updates the status bar information. More...
 
PCB_SCREENGetScreen () const override
 Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives. More...
 
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...
 
EDA_ITEMReadDrawSegmentDescr (LINE_READER *aReader)
 
int ReadListeSegmentDescr (LINE_READER *aReader, TRACK *PtSegm, int StructType, int NumSegm)
 
int ReadSetup (LINE_READER *aReader)
 
int ReadGeneralDescrPcb (LINE_READER *aReader)
 
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...
 
void FocusOnLocation (const wxPoint &aPos, bool aWarpMouseCursor=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...
 
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 ResetModuleTextSizes (const wxString &aFilter, bool aRef, bool aValue, bool aOthers)
 Function ResetModuleTextSizes resets text size and width of all module text fields of given field type to current settings in Preferences->Dimensions->Texts and Drawings. More...
 
void InstallPadOptionsFrame (D_PAD *pad)
 
void InstallTextModOptionsFrame (TEXTE_MODULE *TextMod, wxDC *DC)
 
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 RotatePad (D_PAD *Pad, wxDC *DC)
 
void PlacePad (D_PAD *Pad, wxDC *DC)
 
void Export_Pad_Settings (D_PAD *aPad)
 
void Import_Pad_Settings (D_PAD *aPad, bool aDraw)
 
void GlobalChange_PadSettings (D_PAD *aPad, bool aSameFootprints, bool aPadShapeFilter, bool aPadOrientFilter, bool aPadLayerFilter, bool aRedraw, bool aSaveForUndo)
 Function GlobalChange_PadSettings Function to change pad caracteristics for the given footprint or all footprints which look like the given footprint. More...
 
wxString SelectFootprint (EDA_DRAW_FRAME *aWindow, const wxString &aLibraryName, const wxString &aMask, const wxString &aKeyWord, FP_LIB_TABLE *aTable)
 Function SelectFootprint displays a list of modules found in all libraries or a given library. More...
 
MODULELoadModuleFromLibrary (const wxString &aLibrary, bool aUseFootprintViewer=true)
 Function LoadModuleFromLibrary opens a dialog to select a footprint. More...
 
void AddModuleToBoard (MODULE *module, wxDC *aDC=nullptr)
 Adds the given module to the board. More...
 
wxString SelectFootprintFromLibBrowser ()
 Function SelectFootprintFromLibBrowser launches the footprint viewer to select the name of a footprint to load. More...
 
void Compile_Ratsnest (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 Build_Board_Ratsnest ()
 Function Build_Board_Ratsnest. 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 TestForActiveLinksInRatsnest (int aNetCode)
 Function TestForActiveLinksInRatsnest Explores the full rats nest list (which must exist) to determine the ACTIVE links in the full rats nest list When tracks exist between pads, a link can connect 2 pads already connected by a track and the link is said inactive. More...
 
void TestConnections ()
 Function TestConnections tests the connections relative to all nets. More...
 
void TestNetConnection (wxDC *aDC, int aNetCode)
 Function TestNetConnection tests the connections relative to aNetCode. More...
 
void ComputeLegacyConnections ()
 Function RecalculateAllTracksNetcode search connections between tracks and pads and propagate pad net codes to the track segments. 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...
 
bool InvokeDialogGrid ()
 
void OnTogglePolarCoords (wxCommandEvent &aEvent)
 
void OnTogglePadDrawMode (wxCommandEvent &aEvent)
 
void OnToggleGraphicDrawMode (wxCommandEvent &aEvent)
 
void OnToggleEdgeDrawMode (wxCommandEvent &aEvent)
 
void OnToggleTextDrawMode (wxCommandEvent &aEvent)
 
virtual void OnSwitchCanvas (wxCommandEvent &aEvent)
 
void OnUpdateCoordType (wxUpdateUIEvent &aEvent)
 
void OnUpdatePadDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateGraphicDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateEdgeDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateTextDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectGrid (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 ClearSelection ()
 
void OnUpdateSwitchCanvas (wxUpdateUIEvent &aEvent)
 Update UI called when switches currently used canvas (default / Cairo / OpenGL). More...
 
PCB_GENERAL_SETTINGSSettings ()
 
const PCB_GENERAL_SETTINGSCSettings () const
 
virtual void OnCharHook (wxKeyEvent &event)
 this function capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Function LockFile marks a schematic file as being in use. More...
 
void ReleaseFile ()
 Function ReleaseFile Release the current file marked in use. More...
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Function GetCursorPosition returns the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Function GetNearestGridPosition returns the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Function GetCursorScreenPosition returns the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Function RefPos Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
EDA_DRAW_PANELGetCanvas ()
 
virtual wxString GetScreenDesc () const
 
virtual void ExecuteRemoteCommand (const char *cmdline)
 Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
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)
 Function SetGridColor() , virtual. More...
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
void SetPresetGrid (int aIndex)
 Function SetPresetGrid() changes the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Function OnSize recalculates the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Function SetNextZoom() changes the zoom to the next one available. More...
 
void SetPrevZoom ()
 Function SetPrevZoom() changes the zoom to the previous one available. More...
 
void SetPresetZoom (int aIndex)
 Function SetPresetZoom() changes zoom to one of the preset values. More...
 
void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
void RedrawScreen2 (const wxPoint &posBefore)
 Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming. More...
 
void Zoom_Automatique (bool aWarpPointer)
 Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void Window_Zoom (EDA_RECT &Rect)
 
double GetZoom ()
 Function GetZoom. More...
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnActivate (wxActivateEvent &event)
 Function OnActivate (virtual) is called when activating the frame. More...
 
void DisplayUnitsMsg ()
 Function DisplayUnitsMsg displays current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Function CopyToClipboard copies the current page or the current block to the clipboard. More...
 
void 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)
 Function SetMsgPanel clears the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Function PushPreferences Pushes a few preferences from a parent window to a child window. More...
 
wxString CoordinateToString (int aValue, bool aConvertToMils=false) const
 Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting. More...
 
wxString LengthDoubleToString (double aValue, bool aConvertToMils=false) const
 Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Function GetToolManager returns the tool manager instance, if any. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Function SyncMenusAndToolbars Updates the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
virtual void KiwayMailIn (KIWAY_EXPRESS &aEvent)
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
virtual void SetIconScale (int aScale)
 Function SetIconScale. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

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 CANVAS_TYPE_KEY [] = wxT( "canvas_type" )
 

Key in KifaceSettings to store the canvas type.

More...
 

Protected Member Functions

 FOOTPRINT_EDIT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 protected so only friend PCB::IFACE::CreateWindow() can act as sole factory. More...
 
void updateTitle ()
 Function UpdateTitle updates window title according to getLibNickName(). More...
 
void updateView ()
 Reloads displayed items and sets view. More...
 
const wxString getLibPath ()
 The libPath is not publicly visible, grab it from the FP_LIB_TABLE if we must. 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 updateGridSelectBox ()
 
void updateZoomSelectBox ()
 
virtual void unitsChangeRefresh () override
 Function unitsChangeRefresh is called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
MODULEloadFootprint (const LIB_ID &aFootprintId)
 Function loadFootprint attempts to load aFootprintId from the footprint library table. More...
 
void SetScreen (BASE_SCREEN *aScreen)
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting () const
 Returns the canvas type stored in the application settings. More...
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void OnChangeIconsOptions (wxCommandEvent &event) override
 Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Function autoSaveRequired returns the auto save status of the application. More...
 
virtual bool doAutoSave ()
 Function doAutoSave should be overridden by the derived class to handle the auto save feature. More...
 
virtual wxConfigBase * config ()
 Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual const SEARCH_STACKsys_search ()
 Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual wxString help_name ()
 

Protected Attributes

PCB_LAYER_WIDGETm_Layers
 the layer manager More...
 
PARAM_CFG_ARRAY m_configParams
 List of footprint editor configuration parameters. More...
 
int m_iconScale
 Pretty much what it says on the tin. 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
 
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_DRAW_PANELm_canvas
 The area to draw on. More...
 
TOOL_MANAGERm_toolManager
 
TOOL_DISPATCHERm_toolDispatcher
 
ACTIONSm_actions
 
int m_lastDrawToolId
 Tool ID of previously active draw tool bar button. More...
 
bool m_showAxis
 True shows the X and Y axis indicators. More...
 
bool m_showGridAxis
 True shows the grid axis indicators. More...
 
bool m_showOriginAxis
 True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files. More...
 
bool m_showBorderAndTitleBlock
 True shows the drawing border and title block. More...
 
long m_firstRunDialogSetting
 Key to control whether first run dialog is shown on startup. More...
 
wxChoice * m_gridSelectBox
 Choice box to choose the grid size. More...
 
wxChoice * m_zoomSelectBox
 Choice box to choose the zoom value. More...
 
wxAuiToolBar * m_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...
 
bool m_canvasTypeDirty
 Flag indicating that drawing canvas type needs to be saved to config. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 The current canvas type. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used More...
 
wxAuiToolBar * m_mainToolBar
 Standard horizontal Toolbar. More...
 
wxString m_AboutTitle
 Name of program displayed in About. More...
 
wxAuiManager m_auimgr
 
bool m_hasAutoSave
 Flag to indicate if this frame supports auto save. More...
 
bool m_autoSaveState
 Flag to indicate the last auto save state. More...
 
int m_autoSaveInterval
 The auto save interval time in seconds. More...
 
wxTimer * m_autoSaveTimer
 The timer used to implement the auto save feature;. More...
 
wxString m_perspective
 wxAuiManager perspective. More...
 
wxString m_mruPath
 Most recently used path. More...
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private Member Functions

void moveExact ()
 Function 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
 Function duplicateItems Duplicate the item under the cursor. More...
 

Friends

struct PCB::IFACE
 

Detailed Description

Definition at line 40 of file footprint_edit_frame.h.

Constructor & Destructor Documentation

FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME ( )

Definition at line 368 of file footprint_edit_frame.cpp.

References m_Layers, and retainLastFootprint().

369 {
370  // save the footprint in the PROJECT
372 
373  delete m_Layers;
374 }
PCB_LAYER_WIDGET * m_Layers
the layer manager

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

Definition at line 216 of file footprint_edit_frame.cpp.

References PAGE_INFO::A4, KIWAY_PLAYER::Destroy(), F_SilkS, FRAME_PCB, g_Module_Editor_Hotkeys_Descr, EDA_DRAW_PANEL_GAL::GetBackend(), GetBoard(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_PANEINFO::HorizontalToolbarPane(), ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, EDA_DRAW_FRAME::IsGalCanvasActive(), KiBitmap(), Kiway, LAYER_NO_CONNECTS, EDA_PANEINFO::LayersToolbarPane(), PCAD2KICAD::Left, BOARD_DESIGN_SETTINGS::m_SolderMaskMargin, EDA_PANEINFO::MessageToolbarPane(), KIWAY::Player(), PCAD2KICAD::Right, BOARD::SetElementVisibility(), BOARD::SetVisibleAlls(), UNSCALED_UNITS, and EDA_PANEINFO::VerticalToolbarPane().

216  :
217  PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString,
218  wxDefaultPosition, wxDefaultSize,
220 {
221  m_showBorderAndTitleBlock = false; // true to show the frame references
222  m_showAxis = true; // true to show X and Y axis on screen
223  m_showGridAxis = true; // show the grid origin axis
225 
226  // Give an icon
227  wxIcon icon;
228  icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
229  SetIcon( icon );
230  m_iconScale = -1;
231 
232  // Show a title (frame title + footprint name):
233  updateTitle();
234 
235  // Create GAL canvas
236  bool boardEditorWasRunning = Kiway().Player( FRAME_PCB, false ) != nullptr;
237  PCB_BASE_FRAME* pcbFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) );
238  PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
240  pcbFrame->GetGalCanvas()->GetBackend() );
241  SetGalCanvas( drawPanel );
242 
243  SetBoard( new BOARD() );
244  // In modedit, the default net clearance is not known.
245  // (it depends on the actual board)
246  // So we do not show the default clearance, by setting it to 0
247  // The footprint or pad specific clearance will be shown
248  GetBoard()->GetDesignSettings().GetDefault()->SetClearance( 0 );
249 
250  // Don't show the default board solder mask clearance in the footprint editor. Only the
251  // footprint or pad clearance setting should be shown if it is not 0.
253 
254  // restore the last footprint from the project, if any
256 
257  // Ensure all layers and items are visible:
258  // In footprint editor, some layers have no meaning or
259  // cannot be used, but we show all of them, at least to be able
260  // to edit a bad layer
262 
263  // However the "no net" mark on pads is useless, because there is
264  // no net in footprint editor: make it non visible
266 
267  m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), true );
268 
269  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
270  // initialize parameters in m_LayersManager
271  LoadSettings( config() );
273 
274  SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
276  GetScreen()->SetCurItem( NULL );
277 
280 
281  // In modedit, set the default paper size to A4:
282  // this should be OK for all footprint to plot/print
284 
285  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
286  ReCreateMenuBar();
291 
292  if( m_canvas )
294 
295  m_auimgr.SetManagedWindow( this );
296 
297  EDA_PANEINFO horiz;
298  horiz.HorizontalToolbarPane();
299 
300  EDA_PANEINFO vert;
301  vert.VerticalToolbarPane();
302 
303  EDA_PANEINFO mesg_pane;
304  mesg_pane.MessageToolbarPane();
305 
306  // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
307  // LAYER_WIDGET is floatable, but initially docked at far right
308  EDA_PANEINFO lyrs;
309  lyrs.LayersToolbarPane();
310  lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget
311  lyrs.BestSize( m_Layers->GetBestSize() );
312  lyrs.Caption( _( "Visibles" ) );
313 
314  m_auimgr.AddPane( m_mainToolBar,
315  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top(). Row( 0 ) );
316 
317  m_auimgr.AddPane( m_auxiliaryToolBar,
318  wxAuiPaneInfo( horiz ).Name( "m_auxiliaryToolBar" ).Top().Row( 1 ) );
319 
320  // The main right vertical toolbar
321  m_auimgr.AddPane( m_drawToolBar,
322  wxAuiPaneInfo( vert ).Name( "m_VToolBar" ).Right().Layer(1) );
323 
324  // Add the layer manager ( most right side of pcbframe )
325  m_auimgr.AddPane( m_Layers, lyrs.Name( "m_LayersManagerToolBar" ).Right().Layer( 2 ) );
326  // Layers manager is visible
327  m_auimgr.GetPane( "m_LayersManagerToolBar" ).Show( true );
328 
329  // The left vertical toolbar (fast acces to display options)
330  m_auimgr.AddPane( m_optionsToolBar,
331  wxAuiPaneInfo( vert ).Name( "m_optionsToolBar" ). Left().Layer(1) );
332 
333  m_auimgr.AddPane( m_canvas,
334  wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
335  m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
336  wxAuiPaneInfo().Name( "DrawFrameGal" ).CentrePane().Hide() );
337 
338  m_auimgr.AddPane( m_messagePanel,
339  wxAuiPaneInfo( mesg_pane ).Name( "MsgPanel" ).Bottom().Layer(10) );
340 
341  // Create the manager and dispatcher & route draw panel events to the dispatcher
342  setupTools();
343  GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
344  UseGalCanvas( pcbFrame->IsGalCanvasActive() );
345 
346  if( m_auimgr.GetPane( "m_LayersManagerToolBar" ).IsShown() )
347  {
348  m_Layers->ReFill();
350 
354  }
355 
356  if( !boardEditorWasRunning )
357  pcbFrame->Destroy();
358 
359  m_auimgr.Update();
360 
361  Raise(); // On some window managers, this is needed
362  Show( true );
363 
364  Zoom_Automatique( false );
365 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
int m_SolderMaskMargin
Solder mask margin.
PCB_BASE_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
void SetCurItem(BOARD_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
Definition: pcb_screen.h:82
show a marker on pads with no nets
void ReCreateHToolbar() override
Function ReCreateHToolbar create the main horizontal toolbar for the footprint editor.
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
NETCLASSPTR GetDefault() const
Function GetDefault.
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:924
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:116
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:359
void ReCreateAuxiliaryToolbar() override
Class PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tie...
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:167
struct EDA_HOTKEY_CONFIG g_Module_Editor_Hotkeys_Descr[]
PCB_LAYER_WIDGET * m_Layers
the layer manager
int m_iconScale
Pretty much what it says on the tin.
BOARD * GetBoard() const
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
void SetVisibleAlls()
Function SetVisibleAlls changes the bit-mask of visible element categories and layers.
bool OnLayerSelected()
Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwa...
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:904
wxAuiManager m_auimgr
wxSize GetBestSize() const
Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic conten...
EDA_PANEINFO & LayersToolbarPane()
Function LayersToolbarPane Change *this to a layers toolbar for KiCad.
void ReCreateOptToolbar() override
PCB_LAYER_ID m_Active_Layer
Definition: pcb_screen.h:44
Specialization of the wxAuiPaneInfo class for KiCad panels.
bool m_axesEnabled
Whether or not to draw the coordinate system axes
virtual void UseGalCanvas(bool aEnable) override
>
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:106
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
void ReCreateMenuBar() override
(Re)Create the menubar for the module editor frame
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:139
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:146
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:89
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
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:149
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:49
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:126
void ReFillRender()
Function ReFillRender rebuilds Render for instance after the config is read.
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:119
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:535
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:895
static const wxChar A4[]
Definition: page_info.h:59
#define KICAD_DEFAULT_DRAWFRAME_STYLE
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:102
ID_POPUP_GRID_USER
Definition: draw_frame.cpp:110
wxPoint m_UserGridSize
int m_LastGridSizeId
Definition: draw_frame.h:91
void SetAxesEnabled(bool aAxesEnabled)
Enables drawing the axes.
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:143
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
void updateTitle()
Function UpdateTitle updates window title according to getLibNickName().
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
void AddGrid(const GRID_TYPE &grid)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
virtual void SetBoard(BOARD *aBoard) override
>
void SetMaxUndoItems(int aMax)
Definition: base_screen.h:313
const PAGE_INFO & GetPageSettings() const override
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
void SetEnableBlockCommands(bool aEnable)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:903
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
void SelectLayer(LAYER_NUM aLayer)
Function SelectLayer changes the row selection in the layer list to aLayer provided.
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
static const wxChar * GetFootprintEditorFrameName()
Function GetFootprintEditorFrameName (static)

Member Function Documentation

void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

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

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

Definition at line 686 of file eda_base_frame.cpp.

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

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

687 {
688  wxMenu* menu = NULL;
689  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
690 
691  if( item ) // This menu exists, do nothing
692  return;
693 
694  menu = new wxMenu;
695 
696  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
697  _( "Icons in Menus" ), wxEmptyString,
698  wxITEM_CHECK ) );
699  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
700 
701  AddMenuItem( MasterMenu, menu,
703  _( "Icons Options" ),
704  _( "Select show icons in menus and icons sizes" ),
705  KiBitmap( icon_xpm ) );
706 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

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

Parameters
aMasterMenu= the menu to populate.

Definition at line 270 of file zoom.cpp.

References AddHotkeyName(), AddMenuItem(), BASE_SCREEN::BuildGridsChoiceList(), g_UserUnit, BASE_SCREEN::GetGrid(), BASE_SCREEN::GetGridCount(), EDA_DRAW_PANEL::GetScreen(), BASE_SCREEN::GetZoom(), HK_ZOOM_AUTO, HK_ZOOM_CENTER, HK_ZOOM_IN, HK_ZOOM_OUT, HK_ZOOM_REDRAW, 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().

271 {
272  int maxZoomIds;
273  double zoom;
274  wxString msg;
275  BASE_SCREEN* screen = m_canvas->GetScreen();
276 
277  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
278  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
279  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
280  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
281  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
282  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
283  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
284  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
285  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
286  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
287 
288 
289  wxMenu* zoom_choice = new wxMenu;
290  AddMenuItem( MasterMenu, zoom_choice,
291  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
292  KiBitmap( zoom_selection_xpm ) );
293 
294  zoom = screen->GetZoom();
296  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
297  maxZoomIds : screen->m_ZoomList.size();
298 
299  // Populate zoom submenu.
300  for( int i = 0; i < maxZoomIds; i++ )
301  {
302  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
303 
304  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
305  wxEmptyString, wxITEM_CHECK );
306  if( zoom == screen->m_ZoomList[i] )
307  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
308  }
309 
310  // Create grid submenu as required.
311  if( screen->GetGridCount() )
312  {
313  wxMenu* gridMenu = new wxMenu;
314  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
315  _( "Grid" ), KiBitmap( grid_select_xpm ) );
316 
317  wxArrayString gridsList;
318  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
319 
320  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
321  {
322  GRID_TYPE& grid = screen->GetGrid( i );
323  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
324 
325  if( (int)i == icurr )
326  gridMenu->Check( grid.m_CmdId, true );
327  }
328  }
329 
330  MasterMenu->AppendSeparator();
331  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
332 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:89
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
Definition: common.h:146
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:99
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
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:193
int m_CmdId
Definition: base_screen.h:48
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
void PCB_BASE_FRAME::AddModuleToBoard ( MODULE module,
wxDC *  aDC = nullptr 
)
inherited

Adds the given module to the board.

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

Definition at line 303 of file load_select_footprint.cpp.

References BOARD::Add(), ADD_APPEND, MODULE::Draw(), MODULE::Flip(), GetBoard(), GetNewTimeStamp(), MODULE::GetPosition(), GR_OR, IS_NEW, MODULE::IsFlipped(), BOARD::m_Status_Pcb, EDA_ITEM::SetFlags(), MODULE::SetLink(), MODULE::SetPosition(), and EDA_ITEM::SetTimeStamp().

Referenced by MWAVE::CreateMicrowaveInductor(), PCB_EDIT_FRAME::CreateMuWaveBaseFootprint(), PCB_BASE_FRAME::GetScreen(), PCB_EDIT_FRAME::OnLeftClick(), PCB_EDITOR_CONTROL::PlaceModule(), and FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint().

304 {
305  if( module )
306  {
307  GetBoard()->Add( module, ADD_APPEND );
308 
309  module->SetFlags( IS_NEW );
310  module->SetLink( 0 );
311 
312  if( IsGalCanvasActive() )
313  module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment
314  else
315  module->SetPosition( GetCrossHairPosition() );
316 
317  module->SetTimeStamp( GetNewTimeStamp() );
318  GetBoard()->m_Status_Pcb = 0;
319 
320  // Put it on FRONT layer,
321  // (Can be stored flipped if the lib is an archive built from a board)
322  if( module->IsFlipped() )
323  module->Flip( module->GetPosition() );
324 
325  // Place it in orientation 0,
326  // even if it is not saved with orientation 0 in lib
327  // (Can happen if the lib is an archive built from a board)
328  Rotate_Module( NULL, module, 0, false );
329 
330  //RecalculateAllTracksNetcode();
331 
332  if( aDC )
333  module->Draw( m_canvas, aDC, GR_OR );
334  }
335 }
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw draws the footprint to the aDC.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
BOARD * GetBoard() const
void Rotate_Module(wxDC *DC, MODULE *module, double angle, bool incremental)
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
timestamp_t GetNewTimeStamp()
Definition: common.cpp:160
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
void SetLink(timestamp_t aLink)
Definition: class_module.h:567
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:254
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:895
void SetPosition(const wxPoint &aPos) override
Definition: gr_basic.h:38
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
const wxPoint GetPosition() const override
Definition: class_module.h:182
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:214
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:239
void PCB_BASE_FRAME::AddPad ( MODULE Module,
bool  draw 
)
inherited

Definition at line 114 of file pad_edition_functions.cpp.

References MODULE::CalculateBoundingBox(), D_PAD::GetAttribute(), MODULE::GetBoundingBox(), EDA_DRAW_FRAME::GetCrossHairPosition(), PCB_BASE_FRAME::GetDesignSettings(), 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 PCB_BASE_FRAME::GetScreen(), and OnLeftClick().

115 {
116  m_Pcb->m_Status_Pcb = 0;
117  aModule->SetLastEditTime();
118 
119  D_PAD* pad = new D_PAD( aModule );
120 
121  // Add the new pad to end of the module pad list.
122  aModule->PadsList().PushBack( pad );
123 
124  // Update the pad properties,
125  // and keep NETINFO_LIST::ORPHANED as net info
126  // which is the default when nets cannot be handled.
127  Import_Pad_Settings( pad, false );
128 
130 
131  // Set the relative pad position
132  // ( pad position for module orient, 0, and relative to the module position)
133 
134  wxPoint pos0 = pad->GetPosition() - aModule->GetPosition();
135  RotatePoint( &pos0, -aModule->GetOrientation() );
136  pad->SetPos0( pos0 );
137 
138  /* NPTH pads take empty pad number (since they can't be connected),
139  * other pads get incremented from the last one edited */
140  wxString padName;
141 
143  {
144  padName = GetNextPadName( GetDesignSettings()
145  .m_Pad_Master.GetName() );
146  }
147 
148  pad->SetName( padName );
150 
151  aModule->CalculateBoundingBox();
152  SetMsgPanel( pad );
153 
154  if( draw )
155  m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() );
156 }
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:405
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
void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
Definition: draw_panel.cpp:318
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
static wxString GetNextPadName(wxString aPadName)
Compute the &#39;next&#39; pad number for autoincrement aPadName is the last pad name used.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:831
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
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
const wxPoint GetPosition() const override
Definition: class_pad.h:220
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void Import_Pad_Settings(D_PAD *aPad, bool aDraw)
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:239
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

Definition at line 969 of file draw_frame.cpp.

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

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

970 {
971  BASE_SCREEN* screen = GetScreen();
972 
973  if( !screen || !m_canvas )
974  return;
975 
976  double scale = screen->GetScalingFactor();
977 
978  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
979  aCenterPositionIU.x, aCenterPositionIU.y, scale );
980 
981  // Calculate the portion of the drawing that can be displayed in the
982  // client area at the current zoom level.
983 
984  // visible viewport in device units ~ pixels
985  wxSize clientSizeDU = m_canvas->GetClientSize();
986 
987  // Size of the client window in IU
988  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
989 
990  // Full drawing or "page" rectangle in internal units
991  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
992 
993  // Remark: if something is modified here, perhaps EDA_DRAW_FRAME::RedrawScreen2()
994  // will need changes accordint to the way the center is computed
995  // Account for scrollbars
996  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
997  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
998  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
999 
1000  // The upper left corner of the client rectangle in internal units.
1001  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
1002  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
1003 
1004  // If drawn around the center, adjust the client rectangle accordingly.
1005  if( screen->m_Center )
1006  {
1007  // half page offset.
1008  xIU += pageRectIU.GetWidth() / 2.0;
1009  yIU += pageRectIU.GetHeight() / 2.0;
1010  }
1011 
1012  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
1013  wxPoint centerPositionIU;
1014 
1015  // put "int" limits on the clientRect
1016  if( clientRectIU.GetLeft() < VIRT_MIN )
1017  clientRectIU.MoveLeftTo( VIRT_MIN );
1018  if( clientRectIU.GetTop() < VIRT_MIN )
1019  clientRectIU.MoveTopTo( VIRT_MIN );
1020  if( clientRectIU.GetRight() > VIRT_MAX )
1021  clientRectIU.MoveRightTo( VIRT_MAX );
1022  if( clientRectIU.GetBottom() > VIRT_MAX )
1023  clientRectIU.MoveBottomTo( VIRT_MAX );
1024 
1025  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
1026  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
1027 
1028  if( screen->m_Center )
1029  {
1030  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
1031  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
1032  }
1033 
1034  DSIZE virtualSizeIU;
1035 
1036  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
1037  {
1038  virtualSizeIU.x = pageRectIU.GetSize().x;
1039  }
1040  else
1041  {
1042  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
1043  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
1044 
1045  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
1046  {
1047  if( pageCenterX > clientCenterX )
1048  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
1049  else if( pageCenterX < clientCenterX )
1050  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
1051  else
1052  virtualSizeIU.x = clientRectIU.GetWidth();
1053  }
1054  else
1055  {
1056  if( pageCenterX > clientCenterX )
1057  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
1058  else if( pageCenterX < clientCenterX )
1059  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
1060  else
1061  virtualSizeIU.x = pageRectIU.GetWidth();
1062  }
1063  }
1064 
1065  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
1066  {
1067  virtualSizeIU.y = pageRectIU.GetSize().y;
1068  }
1069  else
1070  {
1071  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
1072  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
1073 
1074  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
1075  {
1076  if( pageCenterY > clientCenterY )
1077  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
1078  else if( pageCenterY < clientCenterY )
1079  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
1080  else
1081  virtualSizeIU.y = clientRectIU.GetHeight();
1082  }
1083  else
1084  {
1085  if( pageCenterY > clientCenterY )
1086  virtualSizeIU.y = pageRectIU.GetHeight() +
1087  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1088  else if( pageCenterY < clientCenterY )
1089  virtualSizeIU.y = pageRectIU.GetHeight() +
1090  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1091  else
1092  virtualSizeIU.y = pageRectIU.GetHeight();
1093  }
1094  }
1095 
1096  // put "int" limits on the virtualSizeIU
1097  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1098  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1099 
1100  if( screen->m_Center )
1101  {
1102  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1103  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1104  }
1105  else
1106  {
1107  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1108  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1109  }
1110 
1111  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1112  * around cursor to jump around. This reported problem occurs when the
1113  * zoom point is not on a pixel per unit increment. If you set the
1114  * pixels per unit to 10, you have potential for the zoom point to
1115  * jump around +/-5 pixels from the nearest grid point.
1116  */
1117  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1118 
1119  // Number of scroll bar units for the given zoom level in device units.
1120  double unitsX = virtualSizeIU.x * scale;
1121  double unitsY = virtualSizeIU.y * scale;
1122 
1123  // Store the requested center position for later use
1124  SetScrollCenterPosition( aCenterPositionIU );
1125 
1126  // Calculate the scroll bar position in internal units to place the
1127  // center position at the center of client rectangle.
1128  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1129  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1130 
1131  // Convert scroll bar position to device units.
1132  posX = KiROUND( posX * scale );
1133  posY = KiROUND( posY * scale );
1134 
1135  if( posX < 0 )
1136  {
1137  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1138  posX = 0;
1139  }
1140 
1141  if( posX > unitsX )
1142  {
1143  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1144  posX = unitsX;
1145  }
1146 
1147  if( posY < 0 )
1148  {
1149  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1150  posY = 0;
1151  }
1152 
1153  if( posY > unitsY )
1154  {
1155  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1156  posY = unitsY;
1157  }
1158 
1159  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1160  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1161 
1162  wxLogTrace( traceScrollSettings,
1163  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1164  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1165  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1167  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1168  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1169 
1170  bool noRefresh = true;
1171 
1172  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1173  screen->m_ScrollPixelsPerUnitY,
1174  screen->m_ScrollbarNumber.x,
1175  screen->m_ScrollbarNumber.y,
1176  screen->m_ScrollbarPos.x,
1177  screen->m_ScrollbarPos.y, noRefresh );
1178 }
wxSize m_ScrollbarNumber
Current virtual draw area size in scroll units.
Definition: base_screen.h:192
#define VIRT_MAX
max X or Y coordinate in virtual space
Definition: draw_frame.cpp:966
int m_ScrollPixelsPerUnitY
Pixels per scroll unit in the vertical direction.
Definition: base_screen.h:190
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:92
#define VIRT_MIN
min X or Y coordinate in virtual space
Definition: draw_frame.cpp:965
void SetScrollCenterPosition(const wxPoint &aPoint)
Class BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated class Vec.
Definition: box2.h:41
virtual const wxSize GetPageSizeIU() const =0
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
bool m_Center
Center on screen.
Definition: base_screen.h:202
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
int m_ScrollPixelsPerUnitX
Pixels per scroll unit in the horizontal direction.
Definition: base_screen.h:189
wxPoint m_ScrollbarPos
Current scroll bar position in scroll units.
Definition: base_screen.h:196
static const wxString traceScrollSettings(wxT("KicadScrollSettings"))
Definition for enabling and disabling scroll bar setting trace output.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
static const double MAX_AXIS
Definition: draw_frame.cpp:963
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:183
#define min(a, b)
Definition: auxiliary.h:85
void EDA_DRAW_FRAME::AppendMsgPanel ( const wxString &  textUpper,
const wxString &  textLower,
COLOR4D  color,
int  pad = 6 
)
inherited

Append a message to the message panel.

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

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

Definition at line 811 of file draw_frame.cpp.

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

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

814 {
815  if( m_messagePanel == NULL )
816  return;
817 
818  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
819 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:149
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
EDGE_MODULE * FOOTPRINT_EDIT_FRAME::Begin_Edge_Module ( EDGE_MODULE Edge,
wxDC *  DC,
STROKE_T  type_edge 
)

Function Begin_Edge_Module 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 323 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(), 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, 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(), UR_CHANGED, wxPoint::x, and wxPoint::y.

Referenced by OnLeftClick().

326 {
327  MODULE* module = GetBoard()->m_Modules;
328 
329  if( module == NULL )
330  return NULL;
331 
332  if( aEdge == NULL ) // Start a new edge item
333  {
334  SaveCopyInUndoList( module, UR_CHANGED );
335 
336  aEdge = new EDGE_MODULE( module );
337  MoveVector.x = MoveVector.y = 0;
338 
339  // Add the new item to the Drawings list head
340  module->GraphicalItemsList().PushFront( aEdge );
341 
342  // Update characteristics of the segment or arc.
343  aEdge->SetFlags( IS_NEW );
344  aEdge->SetAngle( 0 );
345  aEdge->SetShape( type_edge );
346 
347  if( aEdge->GetShape() == S_ARC )
348  aEdge->SetAngle( ArcValue );
349 
350  aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
351  aEdge->SetLayer( GetActiveLayer() );
352 
353  // Initialize the starting point of the new segment or arc
354  aEdge->SetStart( GetCrossHairPosition() );
355 
356  // Initialize the ending point of the new segment or arc
357  aEdge->SetEnd( aEdge->GetStart() );
358 
359  // Initialize the relative coordinates
360  aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
361 
362  RotatePoint( &aEdge->m_Start0, -module->GetOrientation() );
363 
364  aEdge->m_End0 = aEdge->m_Start0;
365  module->CalculateBoundingBox();
367  }
368  /* Segment creation in progress.
369  * The ending coordinate is updated by the function
370  * ShowNewEdgeModule() called on move mouse event
371  * during the segment creation
372  */
373  else
374  {
375  if( type_edge == S_SEGMENT )
376  {
377  if( aEdge->m_Start0 != aEdge->m_End0 )
378  {
379  aEdge->Draw( m_canvas, DC, GR_OR );
380 
381  EDGE_MODULE* newedge = new EDGE_MODULE( *aEdge );
382 
383  // insert _after_ aEdge, which is the same as inserting before aEdge->Next()
384  module->GraphicalItemsList().Insert( newedge, aEdge->Next() );
385  aEdge->ClearFlags();
386 
387  aEdge = newedge; // point now new item
388 
389  aEdge->SetFlags( IS_NEW );
390  aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
391  aEdge->SetStart( GetCrossHairPosition() );
392  aEdge->SetEnd( aEdge->GetStart() );
393 
394  // Update relative coordinate.
395  aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
396 
397  wxPoint pt( aEdge->GetStart0() );
398 
399  RotatePoint( &pt, -module->GetOrientation() );
400 
401  aEdge->SetStart0( pt );
402 
403  aEdge->SetEnd0( aEdge->GetStart0() );
404 
405  module->CalculateBoundingBox();
406  module->SetLastEditTime();
407  OnModify();
408  }
409  }
410  else
411  {
412  wxMessageBox( wxT( "Begin_Edge() error" ) );
413  }
414  }
415 
416  return aEdge;
417 }
static void Abort_Move_ModuleOutline(EDA_DRAW_PANEL *Panel, wxDC *DC)
Definition: edgemod.cpp:296
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.
BOARD * GetBoard() const
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:109
BOARD_ITEM * Next() const
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
virtual void OnModify() override
Virtual Function OnModify() Must be called after a footprint change in order to set the "modify" flag...
double GetOrientation() const
Definition: class_module.h:187
Arcs (with rounded ends)
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:309
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:130
Definition: gr_basic.h:38
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
DLIST< MODULE > m_Modules
Definition: class_board.h:247
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:164
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
const wxPoint GetPosition() const override
Definition: class_module.h:182
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
void Insert(T *aNewElement, T *aElementAfterMe)
Function Insert puts aNewElement just in front of aElementAfterMe in the list sequence.
Definition: dlist.h:200
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 509 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().

510 {
511  EDA_RECT ibbbox = GetBoardBoundingBox();
512 
513  double sizeX = (double) ibbbox.GetWidth();
514  double sizeY = (double) ibbbox.GetHeight();
515 
516  wxPoint centre = ibbbox.Centre();
517 
518  // Reserve a 20% margin around "board" bounding box.
519  double margin_scale_factor = 1.2;
520  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
521 }
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
Definition: zoom.cpp:90
int GetHeight() const
Definition: eda_rect.h:118
wxPoint Centre() const
Definition: eda_rect.h:60
EDA_RECT GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge se...
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetWidth() const
Definition: eda_rect.h:117
double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited

Definition at line 90 of file zoom.cpp.

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

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

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

Function BlockCommand Returns 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
Definition: common.h:65
#define GR_KEY_INVALID
Definition: common.h:69
#define GR_KB_SHIFT
Definition: common.h:66
#define GR_KB_SHIFTCTRL
Definition: common.h:67
#define MOUSE_MIDDLE
Definition: common.h:68
#define EDA_KEY_C
Definition: common.h:60
#define GR_KB_CTRL
Definition: common.h:64
void PCB_BASE_FRAME::Build_Board_Ratsnest ( )
inherited

Function Build_Board_Ratsnest.

Calculates the full ratsnest depending only on pads.

Referenced by PCB_BASE_FRAME::GetScreen().

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 190 of file ratsnest.cpp.

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

Referenced by MODULE::DrawOutlinesWhenMoving(), getOptimalModulePlacement(), PCB_BASE_FRAME::GetScreen(), and PickModule().

191 {
192  auto connectivity = GetBoard()->GetConnectivity();
193 
194  movedModule = *aModule;
195  movedModule.Move( -aMoveVector );
196  connectivity->ClearDynamicRatsnest();
197  connectivity->BlockRatsnestItems( { aModule } );
198  connectivity->ComputeDynamicRatsnest( { &movedModule } );
199 }
BOARD * GetBoard() const
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
static MODULE movedModule(nullptr)
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:293
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 179 of file ratsnest.cpp.

References movedModule, and s_refNet.

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

181 {
182  s_CursorPos = aPosition; // needed for sort_by_distance
183  s_ref = aItemRef;
184  s_refNet = aNet;
185 }
static wxPoint s_CursorPos
Definition: ratsnest.cpp:166
static int s_refNet
Definition: ratsnest.cpp:177
static BOARD_CONNECTED_ITEM * s_ref
Definition: ratsnest.cpp:176
bool PCB_BASE_FRAME::CheckFootprint ( const LIB_ID aFootprintId)
inherited

Check to see if a footprint is available Note that this is more strict than LoadFootprint as it also checks to see that the footprint's library is enabled in the fpTable.

Parameters
aFootprintId
Returns
true if aFootprintId is available and can be loaded

Definition at line 356 of file load_select_footprint.cpp.

References FP_LIB_TABLE::FindRow(), FP_LIB_TABLE::FootprintLoad(), LIB_TABLE_ROW::GetIsEnabled(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), PROJECT::PcbFootprintLibs(), and Prj().

Referenced by DIALOG_GET_FOOTPRINT::DIALOG_GET_FOOTPRINT().

357 {
358  const wxString& libNickname = aFootprintId.GetLibNickname();
359  const wxString& fpName = aFootprintId.GetLibItemName();
360  FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
361 
362  try
363  {
364  const FP_LIB_TABLE_ROW* fpTableRow = fpTable->FindRow( aFootprintId.GetLibNickname() );
365 
366  if( fpTableRow && fpTableRow->GetIsEnabled() )
367  return fpTable->FootprintLoad( libNickname, fpName ) != nullptr;
368  }
369  catch( ... )
370  { }
371 
372  return false;
373 }
Class FP_LIB_TABLE_ROW.
Definition: fp_lib_table.h:42
MODULE * FootprintLoad(const wxString &aNickname, const wxString &aFootprintName)
Function FootprintLoad.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:118
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.
bool GetIsEnabled() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:101
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 591 of file eda_base_frame.cpp.

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

Referenced by EDA_BASE_FRAME::GetMruPath(), and PCB_EDIT_FRAME::OpenProjectFiles().

593 {
594  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
595  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
596 
597  wxFileName autoSaveFileName = aFileName;
598 
599  // Check for auto save file.
600  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
601 
602  wxLogTrace( traceAutoSave,
603  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
604 
605  if( !autoSaveFileName.FileExists() )
606  return;
607 
608  wxString msg = wxString::Format( _(
609  "Well this is potentially embarrassing!\n"
610  "It appears that the last time you were editing the file\n"
611  "\"%s\"\n"
612  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
613  GetChars( aFileName.GetFullName() )
614  );
615 
616  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
617 
618  // Make a backup of the current file, delete the file, and rename the auto save file to
619  // the file name.
620  if( response == wxYES )
621  {
622  // Get the backup file name.
623  wxFileName backupFileName = aFileName;
624  backupFileName.SetExt( aBackupFileExtension );
625 
626  // If an old backup file exists, delete it. If an old copy of the file exists, rename
627  // it to the backup file name
628  if( aFileName.FileExists() )
629  {
630  // Remove the old file backup file.
631  if( backupFileName.FileExists() )
632  wxRemoveFile( backupFileName.GetFullPath() );
633 
634  // Rename the old file to the backup file name.
635  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
636  {
637  msg.Printf( _( "Could not create backup file \"%s\"" ),
638  GetChars( backupFileName.GetFullPath() ) );
639  wxMessageBox( msg );
640  }
641  }
642 
643  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
644  {
645  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
646  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
647  }
648  }
649  else
650  {
651  wxLogTrace( traceAutoSave,
652  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
653 
654  // Remove the auto save file when using the previous file as is.
655  wxRemoveFile( autoSaveFileName.GetFullPath() );
656  }
657 }
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
bool FOOTPRINT_EDIT_FRAME::Clear_Pcb ( bool  aQuery)

Function Clear_Pcb 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(), PCB_BASE_FRAME::GetDesignSettings(), PCB_BASE_FRAME::GetPageSizeIU(), PCB_BASE_FRAME::GetScreen(), BASE_SCREEN::InitDataPoints(), IsOK(), PCB_EDIT_FRAME::SetBoard(), PCB_BASE_FRAME::SetCurItem(), BOARD::SetDesignSettings(), BOARD::SetFileName(), BOARD::SynchronizeNetsAndNetClasses(), and EDA_DRAW_FRAME::Zoom_Automatique().

95 {
96  if( GetBoard() == NULL )
97  return false;
98 
99  if( aQuery && GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
100  {
101  if( !IsOK( this,
102  _( "Current Footprint will be lost and this operation cannot be undone. Continue ?" ) ) )
103  return false;
104  }
105 
106  // Clear undo and redo lists because we want a full deletion
108  GetScreen()->ClrModify();
109 
110  BOARD* board = new BOARD;
111 
112  // Transfer current design settings
113  if( GetBoard() )
115 
117  SetBoard( board );
118 
119  SetCurItem( NULL );
120 
121  // clear filename, to avoid overwriting an old file
122  GetBoard()->SetFileName( wxEmptyString );
123 
125 
126  Zoom_Automatique( false );
127 
128  return true;
129 }
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.
BOARD * GetBoard() const
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:69
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
Definition: netclass.cpp:158
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:106
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:545
void SetFileName(const wxString &aFileName)
Definition: class_board.h:234
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
virtual void SetBoard(BOARD *aBoard) override
>
void ClrModify()
Definition: base_screen.h:325
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
const wxSize GetPageSizeIU() const override
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
void PCB_BASE_FRAME::ClearSelection ( )
inherited
void FOOTPRINT_EDIT_FRAME::CloseModuleEditor ( wxCommandEvent &  Event)

Definition at line 557 of file footprint_edit_frame.cpp.

558 {
559  Close();
560 }
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 54 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::Delete_Module(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_BASE_FRAME::GetScreen(), DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClick(), 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_BASE_FRAME::Rotate_Module(), PCB_BASE_FRAME::TestNetConnection(), and DIALOG_LAYERS_SETUP::TransferDataFromWindow().

55 {
56  GetBoard()->GetConnectivity()->RecalculateRatsnest();
57 
58  GetBoard()->m_Status_Pcb = 0; // we want a full ratsnest computation, from the scratch
59 
60  if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && aDC )
61  DrawGeneralRatsnest( aDC, 0 );
62 
63  wxString msg;
64 
65  ClearMsgPanel();
66 
67  if( aDisplayStatus )
68  {
69  msg.Printf( wxT( " %d" ), m_Pcb->GetConnectivity()->GetPadCount() );
70  AppendMsgPanel( wxT( "Pads" ), msg, RED );
71  msg.Printf( wxT( " %d" ), m_Pcb->GetConnectivity()->GetNetCount() );
72  AppendMsgPanel( wxT( "Nets" ), msg, CYAN );
73  SetMsgPanel( m_Pcb );
74  }
75 }
BOARD * GetBoard() const
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:831
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:85
Definition: colors.h:59
Definition: colors.h:60
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
Definition: draw_frame.cpp:811
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:293
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:822
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:239
void PCB_BASE_FRAME::ComputeLegacyConnections ( )
inherited

Function RecalculateAllTracksNetcode search connections between tracks and pads and propagate pad net codes to the track segments.

Referenced by PCB_BASE_FRAME::GetScreen().

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 374 of file eda_base_frame.cpp.

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

Referenced by CVPCB_MAINFRAME::CVPCB_MAINFRAME(), Export_Module(), GERBVIEW_FRAME::GERBVIEW_FRAME(), Import_Module(), EDA_BASE_FRAME::isAutoSaveRequired(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), 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().

375 {
376  // KICAD_MANAGER_FRAME overrides this
377  wxConfigBase* ret = Kiface().KifaceSettings();
378  //wxASSERT( ret );
379  return ret;
380 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
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 260 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

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

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

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

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

Definition at line 870 of file draw_frame.cpp.

References CoordinateToString().

Referenced by getOptimalModulePlacement().

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

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

Definition at line 42 of file copy_to_clipboard.cpp.

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

Referenced by add_search_paths().

43 {
44  DrawPageOnClipboard( this );
45 
46  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
47  {
48  if( GetScreen()->IsBlockActive() )
49  m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
50 
52  }
53 }
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
bool IsBlockActive() const
Definition: base_screen.h:499
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
int GetDefaultCursor() const
Function GetDefaultCursor.
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 433 of file pcb_base_frame.cpp.

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

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

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

References ARRAY_CREATOR::Invoke().

Referenced by PCB_EDIT_FRAME::Process_Special_Functions().

1766 {
1767  LEGACY_ARRAY_CREATOR array_creator( *this );
1768 
1769  array_creator.Invoke();
1770 }
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 445 of file footprint_libraries_utils.cpp.

References DisplayError(), FMT_LIB_READ_ONLY, FMT_OK_OVERWRITE, PLUGIN::FootprintLibCreate(), PLUGIN::FootprintLibDelete(), Format(), GetChars(), DIALOG_SELECT_PRETTY_LIB::GetFullPrettyLibName(), PLUGIN::IsFootprintLibWritable(), IsOK(), IO_MGR::KICAD_SEXP, KiCadFootprintLibPathExtension, IO_MGR::PluginFind(), KIWAY_HOLDER::Prj(), and IO_ERROR::What().

Referenced by PCB_EDIT_FRAME::ArchiveModulesOnBoard(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

446 {
447  // Kicad cannot write legacy format libraries, only .pretty new format
448  // because the legacy format cannot handle current features.
449  // The footprint library is actually a directory
450 
451  // if a library name is not given, prompt user for footprint library name, ending by ".pretty"
452  // Because there are constraints for the directory name to create,
453  // (the name should have the extension ".pretty", and the folder cannot be inside
454  // a footprint library), we do not use the standard wxDirDialog.
455 
456 
457  wxString initialPath = wxPathOnly( Prj().GetProjectFullName() );
458 
459  wxString libPath;
460 
461  if( aLibName.IsEmpty() )
462  {
463  DIALOG_SELECT_PRETTY_LIB dlg( this, initialPath );
464 
465  if( dlg.ShowModal() != wxID_OK )
466  return wxEmptyString;
467 
468  libPath = dlg.GetFullPrettyLibName();
469  }
470  else
471  {
472  wxFileName fn = aLibName;
473 
474  if( !fn.IsAbsolute() )
475  {
476  fn.SetName( aLibName );
477  fn.MakeAbsolute( initialPath );
478  }
479 
480  // Enforce the .pretty extension:
481  fn.SetExt( KiCadFootprintLibPathExtension );
482 
483  libPath = fn.GetFullPath();
484  }
485 
486 
487  // We can save fp libs only using IO_MGR::KICAD_SEXP format (.pretty libraries)
489 
490  try
491  {
492  PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
493 
494  bool writable = false;
495  bool exists = false;
496 
497  try
498  {
499  writable = pi->IsFootprintLibWritable( libPath );
500  exists = true; // no exception was thrown, lib must exist.
501  }
502  catch( const IO_ERROR& )
503  {
504  // ignore, original values of 'writable' and 'exists' are accurate.
505  }
506 
507  if( exists )
508  {
509  if( !writable )
510  {
511  wxString msg = wxString::Format( FMT_LIB_READ_ONLY, GetChars( libPath ) );
512  DisplayError( this, msg );
513  return wxEmptyString;
514  }
515  else
516  {
517  wxString msg = wxString::Format( FMT_OK_OVERWRITE, GetChars( libPath ) );
518 
519  if( !IsOK( this, msg ) )
520  return wxEmptyString;
521 
522  pi->FootprintLibDelete( libPath );
523  }
524  }
525 
526  pi->FootprintLibCreate( libPath );
527  }
528  catch( const IO_ERROR& ioe )
529  {
530  DisplayError( this, ioe.What() );
531  return wxEmptyString;
532  }
533 
534  return libPath;
535 }
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:563
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const wxString KiCadFootprintLibPathExtension
#define FMT_OK_OVERWRITE
#define FMT_LIB_READ_ONLY
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
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
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:52
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
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:233
S-expression Pcbnew file format.
Definition: io_mgr.h:55
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 825 of file footprint_libraries_utils.cpp.

References DisplayInfoMessage(), FMT_MOD_CREATE, FMT_MOD_REF, FMT_NO_REF_ABORTED, PCB_BASE_FRAME::GetBoard(), GetDesignSettings(), BOARD_DESIGN_SETTINGS::m_ModuleTextSize, BOARD_DESIGN_SETTINGS::m_ModuleTextWidth, 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(), 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(), MODULE::Value(), and wxPoint::y.

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

826 {
827  // Creates a new footprint at position 0,0 which contains the minimal items:
828  // the reference and the value.
829  // Value : initialized to the footprint name.
830  // put on fab layer (front side)
831  // Reference : initialized to a default value (REF**).
832  // put on silkscreen layer (front side)
833 
834  wxString moduleName = aModuleName;
835 
836  // Ask for the new module name
837  if( moduleName.IsEmpty() )
838  {
839  WX_TEXT_ENTRY_DIALOG dlg( this, FMT_MOD_REF, FMT_MOD_CREATE, moduleName );
840  dlg.SetTextValidator( FILE_NAME_CHAR_VALIDATOR( &moduleName ) );
841 
842  if( dlg.ShowModal() != wxID_OK )
843  return NULL; //Aborted by user
844  }
845 
846  moduleName.Trim( true );
847  moduleName.Trim( false );
848 
849  if( moduleName.IsEmpty() )
850  {
852  return NULL;
853  }
854 
855  // Creates the new module and add it to the head of the linked list of modules
856  MODULE* module = new MODULE( GetBoard() );
857 
858  // Update parameters: timestamp ...
859  module->SetLastEditTime();
860 
861  // Update its name in lib
862  module->SetFPID( LIB_ID( moduleName ) );
863 
864  wxPoint default_pos;
866 
867  // Update reference:
868  if( settings.m_RefDefaultText.IsEmpty() )
869  module->SetReference( moduleName );
870  else
871  module->SetReference( settings.m_RefDefaultText );
872 
873  module->Reference().SetThickness( settings.m_ModuleTextWidth );
874  module->Reference().SetTextSize( settings.m_ModuleTextSize );
875  default_pos.y = GetDesignSettings().m_ModuleTextSize.y / 2;
876  module->Reference().SetPosition( default_pos );
877  module->Reference().SetLayer( ToLAYER_ID( settings.m_RefDefaultlayer ) );
878  module->Reference().SetVisible( settings.m_RefDefaultVisibility );
879 
880  // Set the value field to a default value
881  if( settings.m_ValueDefaultText.IsEmpty() )
882  module->SetValue( moduleName );
883  else
884  module->SetValue( settings.m_ValueDefaultText );
885 
886  module->Value().SetThickness( GetDesignSettings().m_ModuleTextWidth );
887  module->Value().SetTextSize( GetDesignSettings().m_ModuleTextSize );
888  default_pos.y = -default_pos.y;
889  module->Value().SetPosition( default_pos );
890  module->Value().SetLayer( ToLAYER_ID( settings.m_ValueDefaultlayer ) );
891  module->Value().SetVisible( settings.m_ValueDefaultVisibility );
892 
893  SetMsgPanel( module );
894  return module;
895 }
wxString m_RefDefaultText
Default ref text on fp creation.
bool m_ValueDefaultVisibility
Default value text visibility on fp creation.
TEXTE_MODULE & Reference()
Definition: class_module.h:502
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
int m_ModuleTextWidth
Default footprint texts thickness.
void SetVisible(bool aVisible)
Definition: eda_text.h:173
BOARD * GetBoard() const
int m_ValueDefaultlayer
Default value text layer on fp creation.
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:212
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
wxSize m_ModuleTextSize
Default footprint texts size.
Class FILE_NAME_CHAR_VALIDATOR.
Definition: validators.h:43
#define FMT_NO_REF_ABORTED
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:831
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:501
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:309
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:468
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:495
int m_RefDefaultlayer
Default ref text layer on fp creation.
#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:216
bool m_RefDefaultVisibility
Default ref text visibility on fp creation.
void SetFPID(const LIB_ID &aFPID)
Definition: class_module.h:192
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:796
void SetThickness(int aNewThickness)
Function SetThickness sets pen width.
Definition: eda_text.h:146
#define FMT_MOD_REF
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
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:84
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(), Clamp_Text_PenSize(), EDA_ITEM::ClearFlags(), TEXTE_MODULE::Draw(), PCB_BASE_FRAME::GetActiveLayer(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetDesignSettings(), EDA_TEXT::GetText(), GR_OR, MODULE::GraphicalItemsList(), PCB_BASE_FRAME::InstallTextModOptionsFrame(), IS_NEW, EDA_DRAW_FRAME::m_canvas, BOARD_DESIGN_SETTINGS::m_ModuleTextWidth, min, EDA_DRAW_PANEL::MoveCursorToCrossHair(), DLIST< T >::PushFront(), EDA_ITEM::SetFlags(), BOARD_ITEM::SetLayer(), EDA_DRAW_FRAME::SetMsgPanel(), TEXTE_MODULE::SetPosition(), EDA_TEXT::SetTextSize(), and EDA_TEXT::SetThickness().

Referenced by OnLeftClick().

67 {
68  TEXTE_MODULE* text = new TEXTE_MODULE( aModule );
69 
70  text->SetFlags( IS_NEW );
71 
73  std::min( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true );
74  text->SetTextSize( GetDesignSettings().m_ModuleTextSize );
75  text->SetThickness( GetDesignSettings().m_ModuleTextWidth );
77 
78  if( LSET::AllTechMask().test( GetActiveLayer() ) ) // i.e. a possible layer for a text
79  text->SetLayer( GetActiveLayer() );
80 
81  InstallTextModOptionsFrame( text, NULL );
82 
84 
85  if( text->GetText().IsEmpty() )
86  {
87  delete text;
88  return NULL;
89  }
90 
91  // Add the new text object to the beginning of the footprint draw list.
92  if( aModule )
93  aModule->GraphicalItemsList().PushFront( text );
94 
95  text->ClearFlags();
96 
97  if( aDC )
98  text->Draw( m_canvas, aDC, GR_OR );
99 
100  SetMsgPanel( text );
101 
102  return text;
103 }
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize As a rule, pen width should not be >1/4em, otherwise the character will b...
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
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
int m_ModuleTextWidth
Default footprint texts thickness.
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:212
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:360
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side...
Definition: lset.cpp:743
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
void InstallTextModOptionsFrame(TEXTE_MODULE *TextMod, wxDC *DC)
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:831
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
virtual void SetPosition(const wxPoint &aPos) override
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:106
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:164
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
void SetThickness(int aNewThickness)
Function SetThickness sets pen width.
Definition: eda_text.h:146
#define min(a, b)
Definition: auxiliary.h:85
const PCB_GENERAL_SETTINGS& PCB_BASE_FRAME::CSettings ( ) const
inlineinherited

Definition at line 736 of file pcb_base_frame.h.

References PCB_BASE_FRAME::m_configSettings.

737  {
738  return m_configSettings;
739  }
PCB_GENERAL_SETTINGS m_configSettings
void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module ( EDGE_MODULE Edge)

Function Delete_Edge_Module deletes EDGE_MODULE Edge.

Parameters
Edge= edge to delete

Definition at line 273 of file edgemod.cpp.

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

274 {
275  if( aEdge == NULL )
276  return;
277 
278  if( aEdge->Type() != PCB_MODULE_EDGE_T )
279  {
280  DisplayError( this, wxT( "StructType error: PCB_MODULE_EDGE_T expected" ) );
281  return;
282  }
283 
284  MODULE* module = (MODULE*) aEdge->GetParent();
285 
286  // Delete segment.
287  aEdge->DeleteStructure();
288  module->SetLastEditTime();
289  module->CalculateBoundingBox();
290  OnModify();
291 }
BOARD_ITEM_CONTAINER * GetParent() const
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
Virtual Function OnModify() Must be called after a footprint change in order to set the "modify" flag...
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:309
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary ( )

Function DeleteModuleFromCurrentLibrary prompts user for footprint name, then deletes it from current library.

Definition at line 538 of file footprint_libraries_utils.cpp.

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

539 {
540  wxString nickname = GetCurrentLib();
541 
542  // Legacy libraries are readable, but modifying legacy format is not allowed
543  // So prompt the user if he try to delete a footprint from a legacy lib
544  wxString libfullname = Prj().PcbFootprintLibs()->FindRow(nickname)->GetFullURI();
546 
547  if( piType == IO_MGR::LEGACY )
548  {
550  return false;
551  }
552 
553  if( !Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname ) )
554  {
555  wxString msg = wxString::Format(
556  _( "Library \"%s\" is read only" ),
557  GetChars( nickname )
558  );
559 
560  DisplayError( this, msg );
561  return false;
562  }
563 
564  wxString fpid_txt = PCB_BASE_FRAME::SelectFootprint( this, nickname,
565  wxEmptyString, wxEmptyString, Prj().PcbFootprintLibs() );
566 
567  if( !fpid_txt )
568  return false;
569 
570  LIB_ID fpid( fpid_txt );
571  wxString fpname = fpid.GetLibItemName();
572 
573  // Confirmation
574  wxString msg = wxString::Format( FMT_OK_DELETE, fpname.GetData(), nickname.GetData() );
575 
576  if( !IsOK( this, msg ) )
577  return false;
578 
579  try
580  {
581  Prj().PcbFootprintLibs()->FootprintDelete( nickname, fpname );
582  }
583  catch( const IO_ERROR& ioe )
584  {
585  DisplayError( this, ioe.What() );
586  return false;
587  }
588 
589  msg.Printf( FMT_MOD_DELETED, fpname.GetData(), nickname.GetData() );
590 
591  SetStatusText( msg );
592 
593  return true;
594 }
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
static const wxString INFO_LEGACY_LIB_WARN_DELETE(_("Modifying legacy libraries (.mod files) is not allowed\n""Please save the current library under the new .pretty format\n""and update your footprint lib table\n""before deleting a footprint"))
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...
const wxString GetCurrentLib() const
Return the current library nickname.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
#define FMT_MOD_DELETED
#define FMT_OK_DELETE
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.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
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
Legacy Pcbnew file formats prior to s-expression.
Definition: io_mgr.h:54
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.
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:52
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:216
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
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:233
wxString SelectFootprint(EDA_DRAW_FRAME *aWindow, const wxString &aLibraryName, const wxString &aMask, const wxString &aKeyWord, FP_LIB_TABLE *aTable)
Function SelectFootprint displays a list of modules found in all libraries or a given library...
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 159 of file pad_edition_functions.cpp.

References MODULE::CalculateBoundingBox(), PCB_BASE_FRAME::GetBoard(), MODULE::GetBoundingBox(), GetChars(), 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_BASE_FRAME::GetScreen(), and PCB_EDIT_FRAME::Process_Special_Functions().

160 {
161  if( aPad == NULL )
162  return;
163 
164  MODULE* module = aPad->GetParent();
165  module->SetLastEditTime();
166 
167  // aQuery = true to prompt for confirmation, false to delete silently
168  if( aQuery )
169  {
170  wxString msg;
171  msg.Printf( _( "Delete Pad (footprint %s %s) ?" ),
172  GetChars( module->GetReference() ),
173  GetChars( module->GetValue() ) );
174 
175  if( !IsOK( this, msg ) )
176  return;
177  }
178 
179  // Stores the initial bounding box to refresh the old area
180  EDA_RECT bbox = module->GetBoundingBox();
181 
182  m_Pcb->m_Status_Pcb = 0;
183 
184  GetBoard()->PadDelete( aPad );
185 
186  // Update the bounding box
187  module->CalculateBoundingBox();
188 
189  // Refresh the modified screen area, using the initial bounding box
190  // which is perhaps larger than the new bounding box
191  m_canvas->RefreshDrawingRect( bbox );
192 
193  OnModify();
194 }
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.
MODULE * GetParent() const
Definition: class_pad.h:162
BOARD * GetBoard() const
const wxString & GetValue() const
Function GetValue.
Definition: class_module.h:486
void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
Definition: draw_panel.cpp:318
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:309
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
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
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:458
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:239
void PCB_BASE_FRAME::DeleteTextModule ( TEXTE_MODULE Text)
inherited

Definition at line 139 of file edtxtmod.cpp.

References BOARD_ITEM::DeleteStructure(), TEXTE_MODULE::GetBoundingBox(), BOARD_ITEM::GetParent(), TEXTE_MODULE::GetType(), EDA_DRAW_FRAME::m_canvas, OnModify(), EDA_DRAW_PANEL::RefreshDrawingRect(), MODULE::SetLastEditTime(), and TEXTE_MODULE::TEXT_is_DIVERS.

Referenced by PCB_BASE_FRAME::GetScreen(), and PCB_EDIT_FRAME::Process_Special_Functions().

140 {
141  MODULE* Module;
142 
143  if( Text == NULL )
144  return;
145 
146  Module = static_cast<MODULE*>( Text->GetParent() );
147 
148  if( Text->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
149  {
151  Text->DeleteStructure();
152  OnModify();
153  Module->SetLastEditTime();
154  }
155 }
BOARD_ITEM_CONTAINER * GetParent() const
TEXT_TYPE GetType() const
void DeleteStructure()
Function DeleteStructure deletes this object after UnLink()ing it from its owner if it has one...
void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
Definition: draw_panel.cpp:318
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:309
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
protectedinherited
void EDA_DRAW_FRAME::DisplayToolMsg ( const wxString &  msg)
inherited
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Function DisplayUnitsMsg displays current unit pane on the status bar.

Definition at line 558 of file draw_frame.cpp.

References g_UserUnit, INCHES, and MILLIMETRES.

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

559 {
560  wxString msg;
561 
562  switch( g_UserUnit )
563  {
564  case INCHES:
565  msg = _( "Inches" );
566  break;
567 
568  case MILLIMETRES:
569  msg = _( "mm" );
570  break;
571 
572  default:
573  msg = _( "Units" );
574  break;
575  }
576 
577  SetStatusText( msg, 4 );
578 }
Definition: common.h:146
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
void FOOTPRINT_EDIT_FRAME::DlgGlobalChange_PadSettings ( D_PAD aPad)

Function DlgGlobalChange_PadSettings changes pad characteristics for the given footprint or all footprints which look like the given footprint.

Options are set by the opened dialog.

Parameters
aPadis the pattern. The given footprint is the parent of this pad

Definition at line 94 of file globaleditpad.cpp.

References DisplayError(), PCB_BASE_FRAME::GetDesignSettings(), D_PAD::GetParent(), PCB_BASE_FRAME::GlobalChange_PadSettings(), DIALOG_GLOBAL_PADS_EDITION_BASE::m_buttonIdModules, DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter, BOARD_DESIGN_SETTINGS::m_Pad_Master, DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter, DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter, and EDA_DRAW_FRAME::SetMsgPanel().

95 {
96  int diag;
97 
98  if( aPad == NULL )
100 
101  MODULE* module = aPad->GetParent();
102 
103  if( module == NULL )
104  {
105  DisplayError( this, wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
106  return;
107  }
108 
109  SetMsgPanel( module );
110 
111  {
112  DIALOG_GLOBAL_PADS_EDITION dlg( this, aPad );
113 
114  dlg.m_buttonIdModules->Enable( false );
115 
116  diag = dlg.ShowModal();
117  }
118 
119  if( diag == -1 )
120  return;
121 
122  bool edit_Same_Modules = false;
123  if( diag == 1 )
124  edit_Same_Modules = true;
125 
126  GlobalChange_PadSettings( aPad, edit_Same_Modules,
130  true, false );
131 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
MODULE * GetParent() const
Definition: class_pad.h:162
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:831
void GlobalChange_PadSettings(D_PAD *aPad, bool aSameFootprints, bool aPadShapeFilter, bool aPadOrientFilter, bool aPadLayerFilter, bool aRedraw, bool aSaveForUndo)
Function GlobalChange_PadSettings Function to change pad caracteristics for the given footprint or al...
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
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 244 of file eda_base_frame.cpp.

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

245 {
246  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
247 }
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 85 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_BASE_FRAME::GetScreen(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::RedrawActiveWindow(), PCB_EDIT_FRAME::Remove_One_Track(), PCB_BASE_FRAME::Rotate_Module(), and PCB_EDIT_FRAME::StartMoveModule().

86 {
88  {
89  return;
90  }
91 
92  if( aDC == NULL )
93  return;
94 
95  auto connectivity = m_Pcb->GetConnectivity();
96 
97  if( !connectivity->TryLock() )
98  return;
99 
101 
102  for( int i = 1; i < connectivity->GetNetCount(); ++i )
103  {
104  RN_NET* net = connectivity->GetRatsnestForNet( i );
105 
106  if( !net )
107  continue;
108 
109  if( ( aNetcode <= 0 ) || ( aNetcode == i ) )
110  {
111  for( const auto& edge : net->GetEdges() )
112  {
113  auto s = edge.GetSourcePos();
114  auto d = edge.GetTargetPos();
115  auto sn = edge.GetSourceNode();
116  auto dn = edge.GetTargetNode();
117 
118  if( !sn->Valid() || !dn->Valid() )
119  continue;
120 
121  bool enable = !sn->GetNoLine() && !dn->GetNoLine();
122  bool show = sn->Parent()->GetLocalRatsnestVisible()
123  || dn->Parent()->GetLocalRatsnestVisible();
124 
125  if( enable && show )
126  GRLine( m_canvas->GetClipBox(), aDC, wxPoint( s.x, s.y ), wxPoint( d.x,
127  d.y ), 0, color );
128  }
129  }
130  }
131 
132  connectivity->Unlock();
133 }
const std::vector< CN_EDGE > & GetEdges() const
int color
Definition: DXF_plotter.cpp:62
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
PCB_GENERAL_SETTINGS & Settings()
EDA_RECT * GetClipBox()
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:380
COLORS_DESIGN_SETTINGS & Colors()
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
size_t i
Definition: json11.cpp:597
Class RN_NET Describes ratsnest for a single net.
Definition: ratsnest_data.h:59
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:293
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:239
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void EDA_DRAW_FRAME::DrawWorkSheet ( wxDC *  aDC,
BASE_SCREEN aScreen,
int  aLineWidth,
double  aScale,
const wxString &  aFilename,
const wxString &  aSheetLayer = wxEmptyString 
)
inherited

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

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

Definition at line 76 of file worksheet.cpp.

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

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

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

1682 {
1683  if( !aItem )
1684  return;
1685 
1686  // The easiest way to handle a duplicate item command
1687  // is to simulate a block copy command, which gives us the undo management
1688  // for free
1689  if( GetScreen()->m_BlockLocate.GetState() == STATE_NO_BLOCK )
1690  {
1692 
1694 
1695  wxPoint crossHairPos = GetCrossHairPosition();
1696 
1697  const BLOCK_COMMAND_T blockType = aIncrement ? BLOCK_DUPLICATE_AND_INCREMENT : BLOCK_DUPLICATE;
1698 
1699  if( !HandleBlockBegin( &dc, blockType, crossHairPos ) )
1700  return;
1701 
1702  // Add the item to the block copy pick list:
1704  ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
1705 
1706  picker.SetItem ( aItem );
1707  itemsList.PushItem( picker );
1708 
1709  // Set 2 coordinates updated by the mouse, because our simulation
1710  // does not use the mouse to call HandleBlockEnd()
1711  GetScreen()->m_BlockLocate.SetLastCursorPosition( crossHairPos );
1712  GetScreen()->m_BlockLocate.SetEnd( crossHairPos );
1713  HandleBlockEnd( &dc );
1714  }
1715 }
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.
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:360
int GetState(int type) const
Definition: base_struct.h:248
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Initialize a block command.
Definition: draw_frame.cpp:881
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)
Function HandleBlockEnd( ) Handle the "end" of a block command, i.e.
Definition: draw_frame.cpp:718
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
#define INSTALL_UNBUFFERED_DC(name, parent)
PCB_SCREEN * GetScreen() const override
Function GetScreen returns 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.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void FOOTPRINT_EDIT_FRAME::duplicateItems ( bool  aIncrement)
overrideprivatevirtual

Function duplicateItems 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 879 of file footprint_editor_utils.cpp.

References PCB_BASE_EDIT_FRAME::duplicateItem().

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

Function Edit_Edge_Layer changes 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 192 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.

193 {
194  // note: if aEdge == NULL, all outline segments will be modified
195 
196  MODULE* module = GetBoard()->m_Modules;
197  PCB_LAYER_ID layer = F_SilkS;
198  bool modified = false;
199 
200  if( aEdge )
201  layer = aEdge->GetLayer();
202 
203  // Ask for the new layer
204  PCB_LAYER_ID new_layer = SelectLayer( layer, Edge_Cuts );
205 
206  if( layer < 0 )
207  return;
208 
209  if( IsCopperLayer( new_layer ) )
210  {
211  // an edge is put on a copper layer, and it is very dangerous.
212  // A confirmation is requested
213  if( !IsOK( this,
214  _( "The graphic item will be on a copper layer.\n"
215  "This is very dangerous. Are you sure?" ) ) )
216  return;
217  }
218 
219  if( !aEdge )
220  {
221  for( BOARD_ITEM *item = module->GraphicalItemsList() ; item != NULL;
222  item = item->Next() )
223  {
224  aEdge = dyn_cast<EDGE_MODULE*>( item );
225 
226  if( aEdge && (aEdge->GetLayer() != new_layer) )
227  {
228  if( ! modified ) // save only once
229  SaveCopyInUndoList( module, UR_CHANGED );
230  aEdge->SetLayer( new_layer );
231  modified = true;
232  }
233  }
234  }
235  else if( aEdge->GetLayer() != new_layer )
236  {
237  SaveCopyInUndoList( module, UR_CHANGED );
238  aEdge->SetLayer( new_layer );
239  modified = true;
240  }
241 
242  if( modified )
243  {
244  module->CalculateBoundingBox();
245  module->SetLastEditTime();
246  }
247 }
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.
BOARD * GetBoard() const
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
BOARD_ITEM * Next() const
PCB_LAYER_ID
A quick note on layer IDs:
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:309
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
DLIST< MODULE > m_Modules
Definition: class_board.h:247
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:164
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
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:221
void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width ( EDGE_MODULE aEdge)

Function Edit_Edge_Width changes 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 163 of file edgemod.cpp.

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

164 {
165  MODULE* module = GetBoard()->m_Modules;
166 
167  SaveCopyInUndoList( module, UR_CHANGED );
168 
169  if( aEdge == NULL )
170  {
171  aEdge = (EDGE_MODULE*) (BOARD_ITEM*) module->GraphicalItemsList();
172 
173  for( BOARD_ITEM *item = module->GraphicalItemsList(); item; item = item->Next() )
174  {
175  aEdge = dyn_cast<EDGE_MODULE*>( item );
176 
177  if( aEdge )
178  aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
179  }
180  }
181  else
182  {
183  aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
184  }
185 
186  OnModify();
187  module->CalculateBoundingBox();
188  module->SetLastEditTime();
189 }
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.
BOARD * GetBoard() const
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
BOARD_ITEM * Next() const
virtual void OnModify() override
Virtual Function OnModify() Must be called after a footprint change in order to set the "modify" flag...
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:309
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
DLIST< MODULE > m_Modules
Definition: class_board.h:247
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:164
void SetWidth(int aWidth)
void PCB_BASE_FRAME::Edit_Module ( MODULE module,
wxDC *  DC 
)
inherited
void FOOTPRINT_EDIT_FRAME::End_Edge_Module ( EDGE_MODULE Edge)

Function End_Edge_Module terminates a move or create edge function.

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

421 {
422  MODULE* module = GetBoard()->m_Modules;
423 
424  if( aEdge )
425  {
426  aEdge->ClearFlags();
427 
428  // If last segment length is 0: remove it
429  if( aEdge->GetStart() == aEdge->GetEnd() )
430  aEdge->DeleteStructure();
431  }
432 
433  module->CalculateBoundingBox();
434  module->SetLastEditTime();
435  OnModify();
436  m_canvas->SetMouseCapture( NULL, NULL );
437 }
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
BOARD * GetBoard() const
virtual void OnModify() override
Virtual Function OnModify() Must be called after a footprint change in order to set the "modify" flag...
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:309
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
DLIST< MODULE > m_Modules
Definition: class_board.h:247
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
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 FOOTPRINT_EDIT_FRAME::Enter_Edge_Width ( EDGE_MODULE aEdge)

Function Enter_Edge_Width Edition of width of module outlines Ask for a new width.

Change the width of EDGE_MODULE Edge if aEdge != NULL

Parameters
aEdge= edge to edit, or NULL changes ModuleSegmentWidth (global) = new width

Definition at line 250 of file edgemod.cpp.

References MODULE::CalculateBoundingBox(), g_UserUnit, PCB_BASE_FRAME::GetBoard(), GetDesignSettings(), WX_TEXT_ENTRY_DIALOG::GetValue(), BOARD::m_Modules, BOARD_DESIGN_SETTINGS::m_ModuleSegmentWidth, OnModify(), DRAWSEGMENT::SetWidth(), StringFromValue(), and ValueFromString().

251 {
252  wxString buffer;
253 
254  buffer = StringFromValue( g_UserUnit, GetDesignSettings().m_ModuleSegmentWidth );
255  WX_TEXT_ENTRY_DIALOG dlg( this, _( "New Width:" ), _( "Edge Width" ), buffer );
256 
257  if( dlg.ShowModal() != wxID_OK )
258  return; // canceled by user
259 
260  buffer = dlg.GetValue( );
262 
263  if( aEdge )
264  {
265  MODULE* module = GetBoard()->m_Modules;
266  aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
267  module->CalculateBoundingBox();
268  OnModify();
269  }
270 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
int m_ModuleSegmentWidth
Default width for all graphic lines.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:205
BOARD * GetBoard() const
virtual void OnModify() override
Virtual Function OnModify() Must be called after a footprint change in order to set the "modify" flag...
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:370
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
DLIST< MODULE > m_Modules
Definition: class_board.h:247
void SetWidth(int aWidth)
void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

Definition at line 275 of file draw_frame.cpp.

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

Referenced by GERBVIEW_FRAME::SetCurItem().

276 {
277  if( m_messagePanel )
279 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:149
void EraseMsgBox()
Definition: msgpanel.cpp:215
virtual void EDA_DRAW_FRAME::ExecuteRemoteCommand ( const char *  cmdline)
inlinevirtualinherited

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

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

Parameters
cmdline= received command from socket

Reimplemented in SCH_EDIT_FRAME, and PCB_EDIT_FRAME.

Definition at line 380 of file draw_frame.h.

References EDA_DRAW_PANEL::OnMouseEvent().

Referenced by EDA_DRAW_FRAME::OnSockRequest().

380 {}
void FOOTPRINT_EDIT_FRAME::Export_Module ( MODULE aModule)

Function Export_Module 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 344 of file footprint_libraries_utils.cpp.

References EDA_BASE_FRAME::config(), 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().

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

Definition at line 46 of file pad_edition_functions.cpp.

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

Referenced by PCB_BASE_FRAME::GetScreen(), and PCB_EDIT_FRAME::Process_Special_Functions().

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

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

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

779 {
780  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
781  wxString mask = wxT( "*." ) + ext;
782 
783 #if 0
784  wxString path = wxPathOnly( Prj().GetProjectFullName() );
785 #else
786  wxString path = GetMruPath();
787 #endif
788  wxFileName fn( aDefaultShortname );
789  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
790 
791  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
792  path,
793  fn.GetFullPath(),
794  ext,
795  mask,
796  this,
797  wxFD_SAVE,
798  true );
799 
800  if( filename.IsEmpty() )
801  return;
802 
803  WriteHotkeyConfig( aDescList, &filename );
804  SetMruPath( wxFileName( filename ).GetPath() );
805 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:292
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
void PCB_BASE_FRAME::FocusOnLocation ( const wxPoint aPos,
bool  aWarpMouseCursor = 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.
aWarpMouseCursoris 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 365 of file pcb_base_frame.cpp.

References EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), INSTALL_UNBUFFERED_DC, EDA_DRAW_FRAME::IsGalCanvasActive(), EDA_DRAW_PANEL::IsPointOnDisplay(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::MoveCursorToCrossHair(), EDA_DRAW_FRAME::RedrawScreen(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), EDA_DRAW_FRAME::SetCrossHairPosition(), and KIGFX::VIEW_CONTROLS::SetCursorPosition().

Referenced by PCB_BASE_FRAME::GetScreen(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), DIALOG_DRC_CONTROL::OnPopupMenu(), and DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent().

367 {
368  if( IsGalCanvasActive() )
369  {
370  if( aCenterView )
371  GetGalCanvas()->GetView()->SetCenter( aPos );
372 
373  if( aWarpMouseCursor )
375  else
377  }
378  else
379  {
381 
382  // There may be need to reframe the drawing.
383  if( aCenterView || !m_canvas->IsPointOnDisplay( aPos ) )
384  {
385  SetCrossHairPosition( aPos );
386  RedrawScreen( aPos, aWarpMouseCursor );
387  }
388  else
389  {
390  // Put cursor on item position
391  m_canvas->CrossHairOff( &dc );
392  SetCrossHairPosition( aPos );
393 
394  if( aWarpMouseCursor )
396  }
397 
398  // Be sure cross hair cursor is ON:
399  m_canvas->CrossHairOn( &dc );
400  m_canvas->CrossHairOn( &dc );
401  }
402 }
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:360
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves cursor to the requested position expressed in world coordinates.
bool IsPointOnDisplay(const wxPoint &aPosition)
Function IsPointOnDisplay.
Definition: draw_panel.cpp:300
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:587
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:895
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:265
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:272
#define INSTALL_UNBUFFERED_DC(name, parent)
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:903
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
bool FOOTPRINT_EDIT_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint aPosition,
EDA_KEY  aHotKey = 0 
)
overridevirtual

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

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

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

Reimplemented from EDA_DRAW_FRAME.

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

692 {
693  // Filter out the 'fake' mouse motion after a keyboard movement
694  if( !aHotKey && m_movingCursorWithKeyboard )
695  {
697  return false;
698  }
699 
700  // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
701  // for next cursor position
702  // ( shift or ctrl key down are PAN command with mouse wheel)
703  bool snapToGrid = true;
704 
705  if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
706  snapToGrid = false;
707 
708  wxPoint oldpos = GetCrossHairPosition();
709  wxPoint pos = aPosition;
710  bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
711 
712  SetCrossHairPosition( pos, snapToGrid );
713  RefreshCrossHair( oldpos, aPosition, aDC );
714 
715  if( aHotKey && OnHotKey( aDC, aHotKey, aPosition ) )
716  {
717  keyHandled = true;
718  }
719 
720  UpdateStatusBar();
721 
722  return keyHandled;
723 }
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
Move and refresh the crosshair after movement and call the mouse capture function.
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Function OnHotKey handle hot key events.
virtual void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:159
bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint aPos,
bool  aSnapToGrid 
)
protectedinherited

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

cursor movement by keyboard)

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

Definition at line 1394 of file draw_frame.cpp.

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

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

1396 {
1397  bool key_handled = false;
1398 
1399  // If requested snap the current position to the grid
1400  if( aSnapToGrid )
1401  *aPos = GetNearestGridPosition( *aPos );
1402 
1403  switch( aHotKey )
1404  {
1405  // All these keys have almost the same treatment
1406  case GR_KB_CTRL | WXK_NUMPAD8:
1407  case GR_KB_CTRL | WXK_UP:
1408  case GR_KB_CTRL | WXK_NUMPAD2:
1409  case GR_KB_CTRL | WXK_DOWN:
1410  case GR_KB_CTRL | WXK_NUMPAD4:
1411  case GR_KB_CTRL | WXK_LEFT:
1412  case GR_KB_CTRL | WXK_NUMPAD6:
1413  case GR_KB_CTRL | WXK_RIGHT:
1414  case WXK_NUMPAD8:
1415  case WXK_UP:
1416  case WXK_NUMPAD2:
1417  case WXK_DOWN:
1418  case WXK_NUMPAD4:
1419  case WXK_LEFT:
1420  case WXK_NUMPAD6:
1421  case WXK_RIGHT:
1422  key_handled = true;
1423  {
1424  /* Here's a tricky part: when doing cursor key movement, the
1425  * 'previous' point should be taken from memory, *not* from the
1426  * freshly computed position in the event. Otherwise you can't do
1427  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1428  * the automatic motion event generated by cursor warping */
1429  wxRealPoint gridSize = GetScreen()->GetGridSize();
1430  *aPos = GetCrossHairPosition();
1431 
1432  // Bonus: ^key moves faster (x10)
1433  switch( aHotKey )
1434  {
1435  case GR_KB_CTRL|WXK_NUMPAD8:
1436  case GR_KB_CTRL|WXK_UP:
1437  aPos->y -= KiROUND( 10 * gridSize.y );
1438  break;
1439 
1440  case GR_KB_CTRL|WXK_NUMPAD2:
1441  case GR_KB_CTRL|WXK_DOWN:
1442  aPos->y += KiROUND( 10 * gridSize.y );
1443  break;
1444 
1445  case GR_KB_CTRL|WXK_NUMPAD4:
1446  case GR_KB_CTRL|WXK_LEFT:
1447  aPos->x -= KiROUND( 10 * gridSize.x );
1448  break;
1449 
1450  case GR_KB_CTRL|WXK_NUMPAD6:
1451  case GR_KB_CTRL|WXK_RIGHT:
1452  aPos->x += KiROUND( 10 * gridSize.x );
1453  break;
1454 
1455  case WXK_NUMPAD8:
1456  case WXK_UP:
1457  aPos->y -= KiROUND( gridSize.y );
1458  break;
1459 
1460  case WXK_NUMPAD2:
1461  case WXK_DOWN:
1462  aPos->y += KiROUND( gridSize.y );
1463  break;
1464 
1465  case WXK_NUMPAD4:
1466  case WXK_LEFT:
1467  aPos->x -= KiROUND( gridSize.x );
1468  break;
1469 
1470  case WXK_NUMPAD6:
1471  case WXK_RIGHT:
1472  aPos->x += KiROUND( gridSize.x );
1473  break;
1474 
1475  default: /* Can't happen since we entered the statement */
1476  break;
1477  }
1478 
1479  m_canvas->MoveCursor( *aPos );
1481  }
1482  break;
1483 
1484  default:
1485  break;
1486  }
1487 
1488  return key_handled;
1489 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
Definition: draw_panel.cpp:366
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
#define GR_KB_CTRL
Definition: common.h:64
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:159
EDA_3D_VIEWER * PCB_BASE_FRAME::Get3DViewerFrame ( )
inherited
Returns
a reference to the 3D viewer frame, when exists, or NULL

Definition at line 132 of file pcb_base_frame.cpp.

References VIEWER3D_FRAMENAME.

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

133 {
134  // return the 3D viewer frame, when exists, or NULL
135  return static_cast<EDA_3D_VIEWER*>
136  ( wxWindow::FindWindowByName( VIEWER3D_FRAMENAME ) );
137 }
Class EDA_3D_VIEWER Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard...
Definition: eda_3d_viewer.h:50
#define VIEWER3D_FRAMENAME
Definition: eda_3d_viewer.h:44
virtual PCB_LAYER_ID PCB_BASE_FRAME::GetActiveLayer ( ) const
inlinevirtualinherited

Function GetActiveLayer returns the active layer.

Definition at line 666 of file pcb_base_frame.h.

References PCB_BASE_FRAME::GetScreen(), PCB_BASE_FRAME::InvokeDialogGrid(), PCB_BASE_FRAME::LoadSettings(), PCB_SCREEN::m_Active_Layer, PCB_BASE_FRAME::OnSwitchCanvas(), PCB_BASE_FRAME::OnToggleEdgeDrawMode(), PCB_BASE_FRAME::OnToggleGraphicDrawMode(), PCB_BASE_FRAME::OnTogglePadDrawMode(), PCB_BASE_FRAME::OnTogglePolarCoords(), PCB_BASE_FRAME::OnToggleTextDrawMode(), PCB_BASE_FRAME::OnUpdateCoordType(), PCB_BASE_FRAME::OnUpdateEdgeDrawMode(), PCB_BASE_FRAME::OnUpdateGraphicDrawMode(), PCB_BASE_FRAME::OnUpdatePadDrawMode(), PCB_BASE_FRAME::OnUpdateSelectGrid(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateTextDrawMode(), and PCB_BASE_FRAME::SaveSettings().

Referenced by PCB_EDIT_FRAME::Begin_DrawSegment(), Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::CreateTextePcb(), CreateTextModule(), PCB_EDIT_FRAME::Delete_Segment(), DRAWING_TOOL::DrawVia(), PCB_BASE_FRAME::GetCollectorsGuide(), DRAWING_TOOL::getDrawingLayer(), PCBNEW_CONTROL::HighContrastMode(), DIALOG_NON_COPPER_ZONES_EDITOR::Init(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCBNEW_CONTROL::LayerToggle(), 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_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), PCB_BASE_FRAME::SwitchLayer(), PCB_EDIT_FRAME::SwitchLayer(), and ROUTER_TOOL::switchLayerOnViaPlacement().

667  {
668  return GetScreen()->m_Active_Layer;
669  }
PCB_LAYER_ID m_Active_Layer
Definition: pcb_screen.h:44
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 219 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

219 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
wxAuiToolBar* EDA_DRAW_FRAME::GetAuxiliaryToolBar ( ) const
inlineinherited

Definition at line 456 of file draw_frame.h.

456 { 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:139
const wxPoint & PCB_BASE_FRAME::GetAuxOrigin ( ) const
overridevirtualinherited

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

Implements EDA_DRAW_FRAME.

Definition at line 240 of file pcb_base_frame.cpp.

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

Referenced by DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_GENDRILL::SetParams(), and DIALOG_MOVE_EXACT::TransferDataFromWindow().

241 {
242  wxASSERT( m_Pcb );
243  return m_Pcb->GetAuxOrigin();
244 }
const wxPoint & GetAuxOrigin() const
Definition: class_board.h:346
BOARD* PCB_BASE_FRAME::GetBoard ( ) const
inlineinherited

Definition at line 196 of file pcb_base_frame.h.

References PCB_BASE_FRAME::m_Pcb, and PCB_BASE_FRAME::OnCloseWindow().

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_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(), 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_Net_Tracks_And_Vias_Sizes(), PCB_EDIT_FRAME::Change_Side_Module(), DIALOG_EXCHANGE_FOOTPRINTS::changeSameFootprints(), PCB_EDIT_FRAME::Check_All_Zones(), 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_FREEROUTE::createDSN_File(), CreateHeaderInfoData(), PCB_BASE_FRAME::CreateNewModule(), PCB_EDIT_FRAME::createPopupMenuForTracks(), 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_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), 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_MODEDIT_FP_BODY_ITEM_PROPERTIES::DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), PCB_EDIT_FRAME::doAutoSave(), 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::End_Edge(), End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::End_Zone(), Enter_Edge_Width(), PCB_EDIT_FRAME::EraseRedundantTrack(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::fixEagleNets(), DIALOG_GENDRILL::GenDrillAndMapFiles(),