KiCad PCB EDA Suite
PCB_EDIT_FRAME Class Reference

#include <wxPcbStruct.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) throw ( IO_ERROR, PARSE_ERROR )
 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...
 
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 SVG_Print (wxCommandEvent &event)
 Function SVG_Print shows the print 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 OnUpdateAutoDeleteTrack (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 OnUpdateSelectAutoTrackWidth (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectCustomTrackWidth (wxUpdateUIEvent &aEvent)
 
void OnUpdateAutoPlaceModulesMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateAutoPlaceTracksMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateMuWaveToolbar (wxUpdateUIEvent &aEvent)
 
void OnLayerColorChange (wxCommandEvent &aEvent)
 
void OnConfigurePaths (wxCommandEvent &aEvent)
 
void OnUpdatePCBFromSch (wxCommandEvent &event)
 
void OnAltWheel (wxCommandEvent &event)
 called when the alt key is pressed during a mouse wheel action More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMaskLayer, bool aPrintMirrorMode, void *aData=NULL) override
 Function PrintPage , virtual used to print a page Print the page pointed by the current screen, set by the calling print function. More...
 
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 () const 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 OnResetModuleTextSizes (wxCommandEvent &event)
 Function OnResetModuleTextSizes resets text size and width of all module text fields of given field type to current settings in Preferences. 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 ()
 
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...
 
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
 Function GeneralControl performs application specific control using aDC at aPosition in logical units. More...
 
void ShowDesignRulesEditor (wxCommandEvent &event)
 Function ShowDesignRulesEditor displays the Design Rules Editor. More...
 
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_Mirror_X ()
 Function Block_Mirror_X mirrors all items within the currently selected block in the X axis. More...
 
void Block_Duplicate (bool aIncrement)
 Function Block_Duplicate Duplicate all items within the selected block. More...
 
void Process_Settings (wxCommandEvent &event)
 
void OnConfigurePcbOptions (wxCommandEvent &aEvent)
 
void InstallDisplayOptionsDialog (wxCommandEvent &aEvent)
 
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 ToPostProcess (wxCommandEvent &event)
 
void OnFileHistory (wxCommandEvent &event)
 
void Files_io (wxCommandEvent &event)
 Function Files_io. More...
 
void 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 ()
 
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)
 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...
 
void Access_to_External_Tool (wxCommandEvent &event)
 Function Access_to_External_Tool Run an external tool (like freeroute ) 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 InstallTextPCBOptionsFrame (TEXTE_PCB *TextPCB, wxDC *DC)
 Routine for main window class to launch text properties dialog. More...
 
void Start_Move_DrawItem (DRAWSEGMENT *drawitem, wxDC *DC)
 
void Place_DrawItem (DRAWSEGMENT *drawitem, wxDC *DC)
 
void InstallGraphicItemPropertiesDialog (DRAWSEGMENT *aItem, wxDC *aDC)
 
void InstallModuleOptionsFrame (MODULE *Module, wxDC *DC)
 
void StartMoveModule (MODULE *aModule, wxDC *aDC, bool aDragConnectedTracks)
 Function StartMoveModule Initialize a drag or move pad command. More...
 
void DlgGlobalChange_PadSettings (D_PAD *aPad, bool aRedraw)
 Function DlgGlobalChange_PadSettings 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 *ExchangeModuleModule)
 
void Exchange_Module (MODULE *aOldModule, MODULE *aNewModule, BOARD_COMMIT &aCommit)
 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...
 
void Via_Edit_Control (wxCommandEvent &event)
 
bool IsMicroViaAcceptable (void)
 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...
 
void HighlightUnconnectedPads (wxDC *DC)
 
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...
 
bool Reset_All_Tracks_And_Vias_To_Netclass_Values (bool aTrack, bool aVia)
 Function Reset_All_Tracks_And_Vias_To_Netclass_Values Reset all tracks width and/or vias diameters and drill to their default Netclass value. More...
 
bool Change_Net_Tracks_And_Vias_Sizes (int aNetcode, bool aUseNetclassValue)
 Function Change_Net_Tracks_And_Vias_Sizes Reset all tracks width and vias diameters and drill to their default Netclass value or current values. 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...
 
bool 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, time_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, bool aVerbose=true)
 Function Fill_All_Zones Fill all zones on the board The old fillings are removed. 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)
 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 OnSelectAutoPlaceMode (wxCommandEvent &aEvent)
 
void OnOrientFootprints (wxCommandEvent &event)
 Function OnOrientFootprints install the dialog box for the common Orient Footprints. More...
 
bool ReOrientModules (const wxString &ModuleMask, double Orient, bool include_fixe)
 Function ReOrientModules Set the orientation of footprints. More...
 
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 AutoPlaceModule (MODULE *Module, int place_mode, wxDC *DC)
 Function AutoPlaceModule automatically places footprints within the confines of the PCB edges. More...
 
int Solve (AUTOROUTER_CONTEXT &aCtx, int aLayersCount)
 
void Reset_Noroutable (wxDC *DC)
 
void Autoroute (wxDC *DC, int mode)
 
void ReadAutoroutedTracks (wxDC *DC)
 
void GlobalRoute (wxDC *DC)
 
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 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...
 
wxString CreateNewLibrary ()
 Function CreateNewLibrary prompts user for a library path, then creates a new footprint library at that location. More...
 
void SaveCopyInUndoList (BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
 Function SaveCopyInUndoList Creates a new entry in undo list of commands. More...
 
void SaveCopyInUndoList (const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
 Function SaveCopyInUndoList Creates a new entry in undo list of commands. More...
 
void RestoreCopyFromRedoList (wxCommandEvent &aEvent)
 Function RestoreCopyFromRedoList Redo the last edition: More...
 
void RestoreCopyFromUndoList (wxCommandEvent &aEvent)
 Function RestoreCopyFromUndoList Undo the last edition: More...
 
void PutDataInPreviousState (PICKED_ITEMS_LIST *aList, bool aRedoCommand, bool aRebuildRatsnet=true)
 Function PutDataInPreviousState Used in undo or redo command. More...
 
bool UndoRedoBlocked () const
 Function UndoRedoBlocked Checks if the undo and redo operations are currently blocked. More...
 
void UndoRedoBlock (bool aBlock=true)
 Function UndoRedoBlock Enables/disable undo and redo operations. More...
 
int GetRotationAngle () const
 Function GetRotationAngle() Returns the angle used for rotate operations. More...
 
void SetRotationAngle (int aRotationAngle)
 Function SetRotationAngle() Sets the angle used for rotate operations. More...
 
EDA_3D_VIEWERGet3DViewerFrame ()
 
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
 Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPointGetAuxOrigin () const override
 Function GetAuxOrigin returns the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPoint) override
 
const wxPointGetGridOrigin () const override
 Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
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 * 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
 Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void UpdateStatusBar () override
 Function UpdateStatusBar updates the status bar information. More...
 
PCB_SCREENGetScreen () const override
 Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives. More...
 
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...
 
EDA_ITEMReadDrawSegmentDescr (LINE_READER *aReader)
 
int ReadListeSegmentDescr (LINE_READER *aReader, TRACK *PtSegm, int StructType, int NumSegm)
 
int ReadSetup (LINE_READER *aReader)
 
int ReadGeneralDescrPcb (LINE_READER *aReader)
 
BOARD_ITEMPcbGeneralLocateAndDisplay (int aHotKeyCode=0)
 Function PcbGeneralLocateAndDisplay searches for an item under the mouse cursor. More...
 
void ProcessItemSelection (wxCommandEvent &event)
 
void SetCurItem (BOARD_ITEM *aItem, bool aDisplayInfo=true)
 Function SetCurItem sets the currently selected item and displays it in the MsgPanel. More...
 
BOARD_ITEMGetCurItem ()
 
void UpdateMsgPanel () override
 > More...
 
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide ()
 Function GetCollectorsGuide. More...
 
void CursorGoto (const wxPoint &aPos, bool aWarp=true)
 Function CursorGoto positions the cursor at a given coordinate and reframes the drawing if the requested point is out of view. 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 aDoNotRecreateRatsnest=false)
 Function PlaceModule places aModule at the current cursor position and updates module coordinates with the new position. More...
 
void RotateTextModule (TEXTE_MODULE *Text, wxDC *DC)
 
void DeleteTextModule (TEXTE_MODULE *Text)
 
void PlaceTexteModule (TEXTE_MODULE *Text, wxDC *DC)
 
void StartMoveTexteModule (TEXTE_MODULE *Text, wxDC *DC)
 
void ResetTextSize (BOARD_ITEM *aItem, wxDC *aDC)
 Function ResetTextSize resets given field text size and width to current settings in Preferences->Dimensions->Texts and Drawings. More...
 
void ResetModuleTextSizes (const wxString &aFilter, bool aRef, bool aValue, bool aOthers)
 Function ResetModuleTextSizes resets text size and width of all module text fields of given field type to current settings in Preferences->Dimensions->Texts and Drawings. More...
 
void InstallPadOptionsFrame (D_PAD *pad)
 
void InstallTextModOptionsFrame (TEXTE_MODULE *TextMod, wxDC *DC)
 
void AddPad (MODULE *Module, bool draw)
 
void DeletePad (D_PAD *aPad, bool aQuery=true)
 Function DeletePad Delete the pad aPad. More...
 
void StartMovePad (D_PAD *aPad, wxDC *aDC, bool aDragConnectedTracks)
 Function StartMovePad Initialize a drag or move pad command. More...
 
void RotatePad (D_PAD *Pad, wxDC *DC)
 
void PlacePad (D_PAD *Pad, wxDC *DC)
 
void Export_Pad_Settings (D_PAD *aPad)
 
void Import_Pad_Settings (D_PAD *aPad, bool aDraw)
 
void GlobalChange_PadSettings (D_PAD *aPad, bool aSameFootprints, bool aPadShapeFilter, bool aPadOrientFilter, bool aPadLayerFilter, bool aRedraw, bool aSaveForUndo)
 Function GlobalChange_PadSettings Function to change pad caracteristics for the given footprint or all footprints which look like the given footprint. More...
 
wxString SelectFootprint (EDA_DRAW_FRAME *aWindow, const wxString &aLibraryName, const wxString &aMask, const wxString &aKeyWord, FP_LIB_TABLE *aTable)
 Function SelectFootprint displays a list of modules found in all libraries or a given library. More...
 
MODULELoadModuleFromLibrary (const wxString &aLibrary, FP_LIB_TABLE *aTable, bool aUseFootprintViewer=true, wxDC *aDC=NULL)
 Function LoadModuleFromLibrary opens a dialog to select a footprint, and loads it into current 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)
 Function build_ratsnest_module Build a ratsnest relative to one footprint. More...
 
void TraceModuleRatsNest (wxDC *aDC)
 Function TraceModuleRatsNest display the rats nest of a moving footprint, computed by build_ratsnest_module() More...
 
void Build_Board_Ratsnest ()
 Function Build_Board_Ratsnest. More...
 
void DrawGeneralRatsnest (wxDC *aDC, int aNetcode=0)
 function Displays the general ratsnest Only ratsnest with the status bit CH_VISIBLE is set are displayed More...
 
void TraceAirWiresToTargets (wxDC *aDC)
 Function TraceAirWiresToTargets This functions shows airwires to nearest connecting points (pads) from the current new track end during track creation Uses data prepared by BuildAirWiresTargetsList() More...
 
void BuildAirWiresTargetsList (BOARD_CONNECTED_ITEM *aItemRef, const wxPoint &aPosition, bool aInit)
 Function BuildAirWiresTargetsList Build a list of candidates that can be a coonection point when a track is started. More...
 
void TestForActiveLinksInRatsnest (int aNetCode)
 Function TestForActiveLinksInRatsnest Explores the full rats nest list (which must exist) to determine the ACTIVE links in the full rats nest list When tracks exist between pads, a link can connect 2 pads already connected by a track and the link is said inactive. More...
 
