KiCad PCB EDA Suite
PCB_EDIT_FRAME Class Reference

Class PCB_EDIT_FRAME is the main frame for Pcbnew. More...

#include <pcb_edit_frame.h>

Inheritance diagram for PCB_EDIT_FRAME:
PCB_BASE_EDIT_FRAME PCB_BASE_FRAME EDA_DRAW_FRAME KIWAY_PLAYER EDA_BASE_FRAME KIWAY_HOLDER

Public Types

enum  FETCH_NETLIST_MODE { NO_ANNOTATION, QUIET_ANNOTATION, ANNOTATION_DIALOG }
 Function FetchNetlistFromSchematic. More...
 

Public Member Functions

virtual ~PCB_EDIT_FRAME ()
 
void LoadFootprints (NETLIST &aNetlist, REPORTER &aReporter)
 Function loadFootprints loads the footprints for each COMPONENT in aNetlist from the list of libraries. More...
 
void OnQuit (wxCommandEvent &event)
 
void PythonPluginsReload ()
 Reload the Python plugins if they are newer than the already loaded, and load new plugins if any Do nothing if KICAD_SCRIPTING is not defined. More...
 
void UpdateUserInterface ()
 Update the layer manager and other widgets from the board setup (layer and items visibility, colors ...) More...
 
virtual void ExecuteRemoteCommand (const char *cmdline) override
 Execute a remote command send by Eeschema via a socket, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void KiwayMailIn (KIWAY_EXPRESS &aEvent) override
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
void ToPlotter (wxCommandEvent &event)
 Function ToPlotter Open a dialog frame to create plot and drill files relative to the current board. More...
 
void ToPrinter (wxCommandEvent &event)
 Function ToPrinter Install the print dialog. More...
 
void ExportSVG (wxCommandEvent &event)
 Function SVG_Print Shows the Export to SVG file dialog. More...
 
void OnUpdateSave (wxUpdateUIEvent &aEvent)
 
void OnUpdateLayerPair (wxUpdateUIEvent &aEvent)
 
void OnUpdateLayerSelectBox (wxUpdateUIEvent &aEvent)
 
void OnUpdateDrcEnable (wxUpdateUIEvent &aEvent)
 
void OnUpdateHighContrastDisplayMode (wxUpdateUIEvent &aEvent)
 
bool LayerManagerShown ()
 
bool MicrowaveToolbarShown ()
 
