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 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 OnUpdateShowBoardRatsnest (wxUpdateUIEvent &aEvent)
 
void OnUpdateViaDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateTraceDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateHighContrastDisplayMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateShowLayerManager (wxUpdateUIEvent &aEvent)
 
void OnUpdateShowMicrowaveToolbar (wxUpdateUIEvent &aEvent)
 
void OnUpdateVerticalToolbar (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectViaSize (wxUpdateUIEvent &aEvent)
 
void OnUpdateZoneDisplayStyle (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
 Function LoadSettings loads common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *aCfg) override
 Function SaveSettings saves common frame parameters to a configuration data file. More...
 
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
 Function ReCreateMenuBar Creates 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...
 
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...
 
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...
 
void Delete_OldZone_Fill (SEGZONE *aZone, timestamp_t aTimestamp=0)
 Function Delete_OldZone_Fill (obsolete) Used for compatibility with old boards Remove the zone filling which include the segment aZone, or the zone which have the given time stamp. 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...
 
int 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...
 
int Fill_All_Zones (wxWindow *aActiveWindow)
 Function Fill_All_Zones Fill all zones on the board The old fillings are removed. 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)
 
void ReadPcbNetlist (const wxString &aNetlistFileName, const wxString &aCmpFileName, REPORTER &aReporter, bool aChangeFootprint, bool aDeleteBadTracks, bool aDeleteExtraFootprints, bool aSelectByTimestamp, bool aDeleteSinglePadNets, bool aIsDryRun, bool *runDragCommand)
 Function ReadPcbNetlist reads aNetlistFileName and updates the footprints (load missing footprints and delete on demand extra footprints) on the board. 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
 Function ShowChangedLanguage redraws 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 (wxEvent &aEvent) 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 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 OnUpdatePadDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateGraphicDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateEdgeDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateTextDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectZoom (wxUpdateUIEvent &aEvent)
 
void SetFastGrid1 ()
 Function SetFastGrid1() More...
 
void SetFastGrid2 ()
 Function SetFastGrid2() More...
 
void SetNextGrid () override
 Virtual function SetNextGrid() changes the grid size settings to the next one available. More...
 
void SetPrevGrid () override
 Virtual function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void OnUpdateSwitchCanvas (wxUpdateUIEvent &aEvent)
 Update UI called when switches currently used canvas (default / Cairo / OpenGL). More...
 
PCB_GENERAL_SETTINGSSettings ()
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
EDA_UNITS_T GetUserUnits () const override
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS_T aUnits)
 
int GetLastGridSizeId () const
 
void SetLastGridSizeId (int aId)
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Set the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Return the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Return the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Return the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPoint & GetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
virtual EDA_DRAW_PANELGetCanvas () const
 
virtual wxString GetScreenDesc () const
 
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)
 
wxAuiToolBar * GetMainToolBar () const
 
wxAuiToolBar * GetOptionsToolBar () const
 
wxAuiToolBar * GetDrawToolBar () const
 
wxAuiToolBar * GetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
wxAuiToolBarItem * GetToolbarTool (int aToolId)
 Checks all the toolbars and returns a reference to the given tool id or nullptr if not found. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
void SetPresetGrid (int aIndex)
 Change the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Set the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Change the zoom to the next one available. More...
 
void SetNextZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the next one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPrevZoom ()
 Change the zoom to the previous one available. More...
 
void SetPreviousZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the previous one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPresetZoom (int aIndex)
 Change zoom to one of the preset values. More...
 
virtual void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
virtual void RedrawScreen2 (const wxPoint &posBefore)
 Put the crosshair back to the screen position it had before zooming. More...
 
virtual void HardRedraw ()
 Rebuild the GAL and redraws the screen. More...
 
virtual void Zoom_Automatique (bool aWarpPointer)
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
virtual void Window_Zoom (EDA_RECT &Rect)
 
void FocusOnLocation (const wxPoint &aPos, bool aWarpCursor=true, bool aCenterView=false)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
double GetZoom ()
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnPageSettingsChange ()
 Called when modifying the page settings. More...
 