void TestConnections ()
 Function TestConnections tests the connections relative to all nets. More...
 
void TestNetConnection (wxDC *aDC, int aNetCode)
 Function TestNetConnection tests the connections relative to aNetCode. More...
 
void RecalculateAllTracksNetcode ()
 Function RecalculateAllTracksNetcode search connections between tracks and pads and propagate pad net codes to the track segments. More...
 
PCB_LAYER_ID SelectLayer (PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
 Install the dialog box for layer selection. More...
 
void SelectCopperLayerPair ()
 
virtual PCB_LAYER_ID GetActiveLayer () const
 Function GetActiveLayer returns the active layer. More...
 
bool InvokeDialogGrid ()
 
void OnTogglePolarCoords (wxCommandEvent &aEvent)
 
void OnTogglePadDrawMode (wxCommandEvent &aEvent)
 
void OnUpdateCoordType (wxUpdateUIEvent &aEvent)
 
void OnUpdatePadDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectZoom (wxUpdateUIEvent &aEvent)
 
void SetFastGrid1 ()
 Function SetFastGrid1() More...
 
void SetFastGrid2 ()
 Function SetFastGrid2() More...
 
void SetNextGrid () override
 Virtual function SetNextGrid() changes the grid size settings to the next one available. More...
 
void SetPrevGrid () override
 Virtual function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void ClearSelection ()
 
void SwitchCanvas (wxCommandEvent &aEvent)
 switches currently used canvas (default / Cairo / OpenGL). More...
 
void OnUpdateSwitchCanvas (wxUpdateUIEvent &aEvent)
 Update UI called when switches currently used canvas (default / Cairo / OpenGL). More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting () const
 Function LoadCanvasTypeSetting() Returns the canvas type stored in the application settings. More...
 
bool SaveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Function SaveCanvasTypeSetting() Stores the canvas type in the application settings. More...
 
bool LockFile (const wxString &aFileName)
 Function LockFile marks a schematic file as being in use. More...
 
void ReleaseFile ()
 Function ReleaseFile Release the current file marked in use. More...
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Function GetCursorPosition returns the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Function GetNearestGridPosition returns the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Function GetCursorScreenPosition returns the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Function RefPos Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
EDA_DRAW_PANELGetCanvas ()
 
virtual wxString GetScreenDesc () const
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
int GetToolId () const
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
void SetPresetGrid (int aIndex)
 Function SetPresetGrid() changes the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Function OnSize recalculates the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 Function OnZoom Called from any zoom event (toolbar , hotkey or popup ) More...
 
void SetNextZoom ()
 Function SetNextZoom() changes the zoom to the next one available. More...
 
void SetPrevZoom ()
 Function SetPrevZoom() changes the zoom to the previous one available. More...
 
void SetPresetZoom (int aIndex)
 Function SetPresetZoom() changes zoom to one of the preset values. More...
 
void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
void RedrawScreen2 (const wxPoint &posBefore)
 Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming. More...
 
void Zoom_Automatique (bool aWarpPointer)
 Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void Window_Zoom (EDA_RECT &Rect)
 Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window screen. More...
 
double GetZoom ()
 Function GetZoom. More...
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnActivate (wxActivateEvent &event)
 Function OnActivate (virtual) is called when activating the frame. More...
 
void DisplayUnitsMsg ()
 Function DisplayUnitsMsg displays current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Function HandleBlockBegin initializes the block command including the command type, initial position, and other variables. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Function CopyToClipboard copies the current page or the current block to the clipboard. More...
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Function SetMsgPanel clears the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Function PushPreferences Pushes a few preferences from a parent window to a child window. More...
 
wxString CoordinateToString (int aValue, bool aConvertToMils=false) const
 Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting. More...
 
wxString LengthDoubleToString (double aValue, bool aConvertToMils=false) const
 Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Function GetToolManager returns the tool manager instance, if any. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering. More...
 
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...
 
bool Enable (bool enable) override
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
int ReadHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys. More...
 
int ReadHotkeyConfigFile (const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Static Public Member Functions

static wxString GetAutoSaveFilePrefix ()
 Function GetAutoSaveFilePrefix. 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
 
DISPLAY_OPTIONS m_DisplayOptions
 
EDA_UNITS_T m_UserGridUnit
 
wxRealPoint m_UserGridSize
 
int m_FastGrid1
 
int m_FastGrid2
 

Static Public Attributes

static const wxChar CANVAS_TYPE_KEY [] = wxT( "canvas_type" )
 

Key in KifaceSettings to store the canvas type.

More...
 

Protected Member Functions

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)
 
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...
 
void forceColorsToLegacy ()
 Helper function to coerce all colors to legacy-compatible when switching from GAL to legacy canvas. 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 void unitsChangeRefresh () override
 Function unitsChangeRefresh is called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
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...
 
 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 updateGridSelectBox ()
 
void updateZoomSelectBox ()
 
MODULEloadFootprint (const LIB_ID &aFootprintId) throw ( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception )
 Function loadFootprint attempts to load aFootprintId from the footprint library table. More...
 
void SetScreen (BASE_SCREEN *aScreen)
 
void GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void OnChangeIconsOptions (wxCommandEvent &event) override
 Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual 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 ()
 

Protected Attributes

PCB_LAYER_WIDGETm_Layers
 
DRCm_drc
 the DRC controller, see drc.cpp More...
 
PARAM_CFG_ARRAY m_configSettings
 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
 
wxAuiToolBar * m_auxiliaryToolBar
 Auxiliary tool bar typically shown below the main tool bar at the top of the main window. More...
 
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
 prevents opening same file multiple times. More...
 
EDA_HOTKEY_CONFIGm_hotkeysDescrList
 
int m_LastGridSizeId
 
bool m_drawGrid
 
bool m_showPageLimits
 true to display the page limits More...
 
COLOR4D m_gridColor
 Grid color. More...
 
COLOR4D m_drawBgColor
 the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema More...
 
double m_zoomLevelCoeff
 a suitable value to convert the internal zoom scaling factor More...
 
int m_UndoRedoCountMax
 default Undo/Redo command Max depth, to be handed More...
 
EDA_DRAW_PANELm_canvas
 The area to draw on. More...
 
TOOL_MANAGERm_toolManager
 
TOOL_DISPATCHERm_toolDispatcher
 
ACTIONSm_actions
 
int m_lastDrawToolId
 Tool ID of previously active draw tool bar button. More...
 
bool m_showAxis
 True shows the X and Y axis indicators. More...
 
bool m_showGridAxis
 True shows the grid axis indicators. More...
 
bool m_showOriginAxis
 True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files. More...
 
bool m_showBorderAndTitleBlock
 True shows the drawing border and title block. More...
 
wxChoice * m_gridSelectBox
 Choice box to choose the grid size. More...
 
wxChoice * m_zoomSelectBox
 Choice box to choose the zoom value. More...
 
wxAuiToolBar * m_drawToolBar
 The tool bar that contains the buttons for quick access to the application draw tools. More...
 
wxAuiToolBar * m_optionsToolBar
 The options tool bar typcially located on the left edge of the main window. More...
 
EDA_MSG_PANELm_messagePanel
 Panel used to display information at the bottom of the main window. More...
 
int m_MsgFrameHeight
 
bool m_movingCursorWithKeyboard
 One-shot to avoid a recursive mouse event during hotkey movement. More...
 
bool m_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...
 

Private Member Functions

void updateTraceWidthSelectBox ()
 
void updateViaSizeSelectBox ()
 

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

Definition at line 81 of file wxPcbStruct.h.

Constructor & Destructor Documentation

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

Definition at line 500 of file pcbframe.cpp.

501 {
502  delete m_drc;
503 }
DRC * m_drc
the DRC controller, see drc.cpp
Definition: wxPcbStruct.h:96

Member Function Documentation

void PCB_EDIT_FRAME::Access_to_External_Tool ( wxCommandEvent &  event)

Function Access_to_External_Tool Run an external tool (like freeroute )

Definition at line 47 of file dialog_freeroute_exchange.cpp.

48 {
49  DIALOG_FREEROUTE dialog( this );
50  dialog.ShowModal();
51 }
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 300 of file editrack.cpp.

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

Referenced by Begin_Route().

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

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

Referenced by Process_Special_Functions().

73 {
74  if( !aZone )
75  return;
76 
78  s_CurrentZone = aZone;
79 
80  // set zone settings to the current zone
81  ZONE_SETTINGS zoneInfo = GetZoneSettings();
82  zoneInfo << *aZone;
83  SetZoneSettings( zoneInfo );
84 
85  // Use the general event handler to set others params (like toolbar)
86  wxCommandEvent evt;
87  evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
88  OnSelectTool( evt );
89 }
const ZONE_SETTINGS & GetZoneSettings() const
static bool s_AddCutoutToCurrentZone
void OnSelectTool(wxCommandEvent &aEvent)
Definition: edit.cpp:1422
static ZONE_CONTAINER * s_CurrentZone
Class ZONE_SETTINGS handles zones parameters.
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
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 92 of file zones_by_polygon.cpp.

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

Referenced by Process_Special_Functions().

93 {
94  if( !aZone )
95  return;
96 
98  s_CurrentZone = aZone;
99 
100  // set zones setup to the current zone
101  ZONE_SETTINGS zoneInfo = GetZoneSettings();
102  zoneInfo << *aZone;
103  SetZoneSettings( zoneInfo );
104 
105  // Use the general event handle to set others params (like toolbar)
106  wxCommandEvent evt;
107  evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
108  OnSelectTool( evt );
109 }
const ZONE_SETTINGS & GetZoneSettings() const
static bool s_AddCutoutToCurrentZone
void OnSelectTool(wxCommandEvent &aEvent)
Definition: edit.cpp:1422
static ZONE_CONTAINER * s_CurrentZone
Class ZONE_SETTINGS handles zones parameters.
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

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

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

Definition at line 671 of file basicframe.cpp.

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

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

672 {
673  wxMenu* menu = NULL;
674  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
675 
676  if( item ) // This menu exists, do nothing
677  return;
678 
679  menu = new wxMenu;
680 
681  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
682  _( "Icons in Menus" ), wxEmptyString,
683  wxITEM_CHECK ) );
684  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
685 
686  AddMenuItem( MasterMenu, menu,
688  _( "Icons Options" ),
689  _( "Select show icons in menus and icons sizes" ),
690  KiBitmap( hammer_xpm ) );
691 }
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:55
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

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

Parameters
aMasterMenu= the menu to populate.

Definition at line 239 of file zoom.cpp.

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