void OnUpdateVerticalToolbar (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectViaSize (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectTrackWidth (wxUpdateUIEvent &aEvent)
 
void OnUpdateMuWaveToolbar (wxUpdateUIEvent &aEvent)
 
void OnLayerColorChange (wxCommandEvent &aEvent)
 
void OnConfigurePaths (wxCommandEvent &aEvent)
 
void OnUpdatePCBFromSch (wxCommandEvent &event)
 
void OnRunEeschema (wxCommandEvent &event)
 
void UpdateTrackWidthSelectBox (wxChoice *aTrackWidthSelectBox, const bool aEdit=true)
 
void UpdateViaSizeSelectBox (wxChoice *aViaSizeSelectBox, const bool aEdit=true)
 
void GetKicadAbout (wxCommandEvent &event)
 
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...
 
virtual void SetGridColor (COLOR4D aColor) override
 Function SetGridColor() , virtual. More...
 
void Process_Config (wxCommandEvent &event)
 
PARAM_CFG_ARRAY GetProjectFileParameters ()
 Function GetProjectFileParameters returns a project file parameter list for Pcbnew. More...
 
void SaveProjectSettings (bool aAskForSave) override
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
bool LoadProjectSettings ()
 Load the current project's file configuration settings which are pertinent to this PCB_EDIT_FRAME instance. More...
 
PARAM_CFG_ARRAYGetConfigurationSettings ()
 Function GetConfigurationSettings returns the Pcbnew applications settings list. More...
 
void LoadSettings (wxConfigBase *aCfg) override
 Load common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *aCfg) override
 Saves common frame parameters to a configuration data file. More...
 
wxConfigBase * GetSettings ()
 
wxString GetLastNetListRead ()
 Get the last net list read with the net list dialog box. More...
 
void SetLastNetListRead (const wxString &aNetListFile)
 Set the last net list successfully read by the net list dialog box. More...
 
EDA_HOTKEYGetHotKeyDescription (int aCommand) const override
 

More...
 
bool OnHotKey (wxDC *aDC, int aHotkeyCode, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
 Function OnHotKey. More...
 
bool OnHotkeyDeleteItem (wxDC *aDC)
 Function OnHotkeyDeleteItem Delete the item found under the mouse cursor Depending on the current active tool:: Tool track if a track is in progress: Delete the last segment else delete the entire track Tool module (footprint): Delete the module. More...
 
bool OnHotkeyPlaceItem (wxDC *aDC)
 Function OnHotkeyPlaceItem Place the item (footprint, track, text . More...
 
bool OnHotkeyEditItem (int aIdCommand)
 
int OnHotkeyCopyItem ()
 Function OnHotkeyCopyItem returns the copy event id for copyable items. More...
 
bool OnHotkeyDuplicateOrArrayItem (int aIdCommand)
 Function OnHotkeyDuplicateOrArrayItem Duplicate an item (optionally incrementing if necessary and possible) or invoke array dialog and create an array. More...
 
bool OnHotkeyMoveItem (int aIdCommand)
 Function OnHotkeyMoveItem Moves or drag the item (footprint, track, text . More...
 
bool OnHotkeyRotateItem (int aIdCommand)
 Function OnHotkeyRotateItem Rotate the item (text or footprint) found under the mouse cursor. More...
 
bool OnHotkeyFlipItem (int aIdCommand)
 Function OnHotkeyFlipItem Flip the item (text or footprint) found under the mouse cursor. More...
 
TRACKOnHotkeyBeginRoute (wxDC *aDC)
 Function OnHotkeyBeginRoute If the current active layer is a copper layer, and if no item currently edited, start a new track segmenton the current copper layer. More...
 
void OnCloseWindow (wxCloseEvent &Event) override
 
void Process_Special_Functions (wxCommandEvent &event)
 
void Tracks_and_Vias_Size_Event (wxCommandEvent &event)
 
void OnSelectTool (wxCommandEvent &aEvent)
 
void OnEditTextAndGraphics (wxCommandEvent &event)
 Function OnEditTextAndGraphics Dialog for editing properties of text and graphic items, selected by type, layer, and/or parent footprint. More...
 
void OnEditTracksAndVias (wxCommandEvent &event)
 Function OnEditTracksAndVias Dialog for editing the properties of tracks and vias, selected by net, netclass, and/or layer. More...
 
void ProcessMuWaveFunctions (wxCommandEvent &event)
 
void MuWaveCommand (wxDC *DC, const wxPoint &MousePos)
 
void RedrawActiveWindow (wxDC *DC, bool EraseBg) override
 
void ReCreateHToolbar () override
 
void ReCreateAuxiliaryToolbar () override
 
void ReCreateVToolbar () override
 
void ReCreateMicrowaveVToolbar ()
 
void ReCreateOptToolbar () override
 
void ReCreateMenuBar () override
 Recreates the menu bar. More...
 
void ReCreateLayerBox (bool aForceResizeToolbar=true)
 Re create the layer Box by clearing the old list, and building le new one, from the new layers names and cole layers. More...
 
bool SetCurrentNetClass (const wxString &aNetClassName)
 Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter change calls BOARD_DESIGN_SETTINGS::SetCurrentNetClass() and update trace width and via size combo boxes on main toolbar Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar and some others parameters (netclass name ....) More...
 
virtual void OnModify () override
 Function OnModify must be called after a board change to set the modified flag. More...
 
virtual void SetActiveLayer (PCB_LAYER_ID aLayer) override
 Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYER_WIDGET. More...
 
PCB_LAYER_WIDGETGetLayerManager ()
 
void OnUpdateLayerAlpha (wxUpdateUIEvent &aEvent) override
 Update the UI to reflect changes to the current layer's transparency. More...
 
bool IsElementVisible (GAL_LAYER_ID aElement) const
 Function IsElementVisible tests whether a given element category is visible. More...
 
void SetElementVisibility (GAL_LAYER_ID aElement, bool aNewState)
 Function SetElementVisibility changes the visibility of an element category. More...
 
void SetVisibleAlls ()
 Function SetVisibleAlls Set the status of all visible element categories and layers to VISIBLE. More...
 
void ReFillLayerWidget ()
 Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading a new BOARD. More...
 
void Show3D_Frame (wxCommandEvent &event) override
 Function Show3D_Frame displays the 3D view of current printed circuit board. More...
 
void UseGalCanvas (bool aEnable) override
 

More...
 
bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
 Perform application specific control using aDC at aPosition in logical units. More...
 
void ShowBoardSetupDialog (wxCommandEvent &event)
 Function ShowBoardSetupDialog. More...
 
void DoShowBoardSetupDialog (const wxString &aInitialPage=wxEmptyString, const wxString &aInitialParentPage=wxEmptyString)
 
void PrepareLayerIndicator ()
 
void OnLeftClick (wxDC *DC, const wxPoint &MousePos) override
 
void OnLeftDClick (wxDC *DC, const wxPoint &MousePos) override
 
bool OnRightClick (const wxPoint &aMousePos, wxMenu *aPopMenu) override
 Function OnRightClick populates a popup menu with the choices appropriate for the current context. More...
 
void OnSelectOptionToolbar (wxCommandEvent &event)
 
void OnFlipPcbView (wxCommandEvent &event)
 
void ToolOnRightClick (wxCommandEvent &event) override
 
virtual int BlockCommand (EDA_KEY aKey) override
 Function BlockCommand Returns the block command internat 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() Called after HandleBlockEnd, when a block command needs to be executed after the block is moved to its new place (bloc move, drag, copy . More...
 
virtual bool HandleBlockEnd (wxDC *DC) override
 Function HandleBlockEnd() Handle the "end" of a block command, i.e. More...
 
void Block_SelectItems ()
 Function Block_SelectItems Uses GetScreen()->m_BlockLocate select items within the selected block. More...
 
void Block_Delete ()
 Function Block_Delete deletes all items within the selected block. More...
 
void Block_Rotate ()
 Function Block_Rotate Rotate all items within the selected block. More...
 
void Block_Flip ()
 Function Block_Flip Flip items within the selected block. More...
 
void Block_Move ()
 Function Block_Move move all items within the selected block. More...
 
void Block_Duplicate (bool aIncrement)
 Function Block_Duplicate Duplicate all items within the selected block. More...
 
void InstallPcbGlobalDeleteFrame (const wxPoint &pos)
 
void GenFootprintsPositionFile (wxCommandEvent &event)
 Function GenFootprintsPositionFile Calls DoGenFootprintsPositionFile to create a footprint position file See DoGenFootprintsPositionFile for options and file format. More...
 
int DoGenFootprintsPositionFile (const wxString &aFullFileName, bool aUnitsMM, bool aForceSmdItems, int aSide, bool aFormatCSV=false)
 Function DoGenFootprintsPositionFile Creates an ascii footprint position file. More...
 
void GenFootprintsReport (wxCommandEvent &event)
 Function GenFootprintsReport Calls DoGenFootprintsReport to create a footprint reprot file See DoGenFootprintsReport for file format. More...
 
bool DoGenFootprintsReport (const wxString &aFullFilename, bool aUnitsMM)
 Function DoGenFootprintsReport Creates an ascii footprint report file giving some infos on footprints and board outlines. More...
 
void InstallDrillFrame (wxCommandEvent &event)
 
void GenD356File (wxCommandEvent &event)
 
void OnFileHistory (wxCommandEvent &event)
 
void Files_io (wxCommandEvent &event)
 Function Files_io. More...
 
bool Files_io_from_id (int aId)
 Function Files_io_from_id Read and write board files. More...
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl=0) override
 Function OpenProjectFiles (was LoadOnePcbFile) loads a KiCad board (.kicad_pcb) from aFileName. More...
 
bool AppendBoardFile (const wxString &aFullFileName, int aCtl)
 Function AppendBoardFile appends a board file onto the current one, creating God knows what. More...
 
bool SavePcbFile (const wxString &aFileName, bool aCreateBackupFile=CREATE_BACKUP_FILE)
 Function SavePcbFile writes the board data structures to a aFileName Creates backup when requested and update flags (modified and saved flgs) More...
 
bool SavePcbCopy (const wxString &aFileName)
 Function SavePcbCopy writes the board data structures to a aFileName but unlike SavePcbFile, does not make anything else (no backup, borad fliename change, no flag changes ...) Used under a project mgr to save under a new name the current board. More...
 
bool Clear_Pcb (bool aQuery)
 Function Clear_Pcb delete all and reinitialize the current board. More...
 
void SetBoard (BOARD *aBoard) override
 

More...
 
BOARD_ITEM_CONTAINERGetModel () const override
 

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

More...
 
DRCGetDrcController ()
 Function GetDrcController. More...
 
void RecreateCmpFileFromBoard (wxCommandEvent &aEvent)
 Function RecreateBOMFileFromBoard Recreates a .cmp file from the current loaded board this is the same as created by CvPcb. More...
 
void ArchiveModulesOnBoard (bool aStoreInNewLib, const wxString &aLibName=wxEmptyString, wxString *aLibPath=NULL)
 Function ArchiveModulesOnBoard Save modules in a library: More...
 
void RecreateBOMFileFromBoard (wxCommandEvent &aEvent)
 Function RecreateBOMFileFromBoard Creates a BOM file from the current loaded board. More...
 
void ExportToGenCAD (wxCommandEvent &event)
 Function ExportToGenCAD creates a file in GenCAD 1.4 format from the current board. More...
 
void OnExportVRML (wxCommandEvent &event)
 Function OnExportVRML will export the current BOARD to a VRML file. More...
 
bool ExportVRML_File (const wxString &aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, bool aUseRelativePaths, bool aUsePlainPCB, const wxString &a3D_Subdir, double aXRef, double aYRef)
 Function ExportVRML_File Creates the file(s) exporting current BOARD to a VRML file. More...
 
void OnExportIDF3 (wxCommandEvent &event)
 Function OnExportIDF3 will export the current BOARD to a IDFv3 board and lib files. More...
 
void OnExportHyperlynx (wxCommandEvent &event)
 Function OnExportHyperlynx will export the current BOARD to a Hyperlynx HYP file. More...
 
bool Export_IDF3 (BOARD *aPcb, const wxString &aFullFileName, bool aUseThou, double aXRef, double aYRef)
 Function Export_IDF3 Creates an IDF3 compliant BOARD (*.emn) and LIBRARY (*.emp) file. More...
 
void OnExportSTEP (wxCommandEvent &event)
 Function OnExportSTEP Exports the current BOARD to a STEP assembly. More...
 
void ExportToSpecctra (wxCommandEvent &event)
 Function ExporttoSPECCTRA Ask for a filename and call ExportSpecctraFile to export the current BOARD to a specctra dsn file. More...
 
bool ExportSpecctraFile (const wxString &aFullFilename)
 Function ExportSpecctraFile will export the current BOARD to a specctra dsn file. More...
 
void ImportSpecctraSession (wxCommandEvent &event)
 Function ImportSpecctraSession will import a specctra *.ses file and use it to relocate MODULEs and to replace all vias and tracks in an existing and loaded BOARD. More...
 
bool ImportSpecctraSession (const wxString &aFullFilename)
 Function ImportSpecctraSession will import a specctra *.ses file and use it to relocate MODULEs and to replace all vias and tracks in an existing and loaded BOARD. More...
 
void ImportSpecctraDesign (wxCommandEvent &event)
 Function ImportSpecctraDesign will import a specctra *.dsn file and use it to replace an entire BOARD. More...
 
MODULEListAndSelectModuleName ()
 Function ListAndSelectModuleName builds and shows a list of existing modules on board that the user can select. More...
 
void ListNetsAndSelect (wxCommandEvent &event)
 Function ListNetsAndSelect called by a command event displays the sorted list of nets in a dialog frame If a net is selected, it is highlighted. More...
 
void Swap_Layers (wxCommandEvent &event)
 
void Rotate_Texte_Pcb (TEXTE_PCB *TextePcb, wxDC *DC)
 
void FlipTextePcb (TEXTE_PCB *aTextePcb, wxDC *aDC)
 
TEXTE_PCBCreateTextePcb (wxDC *aDC, TEXTE_PCB *aText=NULL)
 
void Delete_Texte_Pcb (TEXTE_PCB *TextePcb, wxDC *DC)
 
void StartMoveTextePcb (TEXTE_PCB *aTextePcb, wxDC *aDC, bool aErase=true)
 
void Place_Texte_Pcb (TEXTE_PCB *TextePcb, wxDC *DC)
 
void Start_Move_DrawItem (DRAWSEGMENT *drawitem, wxDC *DC)
 
void Place_DrawItem (DRAWSEGMENT *drawitem, wxDC *DC)
 
void InstallFootprintPropertiesDialog (MODULE *Module, wxDC *DC)
 
void StartMoveModule (MODULE *aModule, wxDC *aDC, bool aDragConnectedTracks)
 Function StartMoveModule Initialize a drag or move pad command. More...
 
void PushPadProperties (D_PAD *aPad)
 Function PushPadProperties Function to change pad caracteristics for the given footprint or all footprints which look like the given footprint Options are set by the opened dialog. More...
 
bool Delete_Module (MODULE *aModule, wxDC *aDC)
 Function Delete Module Remove a footprint from m_Modules linked list and put it in undelete buffer The ratsnest and pad list are recalculated. More...
 
void Change_Side_Module (MODULE *Module, wxDC *DC)
 Function Change_Side_Module Flip a footprint (switch layer from component or component to copper) The mirroring is made from X axis if a footprint is not on copper or component layer it is not flipped (it could be on an adhesive layer, not supported at this time) More...
 
int InstallExchangeModuleFrame (MODULE *aModule, bool updateMode, bool selectedMode)
 
void Exchange_Module (MODULE *aSrc, MODULE *aDest, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true)
 Function Exchange_Module Replaces OldModule by NewModule, using OldModule settings: position, orientation, pad netnames ...) OldModule is deleted or put in undo list. More...
 
void RemoveStruct (BOARD_ITEM *Item, wxDC *DC)
 
void OnEditItemRequest (wxDC *aDC, BOARD_ITEM *aItem) override
 Function OnEditItemRequest Install the corresponding dialog editor for the given item. More...
 
int SelectHighLight (wxDC *DC)
 Locate track or pad and highlight the corresponding net. More...
 
void HighLight (wxDC *DC)
 Function HighLight. More...
 
bool IsMicroViaAcceptable ()
 Function IsMicroViaAcceptable return true if a microvia can be placed on the board. More...
 
bool Other_Layer_Route (TRACK *track, wxDC *DC)
 Function Other_Layer_Route operates in one of two ways. More...
 
TRACKDelete_Segment (wxDC *DC, TRACK *Track)
 Function Delete_Segment removes a track segment. More...
 
void Delete_Track (wxDC *DC, TRACK *Track)
 
void Delete_net (wxDC *DC, TRACK *Track)
 
void Remove_One_Track (wxDC *DC, TRACK *pt_segm)
 Function Remove_One_Track removes 1 track/ The leading segment is removed and all adjacent segments until a pad or a junction point of more than 2 segments is found. More...
 
void Edit_Track_Width (wxDC *aDC, TRACK *aTrackSegment)
 Function Edit_Track_Width Modify a full track width (using DRC control). More...
 
void Edit_TrackSegm_Width (wxDC *aDC, TRACK *aTrackItem)
 Function Edit_TrackSegm_Width Modify one track segment width or one via diameter (using DRC control). More...
 
TRACKBegin_Route (TRACK *aTrack, wxDC *aDC)
 Function Begin_Route Starts a new track and/or establish of a new track point. More...
 
bool End_Route (TRACK *aTrack, wxDC *aDC)
 Function End_Route Terminates a track currently being created. More...
 
void Attribut_Segment (TRACK *track, wxDC *DC, bool Flag_On)
 
void Attribut_Track (TRACK *track, wxDC *DC, bool Flag_On)
 
void Attribut_net (wxDC *DC, int net_code, bool Flag_On)
 
void StartMoveOneNodeOrSegment (TRACK *aTrack, wxDC *aDC, int aCommand)
 Function StartMoveOneNodeOrSegment initializes the parameters to move one via or/and a terminal point of a track segment The terminal point of other connected segments (if any) are moved too. More...
 
bool PlaceDraggedOrMovedTrackSegment (TRACK *Track, wxDC *DC)
 
bool MergeCollinearTracks (TRACK *track, wxDC *DC, int end)
 
void Start_DragTrackSegmentAndKeepSlope (TRACK *track, wxDC *DC)
 
void SwitchLayer (wxDC *DC, PCB_LAYER_ID layer) override
 
bool Add45DegreeSegment (wxDC *aDC)
 Function Add45DegreeSegment adds a track segment between 2 tracks segments if these 2 segments make a 90 deg angle, in order to have 45 deg track segments Its only works on horizontal or vertical segments. More...
 
int EraseRedundantTrack (wxDC *aDC, TRACK *aNewTrack, int aNewTrackSegmentsCount, PICKED_ITEMS_LIST *aItemsListPicker)
 Function EraseRedundantTrack Called after creating a track Remove (if exists) the old track that have the same starting and the same ending point as the new created track (this is the redunding track) More...
 
int SetTrackSegmentWidth (TRACK *aTrackItem, PICKED_ITEMS_LIST *aItemsListPicker, bool aUseNetclassValue)
 Function SetTrackSegmentWidth Modify one track segment width or one via diameter (using DRC control). More...
 
int Delete_LastCreatedCorner (wxDC *DC)
 Function Delete_LastCreatedCorner Used only while creating a new zone outline Remove and delete the current outline segment in progress. More...
 
int Begin_Zone (wxDC *DC)
 Function Begin_Zone either initializes the first segment of a new zone, or adds an intermediate segment. More...
 
bool End_Zone (wxDC *DC)
 Function End_Zone terminates (if no DRC error ) the zone edge creation process. More...
 
void Fill_Zone (ZONE_CONTAINER *aZone)
 Function Fill_Zone Calculate the zone filling for the outline zone_container The zone outline is a frontier, and can be complex (with holes) The filling starts from starting points like pads, tracks. More...
 
void Fill_All_Zones ()
 Function Fill_All_Zones. More...
 
void Check_All_Zones (wxWindow *aActiveWindow)
 Function Check_All_Zones Checks for out-of-date fills and fills them if requested by the user. More...
 
void Add_Zone_Cutout (wxDC *DC, ZONE_CONTAINER *zone_container)
 Function Add_Zone_Cutout Add a cutout zone to a given zone outline. More...
 
void Add_Similar_Zone (wxDC *DC, ZONE_CONTAINER *zone_container)
 Function Add_Similar_Zone Add a zone to a given zone outline. More...
 
void Edit_Zone_Params (wxDC *DC, ZONE_CONTAINER *zone_container)
 Function Edit_Zone_Params Edit params (layer, clearance, ...) for a zone outline. More...
 
void Start_Move_Zone_Corner (wxDC *DC, ZONE_CONTAINER *zone_container, int corner_id, bool IsNewCorner)
 Function Start_Move_Zone_Corner Prepares a move corner in a zone outline, called from a move corner command (IsNewCorner = false), or a create new cornet command (IsNewCorner = true ) More...
 
void Start_Move_Zone_Drag_Outline_Edge (wxDC *DC, ZONE_CONTAINER *zone_container, int corner_id)
 Function Start_Move_Zone_Corner Prepares a drag edge in an existing zone outline,. More...
 
void End_Move_Zone_Corner_Or_Outlines (wxDC *DC, ZONE_CONTAINER *zone_container)
 Function End_Move_Zone_Corner_Or_Outlines Terminates a move corner in a zone outline, or a move zone outlines. More...
 
void Remove_Zone_Corner (wxDC *DC, ZONE_CONTAINER *zone_container)
 Function End_Move_Zone_Corner_Or_Outlines Remove the currently selected corner in a zone outline the .m_CornerSelection is used as corner selection. More...
 
void Delete_Zone_Contour (wxDC *DC, ZONE_CONTAINER *zone_container)
 Function Delete_Zone Remove the zone which include the segment aZone, or the zone which have the given time stamp. More...
 
void Start_Move_Zone_Outlines (wxDC *DC, ZONE_CONTAINER *zone_container)
 Function Start_Move_Zone_Outlines Initialize parameters to move an existing zone outlines. More...
 
PCB_TARGETCreateTarget (wxDC *DC)
 
void DeleteTarget (PCB_TARGET *aTarget, wxDC *DC)
 
void BeginMoveTarget (PCB_TARGET *aTarget, wxDC *DC)
 
void PlaceTarget (PCB_TARGET *aTarget, wxDC *DC)
 
void ShowTargetOptionsDialog (PCB_TARGET *aTarget, wxDC *DC)
 
DRAWSEGMENTBegin_DrawSegment (DRAWSEGMENT *Segment, STROKE_T shape, wxDC *DC)
 
void End_Edge (DRAWSEGMENT *Segment, wxDC *DC)
 
void Delete_Segment_Edge (DRAWSEGMENT *Segment, wxDC *DC)
 
void Delete_Drawings_All_Layer (PCB_LAYER_ID aLayer)
 
void ShowDimensionPropertyDialog (DIMENSION *aDimension, wxDC *aDC)
 
DIMENSIONEditDimension (DIMENSION *aDimension, wxDC *aDC)
 
void DeleteDimension (DIMENSION *aDimension, wxDC *aDC)
 
void BeginMoveDimensionText (DIMENSION *aItem, wxDC *DC)
 
void PlaceDimensionText (DIMENSION *aItem, wxDC *DC)
 
void InstallNetlistFrame (wxDC *DC)
 
bool FetchNetlistFromSchematic (NETLIST &aNetlist, FETCH_NETLIST_MODE aMode)
 
void UpdatePCBFromNetlist (NETLIST &aNetlist)
 Function UpdatePCBFromNetlist. More...
 
void DoUpdatePCBFromNetlist (NETLIST &aNetlist, bool aUseTimestamps)
 Function DoUpdatePCBFromNetlist An automated version of UpdatePCBFromNetlist which skips the UI dialog. More...
 
bool ReadNetlistFromFile (const wxString &aFilename, NETLIST &aNetlist, REPORTER &aReporter)
 Reads a netlist from a file into a NETLIST object. More...
 
void OnNetlistChanged (BOARD_NETLIST_UPDATER &aUpdater, bool *aRunDragCommand)
 Called after netlist is updated. More...
 
bool RemoveMisConnectedTracks ()
 Function RemoveMisConnectedTracks finds all track segments which are mis-connected (to more than one net). More...
 
void OnPlaceOrRouteFootprints (wxCommandEvent &event)
 
void LockModule (MODULE *aModule, bool aLocked)
 
void SpreadFootprints (std::vector< MODULE * > *aFootprints, bool aMoveFootprintsOutsideBoardOnly, bool aCheckForBoardEdges, wxPoint aSpreadAreaPosition, bool aPrepareUndoCommand=true)
 Function SpreadFootprints Footprints (after loaded by reading a netlist for instance) are moved to be in a small free area (outside the current board) without overlapping. More...
 
void Show_1_Ratsnest (EDA_ITEM *item, wxDC *DC)
 Function Show_1_Ratsnest draw ratsnest. More...
 
void Clean_Pcb ()
 Function Clean_Pcb Clean up the board (remove redundant vias, not connected tracks and merges collinear track segments) Install the cleanup dialog frame to know what should be cleaned and run the cleanup function. More...
 
void InstallFindFrame ()
 
void SendMessageToEESCHEMA (BOARD_ITEM *objectToSync)
 Function SendMessageToEESCHEMA sends a message to the schematic editor so that it may move its cursor to a part with the same reference as the objectToSync. More...
 
void SendCrossProbeNetName (const wxString &aNetName)
 Sends a net name to eeschema for highlighting. More...
 
void Edit_Gap (wxDC *DC, MODULE *Module)
 Function Edit_Gap edits the GAP module if it has changed the position and/or size of the pads that form the gap get a new value. More...
 
MODULECreateMuWaveBaseFootprint (const wxString &aValue, int aTextSize, int aPadCount)
 Function CreateMuWaveBaseFootprint create a basic footprint for micro wave applications. More...
 
MODULECreate_MuWaveComponent (int shape_type)
 Create_MuWaveComponent creates a module "GAP" or "STUB" used in micro wave designs. More...
 
MODULECreate_MuWavePolygonShape ()
 
void Begin_Self (wxDC *DC)
 
void ShowChangedLanguage () override
 Redraw the menus and what not in current language. More...
 
void UpdateTitle ()
 Function UpdateTitle sets the main window title bar text. More...
 
void InstallPreferences (PAGED_DIALOG *aParent) override
 Allows Pcbnew to install its preferences panel into the preferences dialog. More...
 
void CommonSettingsChanged () override
 Called after the preferences dialog is run. More...
 
void SyncMenusAndToolbars () override
 Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
wxString CreateNewLibrary (const wxString &aLibName=wxEmptyString)
 Function CreateNewLibrary If a library name is given, creates a new footprint library in the project folder with the given name. More...
 
bool AddLibrary (const wxString &aLibName=wxEmptyString)
 Function AddLibrary Add an existing library to either the global or project library table. More...
 
void SaveCopyInUndoList (BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
 Function SaveCopyInUndoList Creates a new entry in undo list of commands. More...
 
void SaveCopyInUndoList (const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
 Function SaveCopyInUndoList Creates a new entry in undo list of commands. More...
 
void RestoreCopyFromRedoList (wxCommandEvent &aEvent)
 Function RestoreCopyFromRedoList Redo the last edit: More...
 
void RestoreCopyFromUndoList (wxCommandEvent &aEvent)
 Function RestoreCopyFromUndoList Undo the last edit: More...
 
void PutDataInPreviousState (PICKED_ITEMS_LIST *aList, bool aRedoCommand, bool aRebuildRatsnet=true)
 Function PutDataInPreviousState Used in undo or redo command. More...
 
bool UndoRedoBlocked () const
 Function UndoRedoBlocked Checks if the undo and redo operations are currently blocked. More...
 
void UndoRedoBlock (bool aBlock=true)
 Function UndoRedoBlock Enables/disable undo and redo operations. More...
 
int GetRotationAngle () const
 Function GetRotationAngle() Returns the angle used for rotate operations. More...
 
void SetRotationAngle (int aRotationAngle)
 Function SetRotationAngle() Sets the angle used for rotate operations. More...
 
void InstallTextOptionsFrame (BOARD_ITEM *aText, wxDC *aDC)
 Routine for main window class to launch text properties dialog. More...
 
void InstallGraphicItemPropertiesDialog (BOARD_ITEM *aItem)
 
void OnGridSettings (wxCommandEvent &aEvent) override
 
bool InvokeDialogGrid ()
 
EDA_3D_VIEWERGet3DViewerFrame ()
 
bool Update3DView (const wxString *aTitle=nullptr)
 Update the 3D view, if the viewer is opened by this frame. More...
 
MODULELoadFootprint (const LIB_ID &aFootprintId)
 Function LoadFootprint attempts to load aFootprintId from the footprint library table. More...
 
EDA_RECT GetBoardBoundingBox (bool aBoardEdgesOnly=false) const
 Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge segments). More...
 
const BOX2I GetDocumentExtents () const override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPoint & GetAuxOrigin () const override
 Return the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPoint) override
 
const wxPoint & GetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
virtual BOARD_DESIGN_SETTINGSGetDesignSettings () const
 Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame. More...
 
virtual void SetDesignSettings (const BOARD_DESIGN_SETTINGS &aSettings)
 
void SetDrawBgColor (COLOR4D aColor) override
 
void * GetDisplayOptions () override
 Function GetDisplayOptions returns the display options current in use Display options are relative to the way tracks, vias, outlines and other things are shown (for instance solid or sketch mode) Must be overloaded in frames which have display options (board editor and footprint editor) More...
 
const ZONE_SETTINGSGetZoneSettings () const
 
void SetZoneSettings (const ZONE_SETTINGS &aSettings)
 
virtual const PCB_PLOT_PARAMSGetPlotSettings () const
 Function GetPlotSettings returns the PCB_PLOT_PARAMS for the BOARD owned by this frame. More...
 
virtual void SetPlotSettings (const PCB_PLOT_PARAMS &aSettings)
 
BOARDGetBoard () const
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg) override
 Set the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void UpdateStatusBar () override
 Update the status bar information. More...
 
PCB_SCREENGetScreen () const override
 Return a pointer to a BASE_SCREEN or one of its derivatives. More...
 
void UpdateGridSelectBox ()
 
virtual double BestZoom () override
 Function BestZoom. 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...
 
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 ()
 
void UpdateMsgPanel () override
 

More...
 
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide ()
 Function GetCollectorsGuide. More...
 
wxString SelectLibrary (const wxString &aNicknameExisting)
 Function SelectLibrary puts up a dialog and allows the user to pick a library, for unspecified use. More...
 
MODULEGetFootprintFromBoardByReference ()
 Function GetFootprintFromBoardByReference. More...
 
MODULECreateNewModule (const wxString &aModuleName)
 Function CreateNewModule Creates a new module or footprint, at position 0,0 The new module contains only 2 texts: a reference and a value: Reference = REF** Value = "VAL**" or Footprint name in lib Note: they are dummy texts, which will be replaced by the actual texts when the fooprint is placed on a board and a netlist is read. More...
 
void Edit_Module (MODULE *module, wxDC *DC)
 
void Rotate_Module (wxDC *DC, MODULE *module, double angle, bool incremental)
 
void PlaceModule (MODULE *aModule, wxDC *aDC, bool aRecreateRatsnest=true)
 Function PlaceModule places aModule at the current cursor position and updates module coordinates with the new position. More...
 
void RotateTextModule (TEXTE_MODULE *Text, wxDC *DC)
 
void DeleteTextModule (TEXTE_MODULE *Text)
 
void PlaceTexteModule (TEXTE_MODULE *Text, wxDC *DC)
 
void StartMoveTexteModule (TEXTE_MODULE *Text, wxDC *DC)
 
void ResetTextSize (BOARD_ITEM *aItem, wxDC *aDC)
 Function ResetTextSize resets given field text size and width to current settings in Preferences->Dimensions->Texts and Drawings. More...
 
void InstallPadOptionsFrame (D_PAD *pad)
 
void AddPad (MODULE *Module, bool draw)
 
void DeletePad (D_PAD *aPad, bool aQuery=true)
 Function DeletePad Delete the pad aPad. More...
 
void StartMovePad (D_PAD *aPad, wxDC *aDC, bool aDragConnectedTracks)
 Function StartMovePad Initialize a drag or move pad command. More...
 
void PlacePad (D_PAD *Pad, wxDC *DC)
 
void Export_Pad_Settings (D_PAD *aPad)
 
void Import_Pad_Settings (D_PAD *aPad, bool aDraw)
 
void DoPushPadProperties (D_PAD *aPad, bool aSameFootprints, bool aPadShapeFilter, bool aPadOrientFilter, bool aPadLayerFilter, bool aSaveForUndo)
 Function DoPushPadProperties Function to change pad settings for the given footprint or all identical footprints. More...
 
MODULESelectFootprintFromLibTree (LIB_ID aPreselect=LIB_ID(), bool aAllowBroswer=true)
 Function SelectFootprintFromLibTree opens a dialog to select a footprint. More...
 
virtual void AddModuleToBoard (MODULE *module)
 Adds the given module to the board. More...
 
wxString SelectFootprintFromLibBrowser ()
 Function SelectFootprintFromLibBrowser launches the footprint viewer to select the name of a footprint to load. More...
 
void Compile_Ratsnest (wxDC *aDC, bool aDisplayStatus)
 Function Compile_Ratsnest Create the entire board ratsnest. More...
 
void build_ratsnest_module (MODULE *aModule, wxPoint aMoveVector)
 Function build_ratsnest_module Build a ratsnest relative to one footprint. More...
 
void TraceModuleRatsNest (wxDC *aDC)
 Function TraceModuleRatsNest display the rats nest of a moving footprint, computed by build_ratsnest_module() More...
 
void DrawGeneralRatsnest (wxDC *aDC, int aNetcode=0)
 function Displays the general ratsnest Only ratsnest with the status bit CH_VISIBLE is set are displayed More...
 
void TraceAirWiresToTargets (wxDC *aDC)
 Function TraceAirWiresToTargets This functions shows airwires to nearest connecting points (pads) from the current new track end during track creation Uses data prepared by BuildAirWiresTargetsList() More...
 
void BuildAirWiresTargetsList (BOARD_CONNECTED_ITEM *aItemRef, const wxPoint &aPosition, int aNet)
 Function BuildAirWiresTargetsList Build a list of candidates that can be a coonection point when a track is started. More...
 
void TestNetConnection (wxDC *aDC, int aNetCode)
 Function TestNetConnection tests the connections relative to aNetCode. More...
 
PCB_LAYER_ID SelectLayer (PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
 Install the dialog box for layer selection. More...
 
void SelectCopperLayerPair ()
 
virtual PCB_LAYER_ID GetActiveLayer () const
 Function GetActiveLayer returns the active layer. More...
 
void OnTogglePolarCoords (wxCommandEvent &aEvent)
 
void OnTogglePadDrawMode (wxCommandEvent &aEvent)
 
void OnToggleGraphicDrawMode (wxCommandEvent &aEvent)
 
void OnToggleEdgeDrawMode (wxCommandEvent &aEvent)
 
void OnToggleTextDrawMode (wxCommandEvent &aEvent)
 
void OnUpdateCoordType (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectZoom (wxUpdateUIEvent &aEvent)
 
void SetFastGrid1 ()
 Function SetFastGrid1() More...
 
void SetFastGrid2 ()
 Function SetFastGrid2() More...
 
void OnUpdateSwitchCanvas (wxUpdateUIEvent &aEvent)
 Update UI called when switches currently used canvas (default / Cairo / OpenGL). More...
 
PCB_GENERAL_SETTINGSSettings ()
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
EDA_UNITS_T GetUserUnits () const override
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS_T aUnits)
 
void ChangeUserUnits (EDA_UNITS_T aUnits)
 
int GetLastGridSizeId () const
 
void SetLastGridSizeId (int aId)
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Set the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Return the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Return the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Return the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPoint & GetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
virtual EDA_DRAW_PANELGetCanvas () const
 
virtual wxString GetScreenDesc () const
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 After calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 

More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Return a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Return the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
ACTION_TOOLBARGetMainToolBar () const
 
ACTION_TOOLBARGetOptionsToolBar () const
 
ACTION_TOOLBARGetDrawToolBar () const
 
ACTION_TOOLBARGetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Change the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Change the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Change the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Set the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Change the zoom to the next one available. More...
 
void SetNextZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the next one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPrevZoom ()
 Change the zoom to the previous one available. More...
 
void SetPreviousZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the previous one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPresetZoom (int aIndex)
 Change zoom to one of the preset values. More...
 
virtual void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
virtual void RedrawScreen2 (const wxPoint &posBefore)
 Put the crosshair back to the screen position it had before zooming. More...
 
virtual void HardRedraw ()
 Rebuild the GAL and redraws the screen. More...
 
virtual void Zoom_Automatique (bool aWarpPointer)
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
virtual void Window_Zoom (EDA_RECT &Rect)
 
void FocusOnLocation (const wxPoint &aPos, bool aWarpCursor=true, bool aCenterView=false)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
double GetZoom ()
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
wxString GetToolMsg ()
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnPageSettingsChange ()
 Called when modifying the page settings. More...
 
virtual void OnActivate (wxActivateEvent &event)
 Called when activating the frame. More...
 
void DisplayUnitsMsg ()
 Display current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Copy the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
virtual void ClearMsgPanel ()
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Push preferences from a parent window to a child window. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL)
 Print the page pointed by current screen, set by the calling print function. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const override
 Return the tool manager instance, if any. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
bool GetShowAxis () const
 
bool GetShowGridAxis () const
 
bool GetShowOriginAxis () const
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Override 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)
 
bool ShowPreferences (EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys, const wxString &aHotkeysNickname)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Update the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName)
 Check if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