virtual void OnActivate (wxActivateEvent &event)
 Called when activating the frame. More...
 
void DisplayUnitsMsg ()
 Display current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Copy the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Push preferences from a parent window to a child window. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL)
 Print the page pointed by current screen, set by the calling print function. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Return the tool manager instance, if any. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
bool GetShowAxis () const
 
bool GetShowGridAxis () const
 
bool GetShowOriginAxis () const
 
virtual const BOX2I GetDocumentExtents () const
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
bool ShowPreferences (EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys, const wxString &aHotkeysNickname)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

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...
 
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 isBusy () const
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool saveCanvasImageToFile (const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
 
virtual wxString GetCanvasTypeKey ()
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual wxConfigBase * config ()
 Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual const SEARCH_STACKsys_search ()
 Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual wxString help_name ()
 

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 ()
 Function GetBackupSuffix. More...
 
static wxString GetAutoSaveFilePrefix ()
 Function GetAutoSaveFilePrefix. More...
 

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
 
wxAuiToolBar * m_auxiliaryToolBar
 Auxiliary tool bar typically shown below the main tool bar at the top of the main window. More...
 
wxAuiToolBar * m_drawToolBar
 The tool bar that contains the buttons for quick access to the application draw tools. More...
 
wxAuiToolBar * m_optionsToolBar
 The options tool bar typcially located on the left edge of the main window. More...
 
EDA_MSG_PANELm_messagePanel
 Panel used to display information at the bottom of the main window. More...
 
int m_MsgFrameHeight
 
bool m_movingCursorWithKeyboard
 One-shot to avoid a recursive mouse event during hotkey movement. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 The current canvas type. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used More...
 
wxAuiToolBar * m_mainToolBar
 Standard horizontal Toolbar. More...
 
wxString m_AboutTitle
 Name of program displayed in About. More...
 
wxAuiManager m_auimgr
 
bool m_hasAutoSave
 Flag to indicate if this frame supports auto save. More...
 
bool m_autoSaveState
 Flag to indicate the last auto save state. More...
 
int m_autoSaveInterval
 The auto save interval time in seconds. More...
 
wxTimer * m_autoSaveTimer
 The timer used to implement the auto save feature;. More...
 
wxString m_perspective
 wxAuiManager perspective. More...
 
wxString m_mruPath
 Most recently used path. More...
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private 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.

Constructor & Destructor Documentation

◆ PCB_EDIT_FRAME()

Definition at line 291 of file pcb_edit_frame.cpp.

291  :
292  PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB, wxT( "Pcbnew" ), wxDefaultPosition,
294 {
295  m_showBorderAndTitleBlock = true; // true to display sheet references
296  m_showAxis = false; // true to display X and Y axis
297  m_showOriginAxis = true;
298  m_showGridAxis = true;
299  m_SelTrackWidthBox = NULL;
300  m_SelViaSizeBox = NULL;
301  m_SelLayerBox = NULL;
302  m_show_microwave_tools = false;
305  m_hasAutoSave = true;
306  m_microWaveToolBar = NULL;
307  m_Layers = nullptr;
308  m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
309 
310  // We don't know what state board was in when it was lasat saved, so we have to
311  // assume dirty
312  m_ZoneFillsDirty = true;
313 
314  m_rotationAngle = 900;
315 
316  // Create GAL canvas
317  EDA_DRAW_PANEL_GAL* galCanvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
318  m_FrameSize,
321 
322  SetGalCanvas( galCanvas );
323 
324  SetBoard( new BOARD() );
325 
326  // Create the PCB_LAYER_WIDGET *after* SetBoard():
327  m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas() );
328 
329  m_drc = new DRC( this ); // these 2 objects point to each other
330 
331  wxIcon icon;
332  icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) );
333  SetIcon( icon );
334 
335  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
336  // initialize parameters in m_LayersManager
337  LoadSettings( config() );
338 
339  SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
341 
342  // PCB drawings start in the upper left corner.
343  GetScreen()->m_Center = false;
344 
345  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
346 
349 
350  if( m_canvas )
352 
353  ReCreateMenuBar();
359 
360  m_auimgr.SetManagedWindow( this );
361  m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
362 
363  // Horizontal items; layers 4 - 6
364  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
365  m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(4) );
366  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
367 
368  // Vertical items; layers 1 - 3
369  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
370 
371  m_auimgr.AddPane( m_microWaveToolBar, EDA_PANE().VToolbar().Name( "MicrowaveToolbar" ).Right().Layer(1) );
372  m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) );
373  m_auimgr.AddPane( m_Layers, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3)
374  .Caption( _( "Layers Manager" ) ).PaneBorder( false )
375  .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) );
376 
377  m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
378  m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
379 
380  m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
381  m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
382 
383  ReFillLayerWidget(); // this is near end because contents establish size
384  m_Layers->ReFillRender(); // Update colors in Render after the config is read
386 
387  m_auimgr.Update();
388 
389  setupTools();
390 
391  Zoom_Automatique( false );
392 
394 
395  // Nudge user to switch to OpenGL if they are on legacy or Cairo
396  if( m_firstRunDialogSetting < 1 )
397  {
399  {
400  wxString msg = _( "KiCad can use your graphics card to give you a smoother "
401  "and faster experience. This option is turned off by "
402  "default since it is not compatible with all computers.\n\n"
403  "Would you like to try enabling graphics acceleration?\n\n"
404  "If you'd like to choose later, select Modern Toolset "
405  "(Accelerated) in the Preferences menu." );
406 
407  wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ),
408  wxYES_NO );
409 
410  dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
411 
412  if( dlg.ShowModal() == wxID_YES )
413  {
414  // Save Cairo as default in case OpenGL crashes
416 
417  // Switch to OpenGL, which will save the new setting if successful
418  wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL );
419  GetEventHandler()->ProcessEvent( evt );
420 
421  // Switch back to Cairo if OpenGL is not supported
422  if( GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
423  {
424  wxCommandEvent cairoEvt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
425  GetEventHandler()->ProcessEvent( cairoEvt );
426  }
427  }
428  else
429  {
430  // If they were on legacy, or they've been coerced into GAL
431  // due to unavailable legacy (GTK3), switch to Cairo
432  wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
433  GetEventHandler()->ProcessEvent( evt );
434  }
435  }
436 
438  SaveSettings( config() );
439  }
440 
442  {
443  if( GetGalCanvas()->SwitchBackend( m_canvasType ) )
444  UseGalCanvas( true );
445  }
446 
448 
449  // disable Export STEP item if kicad2step does not exist
450  wxString strK2S = Pgm().GetExecutablePath();
451 
452 #ifdef __WXMAC__
453  if (strK2S.find( "pcbnew.app" ) != wxNOT_FOUND )
454  {
455  // On macOS, we have standalone applications inside the main bundle, so we handle that here:
456  strK2S += "../../";
457  }
458 
459  strK2S += "Contents/MacOS/";
460 #endif
461 
462  wxFileName appK2S( strK2S, "kicad2step" );
463 
464  #ifdef _WIN32
465  appK2S.SetExt( "exe" );
466  #endif
467 
468  if( !appK2S.FileExists() )
469  GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
470 }
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file.
PCB_BASE_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
wxSize GetBestSize() const
Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic conten...
void syncLayerWidgetLayer()
Function syncLayerWidgetLayer updates the currently layer "selection" within the PCB_LAYER_WIDGET.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:953
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:136
void UseGalCanvas(bool aEnable) override
virtual void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:181
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
Definition: draw_frame.h:179
void ReCreateMicrowaveVToolbar()
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
wxChoice * m_SelViaSizeBox
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:936
wxAuiManager m_auimgr
bool m_show_microwave_tools
void ReCreateHToolbar() override
DRC * m_drc
the DRC controller, see drc.cpp
wxChoice * m_SelTrackWidthBox
#define PCB_EDIT_FRAME_NAME
Definition: draw_frame.h:56
bool m_show_layer_manager_tools
bool m_showOriginAxis
True shows the origin axis used to indicate the coordinate offset for drill, gerber,...
Definition: draw_frame.h:143
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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.
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window.
Definition: draw_frame.h:156
wxAuiToolBar * m_microWaveToolBar
The auxiliary right vertical tool bar used to access the microwave tools.
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:163
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:108
bool m_Center
Center on screen.
Definition: base_screen.h:202
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:166
GAL not used (the legacy wxDC engine is used)
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:146
void ReFillRender()
Function ReFillRender rebuilds Render for instance after the config is read.
void ReCreateVToolbar() override
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:139
struct EDA_HOTKEY_CONFIG g_Board_Editor_Hotkeys_Descr[]
#define KICAD_DEFAULT_DRAWFRAME_STYLE
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:121
PCB_LAYER_WIDGET * m_Layers
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:395
wxPoint m_UserGridSize
int m_LastGridSizeId
Definition: draw_frame.h:110
Specialization of the wxAuiPaneInfo class for KiCad panels.
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:160
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
int m_rotationAngle
User defined rotation angle (in tenths of a degree).
void enableGALSpecificMenus()
an helper function to enable some menus only active when the display is switched to GAL mode and whic...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void AddGrid(const GRID_TYPE &grid)
void SetBoard(BOARD *aBoard) override
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
VTBL_ENTRY const wxString & GetExecutablePath() const
Definition: pgm_base.h:217
Design Rule Checker object that performs all the DRC tests.
Definition: drc.h:176
void ReCreateOptToolbar() override
void SetMaxUndoItems(int aMax)
Definition: base_screen.h:313
const PAGE_INFO & GetPageSettings() const override
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetEnableBlockCommands(bool aEnable)
bool m_hasAutoSave
Flag to indicate if this frame supports auto save.
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Stores the canvas type in the application settings.
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading a ne...
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
void ReCreateAuxiliaryToolbar() override
long m_firstRunDialogSetting
Key to control whether first run dialog is shown on startup.
Definition: draw_frame.h:149
friend class PCB_LAYER_WIDGET