240 {
241  int maxZoomIds;
242  double zoom;
243  wxString msg;
244  BASE_SCREEN* screen = m_canvas->GetScreen();
245 
246  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
247  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
248  msg = AddHotkeyName( _( "Zoom in" ), m_hotkeysDescrList, HK_ZOOM_IN );
249  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
250  msg = AddHotkeyName( _( "Zoom out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
251  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
252  msg = AddHotkeyName( _( "Redraw view" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
253  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
254  msg = AddHotkeyName( _( "Zoom auto" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
255  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
256 
257 
258  wxMenu* zoom_choice = new wxMenu;
259  AddMenuItem( MasterMenu, zoom_choice,
260  ID_POPUP_ZOOM_SELECT, _( "Zoom Select" ),
261  KiBitmap( zoom_selection_xpm ) );
262 
263  zoom = screen->GetZoom();
265  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
266  maxZoomIds : screen->m_ZoomList.size();
267 
268  // Populate zoom submenu.
269  for( int i = 0; i < maxZoomIds; i++ )
270  {
271  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
272 
273  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
274  wxEmptyString, wxITEM_CHECK );
275  if( zoom == screen->m_ZoomList[i] )
276  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
277  }
278 
279  // Create grid submenu as required.
280  if( screen->GetGridCount() )
281  {
282  wxMenu* gridMenu = new wxMenu;
283  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
284  _( "Grid Select" ), KiBitmap( grid_select_xpm ) );
285 
286  wxArrayString gridsList;
287  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
288 
289  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
290  {
291  GRID_TYPE& grid = screen->GetGrid( i );
292  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
293 
294  if( (int)i == icurr )
295  gridMenu->Check( grid.m_CmdId, true );
296  }
297  }
298 
299  MasterMenu->AppendSeparator();
300  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
301 }
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:55
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
size_t GetGridCount() const
Function GetGridCount().
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:76
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:85
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.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
void PCB_BASE_FRAME::AddPad ( MODULE Module,
bool  draw 
)
inherited

Definition at line 110 of file pad_edition_functions.cpp.

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

Referenced by FOOTPRINT_EDIT_FRAME::OnLeftClick().

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

Definition at line 888 of file draw_frame.cpp.

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

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

889 {
890  BASE_SCREEN* screen = GetScreen();
891 
892  if( !screen || !m_canvas )
893  return;
894 
895  double scale = screen->GetScalingFactor();
896 
897  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
898  aCenterPositionIU.x, aCenterPositionIU.y, scale );
899 
900  // Calculate the portion of the drawing that can be displayed in the
901  // client area at the current zoom level.
902 
903  // visible viewport in device units ~ pixels
904  wxSize clientSizeDU = m_canvas->GetClientSize();
905 
906  // Size of the client window in IU
907  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
908 
909  // Full drawing or "page" rectangle in internal units
910  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
911 
912  // Account for scrollbars
913  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
914  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
915  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
916 
917  // The upper left corner of the client rectangle in internal units.
918  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
919  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
920 
921  // If drawn around the center, adjust the client rectangle accordingly.
922  if( screen->m_Center )
923  {
924  // half page offset.
925  xIU += pageRectIU.GetWidth() / 2.0;
926  yIU += pageRectIU.GetHeight() / 2.0;
927  }
928 
929  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
930  wxPoint centerPositionIU;
931 
932  // put "int" limits on the clientRect
933  if( clientRectIU.GetLeft() < VIRT_MIN )
934  clientRectIU.MoveLeftTo( VIRT_MIN );
935  if( clientRectIU.GetTop() < VIRT_MIN )
936  clientRectIU.MoveTopTo( VIRT_MIN );
937  if( clientRectIU.GetRight() > VIRT_MAX )
938  clientRectIU.MoveRightTo( VIRT_MAX );
939  if( clientRectIU.GetBottom() > VIRT_MAX )
940  clientRectIU.MoveBottomTo( VIRT_MAX );
941 
942  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
943  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
944 
945  if( screen->m_Center )
946  {
947  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
948  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
949  }
950 
951  DSIZE virtualSizeIU;
952 
953  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
954  {
955  virtualSizeIU.x = pageRectIU.GetSize().x;
956  }
957  else
958  {
959  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
960  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
961 
962  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
963  {
964  if( pageCenterX > clientCenterX )
965  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
966  else if( pageCenterX < clientCenterX )
967  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
968  else
969  virtualSizeIU.x = clientRectIU.GetWidth();
970  }
971  else
972  {
973  if( pageCenterX > clientCenterX )
974  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
975  else if( pageCenterX < clientCenterX )
976  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
977  else
978  virtualSizeIU.x = pageRectIU.GetWidth();
979  }
980  }
981 
982  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
983  {
984  virtualSizeIU.y = pageRectIU.GetSize().y;
985  }
986  else
987  {
988  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
989  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
990 
991  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
992  {
993  if( pageCenterY > clientCenterY )
994  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
995  else if( pageCenterY < clientCenterY )
996  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
997  else
998  virtualSizeIU.y = clientRectIU.GetHeight();
999  }
1000  else
1001  {
1002  if( pageCenterY > clientCenterY )
1003  virtualSizeIU.y = pageRectIU.GetHeight() +
1004  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1005  else if( pageCenterY < clientCenterY )
1006  virtualSizeIU.y = pageRectIU.GetHeight() +
1007  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1008  else
1009  virtualSizeIU.y = pageRectIU.GetHeight();
1010  }
1011  }
1012 
1013  // put "int" limits on the virtualSizeIU
1014  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1015  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1016 
1017  if( screen->m_Center )
1018  {
1019  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1020  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1021  }
1022  else
1023  {
1024  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1025  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1026  }
1027 
1028  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1029  * around cursor to jump around. This reported problem occurs when the
1030  * zoom point is not on a pixel per unit increment. If you set the
1031  * pixels per unit to 10, you have potential for the zoom point to
1032  * jump around +/-5 pixels from the nearest grid point.
1033  */
1034  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1035 
1036  // Number of scroll bar units for the given zoom level in device units.
1037  double unitsX = virtualSizeIU.x * scale;
1038  double unitsY = virtualSizeIU.y * scale;
1039 
1040  // Store the requested center position for later use
1041  SetScrollCenterPosition( aCenterPositionIU );
1042 
1043  // Calculate the scroll bar position in internal units to place the
1044  // center position at the center of client rectangle.
1045  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1046  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1047 
1048  // Convert scroll bar position to device units.
1049  posX = KiROUND( posX * scale );
1050  posY = KiROUND( posY * scale );
1051 
1052  if( posX < 0 )
1053  {
1054  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1055  posX = 0;
1056  }
1057 
1058  if( posX > unitsX )
1059  {
1060  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1061  posX = unitsX;
1062  }
1063 
1064  if( posY < 0 )
1065  {
1066  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1067  posY = 0;
1068  }
1069 
1070  if( posY > unitsY )
1071  {
1072  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1073  posY = unitsY;
1074  }
1075 
1076  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1077  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1078 
1079  wxLogTrace( traceScrollSettings,
1080  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1081  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1082  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1084  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1085  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1086 
1087  bool noRefresh = true;
1088 
1089  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1090  screen->m_ScrollPixelsPerUnitY,
1091  screen->m_ScrollbarNumber.x,
1092  screen->m_ScrollbarNumber.y,
1093  screen->m_ScrollbarPos.x,
1094  screen->m_ScrollbarPos.y, noRefresh );
1095 }
wxSize m_ScrollbarNumber
Current virtual draw area size in scroll units.
#define VIRT_MAX
max X or Y coordinate in virtual space
Definition: draw_frame.cpp:885
int m_ScrollPixelsPerUnitY
Pixels per scroll unit in the vertical direction.
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:92
#define VIRT_MIN
min X or Y coordinate in virtual space
Definition: draw_frame.cpp:884
void SetScrollCenterPosition(const wxPoint &aPoint)
Class BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated class Vec.
Definition: box2.h:41
virtual const wxSize GetPageSizeIU() const =0
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
bool m_Center
Center on screen.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
int m_ScrollPixelsPerUnitX
Pixels per scroll unit in the horizontal direction.
wxPoint m_ScrollbarPos
Current scroll bar position in scroll units.
static const wxString traceScrollSettings(wxT("KicadScrollSettings"))
Definition for enabling and disabling scroll bar setting trace output.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
static const double MAX_AXIS
Definition: draw_frame.cpp:882
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
#define min(a, b)
Definition: auxiliary.h:85
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.

References PCB_BASE_FRAME::BestZoom(), BLOCK_PRESELECT_MOVE, BOARD::BuildListOfNets(), EDA_RECT::Centre(), NETCLASSES::Clear(), EDA_ITEM::ClearFlags(), DisplayError(), FLAG0, Format(), BOARD::GetArea(), BOARD::GetAreaCount(), PCB_BASE_FRAME::GetBoard(), MODULE::GetBoundingBox(), EDA_ITEM::GetBoundingBox(), GetChars(), 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(), PLUGIN::Load(), BASE_SCREEN::m_BlockLocate, BOARD::m_Drawings, BOARD::m_Modules, BOARD_DESIGN_SETTINGS::m_NetClasses, EDA_RECT::Merge(), MODULE::Next(), BOARD_ITEM::Next(), plugin_type(), IO_MGR::PluginFind(), PICKED_ITEMS_LIST::PushItem(), ReCreateLayerBox(), ReFillLayerWidget(), 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().

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()->m_Drawings.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  track->ClearFlags( FLAG0 );
90 
91  wxString msg = wxString::Format( _(
92  "Error loading board.\n%s" ),
93  GetChars( ioe.What() )
94  );
95  DisplayError( this, msg );
96 
97  return false;
98  }
99 
100  // Now prepare a block move command to place the new items, and
101  // prepare the undo command.
102  BLOCK_SELECTOR& blockmove = GetScreen()->m_BlockLocate;
104  PICKED_ITEMS_LIST& blockitemsList = blockmove.GetItems();
105  PICKED_ITEMS_LIST undoListPicker;
106  ITEM_PICKER picker( NULL, UR_NEW );
107 
108  EDA_RECT bbox; // the new items bounding box, for block move
109  bool bboxInit = true; // true until the bounding box is initialized
110 
111  for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
112  {
113  if( track->GetFlags() & FLAG0 )
114  {
115  track->ClearFlags( FLAG0 );
116  continue;
117  }
118 
119  track->SetFlags( IS_MOVED );
120  picker.SetItem( track );
121  undoListPicker.PushItem( picker );
122  blockitemsList.PushItem( picker );
123 
124  if( bboxInit )
125  bbox = track->GetBoundingBox();
126  else
127  bbox.Merge( track->GetBoundingBox() );
128 
129  bboxInit = false;
130  }
131 
132  if( module )
133  module = module->Next();
134  else
135  module = GetBoard()->m_Modules;
136 
137  for( ; module; module = module->Next() )
138  {
139  module->SetFlags( IS_MOVED );
140  picker.SetItem( module );
141  undoListPicker.PushItem( picker );
142  blockitemsList.PushItem( picker );
143 
144  if( bboxInit )
145  bbox = module->GetBoundingBox();
146  else
147  bbox.Merge( module->GetBoundingBox() );
148 
149  bboxInit = false;
150  }
151 
152  if( drawing )
153  drawing = drawing->Next();
154  else
155  drawing = GetBoard()->m_Drawings;
156 
157  for( ; drawing; drawing = drawing->Next() )
158  {
159  drawing->SetFlags( IS_MOVED );
160  picker.SetItem( drawing );
161  undoListPicker.PushItem( picker );
162  blockitemsList.PushItem( picker );
163 
164  if( bboxInit )
165  bbox = drawing->GetBoundingBox();
166  else
167  bbox.Merge( drawing->GetBoundingBox() );
168 
169  bboxInit = false;
170  }
171 
172  for( ZONE_CONTAINER* zone = GetBoard()->GetArea( zonescount ); zone;
173  zone = GetBoard()->GetArea( zonescount ) )
174  {
175  zone->SetFlags( IS_MOVED );
176  picker.SetItem( zone );
177  undoListPicker.PushItem( picker );
178  blockitemsList.PushItem( picker );
179  zonescount++;
180 
181  if( bboxInit )
182  bbox = zone->GetBoundingBox();
183  else
184  bbox.Merge( zone->GetBoundingBox() );
185 
186  bboxInit = false;
187  }
188 
189  SaveCopyInUndoList( undoListPicker, UR_NEW );
190 
191  // we should not ask PLUGINs to do these items:
192  int copperLayerCount = GetBoard()->GetCopperLayerCount();
193 
194  if( copperLayerCount > initialCopperLayerCount )
195  GetBoard()->SetCopperLayerCount( copperLayerCount );
196 
197  // Enable all used layers, and make them visible:
198  LSET enabledLayers = GetBoard()->GetEnabledLayers();
199  enabledLayers |= initialEnabledLayers;
200  GetBoard()->SetEnabledLayers( enabledLayers );
201  GetBoard()->SetVisibleLayers( enabledLayers );
204 
205  if( IsGalCanvasActive() )
206  static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( GetBoard() );
207 
210 
211  SetStatusText( wxEmptyString );
212  BestZoom();
213 
214  // Finish block move command:
215  wxPoint cpos = GetNearestGridPosition( bbox.Centre() );
216  blockmove.SetOrigin( bbox.GetOrigin() );
217  blockmove.SetSize( bbox.GetSize() );
218  blockmove.SetLastCursorPosition( cpos );
219  HandleBlockEnd( NULL );
220 
221  return true;
222 }
void BuildListOfNets()
Definition: class_board.h:764
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect...
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
MODULE * Next() const
Definition: class_module.h:99
int GetCopperLayerCount() const
Function GetCopperLayerCount.
void SetCopperLayerCount(int aCount)
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Re create the layer Box by clearing the old list, and building le new one, from the new layers names ...
Definition: tool_pcb.cpp:709
void SetOrigin(const wxPoint &pos)
BOARD * GetBoard() const
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
BOARD_ITEM * Next() const
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:476
const wxPoint & GetOrigin() const
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Function HandleBlockBegin initializes the block command including the command type, initial position, and other variables.
Definition: draw_frame.cpp:804
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Class LSET is a set of PCB_LAYER_IDs.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
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
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
virtual bool HandleBlockEnd(wxDC *DC) override
Function HandleBlockEnd() Handle the "end" of a block command, i.e.
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:242
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:795
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
wxPoint Centre() const
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:172
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:131
virtual double BestZoom() override
Function BestZoom.
void SetSize(const wxSize &size)
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:1022
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
DLIST< MODULE > m_Modules
Definition: class_board.h:243
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
Class EDA_RECT handles the component boundary box.
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
PICKED_ITEMS_LIST & GetItems()
const wxSize GetPageSizeIU() const override
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:803
IO_MGR::PCB_FILE_T plugin_type(const wxString &aFileName, int aCtl)
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading a ne...
Definition: pcbframe.cpp:581
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:51
const wxSize & GetSize() const
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
void SetEnabledLayers(LSET aLayerMask)
Function SetEnabledLayers is a proxy function that calls the correspondent function in m_BoardSetting...
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:112
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 734 of file draw_frame.cpp.

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

Referenced by PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), Fill_Zone(), SCH_PRINTOUT::OnPrintPage(), SCH_EDIT_FRAME::OpenProjectFiles(), LIB_VIEW_FRAME::RedrawActiveWindow(), LIB_EDIT_FRAME::SaveActiveLibrary(), SCH_EDIT_FRAME::SaveEEFile(), SavePcbFile(), ShowNewTrackWhenMovingCursor(), and Solve().