bool PostCommandMenuEvent (int evt_type)
 Post a menu event to the frame, which can be used to trigger actions bound to menu items. More...
 
const wxString & GetAboutTitle () const
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Public Attributes

PCB_LAYER_BOX_SELECTORm_SelLayerBox
 
wxChoice * m_SelTrackWidthBox
 
wxChoice * m_SelViaSizeBox
 
bool m_show_microwave_tools
 
bool m_show_layer_manager_tools
 
bool m_ZoneFillsDirty
 
PCB_DISPLAY_OPTIONS m_DisplayOptions
 
wxPoint m_UserGridSize
 
int m_FastGrid1
 
int m_FastGrid2
 

Static Public Attributes

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

Key in KifaceSettings to store the canvas type.

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

Protected Member Functions

void setupTools ()
 
void createPopUpMenuForZones (ZONE_CONTAINER *edge_zone, wxMenu *aPopMenu)
 
void createPopUpMenuForFootprints (MODULE *aModule, wxMenu *aPopMenu)
 
void createPopUpMenuForFpTexts (TEXTE_MODULE *aText, wxMenu *aPopMenu)
 
void createPopUpMenuForFpPads (D_PAD *aPad, wxMenu *aPopMenu)
 
void createPopupMenuForTracks (TRACK *aTrack, wxMenu *aPopMenu)
 
void createPopUpMenuForTexts (TEXTE_PCB *Text, wxMenu *menu)
 
void createPopUpBlockMenu (wxMenu *menu)
 
void createPopUpMenuForMarkers (MARKER_PCB *aMarker, wxMenu *aPopMenu)
 
wxString createBackupFile (const wxString &aFileName)
 
void enableGALSpecificMenus ()
 an helper function to enable some menus only active when the display is switched to GAL mode and which do nothing in legacy mode More...
 
virtual void OnSwitchCanvas (wxCommandEvent &aEvent) override
 switches currently used canvas (default / Cairo / OpenGL). More...
 
void onBoardLoaded ()
 Updates the state of the GUI after a new board is loaded or created. More...
 
void syncLayerWidgetLayer ()
 Function syncLayerWidgetLayer updates the currently layer "selection" within the PCB_LAYER_WIDGET. More...
 
void syncRenderStates ()
 Function syncRenderStates updates the "Render" checkboxes in the layer widget according to current toggle values determined by IsElementVisible(), and is helpful immediately after loading a BOARD which may have state information in it. More...
 
void syncLayerVisibilities ()
 Function syncLayerVisibilities updates each "Layer" checkbox in the layer widget according to each layer's current visibility determined by IsLayerVisible(), and is helpful immediately after loading a BOARD which may have state information in it. More...
 
virtual bool doAutoSave () override
 Function doAutoSave performs auto save when the board has been modified and not saved within the auto save interval. More...
 
virtual bool isAutoSaveRequired () const override
 Function isautoSaveRequired returns true if the board has been modified. More...
 
void duplicateZone (wxDC *aDC, ZONE_CONTAINER *aZone)
 Function duplicateZone duplicates the given zone. More...
 
void moveExact ()
 Function moveExact Move the selected item exactly. More...
 
void duplicateItems (bool aIncrement) override
 Function duplicateItems Duplicate selected item if possible and start a move. More...
 
bool importFile (const wxString &aFileName, int aFileType)
 Load the given filename but sets the path to the current project path. More...
 
int inferLegacyEdgeClearance (BOARD *aBoard)
 Use the existing edge_cut line thicknesses to infer the edge clearace. More...
 
bool fixEagleNets (const std::unordered_map< wxString, wxString > &aRemap)
 Rematch orphaned zones and vias to schematic nets. More...
 
 PCB_EDIT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 
void createArray ()
 Function createArray Create an array of the selected item (invokes the dialogue) This function is shared between pcbnew and modedit, as it is virtually the same. More...
 
void duplicateItem (BOARD_ITEM *aItem, bool aIncrement)
 Function duplicateItem Duplicate the specified item This function is shared between pcbnew and modedit, as it is virtually the same. More...
 
void unitsChangeRefresh () override
 Called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
void updateZoomSelectBox ()
 
MODULEloadFootprint (const LIB_ID &aFootprintId)
 Function loadFootprint attempts to load aFootprintId from the footprint library table. More...
 
virtual void SetScreen (BASE_SCREEN *aScreen)
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool saveCanvasImageToFile (const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
 
virtual wxString GetCanvasTypeKey ()
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Handle the auto save timer event. More...
 
virtual wxConfigBase * config ()
 Return the wxConfigBase used in SaveSettings(). More...
 
virtual const SEARCH_STACKsys_search ()
 Return a SEARCH_STACK pertaining to entire program. More...
 
virtual wxString help_name ()
 

Static Protected Member Functions

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

Protected Attributes

PCB_LAYER_WIDGETm_Layers
 
DRCm_drc
 the DRC controller, see drc.cpp More...
 
PARAM_CFG_ARRAY m_configParams
 List of Pcbnew configuration settings. More...
 
wxString m_lastNetListRead
 Last net list read with relative path. More...
 
int m_rotationAngle
 User defined rotation angle (in tenths of a degree). More...
 
bool m_undoRedoBlocked
 Is undo/redo operation currently blocked? More...
 
BOARDm_Pcb
 
GENERAL_COLLECTORm_Collector
 
PCB_GENERAL_SETTINGS m_configSettings
 
bool m_galCanvasActive
 whether to use new GAL engine More...
 
bool m_useSingleCanvasPane
 
wxSocketServer * m_socketServer
 
std::vector< wxSocketBase * > m_sockets
 interprocess communication More...
 
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
 prevents opening same file multiple times. More...
 
EDA_HOTKEY_CONFIGm_hotkeysDescrList
 
int m_LastGridSizeId
 
bool m_drawGrid
 
bool m_showPageLimits
 true to display the page limits More...
 
COLOR4D m_gridColor
 Grid color. More...
 
COLOR4D m_drawBgColor
 the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema More...
 
double m_zoomLevelCoeff
 a suitable value to convert the internal zoom scaling factor More...
 
int m_UndoRedoCountMax
 default Undo/Redo command Max depth, to be handed More...
 
EDA_UNITS_T m_UserUnits
 
EDA_DRAW_PANELm_canvas
 The area to draw on. More...
 
TOOL_MANAGERm_toolManager
 
TOOL_DISPATCHERm_toolDispatcher
 
ACTIONSm_actions
 
int m_lastDrawToolId
 Tool ID of previously active draw tool bar button. More...
 
bool m_showAxis
 True shows the X and Y axis indicators. More...
 
bool m_showGridAxis
 True shows the grid axis indicators. More...
 
bool m_showOriginAxis
 True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files. More...
 
bool m_showBorderAndTitleBlock
 True shows the drawing border and title block. More...
 
long m_firstRunDialogSetting
 Key to control whether first run dialog is shown on startup. More...
 
wxChoice * m_gridSelectBox
 
wxChoice * m_zoomSelectBox
 
ACTION_TOOLBARm_mainToolBar
 
ACTION_TOOLBARm_auxiliaryToolBar
 Auxiliary tool bar typically shown below the main tool bar at the top of the main window. More...
 
ACTION_TOOLBARm_drawToolBar
 The tool bar that contains the buttons for quick access to the application draw tools. More...
 
ACTION_TOOLBARm_optionsToolBar
 The options tool bar typcially located on the left edge of the main window. More...
 
EDA_MSG_PANELm_messagePanel
 Panel used to display information at the bottom of the main window. More...
 
int m_MsgFrameHeight
 
bool m_movingCursorWithKeyboard
 One-shot to avoid a recursive mouse event during hotkey movement. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 The current canvas type. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) 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 Attributes

wxAuiToolBar * m_microWaveToolBar
 The auxiliary right vertical tool bar used to access the microwave tools. More...
 

Friends

struct PCB::IFACE
 
class PCB_LAYER_WIDGET
 

Detailed Description

Class PCB_EDIT_FRAME is the main frame for Pcbnew.

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

Definition at line 86 of file pcb_edit_frame.h.

Member Enumeration Documentation

◆ FETCH_NETLIST_MODE

Function FetchNetlistFromSchematic.

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

Definition at line 1554 of file pcb_edit_frame.h.

Constructor & Destructor Documentation

◆ PCB_EDIT_FRAME()

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

◆ ~PCB_EDIT_FRAME()

PCB_EDIT_FRAME::~PCB_EDIT_FRAME ( )
virtual

Definition at line 482 of file pcb_edit_frame.cpp.

483 {
484  delete m_drc;
485 }
DRC * m_drc
the DRC controller, see drc.cpp

Member Function Documentation

◆ Add45DegreeSegment()

bool PCB_EDIT_FRAME::Add45DegreeSegment ( wxDC *  aDC)

Function Add45DegreeSegment adds a track segment between 2 tracks segments if these 2 segments make a 90 deg angle, in order to have 45 deg track segments Its only works on horizontal or vertical segments.

Parameters
aDCThe wxDC device context to draw on.
Returns
A bool value true if ok or false if not.

Definition at line 296 of file editrack.cpp.

297 {
298  int dx0, dy0, dx1, dy1;
299 
300  if( g_CurrentTrackList.GetCount() < 2 )
301  return false; // There must be 2 segments.
302 
303  TRACK* curTrack = g_CurrentTrackSegment;
304  TRACK* prevTrack = curTrack->Back();
305 
306  // Test if we have 2 consecutive track segments ( not via ) to connect.
307  if( curTrack->Type() != PCB_TRACE_T || prevTrack->Type() != PCB_TRACE_T )
308  {
309  return false;
310  }
311 
312  int segm_step_45 = KiROUND( GetScreen()->GetGridSize().x / 2 );
313 
314  if( segm_step_45 < ( curTrack->GetWidth() * 2 ) )
315  segm_step_45 = curTrack->GetWidth() * 2;
316 
317  // Test if the segments are horizontal or vertical.
318  dx0 = prevTrack->GetEnd().x - prevTrack->GetStart().x;
319  dy0 = prevTrack->GetEnd().y - prevTrack->GetStart().y;
320 
321  dx1 = curTrack->GetEnd().x - curTrack->GetStart().x;
322  dy1 = curTrack->GetEnd().y - curTrack->GetStart().y;
323 
324  // Segments should have a min length.
325  if( std::max( abs( dx0 ), abs( dy0 ) ) < ( segm_step_45 * 2 ) )
326  return false;
327 
328  if( std::max( abs( dx1 ), abs( dy1 ) ) < ( segm_step_45 * 2 ) )
329  return false;
330 
331  // Create a new segment and connect it with the previous 2 segments.
332  TRACK* newTrack = (TRACK*)curTrack->Clone();
333 
334  newTrack->SetStart( prevTrack->GetEnd() );
335  newTrack->SetEnd( curTrack->GetStart() );
336 
337  if( dx0 == 0 ) // Previous segment is Vertical
338  {
339  if( dy1 != 0 ) // 2 segments are not 90 degrees.
340  {
341  delete newTrack;
342  return false;
343  }
344 
345  /* Calculate coordinates the connection point.
346  * The new segment connects the 1st vertical segment and the 2nd
347  * horizontal segment.
348  */
349  if( dy0 > 0 )
350  newTrack->SetStart( wxPoint(newTrack->GetStart().x, newTrack->GetStart().y -segm_step_45) );
351  else
352  newTrack->SetStart( wxPoint(newTrack->GetStart().x, newTrack->GetStart().y + segm_step_45) );
353 
354  if( dx1 > 0 )
355  newTrack->SetEnd( wxPoint(newTrack->GetEnd().x + segm_step_45, newTrack->GetEnd().y) );
356  else
357  newTrack->SetEnd( wxPoint(newTrack->GetEnd().x - segm_step_45, newTrack->GetEnd().y) );
358 
359  if( Settings().m_legacyDrcOn &&
360  BAD_DRC == m_drc->DrcOnCreatingTrack( curTrack, GetBoard()->m_Track ) )
361  {
362  delete newTrack;
363  return false;
364  }
365 
366  prevTrack->SetEnd( newTrack->GetStart());
367  curTrack->SetStart( newTrack->GetEnd());
368 
369  g_CurrentTrackList.Insert( newTrack, curTrack );
370  return true;
371  }
372 
373  if( dy0 == 0 ) // Previous segment is horizontal
374  {
375  if( dx1 != 0 ) // 2 segments are not 90 degrees
376  {
377  delete newTrack;
378  return false;
379  }
380 
381  /* Calculate the coordinates of the point of connection:
382  * A new segment has been created, connecting segment 1
383  * (horizontal) and segment 2 (vertical)
384  */
385  if( dx0 > 0 )
386  newTrack->SetStart( wxPoint(newTrack->GetStart().x - segm_step_45 , newTrack->GetStart().y));
387  else
388  newTrack->SetStart( wxPoint(newTrack->GetStart().x + segm_step_45, newTrack->GetStart().y) );
389 
390  if( dy1 > 0 )
391  newTrack->SetEnd( wxPoint(newTrack->GetEnd().x, newTrack->GetEnd().y + segm_step_45) );
392  else
393  newTrack->SetEnd( wxPoint(newTrack->GetEnd().x, newTrack->GetEnd().y - segm_step_45) );
394 
395  if( Settings().m_legacyDrcOn &&
396  BAD_DRC == m_drc->DrcOnCreatingTrack( newTrack, GetBoard()->m_Track ) )
397  {
398  delete newTrack;
399  return false;
400  }
401 
402  prevTrack->SetEnd( newTrack->GetStart());
403  curTrack->SetStart( newTrack->GetEnd());
404 
405  g_CurrentTrackList.Insert( newTrack, curTrack );
406  return true;
407  }
408 
409  return false;
410 }
#define g_CurrentTrackSegment
most recently created segment
Definition: pcbnew.h:89
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
void SetEnd(const wxPoint &aEnd)
Definition: class_track.h:129
DLIST< TRACK > g_CurrentTrackList
Definition: pcbnew.cpp:91
const wxPoint & GetStart() const
Definition: class_track.h:133
unsigned GetCount() const
Function GetCount returns the number of elements in the list.
Definition: dlist.h:126
virtual EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
DRC * m_drc
the DRC controller, see drc.cpp
#define abs(a)
Definition: auxiliary.h:84
int DrcOnCreatingTrack(TRACK *aRefSeg, TRACK *aList)
Function Drc tests the current segment and returns the result and displays the error in the status pa...
Definition: drc.cpp:181
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
PCB_GENERAL_SETTINGS & Settings()
#define BAD_DRC
Definition: drc.h:40
int GetWidth() const
Definition: class_track.h:127
#define max(a, b)
Definition: auxiliary.h:86
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const wxPoint & GetEnd() const
Definition: class_track.h:130
void SetStart(const wxPoint &aStart)
Definition: class_track.h:132
BOARD * GetBoard() const
void Insert(T *aNewElement, T *aElementAfterMe)
Function Insert puts aNewElement just in front of aElementAfterMe in the list sequence.
Definition: dlist.h:200
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
TRACK * Back() const
Definition: class_track.h:111