References PCAD2KICAD::Center, g_Board_Editor_Hotkeys_Descr, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, PGM_BASE::GetExecutablePath(), ID_GEN_EXPORT_FILE_STEP, ID_MENU_CANVAS_CAIRO, ID_MENU_CANVAS_OPENGL, ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, KiBitmap(), PCAD2KICAD::Left, Pgm(), PCAD2KICAD::Right, and UNSCALED_UNITS.

◆ ~PCB_EDIT_FRAME()

PCB_EDIT_FRAME::~PCB_EDIT_FRAME ( )
virtual

Definition at line 473 of file pcb_edit_frame.cpp.

474 {
475  delete m_drc;
476 }
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:95
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
void SetEnd(const wxPoint &aEnd)
Definition: class_track.h:122
DLIST< TRACK > g_CurrentTrackList
Definition: pcbnew.cpp:91
const wxPoint & GetStart() const
Definition: class_track.h:126
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:173
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:120
#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:123
void SetStart(const wxPoint &aStart)
Definition: class_track.h:125
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:201
TRACK * Back() const
Definition: class_track.h:104

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:1406
const ZONE_SETTINGS & GetZoneSettings() const
static ZONE_CONTAINER * s_CurrentZone
Class ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:48
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:1406
const ZONE_SETTINGS & GetZoneSettings() const
static ZONE_CONTAINER * s_CurrentZone
Class ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:48
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:60
Class FP_LIB_TABLE_ROW.
Definition: fp_lib_table.h:42
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
Component library viewer main window.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
static const wxString ShowType(PCB_FILE_T aFileType)
Function ShowType returns a brief name for a plugin, given aFileType enum.
Definition: io_mgr.cpp:77
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Function GuessPluginTypeFromLibPath returns a plugin type given a footprint library's libPath.
Definition: io_mgr.cpp:124
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: pcbnew.cpp:326
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:300
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=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:303
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243
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 1566 of file legacy_gal/eda_draw_frame.cpp.

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

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