737 {
738  if( m_messagePanel == NULL )
739  return;
740 
741  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
742 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
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
void PCB_EDIT_FRAME::ArchiveModulesOnBoard ( bool  aStoreInNewLib)

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

Definition at line 568 of file librairi.cpp.

References PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DisplayError(), DisplayInfoMessage(), FP_LIB_TABLE::FootprintSave(), PLUGIN::FootprintSave(), PCB_BASE_FRAME::GetBoard(), PROJECT::GetRString(), IO_MGR::KICAD, 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 Process_Special_Functions().

569 {
570  if( GetBoard()->m_Modules == NULL )
571  {
572  DisplayInfoMessage( this, _( "No footprints to archive!" ) );
573  return;
574  }
575 
576  wxString footprintName;
577 
578  if( !aStoreInNewLib )
579  {
580  // The footprints are saved in an existing .pretty library in the fp lib table
581  PROJECT& prj = Prj();
582  wxString last_nickname = prj.GetRString( PROJECT::PCB_LIB_NICKNAME );
583  wxString nickname = SelectLibrary( last_nickname );
584 
585  if( !nickname ) // Aborted
586  return;
587 
588  prj.SetRString( PROJECT::PCB_LIB_NICKNAME, nickname );
589 
590  try
591  {
592  FP_LIB_TABLE* tbl = prj.PcbFootprintLibs();
593 
594  for( MODULE* curr_fp = GetBoard()->m_Modules; curr_fp; curr_fp = curr_fp->Next() )
595  {
596  if( !curr_fp->GetFPID().GetLibItemName().empty() ) // Can happen with old boards.
597  tbl->FootprintSave( nickname, curr_fp, false );
598  }
599  }
600  catch( const IO_ERROR& ioe )
601  {
602  DisplayError( this, ioe.What() );
603  }
604  }
605  else
606  {
607  // The footprints are saved in a new .pretty library.
608  // If this library already exists, all previous footprints will be deleted
609  wxString libPath = CreateNewLibrary();
610 
611  if( libPath.IsEmpty() ) // Aborted
612  return;
613 
615  PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
616 
617  for( MODULE* curr_fp = GetBoard()->m_Modules; curr_fp; curr_fp = curr_fp->Next() )
618  {
619  try
620  {
621  if( !curr_fp->GetFPID().GetLibItemName().empty() ) // Can happen with old boards.
622  pi->FootprintSave( libPath, curr_fp );
623  }
624  catch( const IO_ERROR& ioe )
625  {
626  DisplayError( this, ioe.What() );
627  }
628  }
629  }
630 }
Class PROJECT holds project specific data.
Definition: project.h:52
BOARD * GetBoard() const
wxString CreateNewLibrary()
Function CreateNewLibrary prompts user for a library path, then creates a new footprint library at th...
Definition: librairi.cpp:439
BOARD_ITEM * Next() const
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:476
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
S-expression Pcbnew file format.
Definition: io_mgr.h:54
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:162
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
void DisplayInfoMessage(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:89
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:177
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
wxString SelectLibrary(const wxString &aNicknameExisting)
Function SelectLibrary puts up a dialog and allows the user to pick a library, for unspecified use...
Definition: librairi.cpp:822
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:51
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
void PCB_EDIT_FRAME::Attribut_net ( wxDC *  DC,
int  net_code,
bool  Flag_On 
)

Definition at line 97 of file attribut.cpp.

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

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.
Definition: pcbframe.cpp:996
BOARD * GetBoard() const
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:128
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
Definition: gr_basic.h:42
int GetNetCode() const
Function GetNetCode.
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:92
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
TRACK * Next() const
Definition: class_track.h:98
void SetState(int type, int state)
Definition: base_struct.h:242
DLIST< TRACK > m_Track
Definition: class_board.h:244
void PCB_EDIT_FRAME::Attribut_Segment ( TRACK track,
wxDC *  DC,
bool  Flag_On 
)

Definition at line 50 of file attribut.cpp.

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

Referenced by Process_Special_Functions().

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( items );
63  SetMsgPanel( items );
64 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Definition: pcbframe.cpp:996
void GetMsgPanelInfo(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)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:754
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:128
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
Definition: gr_basic.h:42
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:92
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
void SetState(int type, int state)
Definition: base_struct.h:242
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
void PCB_EDIT_FRAME::Attribut_Track ( TRACK track,
wxDC *  DC,
bool  Flag_On 
)

Definition at line 68 of file attribut.cpp.

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

Referenced by Process_Special_Functions().

69 {
70  TRACK* Track;
71  int nb_segm;
72 
73  if( (track == NULL ) || (track->Type() == PCB_ZONE_T) )
74  return;
75 
76  m_canvas->CrossHairOff( DC ); // Erase cursor shape
77  Track = GetBoard()->MarkTrace( 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 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Definition: pcbframe.cpp:996
BOARD * GetBoard() const
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:128
class SEGZONE, a segment used to fill a zone area (segment on a copper layer)
Definition: typeinfo.h:109
TRACK * MarkTrace(TRACK *aTrace, int *aCount, double *aTraceLength, double *aInPackageLength, bool aReorder)
Function MarkTrace marks a chain of trace segments, connected to aTrace.
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
Definition: gr_basic.h:42
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
TRACK * Next() const
Definition: class_track.h:98
void SetState(int type, int state)
Definition: base_struct.h:242
void DrawTraces(EDA_DRAW_PANEL *panel, wxDC *DC, TRACK *aStartTrace, int nbsegment, GR_DRAWMODE mode_color)
Function DrawTraces Draws n consecutive track segments in list.
Definition: tr_modif.cpp:48
void PCB_EDIT_FRAME::AutoPlaceModule ( MODULE Module,
int  place_mode,
wxDC *  DC 
)

Function AutoPlaceModule automatically places footprints within the confines of the PCB edges.

The components with the FIXED status are not moved. If the menu is calling the placement of 1 module, it will be replaced.

Definition at line 129 of file auto_place_footprints.cpp.

References MODULE::CalculateBoundingBox(), PCB_BASE_FRAME::Compile_Ratsnest(), EDA_RECT::Contains(), CurrPosition, MODULE::Draw(), drawPlacementRoutingMatrix(), ESC, g_Route_Layer_BOTTOM, g_Route_Layer_TOP, genModuleOnRoutingMatrix(), genPlacementRoutingMatrix(), PCB_BASE_FRAME::GetBoard(), PICKED_ITEMS_LIST::GetCount(), EDA_DRAW_FRAME::GetCrossHairPosition(), BASE_SCREEN::GetGridSize(), getOptimalModulePlacement(), MODULE::GetOrientation(), MODULE::GetPlacementCost180(), MODULE::GetPlacementCost90(), MODULE::GetPosition(), PCB_BASE_FRAME::GetScreen(), GR_XOR, MODULE::IsLocked(), IsOK(), MATRIX_ROUTING_HEAD::m_BrdBox, EDA_DRAW_FRAME::m_canvas, MATRIX_ROUTING_HEAD::m_GridRouting, EDA_DRAW_FRAME::m_messagePanel, BOARD::m_Modules, PICKED_ITEMS_LIST::m_Status, BOARD::m_Status_Pcb, MinCout, MODULE::NeedsPlaced(), MODULE::Next(), OrientPenality, PickModule(), PLACE_1_MODULE, PLACE_ALL, PLACE_INCREMENTAL, PLACE_OUT_OF_BOARD, PCB_BASE_FRAME::PlaceModule(), PICKED_ITEMS_LIST::PushItem(), EDA_DRAW_PANEL::ReDraw(), PCB_BASE_FRAME::Rotate_Module(), RoutingMatrix, PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_DRAW_PANEL::SetAbortRequest(), EDA_DRAW_FRAME::SetCrossHairPosition(), MODULE::SetIsPlaced(), ITEM_PICKER::SetItem(), MODULE::SetNeedsPlaced(), MATRIX_ROUTING_HEAD::UnInitRoutingMatrix(), and UR_CHANGED.

Referenced by OnPlaceOrRouteFootprints().

130 {
131  MODULE* currModule = NULL;
132  wxPoint PosOK;
133  wxPoint memopos;
134  int error;
135  PCB_LAYER_ID lay_tmp_TOP, lay_tmp_BOTTOM;
136 
137  // Undo: init list
138  PICKED_ITEMS_LIST newList;
139 
140  newList.m_Status = UR_CHANGED;
141  ITEM_PICKER picker( NULL, UR_CHANGED );
142 
143  if( GetBoard()->m_Modules == NULL )
144  return;
145 
146  m_canvas->SetAbortRequest( false );
147 
148  switch( place_mode )
149  {
150  case PLACE_1_MODULE:
151  currModule = Module;
152 
153  if( currModule == NULL )
154  return;
155 
156  currModule->SetIsPlaced( false );
157  currModule->SetNeedsPlaced( false );
158  break;
159 
160  case PLACE_OUT_OF_BOARD:
161  break;
162 
163  case PLACE_ALL:
164 
165  if( !IsOK( this, _( "Footprints NOT LOCKED will be moved" ) ) )
166  return;
167 
168  break;
169 
170  case PLACE_INCREMENTAL:
171 
172  if( !IsOK( this, _( "Footprints NOT PLACED will be moved" ) ) )
173  return;
174 
175  break;
176  }
177 
178  memopos = CurrPosition;
179  lay_tmp_BOTTOM = g_Route_Layer_BOTTOM;
180  lay_tmp_TOP = g_Route_Layer_TOP;
181 
183 
184  // Ensure Board.m_GridRouting has a reasonable value:
185  if( RoutingMatrix.m_GridRouting < Millimeter2iu( 0.25 ) )
186  RoutingMatrix.m_GridRouting = Millimeter2iu( 0.25 );
187 
188  // Compute module parameters used in auto place
190  return;
191 
192  int moduleCount = 0;
193  Module = GetBoard()->m_Modules;
194 
195  for( ; Module != NULL; Module = Module->Next() )
196  {
197  Module->SetNeedsPlaced( false );
198 
199  switch( place_mode )
200  {
201  case PLACE_1_MODULE:
202 
203  if( currModule == Module )
204  {
205  // Module will be placed, add to undo.
206  picker.SetItem( currModule );
207  newList.PushItem( picker );
208  Module->SetNeedsPlaced( true );
209  }
210 
211  break;
212 
213  case PLACE_OUT_OF_BOARD:
214  Module->SetIsPlaced( false );
215 
216  if( Module->IsLocked() )
217  break;
218 
219  if( !RoutingMatrix.m_BrdBox.Contains( Module->GetPosition() ) )
220  {
221  // Module will be placed, add to undo.
222  picker.SetItem( Module );
223  newList.PushItem( picker );
224  Module->SetNeedsPlaced( true );
225  }
226 
227  break;
228 
229  case PLACE_ALL:
230  Module->SetIsPlaced( false );
231 
232  if( Module->IsLocked() )
233  break;
234 
235  // Module will be placed, add to undo.
236  picker.SetItem( Module );
237  newList.PushItem( picker );
238  Module->SetNeedsPlaced( true );
239  break;
240 
241  case PLACE_INCREMENTAL:
242 
243  if( Module->IsLocked() )
244  {
245  Module->SetIsPlaced( false );
246  break;
247  }
248 
249  if( !Module->NeedsPlaced() )
250  {
251  // Module will be placed, add to undo.
252  picker.SetItem( Module );
253  newList.PushItem( picker );
254  Module->SetNeedsPlaced( true );
255  }
256 
257  break;
258  }
259 
260  if( Module->NeedsPlaced() ) // Erase from screen
261  {
262  moduleCount++;
263  Module->Draw( m_canvas, DC, GR_XOR );
264  }
265  else
266  {
267  genModuleOnRoutingMatrix( Module );
268  }
269  }
270 
271  // Undo command: prepare list
272  if( newList.GetCount() )
273  SaveCopyInUndoList( newList, UR_CHANGED );
274 
275  int cnt = 0;
276  wxString msg;
277 
278  while( ( Module = PickModule( this, DC ) ) != NULL )
279  {
280  // Display some info about activity, module placement can take a while:
281  msg.Printf( _( "Place footprint %d of %d" ), cnt, moduleCount );
282  SetStatusText( msg );
283 
284  double initialOrient = Module->GetOrientation();
285  // Display fill area of interest, barriers, penalties.
287 
288  error = getOptimalModulePlacement( this, Module, DC );
289  double bestScore = MinCout;
290  double bestRotation = 0.0;
291  int rotAllowed;
292  PosOK = CurrPosition;
293 
294  if( error == ESC )
295  goto end_of_tst;
296 
297  // Try orientations 90, 180, 270 degrees from initial orientation
298  rotAllowed = Module->GetPlacementCost180();
299 
300  if( rotAllowed != 0 )
301  {
302  Rotate_Module( DC, Module, 1800.0, true );
303  error = getOptimalModulePlacement( this, Module, DC );
304  MinCout *= OrientPenality[rotAllowed];
305 
306  if( bestScore > MinCout ) // This orientation is better.
307  {
308  PosOK = CurrPosition;
309  bestScore = MinCout;
310  bestRotation = 1800.0;
311  }
312  else
313  {
314  Rotate_Module( DC, Module, initialOrient, false );
315  }
316 
317  if( error == ESC )
318  goto end_of_tst;
319  }
320 
321  // Determine if the best orientation of a module is 90.
322  rotAllowed = Module->GetPlacementCost90();
323 
324  if( rotAllowed != 0 )
325  {
326  Rotate_Module( DC, Module, 900.0, true );
327  error = getOptimalModulePlacement( this, Module, DC );
328  MinCout *= OrientPenality[rotAllowed];
329 
330  if( bestScore > MinCout ) // This orientation is better.
331  {
332  PosOK = CurrPosition;
333  bestScore = MinCout;
334  bestRotation = 900.0;
335  }
336  else
337  {
338  Rotate_Module( DC, Module, initialOrient, false );
339  }
340 
341  if( error == ESC )
342  goto end_of_tst;
343  }
344 
345  // Determine if the best orientation of a module is -90.
346  if( rotAllowed != 0 )
347  {
348  Rotate_Module( DC, Module, 2700.0, true );
349  error = getOptimalModulePlacement( this, Module, DC );
350  MinCout *= OrientPenality[rotAllowed];
351 
352  if( bestScore > MinCout ) // This orientation is better.
353  {
354  PosOK = CurrPosition;
355  bestScore = MinCout;
356  bestRotation = 2700.0;
357  }
358  else
359  {
360  Rotate_Module( DC, Module, initialOrient, false );
361  }
362 
363  if( error == ESC )
364  goto end_of_tst;
365  }
366 
367 end_of_tst:
368 
369  if( error == ESC )
370  break;
371 
372  // Place module.
374  SetCrossHairPosition( PosOK );
375 
376  PlaceModule( Module, DC );
377 
378  bestRotation += initialOrient;
379 
380  if( bestRotation != Module->GetOrientation() )
381  Rotate_Module( DC, Module, bestRotation, false );
382 
384 
385  Module->CalculateBoundingBox();
386 
387  genModuleOnRoutingMatrix( Module );
388  Module->SetIsPlaced( true );
389  Module->SetNeedsPlaced( false );
390  }
391 
392  CurrPosition = memopos;
393 
395 
396  g_Route_Layer_TOP = lay_tmp_TOP;
397  g_Route_Layer_BOTTOM = lay_tmp_BOTTOM;
398 
399  Module = GetBoard()->m_Modules;
400 
401  for( ; Module != NULL; Module = Module->Next() )
402  {
403  Module->CalculateBoundingBox();
404  }
405 
406  GetBoard()->m_Status_Pcb = 0;
407  Compile_Ratsnest( DC, true );
408  m_canvas->ReDraw( DC, true );
409 }
static wxPoint CurrPosition
PCB_LAYER_ID g_Route_Layer_TOP
Definition: pcbnew.cpp:78
PCB_LAYER_ID g_Route_Layer_BOTTOM
Definition: pcbnew.cpp:79
static int getOptimalModulePlacement(PCB_EDIT_FRAME *aFrame, MODULE *aModule, wxDC *aDC)
int genPlacementRoutingMatrix(BOARD *aBrd, EDA_MSG_PANEL *messagePanel)
static const double OrientPenality[11]
double MinCout
static void drawPlacementRoutingMatrix(BOARD *aBrd, wxDC *DC)
bool Contains(const wxPoint &aPoint) const
Function Contains.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw draws the footprint to the aDC.
const wxPoint & GetPosition() const override
Definition: class_module.h:143
MODULE * Next() const
Definition: class_module.h:99
void SetNeedsPlaced(bool needsPlaced)
Definition: class_module.h:251
BOARD * GetBoard() const
void Rotate_Module(wxDC *DC, MODULE *module, double angle, bool incremental)
Definition: modules.cpp:430
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
bool NeedsPlaced() const
Definition: class_module.h:250
static MODULE * PickModule(PCB_EDIT_FRAME *pcbframe, wxDC *DC)
Function PickModule find the "best" module place The criteria are:
int GetPlacementCost90() const
Definition: class_module.h:525
#define ESC
Definition: common.h:87
void PlaceModule(MODULE *aModule, wxDC *aDC, bool aDoNotRecreateRatsnest=false)
Function PlaceModule places aModule at the current cursor position and updates module coordinates wit...
Definition: modules.cpp:351
PCB_LAYER_ID
A quick note on layer IDs:
double GetOrientation() const
Definition: class_module.h:147
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
void SetIsPlaced(bool isPlaced)
Definition: class_module.h:242
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:172
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:223
void SetAbortRequest(bool aAbortRequest)
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:165
unsigned GetCount() const
Function GetCount.
MATRIX_ROUTING_HEAD RoutingMatrix
Definition: autorout.cpp:51
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void ReDraw(wxDC *aDC, bool aEraseBackground=true)
Definition: draw_panel.cpp:608
DLIST< MODULE > m_Modules
Definition: class_board.h:243
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
EDA_RECT m_BrdBox
Definition: autorout.h:115
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void genModuleOnRoutingMatrix(MODULE *Module)
int GetPlacementCost180() const
Definition: class_module.h:522
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:111
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240
void PCB_EDIT_FRAME::Autoroute ( wxDC *  DC,
int  mode 
)

Definition at line 54 of file autorout.cpp.

References B_Cu, CH_ROUTE_REQ, PCB_BASE_FRAME::Compile_Ratsnest(), g_Route_Layer_BOTTOM, g_Route_Layer_TOP, PCB_BASE_FRAME::GetBoard(), PCB_SCREEN::GetCurItem(), PCB_BASE_FRAME::GetCurItem(), RATSNEST_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD::GetRatsnestsCount(), PCB_BASE_FRAME::GetScreen(), LISTE_RATSNEST_ITEM_OK, BOARD::m_FullRatsnest, RATSNEST_ITEM::m_PadEnd, RATSNEST_ITEM::m_PadStart, PCB_SCREEN::m_Route_Layer_BOTTOM, PCB_SCREEN::m_Route_Layer_TOP, RATSNEST_ITEM::m_Status, MODULE::Pads(), PCB_MODULE_T, PCB_PAD_T, ROUTE_ALL, ROUTE_MODULE, ROUTE_NET, ROUTE_PAD, and EDA_ITEM::Type().

Referenced by OnPlaceOrRouteFootprints().

55 {
56  int start, stop;
57  MODULE* Module = NULL;
58  D_PAD* Pad = NULL;
59  int autoroute_net_code = -1;
60  wxString msg;
61 
62  if( GetBoard()->GetCopperLayerCount() > 1 )
63  {
66  }
67  else
68  {
70  }
71 
72  switch( mode )
73  {
74  case ROUTE_NET:
75  if( GetScreen()->GetCurItem() )
76  {
77  switch( GetScreen()->GetCurItem()->Type() )
78  {
79  case PCB_PAD_T:
80  Pad = (D_PAD*) GetScreen()->GetCurItem();
81  autoroute_net_code = Pad->GetNetCode();
82  break;
83 
84  default:
85  break;
86  }
87  }
88  if( autoroute_net_code <= 0 )
89  {
90  wxMessageBox( _( "Net not selected" ) ); return;
91  }
92  break;
93 
94  case ROUTE_MODULE:
95  Module = (MODULE*) GetScreen()->GetCurItem();
96  if( (Module == NULL) || (Module->Type() != PCB_MODULE_T) )
97  {
98  wxMessageBox( _( "Footprint not selected" ) );
99  return;
100  }
101  break;
102 
103  case ROUTE_PAD:
104  Pad = (D_PAD*) GetScreen()->GetCurItem();
105 
106  if( (Pad == NULL) || (Pad->Type() != PCB_PAD_T) )
107  {
108  wxMessageBox( _( "Pad not selected" ) );
109  return;
110  }
111 
112  break;
113  }
114 
115  if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
116  Compile_Ratsnest( DC, true );
117 
118  /* Set the flag on the ratsnest to CH_ROUTE_REQ. */
119  for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
120  {
121  RATSNEST_ITEM* ptmp = &GetBoard()->m_FullRatsnest[ii];
122  ptmp->m_Status &= ~CH_ROUTE_REQ;
123 
124  switch( mode )
125  {
126  case ROUTE_ALL:
127  ptmp->m_Status |= CH_ROUTE_REQ;
128  break;
129 
130  case ROUTE_NET:
131  if( autoroute_net_code == ptmp->GetNet() )
132  ptmp->m_Status |= CH_ROUTE_REQ;
133  break;
134 
135  case ROUTE_MODULE:
136  {
137  D_PAD* pt_pad = (D_PAD*) Module->Pads();
138  for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
139  {
140  if( ptmp->m_PadStart == pt_pad )
141  ptmp->m_Status |= CH_ROUTE_REQ;
142 
143  if( ptmp->m_PadEnd == pt_pad )
144  ptmp->m_Status |= CH_ROUTE_REQ;
145  }
146 
147  break;
148  }
149 
150  case ROUTE_PAD:
151  if( ( ptmp->m_PadStart == Pad ) || ( ptmp->m_PadEnd == Pad ) )
152  ptmp->m_Status |= CH_ROUTE_REQ;
153 
154  break;
155  }
156  }
157 
158  start = time( NULL );
159 
160  /* Calculation of no fixed routing to 5 mils and more. */
162 
163  if( RoutingMatrix.m_GridRouting < (5*IU_PER_MILS) )
164  RoutingMatrix.m_GridRouting = 5*IU_PER_MILS;
165 
166 
167  /* Calculated ncol and nrow, matrix size for routing. */
169  AUTOROUTER_CONTEXT ctx = { this, GetBoard(), RoutingMatrix.m_BrdBox, DC };
170 
172 
173  /* Map the board */
175 
178 
179  if( RoutingMatrix.InitRoutingMatrix() < 0 )
180  {
181  wxMessageBox( _( "No memory for autorouting" ) );
182  RoutingMatrix.UnInitRoutingMatrix(); /* Free memory. */
183  return;
184  }
185 
186  SetStatusText( _( "Place Cells" ) );
187  PlaceCells( GetBoard(), -1, FORCE_PADS );
188 
189  /* Construction of the track list for router. */
191 
192  // DisplayRoutingMatrix( m_canvas, DC );
193 
195 
196  /* Free memory. */
197  FreeQueue();
198  InitWork(); /* Free memory for the list of router connections. */
200  stop = time( NULL ) - start;
201  msg.Printf( wxT( "time = %d second%s" ), stop, ( stop == 1 ) ? wxT( "" ) : wxT( "s" ) );
202  SetStatusText( msg );
203 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
PCB_LAYER_ID g_Route_Layer_TOP
Definition: pcbnew.cpp:78
PCB_LAYER_ID g_Route_Layer_BOTTOM
Definition: pcbnew.cpp:79
int InitRoutingMatrix()
Function InitBoard initializes the data structures.
void PlaceCells(BOARD *Pcb, int net_code, int flag=0)
Function PlaceCells Initialize the matrix routing by setting obstacles for each occupied cell a cell ...
BOARD * GetBoard() const
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
std::vector< RATSNEST_ITEM > m_FullRatsnest
Ratsnest list for the BOARD.
Definition: class_board.h:248
D_PAD * m_PadEnd
Definition: class_netinfo.h:76
class MODULE, a footprint
Definition: typeinfo.h:101
unsigned GetRatsnestsCount() const
Function GetNumRatsnests.
Definition: class_board.h:704
BOARD_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem().
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
PCB_LAYER_ID m_Route_Layer_BOTTOM
int Build_Work(BOARD *Pcb)
int GetNet() const
Function GetNet.
Definition: class_netinfo.h:85
void EraseMsgBox()
Definition: msgpanel.cpp:215
#define FORCE_PADS
Definition: autorout.h:71
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:165
D_PAD * m_PadStart
Definition: class_netinfo.h:75
int GetNetCode() const
Function GetNetCode.
MATRIX_ROUTING_HEAD RoutingMatrix
Definition: autorout.cpp:51
int Solve(AUTOROUTER_CONTEXT &aCtx, int aLayersCount)
Definition: solve.cpp:266
bool ComputeMatrixSize(BOARD *aPcb, bool aUseBoardEdgesOnly=false)
Function ComputeMatrixSize calculates the number of rows and columns of dimensions of aPcb for routin...
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void FreeQueue()
Definition: queue.cpp:60
DLIST< D_PAD > & Pads()
Definition: class_module.h:133
Class RATSNEST_ITEM describes a ratsnest line: a straight line connecting 2 pads. ...
Definition: class_netinfo.h:68
BOARD_ITEM * GetCurItem()
EDA_RECT m_BrdBox
Definition: autorout.h:115
void InitWork()
Definition: work.cpp:68
#define CH_ROUTE_REQ
Definition: class_netinfo.h:59
PCB_LAYER_ID m_Route_Layer_TOP
DRAWSEGMENT * PCB_EDIT_FRAME::Begin_DrawSegment ( DRAWSEGMENT Segment,
STROKE_T  shape,
wxDC *  DC 
)

Definition at line 241 of file editedge.cpp.

References Abort_EditEdge(), BOARD::Add(), EDA_ITEM::ClearFlags(), DRAWSEGMENT::Draw(), DrawSegment(), Edge_Cuts, 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(), DRAWSEGMENT::GetShape(), DRAWSEGMENT::GetStart(), DRAWSEGMENT::GetType(), GR_OR, IS_NEW, EDA_DRAW_FRAME::m_canvas, BOARD_DESIGN_SETTINGS::m_DrawSegmentWidth, BOARD_DESIGN_SETTINGS::m_EdgeSegmentWidth, 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().

242 {
243  int s_large;
244  DRAWSEGMENT* DrawItem;
245 
247 
248  if( GetActiveLayer() == Edge_Cuts )
249  {
251  }
252 
253  if( Segment == NULL ) // Create new trace.
254  {
255  SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
256  Segment->SetFlags( IS_NEW );
257  Segment->SetLayer( GetActiveLayer() );
258  Segment->SetWidth( s_large );
259  Segment->SetShape( shape );
260  Segment->SetAngle( 900 );
261  Segment->SetStart( GetCrossHairPosition() );
262  Segment->SetEnd( GetCrossHairPosition() );
264  }
265  else /* The ending point ccordinate Segment->m_End was updated by he function
266  * DrawSegment() called on a move mouse event
267  * during the segment creation
268  */
269  {
270  if( Segment->GetStart() != Segment->GetEnd() )
271  {
272  if( Segment->GetShape() == S_SEGMENT )
273  {
274  SaveCopyInUndoList( Segment, UR_NEW );
275  GetBoard()->Add( Segment );
276 
277  OnModify();
278  Segment->ClearFlags();
279 
280  Segment->Draw( m_canvas, DC, GR_OR );
281 
282  DrawItem = Segment;
283 
284  SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
285 
286  Segment->SetFlags( IS_NEW );
287  Segment->SetLayer( DrawItem->GetLayer() );
288  Segment->SetWidth( s_large );
289  Segment->SetShape( DrawItem->GetShape() );
290  Segment->SetType( DrawItem->GetType() );
291  Segment->SetAngle( DrawItem->GetAngle() );
292  Segment->SetStart( DrawItem->GetEnd() );
293  Segment->SetEnd( DrawItem->GetEnd() );
294  DrawSegment( m_canvas, DC, wxDefaultPosition, false );
295  }
296  else
297  {
298  End_Edge( Segment, DC );
299  Segment = NULL;
300  }
301  }
302  }
303 
304  return Segment;
305 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Definition: pcbframe.cpp:996
void SetShape(STROKE_T aShape)
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:204
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
BOARD * GetBoard() const
usual segment : line with rounded ends
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
STROKE_T GetShape() const
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
int m_DrawSegmentWidth
current graphic line width (not EDGE layer)
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
int GetType() const
static void DrawSegment(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: editedge.cpp:335
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:172
void SetStart(const wxPoint &aStart)
Definition: gr_basic.h:42
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
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:254
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 m_EdgeSegmentWidth
current graphic line width (EDGE layer only)
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.
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
void End_Edge(DRAWSEGMENT *Segment, wxDC *DC)
Definition: editedge.cpp:308
void SetWidth(int aWidth)
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.

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::Drc(), TRACK::end, END_ONPAD, ENDPOINT_END, g_CurrentTrackList, g_CurrentTrackSegment, g_Drc_On, g_FirstTrackSegment, g_Raccord_45_Auto, g_TwoSegmentTrackBuild, PCB_BASE_FRAME::GetBoard(), EDA_DRAW_FRAME::GetCrossHairPosition(), PCB_BASE_FRAME::GetDesignSettings(), TRACK::GetEnd(), BOARD::GetLockPoint(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD::GetPad(), D_PAD::GetPosition(), PCB_BASE_FRAME::GetScreen(), TRACK::GetWidth(), HighLight(), BOARD::HighLightON(), BOARD::HitTestForAnyFilledArea(), IS_NEW, EDA_DRAW_FRAME::m_canvas, m_drc, BOARD_CONNECTED_ITEM::m_PadsConnected, BOARD::m_Track, PCB_PAD_T, PCB_TRACE_T, DLIST< T >::PushBack(), BOARD::PushHighLight(), 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(), TRACK::SetWidth(), ShowNewTrackWhenMovingCursor(), TRACK::start, and EDA_ITEM::Type().

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

99 {
100  TRACK* trackOnStartPoint = NULL;
101  LSET layerMask( GetScreen()->m_Active_Layer );
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  BuildAirWiresTargetsList( lockPoint, wxPoint( 0, 0 ), true );
162 
163  DBG( g_CurrentTrackList.VerifyListIntegrity() );
164 
165  GetBoard()->HighLightON();
166  GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() );
167 
168  // Display info about track Net class, and init track and vias sizes:
169  g_CurrentTrackSegment->SetNetCode( GetBoard()->GetHighLightNetCode() );
170  SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
171 
172  g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
173  g_CurrentTrackSegment->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
174 
175  if( GetDesignSettings().m_UseConnectedTrackWidth )
176  {
177  if( trackOnStartPoint && trackOnStartPoint->Type() == PCB_TRACE_T )
178  g_CurrentTrackSegment->SetWidth( trackOnStartPoint->GetWidth());
179  }
180 
181  g_CurrentTrackSegment->SetStart( pos );
182  g_CurrentTrackSegment->SetEnd( pos );
183 
184  if( pad )
185  {
186  g_CurrentTrackSegment->m_PadsConnected.push_back( pad );
187  // Useful to display track length, if the pad has a die length:
188  g_CurrentTrackSegment->SetState( BEGIN_ONPAD, true );
189  g_CurrentTrackSegment->start = pad;
190  }
191 
193  {
194  // Create 2nd segment
196 
197  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
198 
201 
202  g_FirstTrackSegment->SetState( BEGIN_ONPAD | END_ONPAD, false );
203  }
204 
205  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
206 
209  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
210 
211  if( g_Drc_On )
212  {
213  if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
214  {
215  return g_CurrentTrackSegment;
216  }
217  }
218  }
219  else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor.
220  {
221  // Test for a D.R.C. error:
222  if( g_Drc_On )
223  {
224  if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
225  return NULL;
226 
227  // We must handle 2 segments
229  {
230  if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), GetBoard()->m_Track ) )
231  return NULL;
232  }
233  }
234 
235  /* Current track is Ok: current segment is kept, and a new one is
236  * created unless the current segment is null, or 2 last are null
237  * if this is a 2 segments track build.
238  */
239  bool CanCreateNewSegment = true;
240 
242  CanCreateNewSegment = false;
243 
245  && g_CurrentTrackSegment->Back()
246  && g_CurrentTrackSegment->Back()->IsNull() )
247  CanCreateNewSegment = false;
248 
249  if( CanCreateNewSegment )
250  {
251  // Erase old track on screen
252  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
253 
254  ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
255 
256  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
257 
258  if( g_Raccord_45_Auto )
259  Add45DegreeSegment( aDC );
260 
261  TRACK* previousTrack = g_CurrentTrackSegment;
262 
263  TRACK* newTrack = (TRACK*)g_CurrentTrackSegment->Clone();
264  g_CurrentTrackList.PushBack( newTrack );
265  newTrack->SetFlags( IS_NEW );
266 
267  newTrack->SetState( BEGIN_ONPAD | END_ONPAD, false );
268 
269  D_PAD* pad = GetBoard()->GetPad( previousTrack, ENDPOINT_END );
270 
271  if( pad )
272  {
273  newTrack->m_PadsConnected.push_back( pad );
274  previousTrack->m_PadsConnected.push_back( pad );
275  }
276 
277  newTrack->start = previousTrack->end;
278 
279  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
280 
281  newTrack->SetStart( newTrack->GetEnd() );
282 
283  newTrack->SetLayer( GetScreen()->m_Active_Layer );
284 
285  if( !GetDesignSettings().m_UseConnectedTrackWidth )
286  newTrack->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
287 
288  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
289 
290  // Show the new position
291  ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
292  }
293  }
294 
296  return g_CurrentTrackSegment;
297 }
#define g_FirstTrackSegment
first segment created
Definition: pcbnew.h:101
#define g_CurrentTrackSegment
most recently created segment
Definition: pcbnew.h:100
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
bool g_Drc_On
Definition: pcbnew.cpp:70
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 ...
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:133
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
DLIST< TRACK > g_CurrentTrackList
Definition: pcbnew.cpp:98
bool Add45DegreeSegment(wxDC *aDC)
Function Add45DegreeSegment adds a track segment between 2 tracks segments if these 2 segments make a...
Definition: editrack.cpp:300
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
BOARD * GetBoard() const
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
DRC * m_drc
the DRC controller, see drc.cpp
Definition: wxPcbStruct.h:96
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
Definition: pcbframe.cpp:1115
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:132
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
BOARD_CONNECTED_ITEM * GetLockPoint(const wxPoint &aPosition, LSET aLayerMask)
Function GetLockPoint returns the item at the "attachment" point at the end of a trace at aPosition o...
const wxPoint & GetEnd() const
Definition: class_track.h:118
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
bool g_Raccord_45_Auto
Definition: pcbnew.cpp:72
void SetWidth(int aWidth)
Definition: class_track.h:114
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 ...
#define BAD_DRC
Definition: drc_stuff.h:36
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:113
Class LSET is a set of PCB_LAYER_IDs.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:754
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void BuildAirWiresTargetsList(BOARD_CONNECTED_ITEM *aItemRef, const wxPoint &aPosition, bool aInit)
Function BuildAirWiresTargetsList Build a list of candidates that can be a coonection point when a tr...
Definition: ratsnest.cpp:836
void HighLight(wxDC *DC)
Function HighLight.
Definition: highlight.cpp:101
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
Definition: class_board.h:750
std::vector< D_PAD * > m_PadsConnected
void HighLightON()
Function HighLightON Enable highlight.
Definition: class_board.h:383
int GetNetCode() const
Function GetNetCode.
void SetHighLightNet(int aNetCode)
Function SetHighLightNet.
Definition: class_board.h:361
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
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:242
int GetWidth() const
Definition: class_track.h:115
void ShowNewTrackWhenMovingCursor(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: editrack.cpp:673
void PushHighLight()
Function PushHighLight save current high light info for later use.
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
static PICKED_ITEMS_LIST s_ItemsListPicker
Definition: editrack.cpp:55
void SetStart(const wxPoint &aStart)
Definition: class_track.h:120
int Drc(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:153
#define DBG(x)
Definition: fctsys.h:33
DLIST< TRACK > m_Track
Definition: class_board.h:244
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 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...
Definition: tracepcb.cpp:247
BOARD_CONNECTED_ITEM * end
Definition: class_track.h:90
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
BOARD_CONNECTED_ITEM * start
Definition: class_track.h:89
bool g_TwoSegmentTrackBuild
Definition: pcbnew.cpp:76
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes the list of pickers, AND the data pointed by m_PickedItem or...
void PCB_EDIT_FRAME::Begin_Self ( wxDC *  DC)

Definition at line 139 of file muonde.cpp.

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_inductorInProgress, EDA_DRAW_PANEL::SetMouseCapture(), EDA_DRAW_FRAME::SetMsgPanel(), ShowBoundingBoxMicroWaveInductor(), and PCB_BASE_FRAME::UpdateStatusBar().

Referenced by MuWaveCommand().

140 {
142  {
143  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
144  m_canvas->SetMouseCapture( NULL, NULL );
145 
146  wxString errorMessage;
147 
148  // Prepare parameters for inductor
149  // s_inductor_pattern.m_Start is already initialized,
150  // when s_inductor_pattern.m_Flag == false
153 
154  wxASSERT( s_inductorInProgress );
155  s_inductorInProgress = false;
156 
157  MODULE* footprint = MWAVE::CreateMicrowaveInductor( s_inductor_pattern, this, errorMessage );
158 
159  if( footprint )
160  {
161  SetMsgPanel( footprint );
162  footprint->Draw( m_canvas, DC, GR_OR );
163  }
164 
165  else if( !errorMessage.IsEmpty() )
166  DisplayError( this, errorMessage );
167 
168  return;
169  }
170 
173 
174  s_inductorInProgress = true;
175 
176  // Update the initial coordinates.
178  UpdateStatusBar();
179 
181  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
182 }
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.
static MWAVE::INDUCTOR_PATTERN s_inductor_pattern
An inductor pattern temporarily used during mu-wave inductor creation
Definition: muonde.cpp:70
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:754
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
Definition: gr_basic.h:42
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
virtual void UpdateStatusBar() override
Function UpdateStatusBar updates 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 Exit_Self(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Definition: muonde.cpp:129
static void ShowBoundingBoxMicroWaveInductor(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: muonde.cpp:79
static bool s_inductorInProgress
A flag set to true when mu-wave inductor is being created
Definition: muonde.cpp:73
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
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 GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
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 510 of file zones_by_polygon.cpp.

References Abort_Zone_Create_Outline(), ZONE_CONTAINER::AppendCorner(), BAD_DRC, EDA_DRAW_PANEL::CallMouseCapture(), EDA_ITEM::ClearFlags(), DisplayError(), DRC::Drc(), ZONE_SETTINGS::ExportSetting(), g_Drc_On, PCB_BASE_FRAME::GetActiveLayer(), BOARD::GetArea(), BOARD::GetAreaCount(), PCB_BASE_FRAME::GetBoard(), ZONE_CONTAINER::GetCornerPosition(), EDA_DRAW_FRAME::GetCrossHairPosition(), BOARD::GetHighLightNetCode(), ZONE_SETTINGS::GetIsKeepout(), BOARD_ITEM::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(), Kiface(), KIFACE_I::KifaceSettings(), KiROUND(), EDA_DRAW_FRAME::m_canvas, ZONE_SETTINGS::m_CurrentZone_Layer, BOARD::m_CurrentZoneContour, m_drc, 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, 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(), BOARD_ITEM::SetLayer(), EDA_DRAW_PANEL::SetMouseCapture(), BOARD_CONNECTED_ITEM::SetNetCode(), EDA_ITEM::SetTimeStamp(), PCB_BASE_FRAME::SetZoneSettings(), BOARD::SetZoneSettings(), Show_New_Edge_While_Move_Mouse(), ZONE_SETTINGS::SMOOTHING_NONE, NETINFO_LIST::UNCONNECTED, ZONE_ABORT, 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().

511 {
512  ZONE_SETTINGS zoneInfo = GetZoneSettings();
513 
514  // verify if s_CurrentZone exists (could be deleted since last selection) :
515  int ii;
516  for( ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
517  {
518  if( s_CurrentZone == GetBoard()->GetArea( ii ) )
519  break;
520  }
521 
522  if( ii >= GetBoard()->GetAreaCount() ) // Not found: could be deleted since last selection
523  {
524  s_AddCutoutToCurrentZone = false;
525  s_CurrentZone = NULL;
526  }
527 
529 
530  // Verify if a new zone is allowed on this layer:
531  if( zone == NULL )
532  {
534  {
535  DisplayError( this,
536  _( "Error: a keepout area is allowed only on copper layers" ) );
537  return 0;
538  }
539  }
540 
541  // If no zone contour in progress, a new zone is being created,
542  if( zone == NULL )
543  {
545  zone->SetFlags( IS_NEW );
546  zone->SetTimeStamp( GetNewTimeStamp() );
547  }
548 
549  if( zone->GetNumCorners() == 0 ) // Start a new contour: init zone params (net, layer ...)
550  {
551  if( !s_CurrentZone ) // A new outline is created, from scratch
552  {
553  ZONE_EDIT_T edited;
554 
555  // Init zone params to reasonable values
556  zone->SetLayer( GetActiveLayer() );
557 
558  // Prompt user for parameters:
560 
561  if( zone->IsOnCopperLayer() )
562  {
563  // Put a zone on a copper layer
564  if( GetBoard()->GetHighLightNetCode() > 0 )
565  {
567  zone->SetNetCode( zoneInfo.m_NetcodeSelection );
568  }
569 
570  double tmp = ZONE_THERMAL_RELIEF_GAP_MIL;
571 
572  wxConfigBase* cfg = Kiface().KifaceSettings();
573  cfg->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp );
574  zoneInfo.m_ThermalReliefGap = KiROUND( tmp * IU_PER_MILS);
575 
578  zoneInfo.m_ThermalReliefCopperBridge = KiROUND( tmp * IU_PER_MILS );
579 
580  tmp = ZONE_CLEARANCE_MIL;
581  cfg->Read( ZONE_CLEARANCE_WIDTH_STRING_KEY, &tmp );
582  zoneInfo.m_ZoneClearance = KiROUND( tmp * IU_PER_MILS );
583 
584  tmp = ZONE_THICKNESS_MIL;
585  cfg->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, &tmp );
586  zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS );
587 
588  zoneInfo.m_CurrentZone_Layer = zone->GetLayer();
589 
591  {
592  zoneInfo.SetIsKeepout( true );
593  // Netcode, netname and some other settings are irrelevant,
594  // so ensure they are cleared
597  zoneInfo.SetCornerRadius( 0 );
598 
599  edited = InvokeKeepoutAreaEditor( this, &zoneInfo );
600  }
601  else
602  {
603  zoneInfo.SetIsKeepout( false );
604  edited = InvokeCopperZonesEditor( this, &zoneInfo );
605  }
606  }
607  else // Put a zone on a non copper layer (technical layer)
608  {
609  zoneInfo.SetIsKeepout( false );
610  zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones
611  edited = InvokeNonCopperZonesEditor( this, zone, &zoneInfo );
612  }
613 
615  m_canvas->SetIgnoreMouseEvents( false );
616 
617  if( edited == ZONE_ABORT )
618  {
619  GetBoard()->m_CurrentZoneContour = NULL;
620  delete zone;
621  return 0;
622  }
623 
624  // Switch active layer to the selected zone layer
626  SetZoneSettings( zoneInfo );
627  }
628  else
629  {
630  // Start a new contour: init zone params (net and layer) from an existing
631  // zone (add cutout or similar zone)
632 
635 
636  zoneInfo << *s_CurrentZone;
637 
638  SetZoneSettings( zoneInfo );
639  }
640 
641  // Show the Net for zones on copper layers
642  if( IsCopperLayer( zoneInfo.m_CurrentZone_Layer ) &&
643  !zoneInfo.GetIsKeepout() )
644  {
645  if( s_CurrentZone )
646  {
648  GetBoard()->SetZoneSettings( zoneInfo );
649  }
650 
651  if( GetBoard()->IsHighLightNetON() )
652  {
653  HighLight( DC ); // Remove old highlight selection
654  }
655 
657  HighLight( DC );
658  }
659 
661  s_CurrentZone = NULL; // the zone is used only once ("add similar zone" command)
662  }
663 
664  // if first segment
665  if( zone->GetNumCorners() == 0 )
666  {
667  zoneInfo.ExportSetting( *zone );
668 
669  zone->SetLayer( zoneInfo.m_CurrentZone_Layer );
670 
671  // A duplicated corner is needed; null segments are removed when the zone is finished.
673  zone->AppendCorner( GetCrossHairPosition(), true );
674 
675  if( g_Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() )
676  {
677  zone->ClearFlags();
678  zone->RemoveAllContours();
679 
680  // use the form of SetCurItem() which does not write to the msg panel,
681  // SCREEN::SetCurItem(), so the DRC error remains on screen.
682  // PCB_EDIT_FRAME::SetCurItem() calls DisplayInfo().
683  GetScreen()->SetCurItem( NULL );
684  DisplayError( this,
685  _( "DRC error: this start point is inside or too close an other area" ) );
686  return 0;
687  }
688 
689  SetCurItem( zone );
691  }
692  else // edge in progress:
693  {
694  ii = zone->GetNumCorners() - 1;
695 
696  // edge in progress : the current corner coordinate was set
697  // by Show_New_Edge_While_Move_Mouse
698  if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
699  {
700  if( !g_Drc_On || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) )
701  {
702  // Ok, we can add a new corner
703  if( m_canvas->IsMouseCaptured() )
704  m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
705 
706  // It is necessary to allow duplication of the points, as we have to handle the
707  // continuous drawing while creating the zone at the same time as we build it. Null
708  // segments are removed when the zone is finished, in End_Zone.
709  zone->AppendCorner( GetCrossHairPosition(), true );
710 
711  SetCurItem( zone ); // calls DisplayInfo().
712 
713  if( m_canvas->IsMouseCaptured() )
714  m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
715  }
716  }
717  }
718 
719  return zone->GetNumCorners();
720 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
Definition: class_board.h:555
bool g_Drc_On
Definition: pcbnew.cpp:70
#define OK_DRC
Definition: drc_stuff.h:35
void SetCurItem(BOARD_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:466
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetCornerSmoothingType(int aType)
long m_ThermalReliefCopperBridge
thickness of the copper bridge in thermal reliefs
ZONE_EDIT_T
Exit codes for zone editing dialogs.
Definition: zones.h:47
const ZONE_SETTINGS & GetZoneSettings() const
static bool s_AddCutoutToCurrentZone
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:254
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
time_t GetNewTimeStamp()
Definition: common.cpp:166
BOARD * GetBoard() const
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL
Definition: zones.h:39
DRC * m_drc
the DRC controller, see drc.cpp
Definition: wxPcbStruct.h:96
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:506
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
#define BAD_DRC
Definition: drc_stuff.h:36
void ExportSetting(ZONE_CONTAINER &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
int m_NetcodeSelection
Net code selection for the current zone.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
const bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
bool IsMouseCaptured() const
void AppendCorner(wxPoint position, bool aAllowDuplication=false)
Function AppendCorner.
Definition: class_zone.h:546
static ZONE_CONTAINER * s_CurrentZone
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
if no change
Definition: zones.h:48
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.
void HighLight(wxDC *DC)
Function HighLight.
Definition: highlight.cpp:101
#define ZONE_THERMAL_RELIEF_GAP_STRING_KEY
Definition: zones.h:32
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:101
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
void SetIsKeepout(bool aEnable)
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
ZONE_EDIT_T InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_CONTAINER *aZone, ZONE_SETTINGS *aSettings)
Function InvokeNonCopperZonesEditor invokes up a modal dialog window for non-copper zone editing...
#define ZONE_THICKNESS_MIL
Definition: zones.h:40
Class ZONE_SETTINGS handles zones parameters.
int GetNetCode() const
Function GetNetCode.
void SetHighLightNet(int aNetCode)
Function SetHighLightNet.
Definition: class_board.h:361
#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:92
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.h:179
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY
Definition: zones.h:33
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:1022
int GetToolId() const
Definition: draw_frame.h:406
void SetCornerRadius(int aRadius)
void SetIgnoreMouseEvents(bool aIgnore)
#define ZONE_CLEARANCE_WIDTH_STRING_KEY
Definition: zones.h:34
ZONE_EDIT_T InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing...
PCB_SCREEN * GetScreen() const override
Function GetScreen returns 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:254
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
int Drc(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:153
ZONE_EDIT_T InvokeKeepoutAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeKeepoutAreaEditor invokes up a modal dialog window for copper zone editing...
#define ZONE_THERMAL_RELIEF_GAP_MIL
Definition: zones.h:38
int GetHighLightNetCode() const
Function GetHighLightNetCode.
Definition: class_board.h:355
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 DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
virtual void SetActiveLayer(PCB_LAYER_ID aLayer) override
Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYE...
Definition: pcbframe.cpp:885
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID m_CurrentZone_Layer
Layer used to create the current zone.
static void Show_New_Edge_While_Move_Mouse(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
long m_ThermalReliefGap
thickness of the gap in thermal reliefs
int m_ZoneMinThickness
Min thickness value in filled areas.
void RemoveAllContours(void)
Definition: class_zone.h:501
void PCB_EDIT_FRAME::BeginMoveDimensionText ( DIMENSION aItem,
wxDC *  DC 
)

Definition at line 381 of file dimension.cpp.

References AbortMoveDimensionText(), EDA_DRAW_PANEL::CallMouseCapture(), DIMENSION::Draw(), EDA_TEXT::GetTextPos(), GR_XOR, 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().

382 {
383  if( aItem == NULL )
384  return;
385 
386  // Store the initial position for undo/abort command
387  initialTextPosition = aItem->Text().GetTextPos();
388 
389  aItem->Draw( m_canvas, DC, GR_XOR );
390  aItem->SetFlags( IS_MOVED );
391  SetMsgPanel( aItem );
392 
393  SetCrossHairPosition( aItem->Text().GetTextPos() );
395 
397  SetCurItem( aItem );
398  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
399 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
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.
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
static void MoveDimensionText(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: dimension.cpp:403
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:754
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
static wxPoint initialTextPosition
Definition: dimension.cpp:379
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
TEXTE_PCB & Text()
static void AbortMoveDimensionText(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Definition: dimension.cpp:425
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 SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
#define IS_MOVED
Item being moved.
Definition: base_struct.h:112
void PCB_EDIT_FRAME::BeginMoveTarget ( PCB_TARGET aTarget,
wxDC *  DC 
)

Definition at line 227 of file target_edit.cpp.

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

228 {
229  if( aTarget == NULL )
230  return;
231 
232  s_TargetCopy = *aTarget;
233  aTarget->SetFlags( IS_MOVED );
235  SetCurItem( aTarget );
236 }
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:253
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
static void ShowTargetShapeWhileMovingMouse(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
#define IS_MOVED
Item being moved.
Definition: base_struct.h:112
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.

Definition at line 319 of file basepcbframe.cpp.

References EDA_RECT::Centre(), PCB_BASE_FRAME::GetBoardBoundingBox(), EDA_RECT::GetHeight(), EDA_RECT::GetWidth(), EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::m_Pcb, max, EDA_DRAW_FRAME::SetScrollCenterPosition(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by AppendBoardFile(), and OpenProjectFiles().

320 {
321  if( m_Pcb == NULL )
322  return 1.0;
323 
324  EDA_RECT ibbbox = GetBoardBoundingBox();
325  DSIZE clientz = m_canvas->GetClientSize();
326  DSIZE boardz( ibbbox.GetWidth(), ibbbox.GetHeight() );
327 
328  double iu_per_du_X = clientz.x ? boardz.x / clientz.x : 1.0;
329  double iu_per_du_Y = clientz.y ? boardz.y / clientz.y : 1.0;
330 
331  double bestzoom = std::max( iu_per_du_X, iu_per_du_Y );
332 
333  SetScrollCenterPosition( ibbbox.Centre() );
334 
335  return bestzoom;
336 }
void SetScrollCenterPosition(const wxPoint &aPoint)
int GetHeight() const
wxPoint Centre() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
EDA_RECT GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge se...
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
int GetWidth() const
void PCB_EDIT_FRAME::Block_Delete ( )

Function Block_Delete deletes all items within the selected block.

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

References EDA_ITEM::ClearFlags(), PCB_BASE_FRAME::Compile_Ratsnest(), BOARD_ITEM::DeleteStructure(), PICKED_ITEMS_LIST::GetCount(), BLOCK_SELECTOR::GetItems(), PICKED_ITEMS_LIST::GetPickedItem(), PCB_BASE_FRAME::GetScreen(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, PCB_BASE_FRAME::m_Pcb, PICKED_ITEMS_LIST::m_Status, BOARD::m_Status_Pcb, OnModify(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MARKER_T, PCB_MODULE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, PCB_ZONE_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().

527 {
528  OnModify();
529  SetCurItem( NULL );
530 
532  itemsList->m_Status = UR_DELETED;
533 
534  // unlink items and clear flags
535  for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
536  {
537  BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
538  itemsList->SetPickedItemStatus( UR_DELETED, ii );
539 
540  switch( item->Type() )
541  {
542  case PCB_MODULE_T:
543  {
544  MODULE* module = (MODULE*) item;
545  module->ClearFlags();
546  module->UnLink();
547  m_Pcb->m_Status_Pcb = 0;
548  }
549  break;
550 
551  case PCB_ZONE_AREA_T: // a zone area
552  m_Pcb->Remove( item );
553  break;
554 
555  case PCB_LINE_T: // a segment not on copper layers
556  case PCB_TEXT_T: // a text on a layer
557  case PCB_TRACE_T: // a track segment (segment on a copper layer)
558  case PCB_VIA_T: // a via (like track segment on a copper layer)
559  case PCB_DIMENSION_T: // a dimension (graphic item)
560  case PCB_TARGET_T: // a target (graphic item)
561  item->UnLink();
562  break;
563 
564  // These items are deleted, but not put in undo list
565  case PCB_MARKER_T: // a marker used to show something
566  case PCB_ZONE_T: // SEG_ZONE items are now deprecated
567  item->UnLink();
568  itemsList->RemovePicker( ii );
569  ii--;
570  item->DeleteStructure();
571  break;
572 
573  default:
574  wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Delete( ) error: unexpected type" ) );
575  break;
576  }
577  }
578 
579  SaveCopyInUndoList( *itemsList, UR_DELETED );
580 
581  Compile_Ratsnest( NULL, true );
582  m_canvas->Refresh( true );
583 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Definition: pcbframe.cpp:996
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
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:114
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:104
virtual void UnLink()
Function UnLink detaches this object from its owner.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
class MODULE, a footprint
Definition: typeinfo.h:101
class SEGZONE, a segment used to fill a zone area (segment on a copper layer)
Definition: typeinfo.h:109
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:172
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:112
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:113
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:165
unsigned GetCount() const
Function GetCount.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:111
bool SetPickedItemStatus(UNDO_REDO_T aStatus, unsigned aIdx)
Function SetPickedItemStatus sets the type of undo/redo operation for a given picked item...
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
PCB_SCREEN * GetScreen() const override
Function GetScreen returns 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:254