References abs, TRACK::Back(), BAD_DRC, TRACK::Clone(), DRC::DrcOnCreatingTrack(), g_CurrentTrackList, g_CurrentTrackSegment, PCB_BASE_FRAME::GetBoard(), DHEAD::GetCount(), TRACK::GetEnd(), PCB_BASE_FRAME::GetScreen(), TRACK::GetStart(), TRACK::GetWidth(), DLIST< T >::Insert(), KiROUND(), m_drc, PCB_GENERAL_SETTINGS::m_legacyDrcOn, max, PCB_TRACE_T, TRACK::SetEnd(), TRACK::SetStart(), PCB_BASE_FRAME::Settings(), and EDA_ITEM::Type().

Referenced by Begin_Route().

◆ Add_Similar_Zone()

void PCB_EDIT_FRAME::Add_Similar_Zone ( wxDC *  DC,
ZONE_CONTAINER zone_container 
)

Function Add_Similar_Zone Add a zone to a given zone outline.

if the zones are overlapping they will be merged

Parameters
DC= current Device Context
zone_container= parent zone outline

Definition at line 76 of file zones_by_polygon.cpp.

77 {
78  if( !aZone )
79  return;
80 
82  s_CurrentZone = aZone;
83 
84  // set zone settings to the current zone
85  ZONE_SETTINGS zoneInfo = GetZoneSettings();
86  zoneInfo << *aZone;
87  SetZoneSettings( zoneInfo );
88 
89  // Use the general event handler to set others params (like toolbar)
90  wxCommandEvent evt;
91  evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
92  OnSelectTool( evt );
93 }
static bool s_AddCutoutToCurrentZone
void OnSelectTool(wxCommandEvent &aEvent)
Definition: edit.cpp:1383
const ZONE_SETTINGS & GetZoneSettings() const
static ZONE_CONTAINER * s_CurrentZone
Class ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:49
void SetZoneSettings(const ZONE_SETTINGS &aSettings)

References PCB_BASE_FRAME::GetZoneSettings(), ID_PCB_KEEPOUT_AREA_BUTT, ID_PCB_ZONES_BUTT, OnSelectTool(), s_AddCutoutToCurrentZone, s_CurrentZone, and PCB_BASE_FRAME::SetZoneSettings().

Referenced by Process_Special_Functions().

◆ Add_Zone_Cutout()

void PCB_EDIT_FRAME::Add_Zone_Cutout ( wxDC *  DC,
ZONE_CONTAINER zone_container 
)

Function Add_Zone_Cutout Add a cutout zone to a given zone outline.

Parameters
DC= current Device Context
zone_container= parent zone outline

Definition at line 96 of file zones_by_polygon.cpp.

97 {
98  if( !aZone )
99  return;
100 
102  s_CurrentZone = aZone;
103 
104  // set zones setup to the current zone
105  ZONE_SETTINGS zoneInfo = GetZoneSettings();
106  zoneInfo << *aZone;
107  SetZoneSettings( zoneInfo );
108 
109  // Use the general event handle to set others params (like toolbar)
110  wxCommandEvent evt;
111  evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
112  OnSelectTool( evt );
113 }
static bool s_AddCutoutToCurrentZone
void OnSelectTool(wxCommandEvent &aEvent)
Definition: edit.cpp:1383
const ZONE_SETTINGS & GetZoneSettings() const
static ZONE_CONTAINER * s_CurrentZone
Class ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:49
void SetZoneSettings(const ZONE_SETTINGS &aSettings)

References PCB_BASE_FRAME::GetZoneSettings(), ID_PCB_KEEPOUT_AREA_BUTT, ID_PCB_ZONES_BUTT, OnSelectTool(), s_AddCutoutToCurrentZone, s_CurrentZone, and PCB_BASE_FRAME::SetZoneSettings().

Referenced by Process_Special_Functions().

◆ AddLibrary()

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

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

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

Definition at line 510 of file footprint_libraries_utils.cpp.

511 {
512  wxFileName fn( aFilename );
513 
514  if( aFilename.IsEmpty() )
515  {
516  if( !LibraryFileBrowser( true, fn,
518  true ) )
519  {
520  return false;
521  }
522  }
523 
524  wxString libPath = fn.GetFullPath();
525  wxString libName = fn.GetName();
526 
527  if( libName.IsEmpty() )
528  return false;
529 
530  bool saveInGlobalTable = false;
531  bool saveInProjectTable = false;
532  wxArrayString libTableNames;
533 
534  libTableNames.Add( _( "Global" ) );
535  libTableNames.Add( _( "Project" ) );
536 
537  switch( SelectSingleOption( this, _( "Select Library Table" ),
538  _( "Choose the Library Table to add the library to:" ),
539  libTableNames ) )
540  {
541  case 0: saveInGlobalTable = true; break;
542  case 1: saveInProjectTable = true; break;
543  default: return false;
544  }
545 
546  wxString type = IO_MGR::ShowType( IO_MGR::GuessPluginTypeFromLibPath( libPath ) );
547 
548  // try to use path normalized to an environmental variable or project path
549  wxString normalizedPath = NormalizePath( libPath, &Pgm().GetLocalEnvVariables(), &Prj() );
550 
551  if( normalizedPath.IsEmpty() )
552  normalizedPath = libPath;
553 
554  try
555  {
556  if( saveInGlobalTable )
557  {
558  auto row = new FP_LIB_TABLE_ROW( libName, normalizedPath, type, wxEmptyString );
559  GFootprintTable.InsertRow( row );
561  }
562  else if( saveInProjectTable )
563  {
564  auto row = new FP_LIB_TABLE_ROW( libName, normalizedPath, type, wxEmptyString );
565  Prj().PcbFootprintLibs()->InsertRow( row );
566  Prj().PcbFootprintLibs()->Save( Prj().FootprintLibTblName() );
567  }
568  }
569  catch( const IO_ERROR& ioe )
570  {
571  DisplayError( this, ioe.What() );
572  return false;
573  }
574 
575  auto editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, false );
576 
577  if( editor )
578  editor->SyncLibraryTree( true );
579 
580  auto viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
581 
582  if( viewer )
583  viewer->ReCreateLibraryList();
584 
585  return true;
586 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:61
Class FP_LIB_TABLE_ROW.
Definition: fp_lib_table.h:42
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
Component library viewer main window.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
static const wxString ShowType(PCB_FILE_T aFileType)
Function ShowType returns a brief name for a plugin, given aFileType enum.
Definition: io_mgr.cpp:77
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Function GuessPluginTypeFromLibPath returns a plugin type given a footprint library's libPath.
Definition: io_mgr.cpp:124
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: pcbnew.cpp:326
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:321
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
wxString KiCadFootprintLibPathWildcard()
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
int SelectSingleOption(wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const wxArrayString &aOptions)
Displays a dialog with radioboxes asking the user to select an option.
Definition: confirm.cpp:304
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:244
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
const std::string KiCadFootprintLibPathExtension
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalizes a file path to an environmental variable, if possible.
Definition: env_paths.cpp:67
static wxString GetGlobalTableFileName()
Function GetGlobalTableFileName.

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

Referenced by PCB_BASE_EDIT_FRAME::CreateNewLibrary().

◆ AddMenuZoomAndGrid()

void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

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

Parameters
aMasterMenu= the menu to populate.

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

1013 {
1014  wxFAIL_MSG( "Obsolete! Should go through COMMON_TOOLS." );
1015 }

Referenced by EDA_DRAW_PANEL::OnRightClick().

◆ AddModuleToBoard()

void PCB_BASE_FRAME::AddModuleToBoard ( MODULE module)
virtualinherited

Adds the given module to the board.

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

Reimplemented in FOOTPRINT_EDIT_FRAME.

Definition at line 222 of file pcb_base_frame.cpp.

223 {
224  if( module )
225  {
226  GetBoard()->Add( module, ADD_APPEND );
227 
228  module->SetFlags( IS_NEW );
229 
230  if( IsGalCanvasActive() )
231  module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment
232  else
233  module->SetPosition( GetCrossHairPosition() );
234 
235  module->SetTimeStamp( GetNewTimeStamp() );
236  GetBoard()->m_Status_Pcb = 0;
237 
238  // Put it on FRONT layer,
239  // (Can be stored flipped if the lib is an archive built from a board)
240  if( module->IsFlipped() )
241  module->Flip( module->GetPosition() );
242 
243  // Place it in orientation 0,
244  // even if it is not saved with orientation 0 in lib
245  // (Can happen if the lib is an archive built from a board)
246  module->SetOrientation( 0 );
247  }
248 }
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:258
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use.
Definition: draw_frame.h:924
timestamp_t GetNewTimeStamp()
Definition: common.cpp:217
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
void SetPosition(const wxPoint &aPos) override
void SetOrientation(double newangle)
BOARD * GetBoard() const
const wxPoint GetPosition() const override
Definition: class_module.h:183
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:209
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240

References BOARD::Add(), ADD_APPEND, MODULE::Flip(), PCB_BASE_FRAME::GetBoard(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetNewTimeStamp(), MODULE::GetPosition(), IS_NEW, MODULE::IsFlipped(), EDA_DRAW_FRAME::IsGalCanvasActive(), BOARD::m_Status_Pcb, EDA_ITEM::SetFlags(), MODULE::SetOrientation(), MODULE::SetPosition(), and EDA_ITEM::SetTimeStamp().

Referenced by FOOTPRINT_EDIT_FRAME::AddModuleToBoard(), MWAVE::CreateMicrowaveInductor(), CreateMuWaveBaseFootprint(), and OnLeftClick().

◆ AddPad()

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

Definition at line 111 of file pad_edit_functions.cpp.

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

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

Referenced by FOOTPRINT_EDIT_FRAME::OnLeftClick().

◆ AdjustScrollBars()

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

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

670 {
671 }

◆ AppendBoardFile()

bool PCB_EDIT_FRAME::AppendBoardFile ( const wxString &  aFullFileName,
int  aCtl 
)

Function AppendBoardFile appends a board file onto the current one, creating God knows what.

the main purpose is only to allow panelizing boards.

Definition at line 45 of file append_board_to_current.cpp.

46 {
47  IO_MGR::PCB_FILE_T pluginType = plugin_type( aFullFileName, aCtl );
48  PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
49 
50  // keep trace of existing items, in order to know what are the new items
51  // (for undo command for instance)
52 
53  // Tracks are inserted, not append, so mark existing tracks to know what are
54  // the new tracks
55  for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
56  track->SetFlags( FLAG0 );
57 
58  // Other items are append to the item list, so keep trace to the
59  // last existing item is enough
60  MODULE* module = GetBoard()->m_Modules.GetLast();
61  BOARD_ITEM* drawing = GetBoard()->DrawingsList().GetLast();
62  int zonescount = GetBoard()->GetAreaCount();
63 
64  // Keep also the count of copper layers, because we can happen boards
65  // with different copper layers counts,
66  // and the enabled layers
67  int initialCopperLayerCount = GetBoard()->GetCopperLayerCount();
68  LSET initialEnabledLayers = GetBoard()->GetEnabledLayers();
69 
70  try
71  {
72  PROPERTIES props;
73  char xbuf[30];
74  char ybuf[30];
75 
76  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
77  sprintf( xbuf, "%d", GetPageSizeIU().x );
78  sprintf( ybuf, "%d", GetPageSizeIU().y );
79 
80  props["page_width"] = xbuf;
81  props["page_height"] = ybuf;
82 
84  pi->Load( aFullFileName, GetBoard(), &props );
85  }
86  catch( const IO_ERROR& ioe )
87  {
88  for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
89  {
90  track->ClearFlags( FLAG0 );
91  }
92 
93  DisplayErrorMessage( this, _( "Error loading board in AppendBoardFile" ), ioe.What() );
94 
95  return false;
96  }
97 
98  // Now prepare a block move command to place the new items, and
99  // prepare the undo command.
100  BLOCK_SELECTOR& blockmove = GetScreen()->m_BlockLocate;
101  HandleBlockBegin( NULL, BLOCK_PRESELECT_MOVE, wxPoint( 0, 0) );
102  PICKED_ITEMS_LIST& blockitemsList = blockmove.GetItems();
103  PICKED_ITEMS_LIST undoListPicker;
104  ITEM_PICKER picker( NULL, UR_NEW );
105 
106  EDA_RECT bbox; // the new items bounding box, for block move
107  bool bboxInit = true; // true until the bounding box is initialized
108 
109  for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
110  {
111  if( track->GetFlags() & FLAG0 )
112  {
113  track->ClearFlags( FLAG0 );
114  continue;
115  }
116 
117  track->SetFlags( IS_MOVED );
118  picker.SetItem( track );
119  undoListPicker.PushItem( picker );
120  blockitemsList.PushItem( picker );
121 
122  if( bboxInit )
123  bbox = track->GetBoundingBox();
124  else
125  bbox.Merge( track->GetBoundingBox() );
126 
127  bboxInit = false;
128  }
129 
130  if( module )
131  module = module->Next();
132  else
133  module = GetBoard()->m_Modules;
134 
135  for( ; module; module = module->Next() )
136  {
137  module->SetFlags( IS_MOVED );
138  picker.SetItem( module );
139  undoListPicker.PushItem( picker );
140  blockitemsList.PushItem( picker );
141 
142  if( bboxInit )
143  bbox = module->GetBoundingBox();
144  else
145  bbox.Merge( module->GetBoundingBox() );
146 
147  bboxInit = false;
148  }
149 
150  if( drawing )
151  drawing = drawing->Next();
152  else
153  drawing = GetBoard()->DrawingsList();
154 
155  for( ; drawing; drawing = drawing->Next() )
156  {
157  drawing->SetFlags( IS_MOVED );
158  picker.SetItem( drawing );
159  undoListPicker.PushItem( picker );
160  blockitemsList.PushItem( picker );
161 
162  if( bboxInit )
163  bbox = drawing->GetBoundingBox();
164  else
165  bbox.Merge( drawing->GetBoundingBox() );
166 
167  bboxInit = false;
168  }
169 
170  for( ZONE_CONTAINER* zone = GetBoard()->GetArea( zonescount ); zone;
171  zone = GetBoard()->GetArea( zonescount ) )
172  {
173  zone->SetFlags( IS_MOVED );
174  picker.SetItem( zone );
175  undoListPicker.PushItem( picker );
176  blockitemsList.PushItem( picker );
177  zonescount++;
178 
179  if( bboxInit )
180  bbox = zone->GetBoundingBox();
181  else
182  bbox.Merge( zone->GetBoundingBox() );
183 
184  bboxInit = false;
185  }
186 
187  SaveCopyInUndoList( undoListPicker, UR_NEW );
188 
189  // we should not ask PLUGINs to do these items:
190  int copperLayerCount = GetBoard()->GetCopperLayerCount();
191 
192  if( copperLayerCount > initialCopperLayerCount )
193  GetBoard()->SetCopperLayerCount( copperLayerCount );
194 
195  // Enable all used layers, and make them visible:
196  LSET enabledLayers = GetBoard()->GetEnabledLayers();
197  enabledLayers |= initialEnabledLayers;
198  GetBoard()->SetEnabledLayers( enabledLayers );
199  GetBoard()->SetVisibleLayers( enabledLayers );
200 
201  onBoardLoaded();
202 
203  if( IsGalCanvasActive() )
204  static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( GetBoard() );
205 
208 
209  // Finish block move command:
210  wxPoint cpos = GetNearestGridPosition( bbox.Centre() );
211  blockmove.SetOrigin( bbox.GetOrigin() );
212  blockmove.SetSize( bbox.GetSize() );
213  blockmove.SetLastCursorPosition( cpos );
214  HandleBlockEnd( NULL );
215 
216  return true;
217 }
void BuildListOfNets()
Definition: class_board.h:727
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:258
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
T * GetLast() const
Function GetLast returns the last T* in the list without removing it, or NULL if the list is empty.
Definition: dlist.h:170
DLIST< BOARD_ITEM > & DrawingsList()
Definition: class_board.h:258
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:931
void SetCopperLayerCount(int aCount)
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use.
Definition: draw_frame.h:924
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:568
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Initialize a block command.
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
Definition: netclass.cpp:155
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
Class LSET is a set of PCB_LAYER_IDs.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
void onBoardLoaded()
Updates the state of the GUI after a new board is loaded or created.
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
const wxPoint GetOrigin() const
Definition: eda_rect.h:112
virtual bool HandleBlockEnd(wxDC *DC) override
Function HandleBlockEnd() Handle the "end" of a block command, i.e.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
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:198
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:131
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
void SetSize(const wxSize &size)
Definition: eda_rect.h:126
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
Definition: netclass.h:242
BOARD_ITEM * Next() const
DLIST< MODULE > m_Modules
Definition: class_board.h:248
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save,...
Definition: io_mgr.cpp:58
int GetCopperLayerCount() const
Function GetCopperLayerCount.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint Centre() const
Definition: eda_rect.h:60
PICKED_ITEMS_LIST & GetItems()
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
MODULE * Next() const
Definition: class_module.h:122
IO_MGR::PCB_FILE_T plugin_type(const wxString &aFileName, int aCtl)
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952
BOARD * GetBoard() const
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
PCB_FILE_T
Enum PCB_FILE_T is a set of file types that the IO_MGR knows about, and for which there has been a pl...
Definition: io_mgr.h:54
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
void SetEnabledLayers(LSET aLayerMask)
Function SetEnabledLayers is a proxy function that calls the correspondent function in m_BoardSetting...
const wxSize GetSize() const
Definition: eda_rect.h:101
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113

References BLOCK_PRESELECT_MOVE, BOARD::BuildListOfNets(), EDA_RECT::Centre(), NETCLASSES::Clear(), DisplayErrorMessage(), BOARD::DrawingsList(), FLAG0, BOARD::GetArea(), BOARD::GetAreaCount(), PCB_BASE_FRAME::GetBoard(), MODULE::GetBoundingBox(), EDA_ITEM::GetBoundingBox(), BOARD::GetCopperLayerCount(), PCB_BASE_FRAME::GetDesignSettings(), BOARD::GetEnabledLayers(), EDA_DRAW_FRAME::GetGalCanvas(), BLOCK_SELECTOR::GetItems(), DLIST< T >::GetLast(), EDA_DRAW_FRAME::GetNearestGridPosition(), EDA_RECT::GetOrigin(), PCB_BASE_FRAME::GetPageSizeIU(), PCB_BASE_FRAME::GetScreen(), EDA_RECT::GetSize(), EDA_DRAW_FRAME::HandleBlockBegin(), HandleBlockEnd(), IS_MOVED, EDA_DRAW_FRAME::IsGalCanvasActive(), BASE_SCREEN::m_BlockLocate, BOARD::m_Modules, BOARD_DESIGN_SETTINGS::m_NetClasses, EDA_RECT::Merge(), BOARD_ITEM::Next(), MODULE::Next(), onBoardLoaded(), plugin_type(), IO_MGR::PluginFind(), PICKED_ITEMS_LIST::PushItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), BOARD::SetCopperLayerCount(), BOARD::SetEnabledLayers(), EDA_ITEM::SetFlags(), ITEM_PICKER::SetItem(), BLOCK_SELECTOR::SetLastCursorPosition(), EDA_RECT::SetOrigin(), EDA_RECT::SetSize(), BOARD::SetVisibleLayers(), BOARD::SynchronizeNetsAndNetClasses(), UR_NEW, and IO_ERROR::What().