Referenced by EDA_DRAW_PANEL::OnRightClick().

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

227 {
228  if( module )
229  {
230  GetBoard()->Add( module, ADD_APPEND );
231 
232  module->SetFlags( IS_NEW );
233 
234  if( IsGalCanvasActive() )
235  module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment
236  else
237  module->SetPosition( GetCrossHairPosition() );
238 
239  module->SetTimeStamp( GetNewTimeStamp() );
240  GetBoard()->m_Status_Pcb = 0;
241 
242  // Put it on FRONT layer,
243  // (Can be stored flipped if the lib is an archive built from a board)
244  if( module->IsFlipped() )
245  module->Flip( module->GetPosition() );
246 
247  // Place it in orientation 0,
248  // even if it is not saved with orientation 0 in lib
249  // (Can happen if the lib is an archive built from a board)
250  module->SetOrientation( 0 );
251  }
252 }
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:928
timestamp_t GetNewTimeStamp()
Definition: common.cpp:216
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
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:206
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241

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:219
virtual void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:412
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: class_pad.h:182
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:262
const wxString & GetName() const
Definition: class_pad.h:190
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
const wxPoint GetPosition() const override
Definition: class_pad.h:220
static wxString GetNextPadName(wxString aPadName)
void Import_Pad_Settings(D_PAD *aPad, bool aDraw)
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241

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