Referenced by Files_io_from_id().

◆ AppendMsgPanel()

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

Append a message to the message panel.

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

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

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

611 {
612  if( m_messagePanel == NULL )
613  return;
614 
615  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
616 }
int color
Definition: DXF_plotter.cpp:62
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:169
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, COLOR4D aColor, int aPad=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:110

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

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

◆ ArchiveModulesOnBoard()

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

Function ArchiveModulesOnBoard Save modules in a library:

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

Definition at line 638 of file footprint_libraries_utils.cpp.

640 {
641  if( GetBoard()->m_Modules == NULL )
642  {
643  DisplayInfoMessage( this, _( "No footprints to archive!" ) );
644  return;
645  }
646 
647  wxString footprintName;
648 
649  if( !aStoreInNewLib )
650  {
651  // The footprints are saved in an existing .pretty library in the fp lib table
652  PROJECT& prj = Prj();
653  wxString last_nickname = prj.GetRString( PROJECT::PCB_LIB_NICKNAME );
654  wxString nickname = SelectLibrary( last_nickname );
655 
656  if( !nickname ) // Aborted
657  return;
658 
659  prj.SetRString( PROJECT::PCB_LIB_NICKNAME, nickname );
660 
661  try
662  {
663  FP_LIB_TABLE* tbl = prj.PcbFootprintLibs();
664 
665  for( MODULE* curr_fp = GetBoard()->m_Modules; curr_fp; curr_fp = curr_fp->Next() )
666  {
667  if( !curr_fp->GetFPID().GetLibItemName().empty() ) // Can happen with old boards.
668  tbl->FootprintSave( nickname, curr_fp, false );
669  }
670  }
671  catch( const IO_ERROR& ioe )
672  {
673  DisplayError( this, ioe.What() );
674  }
675  }
676  else
677  {
678  // The footprints are saved in a new .pretty library.
679  // If this library already exists, all previous footprints will be deleted
680  wxString libPath = CreateNewLibrary( aLibName );
681 
682  if( libPath.IsEmpty() ) // Aborted
683  return;
684 
685 
686  if( aLibPath ) *aLibPath = libPath;
687 
689  PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
690 
691  for( MODULE* curr_fp = GetBoard()->m_Modules; curr_fp; curr_fp = curr_fp->Next() )
692  {
693  try
694  {
695  if( !curr_fp->GetFPID().GetLibItemName().empty() ) // Can happen with old boards.
696  pi->FootprintSave( libPath, curr_fp );
697  }
698  catch( const IO_ERROR& ioe )
699  {
700  DisplayError( this, ioe.What() );
701  }
702  }
703  }
704 }
Class PROJECT holds project specific data.
Definition: project.h:57
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:568
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
VTBL_ENTRY void SetRString(RSTRING_T aStringId, const wxString &aString)
Function SetRString stores a "retained string", which is any session and project specific string iden...
Definition: project.cpp:171
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
wxString CreateNewLibrary(const wxString &aLibName=wxEmptyString)
Function CreateNewLibrary If a library name is given, creates a new footprint library in the project ...
VTBL_ENTRY const wxString & GetRString(RSTRING_T aStringId)
Function GetRString returns a "retained string", which is any session and project specific string ide...
Definition: project.cpp:186
BOARD_ITEM * Next() const
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save,...
Definition: io_mgr.cpp:58
wxString SelectLibrary(const wxString &aNicknameExisting)
Function SelectLibrary puts up a dialog and allows the user to pick a library, for unspecified use.
BOARD * GetBoard() const
SAVE_T FootprintSave(const wxString &aNickname, const MODULE *aFootprint, bool aOverwrite=true)
Function FootprintSave.
PCB_FILE_T
Enum PCB_FILE_T is a set of file types that the IO_MGR knows about, and for which there has been a pl...
Definition: io_mgr.h:54
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:276
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:244
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
S-expression Pcbnew file format.
Definition: io_mgr.h:57

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

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

◆ Attribut_net()

void PCB_EDIT_FRAME::Attribut_net ( wxDC *  DC,
int  net_code,
bool  Flag_On 
)

Definition at line 97 of file attribut.cpp.

98 {
99  TRACK* Track = GetBoard()->m_Track;
100 
101  /* search the first segment for the selected net_code */
102  if( net_code >= 0 )
103  {
104  for( ; Track != NULL; Track = Track->Next() )
105  {
106  if( net_code == Track->GetNetCode() )
107  break;
108  }
109  }
110 
111  m_canvas->CrossHairOff( DC ); // Erase cursor shape
112 
113  while( Track ) /* Flag change */
114  {
115  if( ( net_code >= 0 ) && ( net_code != Track->GetNetCode() ) )
116  break;
117 
118  OnModify();
119  Track->SetState( TRACK_LOCKED, Flag_On );
120  Track->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
121  Track = Track->Next();
122  }
123 
124  m_canvas->CrossHairOn( DC ); // Display cursor shape
125  OnModify();
126 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
int GetNetCode() const
Function GetNetCode.
virtual void CrossHairOn(wxDC *DC=nullptr)
virtual void CrossHairOff(wxDC *DC=nullptr)
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:128
Definition: gr_basic.h:38
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
void SetState(int type, int state)
Definition: base_struct.h:248
TRACK * Next() const
Definition: class_track.h:110
DLIST< TRACK > m_Track
Definition: class_board.h:249
BOARD * GetBoard() const

References EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), TRACK::Draw(), PCB_BASE_FRAME::GetBoard(), BOARD_CONNECTED_ITEM::GetNetCode(), GR_HIGHLIGHT, GR_OR, EDA_DRAW_FRAME::m_canvas, BOARD::m_Track, TRACK::Next(), OnModify(), EDA_ITEM::SetState(), and TRACK_LOCKED.

Referenced by Process_Special_Functions().

◆ Attribut_Segment()

void PCB_EDIT_FRAME::Attribut_Segment ( TRACK track,
wxDC *  DC,
bool  Flag_On 
)

Definition at line 50 of file attribut.cpp.