1017 {
1018 }

◆ 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:735
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:257
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:261
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
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:928
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:1026
Class LSET is a set of PCB_LAYER_IDs.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
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:202
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:132
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:249
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:997
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 877 of file legacy_gal/eda_draw_frame.cpp.

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

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:275
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243
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 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:129
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:126
void SetState(int type, int state)
Definition: base_struct.h:245
TRACK * Next() const
Definition: class_track.h:103
DLIST< TRACK > m_Track
Definition: class_board.h:250
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:129
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:126
void SetState(int type, int state)
Definition: base_struct.h:245
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:123

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 ) || (track->Type() == PCB_SEGZONE_T) )
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:135
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:129
Definition: gr_basic.h:38
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void SetState(int type, int state)
Definition: base_struct.h:245
TRACK * Next() const
Definition: class_track.h:103
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.
class SEGZONE, a segment used to fill a zone area (segment on a
Definition: typeinfo.h:97
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201

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(), PCB_SEGZONE_T, EDA_ITEM::SetState(), TRACK_LOCKED, and EDA_ITEM::Type().

Referenced by Process_Special_Functions().

◆ Begin_DrawSegment()

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

Definition at line 239 of file editedge.cpp.

240 {
241  int lineWidth;
242  DRAWSEGMENT* DrawItem;
243 
245 
246  if( Segment == NULL ) // Create new segment.
247  {
248  SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
249  Segment->SetFlags( IS_NEW );
250  Segment->SetLayer( GetActiveLayer() );
251  Segment->SetWidth( lineWidth );
252  Segment->SetShape( shape );
253  Segment->SetAngle( 900 );
254  Segment->SetStart( GetCrossHairPosition() );
255  Segment->SetEnd( GetCrossHairPosition() );
257  }
258  else
259  {
260  // The ending point coordinate Segment->m_End was updated by the function
261  // DrawSegment() called on a move mouse event during the segment creation
262  if( Segment->GetStart() != Segment->GetEnd() )
263  {
264  if( Segment->GetShape() == S_SEGMENT )
265  {
266  SaveCopyInUndoList( Segment, UR_NEW );
267  GetBoard()->Add( Segment );
268 
269  OnModify();
270  Segment->ClearFlags();
271 
272  Segment->Draw( m_canvas, DC, GR_OR );
273 
274  DrawItem = Segment;
275 
276  SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
277 
278  Segment->SetFlags( IS_NEW );
279  Segment->SetLayer( DrawItem->GetLayer() );
280  Segment->SetWidth( lineWidth );
281  Segment->SetShape( DrawItem->GetShape() );
282  Segment->SetType( DrawItem->GetType() );
283  Segment->SetAngle( DrawItem->GetAngle() );
284  Segment->SetStart( DrawItem->GetEnd() );
285  Segment->SetEnd( DrawItem->GetEnd() );
286  DrawSegment( m_canvas, DC, wxDefaultPosition, false );
287  }
288  else
289  {
290  End_Edge( Segment, DC );
291  Segment = NULL;
292  }
293  }
294  }
295 
296  return Segment;
297 }
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:202
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:256
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:327
void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
Function SaveCopyInUndoList Creates a new entry in undo list of commands.
Definition: undo_redo.cpp:202
void SetStart(const wxPoint &aStart)
Definition: gr_basic.h:38
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
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:257
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:300
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:96
#define g_CurrentTrackSegment
most recently created segment
Definition: pcbnew.h:95
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:134
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:182
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:133
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:173
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:119
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:256
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:105
#define BAD_DRC
Definition: drc.h:40
void HighLightON()
Function HighLightON Enable highlight.
Definition: class_board.h:401
void SetHighLightNet(int aNetCode)
Function SetHighLightNet.
Definition: class_board.h:379
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
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:245
int GetWidth() const
Definition: class_track.h:120
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:123
static PICKED_ITEMS_LIST s_ItemsListPicker
Definition: editrack.cpp:55
void SetStart(const wxPoint &aStart)
Definition: class_track.h:125
#define DBG(x)
Definition: fctsys.h:33
DLIST< TRACK > m_Track
Definition: class_board.h:250
BOARD * GetBoard() const
const wxPoint GetPosition() const override
Definition: class_pad.h:220
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:95
BOARD_CONNECTED_ITEM * start
Definition: class_track.h:94
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:201

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:126
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:243
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:564
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:257
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
void SetCornerSmoothingType(int aType)
long m_ThermalReliefCopperBridge
thickness of the copper bridge in thermal reliefs
Definition: zone_settings.h:78
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:179
static bool s_AddCutoutToCurrentZone
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:264
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:65
timestamp_t GetNewTimeStamp()
Definition: common.cpp:216
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1026
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
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:371
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:445
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:63
void HighLight(wxDC *DC)
Function HighLight.
Definition: highlight.cpp:105
#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:48
int GetHighLightNetCode() const
Function GetHighLightNetCode.
Definition: class_board.h:373
void SetHighLightNet(int aNetCode)
Function SetHighLightNet.
Definition: class_board.h:379
#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:126
#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:257
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:997
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:469
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:185
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:485
PCB_LAYER_ID m_CurrentZone_Layer
Layer used to create the current zone.
Definition: zone_settings.h:69
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:526
long m_ThermalReliefGap
thickness of the gap in thermal reliefs
Definition: zone_settings.h:77
int m_ZoneMinThickness
Min thickness value in filled areas.
Definition: zone_settings.h:64
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:206
void RemoveAllContours(void)
Definition: class_zone.h:480

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:256
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:126
TEXTE_PCB & Text()
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
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:256
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:126
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 400 of file pcb_base_frame.cpp.

401 {
402  EDA_RECT ibbbox = GetBoardBoundingBox();
403 
404  double sizeX = (double) ibbbox.GetWidth();
405  double sizeY = (double) ibbbox.GetHeight();
406  wxPoint centre = ibbbox.Centre();
407 
408  // Reserve a 10% margin around board bounding box.
409  double margin_scale_factor = 1.1;
410 
411  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
412 }
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  case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
570  item->UnLink();
571  itemsList->RemovePicker( ii );
572  ii--;
573  item->DeleteStructure();
574  break;
575 
576  default:
577  wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Delete( ) error: unexpected type" ) );
578  break;
579  }
580  }
581 
582  SaveCopyInUndoList( *itemsList, UR_DELETED );
583 
584  Compile_Ratsnest( NULL, true );
585  m_canvas->Refresh( true );
586 }
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:102
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:297
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:202
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:101
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:126
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
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:257
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
class SEGZONE, a segment used to fill a zone area (segment on a
Definition: typeinfo.h:97
void Remove(BOARD_ITEM *aBoardItem) override
Removes an item from the container.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241

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_SEGZONE_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 773 of file pcbnew/block.cpp.

774 {
776 
777  OnModify();
778 
780 
781  PICKED_ITEMS_LIST newList;
782  newList.m_Status = UR_NEW;
783 
784  ITEM_PICKER picker( NULL, UR_NEW );
785  BOARD_ITEM* newitem;
786 
787  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
788  {
789  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
790 
791  newitem = (BOARD_ITEM*)item->Clone();
792 
793  if( item->Type() == PCB_MODULE_T )
794  m_Pcb->m_Status_Pcb = 0;
795 
796  m_Pcb->Add( newitem );
797 
798  if( newitem )
799  {
800  newitem->Move( MoveVector );
801  picker.SetItem ( newitem );
802  newList.PushItem( picker );
803  }
804  }
805 
806  if( newList.GetCount() )
807  SaveCopyInUndoList( newList, UR_NEW );
808 
809  Compile_Ratsnest( NULL, true );
810  m_canvas->Refresh( true );
811 }
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:202
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:126
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:201
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241

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 658 of file pcbnew/block.cpp.

659 {
660 #define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
661  wxPoint center; // Position of the axis for inversion of all elements
662 
663  OnModify();
664 
666  itemsList->m_Status = UR_FLIPPED;
667 
668  center = GetScreen()->m_BlockLocate.Centre();
669 
670  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
671  {
672  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
673  wxASSERT( item );
674  itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
675  item->Flip( center );
676  GetBoard()->GetConnectivity()->Update( item );
677 
678  // If a connected item is flipped, the ratsnest is no more OK
679  switch( item->Type() )
680  {
681  case PCB_MODULE_T:
682  item->ClearFlags();
683  m_Pcb->m_Status_Pcb = 0;
684  break;
685 
686  case PCB_TRACE_T:
687  case PCB_VIA_T:
688  m_Pcb->m_Status_Pcb = 0;
689  break;
690 
691  case PCB_ZONE_AREA_T:
692  case PCB_LINE_T:
693  case PCB_TEXT_T:
694  case PCB_TARGET_T:
695  case PCB_DIMENSION_T:
696  break;
697 
698  // This item is not put in undo list
699  case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
700  itemsList->RemovePicker( ii );
701  ii--;
702  break;
703 
704 
705  default:
706  wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Flip( ) error: unexpected type" ) );
707  break;
708  }
709  }
710 
711  SaveCopyInUndoList( *itemsList, UR_FLIPPED, center );
712  Compile_Ratsnest( NULL, true );
713  m_canvas->Refresh( true );
714 }
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:102
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:297
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:202
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:101
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:126
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:257
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
class SEGZONE, a segment used to fill a zone area (segment on a
Definition: typeinfo.h:97
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241

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_SEGZONE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, EDA_DRAW_PANEL::Refresh(), PICKED_ITEMS_LIST::RemovePicker(), 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 717 of file pcbnew/block.cpp.

718 {
719  OnModify();
720 
722 
724  itemsList->m_Status = UR_MOVED;
725 
726  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
727  {
728  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
729  itemsList->SetPickedItemStatus( UR_MOVED, ii );
730  item->Move( MoveVector );
731  GetBoard()->GetConnectivity()->Update( item );
732  item->ClearFlags( IS_MOVED );
733 
734  switch( item->Type() )
735  {
736  case PCB_MODULE_T:
737  m_Pcb->m_Status_Pcb = 0;
738  item->ClearFlags();
739  break;
740 
741  // Move track segments
742  case PCB_TRACE_T: // a track segment (segment on a copper layer)
743  case PCB_VIA_T: // a via (like a track segment on a copper layer)
744  m_Pcb->m_Status_Pcb = 0;
745  break;
746 
747  case PCB_ZONE_AREA_T:
748  case PCB_LINE_T:
749  case PCB_TEXT_T:
750  case PCB_TARGET_T:
751  case PCB_DIMENSION_T:
752  break;
753 
754  // This item is not put in undo list
755  case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
756  itemsList->RemovePicker( ii );
757  ii--;
758  break;
759 
760  default:
761  wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Move( ) error: unexpected type" ) );
762  break;
763  }
764  }
765 
766  SaveCopyInUndoList( *itemsList, UR_MOVED, MoveVector );
767 
768  Compile_Ratsnest( NULL, true );
769  m_canvas->Refresh( true );
770 }
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:102
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:297