51 {
52  if( track == NULL )
53  return;
54 
55  OnModify();
56  m_canvas->CrossHairOff( DC ); // Erase cursor shape
57  track->SetState( TRACK_LOCKED, Flag_On );
58  track->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
59  m_canvas->CrossHairOn( DC ); // Display cursor shape
60 
61  MSG_PANEL_ITEMS items;
62  track->GetMsgPanelInfo( m_UserUnits, items );
63  SetMsgPanel( items );
64 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
void GetMsgPanelInfo(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void CrossHairOn(wxDC *DC=nullptr)
virtual void CrossHairOff(wxDC *DC=nullptr)
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:128
Definition: gr_basic.h:38
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
void SetState(int type, int state)
Definition: base_struct.h:248
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:125

References EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), TRACK::Draw(), TRACK::GetMsgPanelInfo(), GR_HIGHLIGHT, GR_OR, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_UserUnits, OnModify(), EDA_DRAW_FRAME::SetMsgPanel(), EDA_ITEM::SetState(), and TRACK_LOCKED.

Referenced by Process_Special_Functions().

◆ Attribut_Track()

void PCB_EDIT_FRAME::Attribut_Track ( TRACK track,
wxDC *  DC,
bool  Flag_On 
)

Definition at line 68 of file attribut.cpp.

69 {
70  TRACK* Track;
71  int nb_segm;
72 
73  if( track == NULL )
74  return;
75 
76  m_canvas->CrossHairOff( DC ); // Erase cursor shape
77  Track = GetBoard()->MarkTrace( GetBoard()->m_Track, track, &nb_segm, NULL, NULL, true );
78  DrawTraces( m_canvas, DC, Track, nb_segm, GR_OR | GR_HIGHLIGHT );
79 
80  for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
81  {
82  Track->SetState( TRACK_LOCKED, Flag_On );
83  Track->SetState( BUSY, false );
84  Track = Track->Next();
85  }
86 
87  m_canvas->CrossHairOn( DC ); // Display cursor shape
88 
89  OnModify();
90 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
virtual void CrossHairOn(wxDC *DC=nullptr)
void DrawTraces(EDA_DRAW_PANEL *panel, wxDC *DC, TRACK *aTrackList, int nbsegment, GR_DRAWMODE draw_mode)
Function DrawTraces Draws n consecutive track segments in list.
virtual void CrossHairOff(wxDC *DC=nullptr)
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:128
Definition: gr_basic.h:38
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
void SetState(int type, int state)
Definition: base_struct.h:248
TRACK * Next() const
Definition: class_track.h:110
BOARD * GetBoard() const
TRACK * MarkTrace(TRACK *aTrackList, TRACK *aTrace, int *aCount, double *aTraceLength, double *aInPackageLength, bool aReorder)
Function MarkTrace marks a chain of trace segments, connected to aTrace.

References BUSY, EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), DrawTraces(), PCB_BASE_FRAME::GetBoard(), GR_HIGHLIGHT, GR_OR, EDA_DRAW_FRAME::m_canvas, BOARD::MarkTrace(), TRACK::Next(), OnModify(), EDA_ITEM::SetState(), and TRACK_LOCKED.

Referenced by Process_Special_Functions().

◆ Begin_DrawSegment()

DRAWSEGMENT * PCB_EDIT_FRAME::Begin_DrawSegment ( DRAWSEGMENT Segment,
STROKE_T  shape,
wxDC *  DC 
)

Definition at line 238 of file editedge.cpp.

239 {
240  int lineWidth;
241  DRAWSEGMENT* DrawItem;
242 
244 
245  if( Segment == NULL ) // Create new segment.
246  {
247  SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
248  Segment->SetFlags( IS_NEW );
249  Segment->SetLayer( GetActiveLayer() );
250  Segment->SetWidth( lineWidth );
251  Segment->SetShape( shape );
252  Segment->SetAngle( 900 );
253  Segment->SetStart( GetCrossHairPosition() );
254  Segment->SetEnd( GetCrossHairPosition() );
256  }
257  else
258  {
259  // The ending point coordinate Segment->m_End was updated by the function
260  // DrawSegment() called on a move mouse event during the segment creation
261  if( Segment->GetStart() != Segment->GetEnd() )
262  {
263  if( Segment->GetShape() == S_SEGMENT )
264  {
265  SaveCopyInUndoList( Segment, UR_NEW );
266  GetBoard()->Add( Segment );
267 
268  OnModify();
269  Segment->ClearFlags();
270 
271  Segment->Draw( m_canvas, DC, GR_OR );
272 
273  DrawItem = Segment;
274 
275  SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
276 
277  Segment->SetFlags( IS_NEW );
278  Segment->SetLayer( DrawItem->GetLayer() );
279  Segment->SetWidth( lineWidth );
280  Segment->SetShape( DrawItem->GetShape() );
281  Segment->SetType( DrawItem->GetType() );
282  Segment->SetAngle( DrawItem->GetAngle() );
283  Segment->SetStart( DrawItem->GetEnd() );
284  Segment->SetEnd( DrawItem->GetEnd() );
285  DrawSegment( m_canvas, DC, wxDefaultPosition, false );
286  }
287  else
288  {
289  End_Edge( Segment, DC );
290  Segment = NULL;
291  }
292  }
293  }
294 
295  return Segment;
296 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
void SetShape(STROKE_T aShape)
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetType(int aType)
static void Abort_EditEdge(EDA_DRAW_PANEL *aPanel, wxDC *DC)
Definition: editedge.cpp:201
STROKE_T GetShape() const
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
int GetType() const
usual segment : line with rounded ends
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
int GetLineThickness(PCB_LAYER_ID aLayer) const
Function GetLineThickness Returns the default graphic segment thickness from the layer class for the ...
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
static void DrawSegment(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: editedge.cpp:326
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:198
void SetStart(const wxPoint &aStart)
Definition: gr_basic.h:38
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
double GetAngle() const
void SetEnd(const wxPoint &aEnd)
void SetAngle(double aAngle)
Function SetAngle sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:260
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
BOARD * GetBoard() const
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
void End_Edge(DRAWSEGMENT *Segment, wxDC *DC)
Definition: editedge.cpp:299
void SetWidth(int aWidth)

References Abort_EditEdge(), BOARD::Add(), EDA_ITEM::ClearFlags(), DRAWSEGMENT::Draw(), DrawSegment(), End_Edge(), PCB_BASE_FRAME::GetActiveLayer(), DRAWSEGMENT::GetAngle(), PCB_BASE_FRAME::GetBoard(), EDA_DRAW_FRAME::GetCrossHairPosition(), PCB_BASE_FRAME::GetDesignSettings(), DRAWSEGMENT::GetEnd(), BOARD_ITEM::GetLayer(), BOARD_DESIGN_SETTINGS::GetLineThickness(), DRAWSEGMENT::GetShape(), DRAWSEGMENT::GetStart(), DRAWSEGMENT::GetType(), GR_OR, IS_NEW, EDA_DRAW_FRAME::m_canvas, OnModify(), S_SEGMENT, PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), DRAWSEGMENT::SetAngle(), PCB_BASE_FRAME::SetCurItem(), DRAWSEGMENT::SetEnd(), EDA_ITEM::SetFlags(), BOARD_ITEM::SetLayer(), EDA_DRAW_PANEL::SetMouseCapture(), DRAWSEGMENT::SetShape(), DRAWSEGMENT::SetStart(), DRAWSEGMENT::SetType(), DRAWSEGMENT::SetWidth(), and UR_NEW.

Referenced by OnLeftClick().

◆ Begin_Route()

TRACK * PCB_EDIT_FRAME::Begin_Route ( TRACK aTrack,
wxDC *  aDC 
)

Function Begin_Route Starts a new track and/or establish of a new track point.

For a new track:

  • Search the netname of the new track from the starting point if it is on a pad or an existing track
  • Highlight all this net If a track is in progress:
  • Call DRC
  • If DRC is OK: finish the track segment and starts a new one.
    Parameters
    aTrack= the current track segment, or NULL to start a new track
    aDC= the current device context
    Returns
    a pointer to the new track segment or null if not created (DRC error)

Definition at line 98 of file editrack.cpp.

99 {
100  TRACK* trackOnStartPoint = NULL;
101  LSET layerMask( GetScreen()->m_Active_Layer );
102  wxPoint pos = GetCrossHairPosition();
103 
104  BOARD_CONNECTED_ITEM* lockPoint;
105 
106  if( aTrack == NULL ) // Starting a new track segment
107  {
109 
110  // Prepare the undo command info
111  s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but...
112 
113  GetBoard()->PushHighLight();
114 
115  // erase old highlight
116  if( GetBoard()->IsHighLightNetON() )
117  HighLight( aDC );
118 
120  g_CurrentTrackSegment->SetFlags( IS_NEW );
121 
122  GetBoard()->SetHighLightNet( 0 );
123 
124  // Search for a starting point of the new track, a track or pad
125  lockPoint = GetBoard()->GetLockPoint( pos, layerMask );
126 
127  D_PAD* pad = NULL;
128  if( lockPoint ) // An item (pad or track) is found
129  {
130  if( lockPoint->Type() == PCB_PAD_T )
131  {
132  pad = (D_PAD*) lockPoint;
133 
134  // A pad is found: put the starting point on pad center
135  pos = pad->GetPosition();
136  GetBoard()->SetHighLightNet( pad->GetNetCode() );
137  }
138  else // A track segment is found
139  {
140  trackOnStartPoint = (TRACK*) lockPoint;
141  GetBoard()->SetHighLightNet( trackOnStartPoint->GetNetCode() );
142  GetBoard()->CreateLockPoint( pos, trackOnStartPoint, &s_ItemsListPicker );
143  }
144  }
145  else
146  {
147  // Not a starting point, but a filled zone area can exist. This is also a
148  // good starting point.
149  ZONE_CONTAINER* zone;
150  zone = GetBoard()->HitTestForAnyFilledArea( pos,
151  GetScreen()-> m_Active_Layer,
152  GetScreen()-> m_Active_Layer,
153  -1 );
154 
155  if( zone )
156  GetBoard()->SetHighLightNet( zone->GetNetCode() );
157  }
158 
159  DBG( g_CurrentTrackList.VerifyListIntegrity() );
160 
161  int net = -1;
162 
163  if( lockPoint )
164  net = lockPoint->GetNetCode();
165 
166  BuildAirWiresTargetsList( lockPoint, wxPoint( 0, 0 ), net );
167 
168  DBG( g_CurrentTrackList.VerifyListIntegrity() );
169 
170  GetBoard()->HighLightON();
171  GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() );
172 
173  // Display info about track Net class, and init track and vias sizes:
174  g_CurrentTrackSegment->SetNetCode( GetBoard()->GetHighLightNetCode() );
175  SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
176 
177  g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
178  g_CurrentTrackSegment->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
179 
180  if( GetDesignSettings().m_UseConnectedTrackWidth )
181  {
182  if( trackOnStartPoint && trackOnStartPoint->Type() == PCB_TRACE_T )
183  g_CurrentTrackSegment->SetWidth( trackOnStartPoint->GetWidth());
184  }
185 
186  g_CurrentTrackSegment->SetStart( pos );
187  g_CurrentTrackSegment->SetEnd( pos );
188 
189  if( pad )
190  {
191  // Useful to display track length, if the pad has a die length:
192  g_CurrentTrackSegment->SetState( BEGIN_ONPAD, true );
193  g_CurrentTrackSegment->start = pad;
194  }
195 
196  if( Settings().m_legacyUseTwoSegmentTracks )
197  {
198  // Create 2nd segment
200 
201  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
202 
205 
206  g_FirstTrackSegment->SetState( BEGIN_ONPAD | END_ONPAD, false );
207  }
208 
209  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
210 
213  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
214 
215  if( Settings().m_legacyDrcOn )
216  {
218  {
219  return g_CurrentTrackSegment;
220  }
221  }
222  }
223  else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor.
224  {
225  // Test for a D.R.C. error:
226  if( Settings().m_legacyDrcOn )
227  {
229  return NULL;
230 
231  // We must handle 2 segments
233  {
235  GetBoard()->m_Track ) )
236  return NULL;
237  }
238  }
239 
240  /* Current track is Ok: current segment is kept, and a new one is
241  * created unless the current segment is null, or 2 last are null
242  * if this is a 2 segments track build.
243  */
244  bool CanCreateNewSegment = true;
245 
247  CanCreateNewSegment = false;
248 
250  && g_CurrentTrackSegment->Back()
251  && g_CurrentTrackSegment->Back()->IsNull() )
252  CanCreateNewSegment = false;
253 
254  if( CanCreateNewSegment )
255  {
256  // Erase old track on screen
257  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
258 
259  ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
260 
261  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
262 
263  if( g_Raccord_45_Auto )
264  Add45DegreeSegment( aDC );
265 
266  TRACK* previousTrack = g_CurrentTrackSegment;
267 
268  TRACK* newTrack = (TRACK*)g_CurrentTrackSegment->Clone();
269  g_CurrentTrackList.PushBack( newTrack );
270  newTrack->SetFlags( IS_NEW );
271 
272  newTrack->SetState( BEGIN_ONPAD | END_ONPAD, false );
273  newTrack->start = previousTrack->end;
274 
275  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
276 
277  newTrack->SetStart( newTrack->GetEnd() );
278 
279  newTrack->SetLayer( GetScreen()->m_Active_Layer );
280 
281  if( !GetDesignSettings().m_UseConnectedTrackWidth )
282  newTrack->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
283 
284  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
285 
286  // Show the new position
287  ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
288  }
289  }
290 
292  return g_CurrentTrackSegment;
293 }
#define g_FirstTrackSegment
first segment created
Definition: pcbnew.h:90
#define g_CurrentTrackSegment
most recently created segment
Definition: pcbnew.h:89
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
TRACK * CreateLockPoint(wxPoint &aPosition, TRACK *aSegment, PICKED_ITEMS_LIST *aList)
Function CreateLockPoint creates an intermediate point on aSegment and break it into two segments at ...
int GetNetCode() const
Function GetNetCode.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:133
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
DLIST< TRACK > g_CurrentTrackList
Definition: pcbnew.cpp:91
bool Add45DegreeSegment(wxDC *aDC)
Function Add45DegreeSegment adds a track segment between 2 tracks segments if these 2 segments make a...
Definition: editrack.cpp:296
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
DRC * m_drc
the DRC controller, see drc.cpp
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 tr...
Definition: ratsnest.cpp:195
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:132
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
BOARD_CONNECTED_ITEM * GetLockPoint(const wxPoint &aPosition, LSET aLayerMask)
Function GetLockPoint returns the item at the "attachment" point at the end of a trace at aPosition o...
int DrcOnCreatingTrack(TRACK *aRefSeg, TRACK *aList)
Function Drc tests the current segment and returns the result and displays the error in the status pa...
Definition: drc.cpp:181
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
bool g_Raccord_45_Auto
Definition: pcbnew.cpp:74
void SetWidth(int aWidth)
Definition: class_track.h:126
ZONE_CONTAINER * HitTestForAnyFilledArea(const wxPoint &aRefPos, PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer, int aNetCode)
Function HitTestForAnyFilledArea tests if the given wxPoint is within the bounds of a filled area of ...
void PushBack(T *aNewElement)
Function PushBack puts aNewElement at the end of the list sequence.
Definition: dlist.h:250
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
Class LSET is a set of PCB_LAYER_IDs.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
PCB_GENERAL_SETTINGS & Settings()
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void HighLight(wxDC *DC)
Function HighLight.
Definition: highlight.cpp:104
#define BAD_DRC
Definition: drc.h:40
void HighLightON()
Function HighLightON Enable highlight.
Definition: class_board.h:396
void SetHighLightNet(int aNetCode)
Function SetHighLightNet.
Definition: class_board.h:374
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
static void Abort_Create_Track(EDA_DRAW_PANEL *panel, wxDC *DC)
Definition: editrack.cpp:60
void SetState(int type, int state)
Definition: base_struct.h:248
int GetWidth() const
Definition: class_track.h:127
void ShowNewTrackWhenMovingCursor(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: editrack.cpp:665
void PushHighLight()
Function PushHighLight save current high light info for later use.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const wxPoint & GetEnd() const
Definition: class_track.h:130
static PICKED_ITEMS_LIST s_ItemsListPicker
Definition: editrack.cpp:55
void SetStart(const wxPoint &aStart)
Definition: class_track.h:132
#define DBG(x)
Definition: fctsys.h:33
DLIST< TRACK > m_Track
Definition: class_board.h:249
BOARD * GetBoard() const
const wxPoint GetPosition() const override
Definition: class_pad.h:222
void DrawHighLight(EDA_DRAW_PANEL *aDrawPanel, wxDC *aDC, int aNetCode)
Function DrawHighLight redraws the objects in the board that are associated with the given aNetCode a...
BOARD_CONNECTED_ITEM * end
Definition: class_track.h:102
BOARD_CONNECTED_ITEM * start
Definition: class_track.h:101
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes the list of pickers, AND the data pointed by m_PickedItem or...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References Abort_Create_Track(), Add45DegreeSegment(), BAD_DRC, BEGIN_ONPAD, PCB_BASE_FRAME::BuildAirWiresTargetsList(), EDA_DRAW_PANEL::CallMouseCapture(), PICKED_ITEMS_LIST::ClearListAndDeleteItems(), BOARD::CreateLockPoint(), DBG, BOARD::DrawHighLight(), DRC::DrcOnCreatingTrack(), TRACK::end, END_ONPAD, g_CurrentTrackList, g_CurrentTrackSegment, g_FirstTrackSegment, g_Raccord_45_Auto, PCB_BASE_FRAME::GetBoard(), EDA_DRAW_FRAME::GetCrossHairPosition(), PCB_BASE_FRAME::GetDesignSettings(), TRACK::GetEnd(), BOARD::GetLockPoint(), BOARD_CONNECTED_ITEM::GetNetCode(), D_PAD::GetPosition(), PCB_BASE_FRAME::GetScreen(), TRACK::GetWidth(), HighLight(), BOARD::HighLightON(), BOARD::HitTestForAnyFilledArea(), IS_NEW, EDA_DRAW_FRAME::m_canvas, m_drc, PCB_GENERAL_SETTINGS::m_legacyDrcOn, PCB_GENERAL_SETTINGS::m_legacyUseTwoSegmentTracks, BOARD::m_Track, PCB_PAD_T, PCB_TRACE_T, DLIST< T >::PushBack(), BOARD::PushHighLight(), s_ItemsListPicker, PCB_BASE_FRAME::SetCurItem(), SetCurrentNetClass(), EDA_ITEM::SetFlags(), BOARD::SetHighLightNet(), BOARD_ITEM::SetLayer(), EDA_DRAW_PANEL::SetMouseCapture(), EDA_DRAW_FRAME::SetMsgPanel(), TRACK::SetStart(), EDA_ITEM::SetState(), PCB_BASE_FRAME::Settings(), TRACK::SetWidth(), ShowNewTrackWhenMovingCursor(), TRACK::start, and EDA_ITEM::Type().

Referenced by End_Route(), OnHotkeyBeginRoute(), OnLeftClick(), and Other_Layer_Route().

◆ Begin_Self()

void PCB_EDIT_FRAME::Begin_Self ( wxDC *  DC)

Definition at line 140 of file microwave.cpp.

141 {
143  {
144  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
145  m_canvas->SetMouseCapture( NULL, NULL );
146 
147  wxString errorMessage;
148 
149  // Prepare parameters for inductor
150  // s_inductor_pattern.m_Start is already initialized,
151  // when s_inductor_pattern.m_Flag == false
154 
155  wxASSERT( s_inductorInProgress );
156  s_inductorInProgress = false;
157 
158  MODULE* footprint = MWAVE::CreateMicrowaveInductor( s_inductor_pattern, this, errorMessage );
159 
160  if( footprint )
161  {
162  SetMsgPanel( footprint );
163  footprint->Draw( m_canvas, DC, GR_OR );
164  }
165 
166  else if( !errorMessage.IsEmpty() )
167  DisplayError( this, errorMessage );
168 
169  return;
170  }
171 
174 
175  s_inductorInProgress = true;
176 
177  // Update the initial coordinates.
179  UpdateStatusBar();
180 
182  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
183 }
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw draws the footprint to the aDC.
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:185
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
static void Exit_Self(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Definition: microwave.cpp:130
Definition: gr_basic.h:38
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
virtual void UpdateStatusBar() override
Update the status bar information.
MODULE * CreateMicrowaveInductor(INDUCTOR_PATTERN &aPattern, PCB_EDIT_FRAME *aPcbFrame, wxString &aErrorMessage)
Creates an S-shaped coil footprint for microwave applications.
static void ShowBoundingBoxMicroWaveInductor(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: microwave.cpp:80
static MWAVE::INDUCTOR_PATTERN s_inductor_pattern
An inductor pattern temporarily used during mu-wave inductor creation
Definition: microwave.cpp:71
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static bool s_inductorInProgress
A flag set to true when mu-wave inductor is being created
Definition: microwave.cpp:74
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:244
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References EDA_DRAW_PANEL::CallMouseCapture(), MWAVE::CreateMicrowaveInductor(), DisplayError(), MODULE::Draw(), Exit_Self(), EDA_DRAW_FRAME::GetCrossHairPosition(), BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), PCB_BASE_FRAME::GetDesignSettings(), PCB_BASE_FRAME::GetScreen(), GR_OR, EDA_DRAW_FRAME::m_canvas, MWAVE::INDUCTOR_PATTERN::m_End, BASE_SCREEN::m_O_Curseur, MWAVE::INDUCTOR_PATTERN::m_Start, MWAVE::INDUCTOR_PATTERN::m_Width, s_inductor_pattern, s_inductorInProgress, EDA_DRAW_PANEL::SetMouseCapture(), EDA_DRAW_FRAME::SetMsgPanel(), ShowBoundingBoxMicroWaveInductor(), and PCB_BASE_FRAME::UpdateStatusBar().

Referenced by MuWaveCommand().

◆ Begin_Zone()

int PCB_EDIT_FRAME::Begin_Zone ( wxDC *  DC)

Function Begin_Zone either initializes the first segment of a new zone, or adds an intermediate segment.

A new zone can be: created from scratch: the user will be prompted to define parameters (layer, clearence ...) created from a similar zone (s_CurrentZone is used): parameters are copied from s_CurrentZone created as a cutout (an hole) inside s_CurrentZone

Definition at line 516 of file zones_by_polygon.cpp.

517 {
518  ZONE_SETTINGS zoneInfo = GetZoneSettings();
519 
520  // verify if s_CurrentZone exists (could be deleted since last selection) :
521  int ii;
522  for( ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
523  {
524  if( s_CurrentZone == GetBoard()->GetArea( ii ) )
525  break;
526  }
527 
528  if( ii >= GetBoard()->GetAreaCount() ) // Not found: could be deleted since last selection
529  {
530  s_AddCutoutToCurrentZone = false;
531  s_CurrentZone = NULL;
532  }
533 
535 
536  // Verify if a new zone is allowed on this layer:
537  if( zone == NULL )
538  {
540  {
541  DisplayErrorMessage( this,
542  _( "Error: a keepout area is allowed only on copper layers" ) );
543  return 0;
544  }
545  }
546 
547  // If no zone contour in progress, a new zone is being created,
548  if( zone == NULL )
549  {
551  zone->SetFlags( IS_NEW );
552  zone->SetTimeStamp( GetNewTimeStamp() );
553  }
554 
555  if( zone->GetNumCorners() == 0 ) // Start a new contour: init zone params (net, layer ...)
556  {
557  if( !s_CurrentZone ) // A new outline is created, from scratch
558  {
559  int dialogResult;
560 
561  // Prompt user for parameters:
563 
564  if( IsCopperLayer( GetActiveLayer() ) )
565  {
566  // Put a zone on a copper layer
567  if( GetBoard()->GetHighLightNetCode() > 0 )
568  {
570  zone->SetNetCode( zoneInfo.m_NetcodeSelection );
571  }
572 
573  double tmp = ZONE_THERMAL_RELIEF_GAP_MIL;
574 
575  wxConfigBase* cfg = Kiface().KifaceSettings();
576  cfg->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp );
577  zoneInfo.m_ThermalReliefGap = KiROUND( tmp * IU_PER_MILS);
578 
581  zoneInfo.m_ThermalReliefCopperBridge = KiROUND( tmp * IU_PER_MILS );
582 
583  tmp = ZONE_CLEARANCE_MIL;
584  cfg->Read( ZONE_CLEARANCE_WIDTH_STRING_KEY, &tmp );
585  zoneInfo.m_ZoneClearance = KiROUND( tmp * IU_PER_MILS );
586 
587  tmp = ZONE_THICKNESS_MIL;
588  cfg->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, &tmp );
589  zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS );
590 
592  {
593  zoneInfo.SetIsKeepout( true );
594  // Netcode, netname and some other settings are irrelevant,
595  // so ensure they are cleared
598  zoneInfo.SetCornerRadius( 0 );
599 
600  dialogResult = InvokeKeepoutAreaEditor( this, &zoneInfo );
601  }
602  else
603  {
604  zoneInfo.m_CurrentZone_Layer = GetActiveLayer(); // Preselect a layer
605  zoneInfo.SetIsKeepout( false );
606  dialogResult = InvokeCopperZonesEditor( this, &zoneInfo );
607  }
608  }
609  else // Put a zone on a non copper layer (technical layer)
610  {
611  zoneInfo.m_CurrentZone_Layer = GetActiveLayer(); // Preselect a layer
612  zoneInfo.SetIsKeepout( false );
613  zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones
614  dialogResult = InvokeNonCopperZonesEditor( this, &zoneInfo );
615  }
616 
618  m_canvas->SetIgnoreMouseEvents( false );
619 
620  if( dialogResult == wxID_CANCEL )
621  {
622  GetBoard()->m_CurrentZoneContour = NULL;
623  delete zone;
624  return 0;
625  }
626 
627  // Switch active layer to the selected zone layer
629  SetZoneSettings( zoneInfo );
630  OnModify();
631  }
632  else
633  {
634  // Start a new contour: init zone params (net and layer) from an existing
635  // zone (add cutout or similar zone)
636 
639 
640  zoneInfo << *s_CurrentZone;
641 
642  SetZoneSettings( zoneInfo );
643  OnModify();
644  }
645 
646  // Show the Net for zones on copper layers
647  if( IsCopperLayer( zoneInfo.m_CurrentZone_Layer ) &&
648  !zoneInfo.GetIsKeepout() )
649  {
650  if( s_CurrentZone )
651  {
653  GetBoard()->SetZoneSettings( zoneInfo );
654  }
655 
656  if( GetBoard()->IsHighLightNetON() )
657  {
658  HighLight( DC ); // Remove old highlight selection
659  }
660 
662  HighLight( DC );
663  }
664 
666  s_CurrentZone = NULL; // the zone is used only once ("add similar zone" command)
667  }
668 
669  // if first segment
670  if( zone->GetNumCorners() == 0 )
671  {
672  zoneInfo.ExportSetting( *zone );
673 
674  // A duplicated corner is needed; null segments are removed when the zone is finished.
675  zone->AppendCorner( GetCrossHairPosition(), -1 );
676  // Add the duplicate corner:
677  zone->AppendCorner( GetCrossHairPosition(), -1, true );
678 
679  if( Settings().m_legacyDrcOn && (m_drc->DrcOnCreatingZone( zone, 0 ) == BAD_DRC)
680  && zone->IsOnCopperLayer() )
681  {
682  zone->ClearFlags();
683  zone->RemoveAllContours();
684 
685  // use the form of SetCurItem() which does not write to the msg panel,
686  // SCREEN::SetCurItem(), so the DRC error remains on screen.
687  // PCB_EDIT_FRAME::SetCurItem() calls DisplayInfo().
688  GetScreen()->SetCurItem( NULL );
689  DisplayErrorMessage( this, _( "DRC error: this start point is inside or too close another area" ) );
690  return 0;
691  }
692 
693  SetCurItem( zone );
695  }
696  else // edge in progress:
697  {
698  ii = zone->GetNumCorners() - 1;
699 
700  // edge in progress : the current corner coordinate was set
701  // by Show_New_Edge_While_Move_Mouse
702  if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
703  {
704  if( !Settings().m_legacyDrcOn || !zone->IsOnCopperLayer()
705  || ( m_drc->DrcOnCreatingZone( zone, ii - 1 ) == OK_DRC ) )
706  {
707  // Ok, we can add a new corner
708  if( m_canvas->IsMouseCaptured() )
709  m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
710 
711  // It is necessary to allow duplication of the points, as we have to handle the
712  // continuous drawing while creating the zone at the same time as we build it. Null
713  // segments are removed when the zone is finished, in End_Zone.
714  zone->AppendCorner( GetCrossHairPosition(), -1, true );
715 
716  SetCurItem( zone ); // calls DisplayInfo().
717 
718  if( m_canvas->IsMouseCaptured() )
719  m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
720  }
721  }
722  }
723 
724  return zone->GetNumCorners();
725 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
Definition: class_board.h:559
void SetCurItem(BOARD_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
Definition: pcb_screen.h:82
#define OK_DRC
Definition: drc.h:39
int GetNetCode() const
Function GetNetCode.
int InvokeKeepoutAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeKeepoutAreaEditor invokes up a modal dialog window for copper zone editing.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:258
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
void SetCornerSmoothingType(int aType)
long m_ThermalReliefCopperBridge
thickness of the copper bridge in thermal reliefs
Definition: zone_settings.h:87
int InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings)
Function InvokeNonCopperZonesEditor invokes up a modal dialog window for non-copper zone editing.
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:185
static bool s_AddCutoutToCurrentZone
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:261
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL
Definition: zones.h:39
DRC * m_drc
the DRC controller, see drc.cpp
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
int m_NetcodeSelection
Net code selection for the current zone.
Definition: zone_settings.h:74
timestamp_t GetNewTimeStamp()
Definition: common.cpp:217
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
PCB_GENERAL_SETTINGS & Settings()
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
int DrcOnCreatingZone(ZONE_CONTAINER *aArea, int aCornerIndex)
Function Drc tests the outline segment starting at CornerIndex and returns the result and displays th...
Definition: drc.cpp:379
const ZONE_SETTINGS & GetZoneSettings() const
static ZONE_CONTAINER * s_CurrentZone
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:459
static void Abort_Zone_Create_Outline(EDA_DRAW_PANEL *Panel, wxDC *DC)
Function Abort_Zone_Create_Outline cancels the Begin_Zone command if at least one EDGE_ZONE was creat...
#define ZONE_CLEARANCE_MIL
Definition: zones.h:42
int m_ZoneClearance
Clearance value.
Definition: zone_settings.h:64
void HighLight(wxDC *DC)
Function HighLight.
Definition: highlight.cpp:104
#define ZONE_THERMAL_RELIEF_GAP_STRING_KEY
Definition: zones.h:32
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
void SetIsKeepout(bool aEnable)
const bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
void ExportSetting(ZONE_CONTAINER &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
#define ZONE_THICKNESS_MIL
Definition: zones.h:40
#define BAD_DRC
Definition: drc.h:40
Class ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:49
int GetHighLightNetCode() const
Function GetHighLightNetCode.
Definition: class_board.h:368
void SetHighLightNet(int aNetCode)
Function SetHighLightNet.
Definition: class_board.h:374
#define ZONE_MIN_THICKNESS_WIDTH_STRING_KEY
Definition: zones.h:35
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY
Definition: zones.h:33
void SetCornerRadius(int aRadius)
void SetIgnoreMouseEvents(bool aIgnore)
#define IU_PER_MILS
Definition: plotter.cpp:134
#define ZONE_CLEARANCE_WIDTH_STRING_KEY
Definition: zones.h:34
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:260
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
#define ZONE_THERMAL_RELIEF_GAP_MIL
Definition: zones.h:38
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952
BOARD * GetBoard() const
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:465
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:191
virtual void SetActiveLayer(PCB_LAYER_ID aLayer) override
Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYE...
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:499
PCB_LAYER_ID m_CurrentZone_Layer
Layer used to create the current zone.
Definition: zone_settings.h:78
static void Show_New_Edge_While_Move_Mouse(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
int GetToolId() const
Definition: draw_frame.h:524
long m_ThermalReliefGap
thickness of the gap in thermal reliefs
Definition: zone_settings.h:86
int m_ZoneMinThickness
Min thickness value in filled areas.
Definition: zone_settings.h:65
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:209
void RemoveAllContours(void)
Definition: class_zone.h:494

References Abort_Zone_Create_Outline(), ZONE_CONTAINER::AppendCorner(), BAD_DRC, EDA_DRAW_PANEL::CallMouseCapture(), EDA_ITEM::ClearFlags(), DisplayErrorMessage(), DRC::DrcOnCreatingZone(), ZONE_SETTINGS::ExportSetting(), PCB_BASE_FRAME::GetActiveLayer(), BOARD::GetArea(), BOARD::GetAreaCount(), PCB_BASE_FRAME::GetBoard(), ZONE_CONTAINER::GetCornerPosition(), EDA_DRAW_FRAME::GetCrossHairPosition(), BOARD::GetHighLightNetCode(), ZONE_SETTINGS::GetIsKeepout(), ZONE_CONTAINER::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), GetNewTimeStamp(), ZONE_CONTAINER::GetNumCorners(), PCB_BASE_FRAME::GetScreen(), EDA_DRAW_FRAME::GetToolId(), PCB_BASE_FRAME::GetZoneSettings(), HighLight(), ID_PCB_KEEPOUT_AREA_BUTT, InvokeCopperZonesEditor(), InvokeKeepoutAreaEditor(), InvokeNonCopperZonesEditor(), IS_NEW, IsCopperLayer(), EDA_DRAW_PANEL::IsMouseCaptured(), ZONE_CONTAINER::IsOnCopperLayer(), IU_PER_MILS, Kiface(), KIFACE_I::KifaceSettings(), KiROUND(), EDA_DRAW_FRAME::m_canvas, ZONE_SETTINGS::m_CurrentZone_Layer, BOARD::m_CurrentZoneContour, m_drc, PCB_GENERAL_SETTINGS::m_legacyDrcOn, ZONE_SETTINGS::m_NetcodeSelection, ZONE_SETTINGS::m_ThermalReliefCopperBridge, ZONE_SETTINGS::m_ThermalReliefGap, ZONE_SETTINGS::m_ZoneClearance, ZONE_SETTINGS::m_ZoneMinThickness, EDA_DRAW_PANEL::MoveCursorToCrossHair(), OK_DRC, OnModify(), ZONE_CONTAINER::RemoveAllContours(), s_AddCutoutToCurrentZone, s_CurrentZone, SetActiveLayer(), ZONE_SETTINGS::SetCornerRadius(), ZONE_SETTINGS::SetCornerSmoothingType(), PCB_SCREEN::SetCurItem(), PCB_BASE_FRAME::SetCurItem(), EDA_ITEM::SetFlags(), BOARD::SetHighLightNet(), EDA_DRAW_PANEL::SetIgnoreMouseEvents(), ZONE_SETTINGS::SetIsKeepout(), EDA_DRAW_PANEL::SetMouseCapture(), BOARD_CONNECTED_ITEM::SetNetCode(), EDA_ITEM::SetTimeStamp(), PCB_BASE_FRAME::Settings(), PCB_BASE_FRAME::SetZoneSettings(), BOARD::SetZoneSettings(), Show_New_Edge_While_Move_Mouse(), ZONE_SETTINGS::SMOOTHING_NONE, NETINFO_LIST::UNCONNECTED, ZONE_CLEARANCE_MIL, ZONE_CLEARANCE_WIDTH_STRING_KEY, ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL, ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, ZONE_THERMAL_RELIEF_GAP_MIL, ZONE_THERMAL_RELIEF_GAP_STRING_KEY, and ZONE_THICKNESS_MIL.

Referenced by OnLeftClick().

◆ BeginMoveDimensionText()

void PCB_EDIT_FRAME::BeginMoveDimensionText ( DIMENSION aItem,
wxDC *  DC 
)

Definition at line 214 of file dimension.cpp.

215 {
216  if( aItem == NULL )
217  return;
218 
219  // Store the initial position for undo/abort command
220  initialTextPosition = aItem->Text().GetTextPos();
221 
222  aItem->Draw( m_canvas, DC, GR_XOR );
223  aItem->SetFlags( IS_MOVED );
224  SetMsgPanel( aItem );
225 
226  SetCrossHairPosition( aItem->Text().GetTextPos() );
228 
230  SetCurItem( aItem );
231  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
232 }
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aColorMode, const wxPoint &offset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
static void MoveDimensionText(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: dimension.cpp:236
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
static wxPoint initialTextPosition
Definition: dimension.cpp:212
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
TEXTE_PCB & Text()
const wxPoint & GetTextPos() const
Definition: eda_text.h:241
static void AbortMoveDimensionText(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Definition: dimension.cpp:258
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113

References AbortMoveDimensionText(), EDA_DRAW_PANEL::CallMouseCapture(), DIMENSION::Draw(), EDA_TEXT::GetTextPos(), GR_XOR, initialTextPosition, IS_MOVED, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::MoveCursorToCrossHair(), MoveDimensionText(), EDA_DRAW_FRAME::SetCrossHairPosition(), PCB_BASE_FRAME::SetCurItem(), EDA_ITEM::SetFlags(), EDA_DRAW_PANEL::SetMouseCapture(), EDA_DRAW_FRAME::SetMsgPanel(), and DIMENSION::Text().

Referenced by Process_Special_Functions().

◆ BeginMoveTarget()

void PCB_EDIT_FRAME::BeginMoveTarget ( PCB_TARGET aTarget,
wxDC *  DC 
)

Definition at line 219 of file target_edit.cpp.

220 {
221  if( aTarget == NULL )
222  return;
223 
224  s_TargetCopy = *aTarget;
225  aTarget->SetFlags( IS_MOVED );
227  SetCurItem( aTarget );
228 }
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
static void AbortMoveAndEditTarget(EDA_DRAW_PANEL *Panel, wxDC *DC)
static PCB_TARGET s_TargetCopy(NULL)
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
static void ShowTargetShapeWhileMovingMouse(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113

References AbortMoveAndEditTarget(), IS_MOVED, EDA_DRAW_FRAME::m_canvas, s_TargetCopy, PCB_BASE_FRAME::SetCurItem(), EDA_ITEM::SetFlags(), EDA_DRAW_PANEL::SetMouseCapture(), and ShowTargetShapeWhileMovingMouse().

Referenced by Process_Special_Functions().

◆ bestZoom()

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

◆ BestZoom()

double PCB_BASE_FRAME::BestZoom ( )
overridevirtualinherited

Function BestZoom.

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

Implements EDA_DRAW_FRAME.

Reimplemented in FOOTPRINT_EDIT_FRAME.

Definition at line 396 of file pcb_base_frame.cpp.

397 {
398  EDA_RECT ibbbox = GetBoardBoundingBox();
399 
400  double sizeX = (double) ibbbox.GetWidth();
401  double sizeY = (double) ibbbox.GetHeight();
402  wxPoint centre = ibbbox.Centre();
403 
404  // Reserve a 10% margin around board bounding box.
405  double margin_scale_factor = 1.1;
406 
407  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
408 }
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
int GetWidth() const
Definition: eda_rect.h:117
EDA_RECT GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge se...
int GetHeight() const
Definition: eda_rect.h:118
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint Centre() const
Definition: eda_rect.h:60

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

◆ Block_Delete()

void PCB_EDIT_FRAME::Block_Delete ( )

Function Block_Delete deletes all items within the selected block.

Definition at line 528 of file pcbnew/block.cpp.

529 {
530  OnModify();
531  SetCurItem( NULL );
532 
534  itemsList->m_Status = UR_DELETED;
535 
536  // unlink items and clear flags
537  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
538  {
539  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
540  itemsList->SetPickedItemStatus( UR_DELETED, ii );
541  GetBoard()->GetConnectivity()->Remove( item );
542 
543  switch( item->Type() )
544  {
545  case PCB_MODULE_T:
546  {
547  MODULE* module = (MODULE*) item;
548  module->ClearFlags();
549  module->UnLink();
550  m_Pcb->m_Status_Pcb = 0;
551  }
552  break;
553 
554  case PCB_ZONE_AREA_T: // a zone area
555  m_Pcb->Remove( item );
556  break;
557 
558  case PCB_LINE_T: // a segment not on copper layers
559  case PCB_TEXT_T: // a text on a layer
560  case PCB_TRACE_T: // a track segment (segment on a copper layer)
561  case PCB_VIA_T: // a via (like track segment on a copper layer)
562  case PCB_DIMENSION_T: // a dimension (graphic item)
563  case PCB_TARGET_T: // a target (graphic item)
564  item->UnLink();
565  break;
566 
567  // These items are deleted, but not put in undo list
568  case PCB_MARKER_T: // a marker used to show something
569  item->UnLink();
570  itemsList->RemovePicker( ii );
571  ii--;
572  item->DeleteStructure();
573  break;
574 
575  default:
576  wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Delete( ) error: unexpected type" ) );
577  break;
578  }
579  }
580 
581  SaveCopyInUndoList( *itemsList, UR_DELETED );
582 
583  Compile_Ratsnest( NULL, true );
584  m_canvas->Refresh( true );
585 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
void DeleteStructure()
Function DeleteStructure deletes this object after UnLink()ing it from its owner if it has one.
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
virtual void UnLink()
Function UnLink detaches this object from its owner.
unsigned GetCount() const
Function GetCount.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class MODULE, a footprint
Definition: typeinfo.h:89
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:292
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
bool RemovePicker(unsigned aIdx)
Function RemovePicker removes one entry (one picker) from the list of picked items.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
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:198
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:98
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:99
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:53
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:97
bool SetPickedItemStatus(UNDO_REDO_T aStatus, unsigned aIdx)
Function SetPickedItemStatus sets the type of undo/redo operation for a given picked item.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PICKED_ITEMS_LIST & GetItems()
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:260
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
BOARD * GetBoard() const
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
void Remove(BOARD_ITEM *aBoardItem) override
Removes an item from the container.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240

References EDA_ITEM::ClearFlags(), PCB_BASE_FRAME::Compile_Ratsnest(), BOARD_ITEM::DeleteStructure(), PCB_BASE_FRAME::GetBoard(), BOARD::GetConnectivity(), PICKED_ITEMS_LIST::GetCount(), BLOCK_SELECTOR::GetItems(), PICKED_ITEMS_LIST::GetPickedItem(), PCB_BASE_FRAME::GetScreen(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::m_Pcb, PICKED_ITEMS_LIST::m_Status, BOARD::m_Status_Pcb, OnModify(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MARKER_T, PCB_MODULE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, EDA_DRAW_PANEL::Refresh(), BOARD::Remove(), PICKED_ITEMS_LIST::RemovePicker(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), PCB_BASE_FRAME::SetCurItem(), PICKED_ITEMS_LIST::SetPickedItemStatus(), EDA_ITEM::Type(), BOARD_ITEM::UnLink(), and UR_DELETED.

Referenced by HandleBlockEnd().

◆ Block_Duplicate()

void PCB_EDIT_FRAME::Block_Duplicate ( bool  aIncrement)

Function Block_Duplicate Duplicate all items within the selected block.

New location is determined by the current offset from the selected block's original location.

Definition at line 753 of file pcbnew/block.cpp.

754 {
756 
757  OnModify();
758 
760 
761  PICKED_ITEMS_LIST newList;
762  newList.m_Status = UR_NEW;
763 
764  ITEM_PICKER picker( NULL, UR_NEW );
765  BOARD_ITEM* newitem;
766 
767  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
768  {
769  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
770 
771  newitem = (BOARD_ITEM*)item->Clone();
772 
773  if( item->Type() == PCB_MODULE_T )
774  m_Pcb->m_Status_Pcb = 0;
775 
776  m_Pcb->Add( newitem );
777 
778  if( newitem )
779  {
780  newitem->Move( MoveVector );
781  picker.SetItem ( newitem );
782  newList.PushItem( picker );
783  }
784  }
785 
786  if( newList.GetCount() )
787  SaveCopyInUndoList( newList, UR_NEW );
788 
789  Compile_Ratsnest( NULL, true );
790  m_canvas->Refresh( true );
791 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
wxPoint MoveVector
Definition: edtxtmod.cpp:54
wxPoint GetMoveVector() const
unsigned GetCount() const
Function GetCount.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
class MODULE, a footprint
Definition: typeinfo.h:89
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
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:198
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:53
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PICKED_ITEMS_LIST & GetItems()
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240

References BOARD::Add(), EDA_ITEM::Clone(), PCB_BASE_FRAME::Compile_Ratsnest(), PICKED_ITEMS_LIST::GetCount(), BLOCK_SELECTOR::GetItems(), BLOCK_SELECTOR::GetMoveVector(), PICKED_ITEMS_LIST::GetPickedItem(), PCB_BASE_FRAME::GetScreen(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::m_Pcb, PICKED_ITEMS_LIST::m_Status, BOARD::m_Status_Pcb, BOARD_ITEM::Move(), MoveVector, OnModify(), PCB_MODULE_T, PICKED_ITEMS_LIST::PushItem(), EDA_DRAW_PANEL::Refresh(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), ITEM_PICKER::SetItem(), EDA_ITEM::Type(), and UR_NEW.

Referenced by HandleBlockPlace().

◆ Block_Flip()

void PCB_EDIT_FRAME::Block_Flip ( )

Function Block_Flip Flip items within the selected block.

The flip center is the center of the block

Definition at line 651 of file pcbnew/block.cpp.

652 {
653 #define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
654  wxPoint center; // Position of the axis for inversion of all elements
655 
656  OnModify();
657 
659  itemsList->m_Status = UR_FLIPPED;
660 
661  center = GetScreen()->m_BlockLocate.Centre();
662 
663  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
664  {
665  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
666  wxASSERT( item );
667  itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
668  item->Flip( center );
669  GetBoard()->GetConnectivity()->Update( item );
670 
671  // If a connected item is flipped, the ratsnest is no more OK
672  switch( item->Type() )
673  {
674  case PCB_MODULE_T:
675  item->ClearFlags();
676  m_Pcb->m_Status_Pcb = 0;
677  break;
678 
679  case PCB_TRACE_T:
680  case PCB_VIA_T:
681  m_Pcb->m_Status_Pcb = 0;
682  break;
683 
684  case PCB_ZONE_AREA_T:
685  case PCB_LINE_T:
686  case PCB_TEXT_T:
687  case PCB_TARGET_T:
688  case PCB_DIMENSION_T:
689  break;
690 
691  default:
692  wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Flip( ) error: unexpected type" ) );
693  break;
694  }
695  }
696 
697  SaveCopyInUndoList( *itemsList, UR_FLIPPED, center );
698  Compile_Ratsnest( NULL, true );
699  m_canvas->Refresh( true );
700 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
unsigned GetCount() const
Function GetCount.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class MODULE, a footprint
Definition: typeinfo.h:89
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:292
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
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:198
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:98
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:99
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:53
virtual void Flip(const wxPoint &aCentre)
Function Flip Flip this object, i.e.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
bool SetPickedItemStatus(UNDO_REDO_T aStatus, unsigned aIdx)
Function SetPickedItemStatus sets the type of undo/redo operation for a given picked item.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint Centre() const
Definition: eda_rect.h:60
PICKED_ITEMS_LIST & GetItems()
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:260
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
BOARD * GetBoard() const
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240

References EDA_RECT::Centre(), EDA_ITEM::ClearFlags(), PCB_BASE_FRAME::Compile_Ratsnest(), BOARD_ITEM::Flip(), PCB_BASE_FRAME::GetBoard(), BOARD::GetConnectivity(), PICKED_ITEMS_LIST::GetCount(), BLOCK_SELECTOR::GetItems(), PICKED_ITEMS_LIST::GetPickedItem(), PCB_BASE_FRAME::GetScreen(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::m_Pcb, PICKED_ITEMS_LIST::m_Status, BOARD::m_Status_Pcb, OnModify(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, EDA_DRAW_PANEL::Refresh(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), PICKED_ITEMS_LIST::SetPickedItemStatus(), EDA_ITEM::Type(), and UR_FLIPPED.

Referenced by HandleBlockEnd().

◆ Block_Move()

void PCB_EDIT_FRAME::Block_Move ( )

Function Block_Move move all items within the selected block.

New location is determined by the current offset from the selected block's original location.

Definition at line 703 of file pcbnew/block.cpp.

704 {
705  OnModify();
706 
708 
710  itemsList->m_Status = UR_MOVED;
711 
712  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
713  {
714  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
715  itemsList->SetPickedItemStatus( UR_MOVED, ii );
716  item->Move( MoveVector );
717  GetBoard()->GetConnectivity()->Update( item );
718  item->ClearFlags( IS_MOVED );
719 
720  switch( item->Type() )
721  {
722  case PCB_MODULE_T:
723  m_Pcb->m_Status_Pcb = 0;
724  item->ClearFlags();
725  break;
726 
727  // Move track segments
728  case PCB_TRACE_T: // a track segment (segment on a copper layer)
729  case PCB_VIA_T: // a via (like a track segment on a copper layer)
730  m_Pcb->m_Status_Pcb = 0;
731  break;
732 
733  case PCB_ZONE_AREA_T:
734  case PCB_LINE_T:
735  case PCB_TEXT_T:
736  case PCB_TARGET_T:
737  case PCB_DIMENSION_T:
738  break;
739 
740  default:
741  wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Move( ) error: unexpected type" ) );
742  break;
743  }
744  }
745 
746  SaveCopyInUndoList( *itemsList, UR_MOVED, MoveVector );
747 
748  Compile_Ratsnest( NULL, true );
749  m_canvas->Refresh( true );
750 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
wxPoint MoveVector
Definition: edtxtmod.cpp:54
wxPoint GetMoveVector() const
unsigned GetCount() const
Function GetCount.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class MODULE, a footprint
Definition: typeinfo.h:89
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:292
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
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:198
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:98
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:99
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:53
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
bool SetPickedItemStatus(UNDO_REDO_T aStatus, unsigned aIdx)
Function SetPickedItemStatus sets the type of undo/redo operation for a given picked item.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PICKED_ITEMS_LIST & GetItems()
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:260
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
BOARD * GetBoard() const
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113

References EDA_ITEM::ClearFlags(), PCB_BASE_FRAME::Compile_Ratsnest(), PCB_BASE_FRAME::GetBoard(), BOARD::GetConnectivity(), PICKED_ITEMS_LIST::GetCount(), BLOCK_SELECTOR::GetItems(), BLOCK_SELECTOR::GetMoveVector(), PICKED_ITEMS_LIST::GetPickedItem(), PCB_BASE_FRAME::GetScreen(), IS_MOVED, BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::m_Pcb, PICKED_ITEMS_LIST::m_Status, BOARD::m_Status_Pcb, BOARD_ITEM::Move(), MoveVector, OnModify(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, EDA_DRAW_PANEL::Refresh(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), PICKED_ITEMS_LIST::SetPickedItemStatus(), EDA_ITEM::Type(), and UR_MOVED.

Referenced by HandleBlockPlace().

◆ Block_Rotate()

void PCB_EDIT_FRAME::Block_Rotate ( )

Function Block_Rotate Rotate all items within the selected block.

The rotation center is the center of the block

Definition at line 588 of file pcbnew/block.cpp.

589 {
590  // 6.0 TODO: This is the legacy toolset version
591 
592  wxPoint centre; // rotation cent-re for the rotation transform
593  int rotAngle = m_rotationAngle; // rotation angle in 0.1 deg.
594 
595  centre = GetScreen()->m_BlockLocate.Centre();
596 
597  OnModify();
598 
600  itemsList->m_Status = UR_CHANGED;
601 
602  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
603  {
604  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
605  wxASSERT( item );
606  itemsList->SetPickedItemStatus( UR_CHANGED, ii );
607 
608  switch( item->Type() )
609  {
610  case PCB_MODULE_T:
611  ( (MODULE*) item )->ClearFlags();
612  m_Pcb->m_Status_Pcb = 0;
613  break;
614 
615  // Move and rotate the track segments
616  case PCB_TRACE_T: // a track segment (segment on a copper layer)
617  case PCB_VIA_T: // a via (like track segment on a copper layer)
618  m_Pcb->m_Status_Pcb = 0;
619  break;
620 
621  case PCB_ZONE_AREA_T:
622  case PCB_LINE_T:
623  case PCB_TEXT_T:
624  case PCB_TARGET_T:
625  case PCB_DIMENSION_T:
626  break;
627 
628  default:
629  wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Rotate( ) error: unexpected type" ) );
630  break;
631  }
632  }
633 
634  // Save all the block items in there current state before applying the rotation.
635  SaveCopyInUndoList( *itemsList, UR_CHANGED, centre );
636 
637  // Now perform the rotation.
638  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
639  {
640  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
641  wxASSERT( item );
642  item->Rotate( centre, rotAngle );
643  GetBoard()->GetConnectivity()->Update( item );
644  }
645 
646  Compile_Ratsnest( NULL, true );
647  m_canvas->Refresh( true );
648 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
unsigned GetCount() const
Function GetCount.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class MODULE, a footprint
Definition: typeinfo.h:89
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:292
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
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:198
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:98
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:99
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:53
int m_rotationAngle
User defined rotation angle (in tenths of a degree).
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
bool SetPickedItemStatus(UNDO_REDO_T aStatus, unsigned aIdx)
Function SetPickedItemStatus sets the type of undo/redo operation for a given picked item.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint Centre() const
Definition: eda_rect.h:60
PICKED_ITEMS_LIST & GetItems()
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
BOARD * GetBoard() const
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240

References EDA_RECT::Centre(), PCB_BASE_FRAME::Compile_Ratsnest(), PCB_BASE_FRAME::GetBoard(), BOARD::GetConnectivity(), PICKED_ITEMS_LIST::GetCount(), BLOCK_SELECTOR::GetItems(), PICKED_ITEMS_LIST::GetPickedItem(), PCB_BASE_FRAME::GetScreen(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::m_Pcb, PCB_BASE_EDIT_FRAME::m_rotationAngle, PICKED_ITEMS_LIST::m_Status, BOARD::m_Status_Pcb, OnModify(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, EDA_DRAW_PANEL::Refresh(), BOARD_ITEM::Rotate(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), PICKED_ITEMS_LIST::SetPickedItemStatus(), EDA_ITEM::Type(), and UR_CHANGED.

Referenced by HandleBlockEnd().

◆ Block_SelectItems()

void PCB_EDIT_FRAME::Block_SelectItems ( )

Function Block_SelectItems Uses GetScreen()->m_BlockLocate select items within the selected block.

selected items are put in the pick list

Definition at line 307 of file pcbnew/block.cpp.

308 {
309  LSET layerMask;
310  bool selectOnlyComplete = GetScreen()->m_BlockLocate.GetWidth() > 0 ;
311 
313 
315  ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
316 
317  // Add modules
319  {
320  for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
321  {
322  PCB_LAYER_ID layer = module->GetLayer();
323 
324  if( module->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete )
325  && ( !module->IsLocked() || blockOpts.includeLockedModules ) )
326  {
328  {
329  picker.SetItem ( module );
330  itemsList->PushItem( picker );
331  }
332  }
333  }
334  }
335 
336  // Add tracks and vias
337  for( auto PtStruct : m_Pcb->Tracks() )
338  {
339  if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && !blockOpts.includeItemsOnInvisibleLayers )
340  continue;
341 
342  if( !( blockOpts.includeTracks && PtStruct->Type() == PCB_TRACE_T ) &&
343  !( blockOpts.includeVias && PtStruct->Type() == PCB_VIA_T) )
344  continue;
345 
346  if( PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
347  {
348  picker.SetItem ( PtStruct );
349  itemsList->PushItem( picker );
350  }
351  }
352 
353  // Add graphic items
354  layerMask = LSET( Edge_Cuts );
355 
357  layerMask.set();
358 
360  layerMask.set( Edge_Cuts, false );
361 
362  for( auto PtStruct : m_Pcb->Drawings() )
363  {
364  if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockOpts.includeItemsOnInvisibleLayers)
365  continue;
366 
367  bool select_me = false;
368 
369  switch( PtStruct->Type() )
370  {
371  case PCB_LINE_T:
372  if( !layerMask[PtStruct->GetLayer()] )
373  break;
374 
375  if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
376  break;
377 
378  select_me = true; // This item is in bloc: select it
379  break;
380 
381  case PCB_TEXT_T:
383  break;
384 
385  if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
386  break;
387 
388  select_me = true; // This item is in bloc: select it
389  break;
390 
391  case PCB_TARGET_T:
392  if( !layerMask[PtStruct->GetLayer()] )
393  break;
394 
395  if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
396  break;
397 
398  select_me = true; // This item is in bloc: select it
399  break;
400 
401  case PCB_DIMENSION_T:
402  if( !layerMask[PtStruct->GetLayer()] )
403  break;
404 
405  if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
406  break;
407 
408  select_me = true; // This item is in bloc: select it
409  break;
410 
411  default:
412  break;
413  }
414 
415  if( select_me )
416  {
417  picker.SetItem ( PtStruct );
418  itemsList->PushItem( picker );
419  }
420  }
421 
422  // Add zones
423  if( blockOpts.includeZones )
424  {
425  for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
426  {
427  ZONE_CONTAINER* area = m_Pcb->GetArea( ii );
428 
429  if( area->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
430  {
432  || m_Pcb->IsLayerVisible( area->GetLayer() ) )
433  {
434  BOARD_ITEM* zone_c = (BOARD_ITEM*) area;
435  picker.SetItem ( zone_c );
436  itemsList->PushItem( picker );
437  }
438  }
439  }
440  }
441 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
static DIALOG_BLOCK_OPTIONS::OPTIONS blockOpts
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:185
int GetWidth() const
Definition: eda_rect.h:117
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
PCB_LAYER_ID
A quick note on layer IDs:
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
Class LSET is a set of PCB_LAYER_IDs.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if a point is near an outline edge or a corner of this zone.
Definition: class_zone.cpp:653
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:98
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:99
void Normalize()
Function Normalize ensures that the height ant width are positive.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:453
DLIST< MODULE > m_Modules
Definition: class_board.h:248
bool IsModuleLayerVisible(PCB_LAYER_ID aLayer)
Function IsModuleLayerVisible expects either of the two layers on which a module can reside,...
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PICKED_ITEMS_LIST & GetItems()
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:251
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > Drawings()
Definition: class_board.h:253

References blockOpts, BOARD::Drawings(), Edge_Cuts, BOARD::GetArea(), BOARD::GetAreaCount(), BLOCK_SELECTOR::GetItems(), ZONE_CONTAINER::GetLayer(), PCB_BASE_FRAME::GetScreen(), EDA_RECT::GetWidth(), ZONE_CONTAINER::HitTest(), DIALOG_BLOCK_OPTIONS::OPTIONS::includeBoardOutlineLayer, DIALOG_BLOCK_OPTIONS::OPTIONS::includeItemsOnInvisibleLayers, DIALOG_BLOCK_OPTIONS::OPTIONS::includeItemsOnTechLayers, DIALOG_BLOCK_OPTIONS::OPTIONS::includeLockedModules, DIALOG_BLOCK_OPTIONS::OPTIONS::includeModules, DIALOG_BLOCK_OPTIONS::OPTIONS::includePcbTexts, DIALOG_BLOCK_OPTIONS::OPTIONS::includeTracks, DIALOG_BLOCK_OPTIONS::OPTIONS::includeVias, DIALOG_BLOCK_OPTIONS::OPTIONS::includeZones, BOARD::IsLayerVisible(), BOARD::IsModuleLayerVisible(), BASE_SCREEN::m_BlockLocate, BOARD::m_Modules, PCB_BASE_FRAME::m_Pcb, EDA_RECT::Normalize(), PCB_DIMENSION_T, PCB_LINE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PICKED_ITEMS_LIST::PushItem(), ITEM_PICKER::SetItem(), BOARD::Tracks(), and UR_UNSPECIFIED.

Referenced by HandleBlockEnd().

◆ BlockCommand()

int PCB_EDIT_FRAME::BlockCommand ( EDA_KEY  aKey)
overridevirtual

Function BlockCommand Returns the block command internat 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 99 of file pcbnew/block.cpp.

100 {
101  int cmd = 0;
102 
103  switch( aKey )
104  {
105  default:
106  cmd = aKey & 0xFF;
107  break;
108 
109  case 0:
110  cmd = BLOCK_MOVE;
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 GR_KB_SHIFTCTRL:
122  cmd = BLOCK_DELETE;
123  break;
124 
125  case GR_KB_ALT:
126  cmd = BLOCK_FLIP;
127  break;
128 
129  case MOUSE_MIDDLE:
130  cmd = BLOCK_ZOOM;
131  break;
132  }
133 
134  return cmd;
135 }
#define GR_KB_ALT
#define MOUSE_MIDDLE
#define GR_KB_CTRL
#define GR_KB_SHIFT
#define GR_KB_SHIFTCTRL

References BLOCK_DELETE, BLOCK_DUPLICATE, BLOCK_FLIP, BLOCK_MOVE, BLOCK_ROTATE, BLOCK_ZOOM, GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, GR_KB_SHIFTCTRL, and MOUSE_MIDDLE.

◆ build_ratsnest_module()

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

Function build_ratsnest_module Build a ratsnest relative to one footprint.

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

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

Definition at line 206 of file ratsnest.cpp.

207 {
208  auto connectivity = GetBoard()->GetConnectivity();
209 
210  movedModule = *aModule;
211  movedModule.Move( -aMoveVector );
212  connectivity->ClearDynamicRatsnest();
213  connectivity->BlockRatsnestItems( { aModule } );
214  connectivity->ComputeDynamicRatsnest( { &movedModule } );
215 }
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:292
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
BOARD * GetBoard() const
static MODULE movedModule(nullptr)

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

Referenced by MODULE::DrawOutlinesWhenMoving().

◆ BuildAirWiresTargetsList()

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

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

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

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

Definition at line 195 of file ratsnest.cpp.

197 {
198  s_CursorPos = aPosition; // needed for sort_by_distance
199  s_ref = aItemRef;
200  s_refNet = aNet;
201 }
static wxPoint s_CursorPos
Definition: ratsnest.cpp:182
static int s_refNet
Definition: ratsnest.cpp:193
static BOARD_CONNECTED_ITEM * s_ref
Definition: ratsnest.cpp:192

References s_CursorPos, s_ref, and s_refNet.

Referenced by Begin_Route(), and ShowNewTrackWhenMovingCursor().

◆ Change_Side_Module()

void PCB_EDIT_FRAME::Change_Side_Module ( MODULE Module,
wxDC *  DC 
)

Function Change_Side_Module Flip a footprint (switch layer from component or component to copper) The mirroring is made from X axis if a footprint is not on copper or component layer it is not flipped (it could be on an adhesive layer, not supported at this time)

Parameters
Modulethe footprint to flip
DCCurrent Device Context. if NULL, no redraw

Definition at line 287 of file pcb_footprint_edit_utils.cpp.

288 {
289  if( Module == NULL )
290  return;
291 
292  if( ( Module->GetLayer() != F_Cu ) && ( Module->GetLayer() != B_Cu ) )
293  return;
294 
295