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)
 Function loadFootprints loads the footprints for each COMPONENT in aNetlist from the list of libraries. More...
 
void OnQuit (wxCommandEvent &event)
 
void PythonPluginsReload ()
 Reload the Python plugins if they are newer than the already loaded, and load new plugins if any Do nothing if KICAD_SCRIPTING is not defined. More...
 
void UpdateUserInterface ()
 Update the layer manager and other widgets from the board setup (layer and items visibility, colors ...) More...
 
virtual void ExecuteRemoteCommand (const char *cmdline) override
 Execute a remote command send by Eeschema via a socket, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void KiwayMailIn (KIWAY_EXPRESS &aEvent) override
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
void ToPlotter (wxCommandEvent &event)
 Function ToPlotter Open a dialog frame to create plot and drill files relative to the current board. More...
 
void ToPrinter (wxCommandEvent &event)
 Function ToPrinter Install the print dialog. More...
 
void 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 () 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, wxPoint aMoveVector)
 Function build_ratsnest_module Build a ratsnest relative to one footprint. More...
 
void TraceModuleRatsNest (wxDC *aDC)
 Function TraceModuleRatsNest display the rats nest of a moving footprint, computed by build_ratsnest_module() More...
 
void Build_Board_Ratsnest ()
 Function Build_Board_Ratsnest. More...
 
void DrawGeneralRatsnest (wxDC *aDC, int aNetcode=0)
 function Displays the general ratsnest Only ratsnest with the status bit CH_VISIBLE is set are displayed More...
 
void TraceAirWiresToTargets (wxDC *aDC)
 Function TraceAirWiresToTargets This functions shows airwires to nearest connecting points (pads) from the current new track end during track creation Uses data prepared by BuildAirWiresTargetsList() More...
 
void BuildAirWiresTargetsList (BOARD_CONNECTED_ITEM *aItemRef, const wxPoint &aPosition, int aNet)
 Function BuildAirWiresTargetsList Build a list of candidates that can be a coonection point when a track is started. More...
 
void TestForActiveLinksInRatsnest (int aNetCode)
 Function TestForActiveLinksInRatsnest Explores the full rats nest list (which must exist) to determine the ACTIVE links in the full rats nest list When tracks exist between pads, a link can connect 2 pads already connected by a track and the link is said inactive. More...
 
void TestConnections ()
 Function TestConnections tests the connections relative to all nets. More...
 
void TestNetConnection (wxDC *aDC, int aNetCode)
 Function TestNetConnection tests the connections relative to aNetCode. More...
 
void ComputeLegacyConnections ()
 Function RecalculateAllTracksNetcode search connections between tracks and pads and propagate pad net codes to the track segments. More...
 
PCB_LAYER_ID SelectLayer (PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
 Install the dialog box for layer selection. More...
 
void SelectCopperLayerPair ()
 
virtual 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 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...
 
PCB_GENERAL_SETTINGSSettings ()
 
const PCB_GENERAL_SETTINGSCSettings () const
 
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)
 
wxAuiToolBar * GetMainToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 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)
 Initialize a block command. 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...
 
virtual void SwitchCanvas (wxCommandEvent &aEvent) override
 switches currently used canvas (default / Cairo / OpenGL). 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)
 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)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
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_configParams
 List of Pcbnew configuration settings. More...
 
wxString m_lastNetListRead
 Last net list read with relative path. More...
 
int m_rotationAngle
 User defined rotation angle (in tenths of a degree). More...
 
bool m_undoRedoBlocked
 Is undo/redo operation currently blocked? More...
 
BOARDm_Pcb
 
GENERAL_COLLECTORm_Collector
 
PCB_GENERAL_SETTINGS m_configSettings
 
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

Definition at line 322 of file pcbframe.cpp.

References g_Board_Editor_Hokeys_Descr, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, PGM_BASE::GetExecutablePath(), EDA_PANEINFO::HorizontalToolbarPane(), ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, KiBitmap(), EDA_PANEINFO::LayersToolbarPane(), PCAD2KICAD::Left, EDA_PANEINFO::MessageToolbarPane(), Pgm(), PCAD2KICAD::Right, and EDA_PANEINFO::VerticalToolbarPane().

322  :
323  PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB, wxT( "Pcbnew" ), wxDefaultPosition,
325 {
326  m_showBorderAndTitleBlock = true; // true to display sheet references
327  m_showAxis = false; // true to display X and Y axis
328  m_showOriginAxis = true;
329  m_showGridAxis = true;
330  m_SelTrackWidthBox = NULL;
331  m_SelViaSizeBox = NULL;
332  m_SelLayerBox = NULL;
333  m_show_microwave_tools = false;
336  m_hasAutoSave = true;
337  m_microWaveToolBar = NULL;
338 
339  m_rotationAngle = 900;
340 
341  // Create GAL canvas
342  EDA_DRAW_PANEL_GAL* galCanvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
343  m_FrameSize,
346 
347  SetGalCanvas( galCanvas );
348 
349  SetBoard( new BOARD() );
350 
351  // Create the PCB_LAYER_WIDGET *after* SetBoard():
352 
353  wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
354  int pointSize = font.GetPointSize();
355  int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
356 
357  // printf( "pointSize:%d 80%%:%d\n", pointSize, (pointSize*8)/10 );
358 
359  if( screenHeight <= 900 )
360  pointSize = (pointSize * 8) / 10;
361 
362  m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), pointSize );
363 
364  m_drc = new DRC( this ); // these 2 objects point to each other
365 
366  wxIcon icon;
367  icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) );
368  SetIcon( icon );
369 
370  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
371  // initialize parameters in m_LayersManager
372  LoadSettings( config() );
373 
374  SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
376 
377  // PCB drawings start in the upper left corner.
378  GetScreen()->m_Center = false;
379 
380  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
381 
384 
385  if( m_canvas )
387 
388  ReCreateMenuBar();
393 
395 
396  m_auimgr.SetManagedWindow( this );
397 
398  EDA_PANEINFO horiz;
399  horiz.HorizontalToolbarPane();
400 
401  EDA_PANEINFO vert;
402  vert.VerticalToolbarPane();
403 
404  EDA_PANEINFO mesg;
405  mesg.MessageToolbarPane();
406 
407  // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
408  // LAYER_WIDGET is floatable, but initially docked at far right
409  EDA_PANEINFO lyrs;
410  lyrs.LayersToolbarPane();
411  lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget
412  lyrs.BestSize( m_Layers->GetBestSize() );
413  lyrs.Caption( _( "Visibles" ) );
414  lyrs.TopDockable( false ).BottomDockable( false );
415 
416  if( m_mainToolBar ) // The main horizontal toolbar
417  {
418  m_auimgr.AddPane( m_mainToolBar,
419  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
420  }
421 
422  if( m_auxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows track and via sizes, zoom ...)
423  {
424  m_auimgr.AddPane( m_auxiliaryToolBar,
425  wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) );
426  }
427 
428  if( m_microWaveToolBar ) // The auxiliary vertical right toolbar (currently microwave tools)
429  m_auimgr.AddPane( m_microWaveToolBar,
430  wxAuiPaneInfo( vert ).Name( wxT( "m_microWaveToolBar" ) ).
431  Right().Layer( 1 ).Position(1).Hide() );
432 
433  if( m_drawToolBar ) // The main right vertical toolbar
434  m_auimgr.AddPane( m_drawToolBar,
435  wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Layer( 2 ) );
436 
437  // Add the layer manager ( most right side of pcbframe )
438  m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 3 ) );
439 
440  if( m_optionsToolBar ) // The left vertical toolbar (fast acces display options of Pcbnew)
441  {
442  m_auimgr.AddPane( m_optionsToolBar,
443  wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left().Layer(1) );
444 
445  m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
446  m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools );
447  }
448 
449  if( m_canvas )
450  m_auimgr.AddPane( m_canvas,
451  wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
452 
453  if( GetGalCanvas() )
454  m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
455  wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
456 
457  if( m_messagePanel )
458  m_auimgr.AddPane( m_messagePanel,
459  wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
460 
461  ReFillLayerWidget(); // this is near end because contents establish size
462  m_Layers->ReFillRender(); // Update colors in Render after the config is read
464 
465  m_auimgr.Update();
466 
467  setupTools();
468 
469  Zoom_Automatique( false );
470 
472 
473  if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
474  {
475  if( GetGalCanvas()->SwitchBackend( canvasType ) )
476  UseGalCanvas( true );
477  }
478 
480 
481  // disable Export STEP item if kicad2step does not exist
482  wxString strK2S = Pgm().GetExecutablePath();
483  #ifdef __WXMAC__
484  strK2S += "Contents/MacOS/";
485  #endif
486  wxFileName appK2S( strK2S, "kicad2step" );
487 
488  #ifdef _WIN32
489  appK2S.SetExt( "exe" );
490  #endif
491 
492  if( !appK2S.FileExists() )
493  GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
494 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:479
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
PCB_BASE_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
void syncLayerWidgetLayer()
Function syncLayerWidgetLayer updates the currently layer "selection" within the PCB_LAYER_WIDGET.
Definition: pcbframe.cpp:905
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:857
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:102
void UseGalCanvas(bool aEnable) override
>
Definition: pcbframe.cpp:710
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:304
VTBL_ENTRY const wxString & GetExecutablePath() const
Definition: pgm_base.h:173
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Definition: pcbframe.cpp:796
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:140
void ReCreateMicrowaveVToolbar()
Definition: tool_pcb.cpp:500
wxChoice * m_SelViaSizeBox
Definition: wxPcbStruct.h:245
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
Definition: basicframe.cpp:361
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
EDA_UNITS_T m_UserGridUnit
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:837
wxAuiManager m_auimgr
Definition: wxstruct.h:144
bool m_show_microwave_tools
Definition: wxPcbStruct.h:247
void ReCreateHToolbar() override
Definition: tool_pcb.cpp:202
DRC * m_drc
the DRC controller, see drc.cpp
Definition: wxPcbStruct.h:96
wxSize GetBestSize() const
Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic conten...
EDA_PANEINFO & LayersToolbarPane()
Function LayersToolbarPane Change *this to a layers toolbar for KiCad.
Definition: wxstruct.h:531
wxChoice * m_SelTrackWidthBox
Definition: wxPcbStruct.h:244
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:470
bool m_show_layer_manager_tools
Definition: wxPcbStruct.h:248
wxRealPoint m_UserGridSize
struct EDA_HOTKEY_CONFIG g_Board_Editor_Hokeys_Descr[]
bool m_showOriginAxis
True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files.
Definition: draw_frame.h:109
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:77
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
Definition: wxstruct.h:497
wxAuiToolBar * m_microWaveToolBar
The auxiliary right vertical tool bar used to access the microwave tools.
Definition: wxPcbStruct.h:90
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:125
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:76
bool m_Center
Center on screen.
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:112
void ReFillRender()
Function ReFillRender rebuilds Render for instance after the config is read.
void ReCreateVToolbar() override
Definition: tool_pcb.cpp:414
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:105
wxPoint m_FramePos
Definition: wxstruct.h:134
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:88
PCB_LAYER_WIDGET * m_Layers
Definition: wxPcbStruct.h:94
ID_POPUP_GRID_USER
Definition: draw_frame.cpp:105
void ReCreateOptToolbar()
Definition: tool_pcb.cpp:325
int m_LastGridSizeId
Definition: draw_frame.h:77
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:122
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:140
int m_rotationAngle
User defined rotation angle (in tenths of a degree).
void enableGALSpecificMenus()
an helper function to enable some menus only active when the display is switched to GAL mode and whic...
Definition: pcbframe.cpp:752
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Definition: wxstruct.h:516
void AddGrid(const GRID_TYPE &grid)
void SetBoard(BOARD *aBoard) override
>
Definition: pcbframe.cpp:503
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
Class DRC is the Design Rule Checker, and performs all the DRC tests.
Definition: drc_stuff.h:158
void SetMaxUndoItems(int aMax)
const PAGE_INFO & GetPageSettings() const override
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SetEnableBlockCommands(bool aEnable)
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:836
bool m_hasAutoSave
Flag to indicate if this frame supports auto save.
Definition: wxstruct.h:147
wxSize m_FrameSize
Definition: wxstruct.h:135
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
Definition: wxPcbStruct.h:243
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading a ne...
Definition: pcbframe.cpp:578
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
#define PCB_EDIT_FRAME_NAME
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
Definition: wxPcbStruct.h:78
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
void ReCreateAuxiliaryToolbar() override
Definition: tool_pcb.cpp:543
friend class PCB_LAYER_WIDGET
Definition: wxPcbStruct.h:84
void setupTools()
Definition: pcbframe.cpp:560
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting() const
Function LoadCanvasTypeSetting() Returns the canvas type stored in the application settings...
PCB_EDIT_FRAME::~PCB_EDIT_FRAME ( )
virtual

Definition at line 497 of file pcbframe.cpp.

498 {
499  delete m_drc;
500 }
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 295 of file editrack.cpp.

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

Referenced by Begin_Route().

296 {
297  int dx0, dy0, dx1, dy1;
298 
299  if( g_CurrentTrackList.GetCount() < 2 )
300  return false; // There must be 2 segments.
301 
302  TRACK* curTrack = g_CurrentTrackSegment;
303  TRACK* prevTrack = curTrack->Back();
304 
305  // Test if we have 2 consecutive track segments ( not via ) to connect.
306  if( curTrack->Type() != PCB_TRACE_T || prevTrack->Type() != PCB_TRACE_T )
307  {
308  return false;
309  }
310 
311  int segm_step_45 = KiROUND( GetScreen()->GetGridSize().x / 2 );
312 
313  if( segm_step_45 < ( curTrack->GetWidth() * 2 ) )
314  segm_step_45 = curTrack->GetWidth() * 2;
315 
316  // Test if the segments are horizontal or vertical.
317  dx0 = prevTrack->GetEnd().x - prevTrack->GetStart().x;
318  dy0 = prevTrack->GetEnd().y - prevTrack->GetStart().y;
319 
320  dx1 = curTrack->GetEnd().x - curTrack->GetStart().x;
321  dy1 = curTrack->GetEnd().y - curTrack->GetStart().y;
322 
323  // Segments should have a min length.
324  if( std::max( abs( dx0 ), abs( dy0 ) ) < ( segm_step_45 * 2 ) )
325  return false;
326 
327  if( std::max( abs( dx1 ), abs( dy1 ) ) < ( segm_step_45 * 2 ) )
328  return false;
329 
330  // Create a new segment and connect it with the previous 2 segments.
331  TRACK* newTrack = (TRACK*)curTrack->Clone();
332 
333  newTrack->SetStart( prevTrack->GetEnd() );
334  newTrack->SetEnd( curTrack->GetStart() );
335 
336  if( dx0 == 0 ) // Previous segment is Vertical
337  {
338  if( dy1 != 0 ) // 2 segments are not 90 degrees.
339  {
340  delete newTrack;
341  return false;
342  }
343 
344  /* Calculate coordinates the connection point.
345  * The new segment connects the 1st vertical segment and the 2nd
346  * horizontal segment.
347  */
348  if( dy0 > 0 )
349  newTrack->SetStart( wxPoint(newTrack->GetStart().x, newTrack->GetStart().y -segm_step_45) );
350  else
351  newTrack->SetStart( wxPoint(newTrack->GetStart().x, newTrack->GetStart().y + segm_step_45) );
352 
353  if( dx1 > 0 )
354  newTrack->SetEnd( wxPoint(newTrack->GetEnd().x + segm_step_45, newTrack->GetEnd().y) );
355  else
356  newTrack->SetEnd( wxPoint(newTrack->GetEnd().x - segm_step_45, newTrack->GetEnd().y) );
357 
358  if( Settings().m_legacyDrcOn && BAD_DRC == m_drc->Drc( curTrack, GetBoard()->m_Track ) )
359  {
360  delete newTrack;
361  return false;
362  }
363 
364  prevTrack->SetEnd( newTrack->GetStart());
365  curTrack->SetStart( newTrack->GetEnd());
366 
367  g_CurrentTrackList.Insert( newTrack, curTrack );
368  return true;
369  }
370 
371  if( dy0 == 0 ) // Previous segment is horizontal
372  {
373  if( dx1 != 0 ) // 2 segments are not 90 degrees
374  {
375  delete newTrack;
376  return false;
377  }
378 
379  /* Calculate the coordinates of the point of connection:
380  * A new segment has been created, connecting segment 1
381  * (horizontal) and segment 2 (vertical)
382  */
383  if( dx0 > 0 )
384  newTrack->SetStart( wxPoint(newTrack->GetStart().x - segm_step_45 , newTrack->GetStart().y));
385  else
386  newTrack->SetStart( wxPoint(newTrack->GetStart().x + segm_step_45, newTrack->GetStart().y) );
387 
388  if( dy1 > 0 )
389  newTrack->SetEnd( wxPoint(newTrack->GetEnd().x, newTrack->GetEnd().y + segm_step_45) );
390  else
391  newTrack->SetEnd( wxPoint(newTrack->GetEnd().x, newTrack->GetEnd().y - segm_step_45) );
392 
393  if( Settings().m_legacyDrcOn && BAD_DRC==m_drc->Drc( newTrack, GetBoard()->m_Track ) )
394  {
395  delete newTrack;
396  return false;
397  }
398 
399  prevTrack->SetEnd( newTrack->GetStart());
400  curTrack->SetStart( newTrack->GetEnd());
401 
402  g_CurrentTrackList.Insert( newTrack, curTrack );
403  return true;
404  }
405 
406  return false;
407 }
#define g_CurrentTrackSegment
most recently created segment
Definition: pcbnew.h:95
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
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:88
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
PCB_GENERAL_SETTINGS & Settings()
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:155
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:1424
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:1424
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 673 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().

674 {
675  wxMenu* menu = NULL;
676  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
677 
678  if( item ) // This menu exists, do nothing
679  return;
680 
681  menu = new wxMenu;
682 
683  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
684  _( "Icons in Menus" ), wxEmptyString,
685  wxITEM_CHECK ) );
686  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
687 
688  AddMenuItem( MasterMenu, menu,
690  _( "Icons Options" ),
691  _( "Select show icons in menus and icons sizes" ),
692  KiBitmap( icon_xpm ) );
693 }
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:187
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
void PCB_BASE_FRAME::AddPad ( MODULE Module,
bool  draw 
)
inherited

Definition at line 114 of file pad_edition_functions.cpp.

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

Referenced by FOOTPRINT_EDIT_FRAME::OnLeftClick().

115 {
116  m_Pcb->m_Status_Pcb = 0;
117  aModule->SetLastEditTime();
118 
119  D_PAD* pad = new D_PAD( aModule );
120 
121  // Add the new pad to end of the module pad list.
122  aModule->PadsList().PushBack( pad );
123 
124  // Update the pad properties,
125  // and keep NETINFO_LIST::ORPHANED as net info
126  // which is the default when nets cannot be handled.
127  Import_Pad_Settings( pad, false );
128 
130 
131  // Set the relative pad position
132  // ( pad position for module orient, 0, and relative to the module position)
133 
134  wxPoint pos0 = pad->GetPosition() - aModule->GetPosition();
135  RotatePoint( &pos0, -aModule->GetOrientation() );
136  pad->SetPos0( pos0 );
137 
138  /* NPTH pads take empty pad number (since they can't be connected),
139  * other pads get incremented from the last one edited */
140  wxString padName;
141 
143  {
144  padName = GetNextPadName( GetDesignSettings()
145  .m_Pad_Master.GetName() );
146  }
147 
148  pad->SetName( padName );
150 
151  aModule->CalculateBoundingBox();
152  SetMsgPanel( pad );
153 
154  if( draw )
155  m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() );
156 }
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:380
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:204
void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
Definition: draw_panel.cpp:305
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:773
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12)...
Definition: class_pad.h:167
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:247
const wxPoint & GetPosition() const override
Definition: class_pad.h:205
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.
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:237
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

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

912 {
913  BASE_SCREEN* screen = GetScreen();
914 
915  if( !screen || !m_canvas )
916  return;
917 
918  double scale = screen->GetScalingFactor();
919 
920  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
921  aCenterPositionIU.x, aCenterPositionIU.y, scale );
922 
923  // Calculate the portion of the drawing that can be displayed in the
924  // client area at the current zoom level.
925 
926  // visible viewport in device units ~ pixels
927  wxSize clientSizeDU = m_canvas->GetClientSize();
928 
929  // Size of the client window in IU
930  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
931 
932  // Full drawing or "page" rectangle in internal units
933  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
934 
935  // Account for scrollbars
936  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
937  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
938  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
939 
940  // The upper left corner of the client rectangle in internal units.
941  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
942  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
943 
944  // If drawn around the center, adjust the client rectangle accordingly.
945  if( screen->m_Center )
946  {
947  // half page offset.
948  xIU += pageRectIU.GetWidth() / 2.0;
949  yIU += pageRectIU.GetHeight() / 2.0;
950  }
951 
952  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
953  wxPoint centerPositionIU;
954 
955  // put "int" limits on the clientRect
956  if( clientRectIU.GetLeft() < VIRT_MIN )
957  clientRectIU.MoveLeftTo( VIRT_MIN );
958  if( clientRectIU.GetTop() < VIRT_MIN )
959  clientRectIU.MoveTopTo( VIRT_MIN );
960  if( clientRectIU.GetRight() > VIRT_MAX )
961  clientRectIU.MoveRightTo( VIRT_MAX );
962  if( clientRectIU.GetBottom() > VIRT_MAX )
963  clientRectIU.MoveBottomTo( VIRT_MAX );
964 
965  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
966  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
967 
968  if( screen->m_Center )
969  {
970  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
971  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
972  }
973 
974  DSIZE virtualSizeIU;
975 
976  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
977  {
978  virtualSizeIU.x = pageRectIU.GetSize().x;
979  }
980  else
981  {
982  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
983  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
984 
985  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
986  {
987  if( pageCenterX > clientCenterX )
988  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
989  else if( pageCenterX < clientCenterX )
990  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
991  else
992  virtualSizeIU.x = clientRectIU.GetWidth();
993  }
994  else
995  {
996  if( pageCenterX > clientCenterX )
997  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
998  else if( pageCenterX < clientCenterX )
999  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
1000  else
1001  virtualSizeIU.x = pageRectIU.GetWidth();
1002  }
1003  }
1004 
1005  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
1006  {
1007  virtualSizeIU.y = pageRectIU.GetSize().y;
1008  }
1009  else
1010  {
1011  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
1012  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
1013 
1014  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
1015  {
1016  if( pageCenterY > clientCenterY )
1017  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
1018  else if( pageCenterY < clientCenterY )
1019  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
1020  else
1021  virtualSizeIU.y = clientRectIU.GetHeight();
1022  }
1023  else
1024  {
1025  if( pageCenterY > clientCenterY )
1026  virtualSizeIU.y = pageRectIU.GetHeight() +
1027  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1028  else if( pageCenterY < clientCenterY )
1029  virtualSizeIU.y = pageRectIU.GetHeight() +
1030  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1031  else
1032  virtualSizeIU.y = pageRectIU.GetHeight();
1033  }
1034  }
1035 
1036  // put "int" limits on the virtualSizeIU
1037  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1038  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1039 
1040  if( screen->m_Center )
1041  {
1042  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1043  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1044  }
1045  else
1046  {
1047  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1048  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1049  }
1050 
1051  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1052  * around cursor to jump around. This reported problem occurs when the
1053  * zoom point is not on a pixel per unit increment. If you set the
1054  * pixels per unit to 10, you have potential for the zoom point to
1055  * jump around +/-5 pixels from the nearest grid point.
1056  */
1057  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1058 
1059  // Number of scroll bar units for the given zoom level in device units.
1060  double unitsX = virtualSizeIU.x * scale;
1061  double unitsY = virtualSizeIU.y * scale;
1062 
1063  // Store the requested center position for later use
1064  SetScrollCenterPosition( aCenterPositionIU );
1065 
1066  // Calculate the scroll bar position in internal units to place the
1067  // center position at the center of client rectangle.
1068  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1069  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1070 
1071  // Convert scroll bar position to device units.
1072  posX = KiROUND( posX * scale );
1073  posY = KiROUND( posY * scale );
1074 
1075  if( posX < 0 )
1076  {
1077  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1078  posX = 0;
1079  }
1080 
1081  if( posX > unitsX )
1082  {
1083  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1084  posX = unitsX;
1085  }
1086 
1087  if( posY < 0 )
1088  {
1089  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1090  posY = 0;
1091  }
1092 
1093  if( posY > unitsY )
1094  {
1095  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1096  posY = unitsY;
1097  }
1098 
1099  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1100  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1101 
1102  wxLogTrace( traceScrollSettings,
1103  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1104  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1105  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1107  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1108  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1109 
1110  bool noRefresh = true;
1111 
1112  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1113  screen->m_ScrollPixelsPerUnitY,
1114  screen->m_ScrollbarNumber.x,
1115  screen->m_ScrollbarNumber.y,
1116  screen->m_ScrollbarPos.x,
1117  screen->m_ScrollbarPos.y, noRefresh );
1118 }
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:908
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:907
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:314
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:905
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(), DisplayErrorMessage(), BOARD::DrawingsList(), FLAG0, BOARD::GetArea(), BOARD::GetAreaCount(), PCB_BASE_FRAME::GetBoard(), MODULE::GetBoundingBox(), EDA_ITEM::GetBoundingBox(), BOARD::GetCopperLayerCount(), PCB_BASE_FRAME::GetDesignSettings(), BOARD::GetEnabledLayers(), EDA_DRAW_FRAME::GetGalCanvas(), BLOCK_SELECTOR::GetItems(), DLIST< T >::GetLast(), EDA_DRAW_FRAME::GetNearestGridPosition(), EDA_RECT::GetOrigin(), PCB_BASE_FRAME::GetPageSizeIU(), PCB_BASE_FRAME::GetScreen(), EDA_RECT::GetSize(), EDA_DRAW_FRAME::HandleBlockBegin(), HandleBlockEnd(), IS_MOVED, EDA_DRAW_FRAME::IsGalCanvasActive(), PLUGIN::Load(), BASE_SCREEN::m_BlockLocate, 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()->DrawingsList().GetLast();
62  int zonescount = GetBoard()->GetAreaCount();
63 
64  // Keep also the count of copper layers, because we can happen boards
65  // with different copper layers counts,
66  // and the enabled layers
67  int initialCopperLayerCount = GetBoard()->GetCopperLayerCount();
68  LSET initialEnabledLayers = GetBoard()->GetEnabledLayers();
69 
70  try
71  {
72  PROPERTIES props;
73  char xbuf[30];
74  char ybuf[30];
75 
76  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
77  sprintf( xbuf, "%d", GetPageSizeIU().x );
78  sprintf( ybuf, "%d", GetPageSizeIU().y );
79 
80  props["page_width"] = xbuf;
81  props["page_height"] = ybuf;
82 
84  pi->Load( aFullFileName, GetBoard(), &props );
85  }
86  catch( const IO_ERROR& ioe )
87  {
88  for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
89  {
90  track->ClearFlags( FLAG0 );
91  }
92 
93  DisplayErrorMessage( this, _( "Error loading board in AppendBoardFile" ), ioe.What() );
94 
95  return false;
96  }
97 
98  // Now prepare a block move command to place the new items, and
99  // prepare the undo command.
100  BLOCK_SELECTOR& blockmove = GetScreen()->m_BlockLocate;
102  PICKED_ITEMS_LIST& blockitemsList = blockmove.GetItems();
103  PICKED_ITEMS_LIST undoListPicker;
104  ITEM_PICKER picker( NULL, UR_NEW );
105 
106  EDA_RECT bbox; // the new items bounding box, for block move
107  bool bboxInit = true; // true until the bounding box is initialized
108 
109  for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
110  {
111  if( track->GetFlags() & FLAG0 )
112  {
113  track->ClearFlags( FLAG0 );
114  continue;
115  }
116 
117  track->SetFlags( IS_MOVED );
118  picker.SetItem( track );
119  undoListPicker.PushItem( picker );
120  blockitemsList.PushItem( picker );
121 
122  if( bboxInit )
123  bbox = track->GetBoundingBox();
124  else
125  bbox.Merge( track->GetBoundingBox() );
126 
127  bboxInit = false;
128  }
129 
130  if( module )
131  module = module->Next();
132  else
133  module = GetBoard()->m_Modules;
134 
135  for( ; module; module = module->Next() )
136  {
137  module->SetFlags( IS_MOVED );
138  picker.SetItem( module );
139  undoListPicker.PushItem( picker );
140  blockitemsList.PushItem( picker );
141 
142  if( bboxInit )
143  bbox = module->GetBoundingBox();
144  else
145  bbox.Merge( module->GetBoundingBox() );
146 
147  bboxInit = false;
148  }
149 
150  if( drawing )
151  drawing = drawing->Next();
152  else
153  drawing = GetBoard()->DrawingsList();
154 
155  for( ; drawing; drawing = drawing->Next() )
156  {
157  drawing->SetFlags( IS_MOVED );
158  picker.SetItem( drawing );
159  undoListPicker.PushItem( picker );
160  blockitemsList.PushItem( picker );
161 
162  if( bboxInit )
163  bbox = drawing->GetBoundingBox();
164  else
165  bbox.Merge( drawing->GetBoundingBox() );
166 
167  bboxInit = false;
168  }
169 
170  for( ZONE_CONTAINER* zone = GetBoard()->GetArea( zonescount ); zone;
171  zone = GetBoard()->GetArea( zonescount ) )
172  {
173  zone->SetFlags( IS_MOVED );
174  picker.SetItem( zone );
175  undoListPicker.PushItem( picker );
176  blockitemsList.PushItem( picker );
177  zonescount++;
178 
179  if( bboxInit )
180  bbox = zone->GetBoundingBox();
181  else
182  bbox.Merge( zone->GetBoundingBox() );
183 
184  bboxInit = false;
185  }
186 
187  SaveCopyInUndoList( undoListPicker, UR_NEW );
188 
189  // we should not ask PLUGINs to do these items:
190  int copperLayerCount = GetBoard()->GetCopperLayerCount();
191 
192  if( copperLayerCount > initialCopperLayerCount )
193  GetBoard()->SetCopperLayerCount( copperLayerCount );
194 
195  // Enable all used layers, and make them visible:
196  LSET enabledLayers = GetBoard()->GetEnabledLayers();
197  enabledLayers |= initialEnabledLayers;
198  GetBoard()->SetEnabledLayers( enabledLayers );
199  GetBoard()->SetVisibleLayers( enabledLayers );
202 
203  if( IsGalCanvasActive() )
204  static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( GetBoard() );
205 
208 
209  SetStatusText( wxEmptyString );
210  BestZoom();
211 
212  // Finish block move command:
213  wxPoint cpos = GetNearestGridPosition( bbox.Centre() );
214  blockmove.SetOrigin( bbox.GetOrigin() );
215  blockmove.SetSize( bbox.GetSize() );
216  blockmove.SetLastCursorPosition( cpos );
217  HandleBlockEnd( NULL );
218 
219  return true;
220 }
void BuildListOfNets()
Definition: class_board.h:722
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...
DLIST< BOARD_ITEM > & DrawingsList()
Definition: class_board.h:256
MODULE * Next() const
Definition: class_module.h:100
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:711
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:474
const wxPoint & GetOrigin() const
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Initialize a block command.
Definition: draw_frame.cpp:823
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 DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:85
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
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.
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:828
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:1011
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:145
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.
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:982
DLIST< MODULE > m_Modules
Definition: class_board.h:245
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:836
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:578
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
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:126
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 753 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().

756 {
757  if( m_messagePanel == NULL )
758  return;
759 
760  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
761 }
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:56
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:474
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
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:102
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.
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:71
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:999
BOARD * GetBoard() const
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:142
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:252
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:259
TRACK * Next() const
Definition: class_track.h:98
void SetState(int type, int state)
Definition: base_struct.h:256
DLIST< TRACK > m_Track
Definition: class_board.h:246
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:999
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:773
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:142
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:252
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:259
void SetState(int type, int state)
Definition: base_struct.h:256
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:212
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Definition: pcbframe.cpp:999
BOARD * GetBoard() const
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:148
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:142
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:252
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:259
TRACK * Next() const
Definition: class_track.h:98
void SetState(int type, int state)
Definition: base_struct.h:256
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:49
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 128 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().

129 {
130  MODULE* currModule = NULL;
131  wxPoint PosOK;
132  wxPoint memopos;
133  int error;
134  PCB_LAYER_ID lay_tmp_TOP, lay_tmp_BOTTOM;
135 
136  // Undo: init list
137  PICKED_ITEMS_LIST newList;
138 
139  newList.m_Status = UR_CHANGED;
140  ITEM_PICKER picker( NULL, UR_CHANGED );
141 
142  if( GetBoard()->m_Modules == NULL )
143  return;
144 
145  m_canvas->SetAbortRequest( false );
146 
147  switch( place_mode )
148  {
149  case PLACE_1_MODULE:
150  currModule = Module;
151 
152  if( currModule == NULL )
153  return;
154 
155  currModule->SetIsPlaced( false );
156  currModule->SetNeedsPlaced( false );
157  break;
158 
159  case PLACE_OUT_OF_BOARD:
160  break;
161 
162  case PLACE_ALL:
163 
164  if( !IsOK( this, _( "Footprints NOT LOCKED will be moved" ) ) )
165  return;
166 
167  break;
168 
169  case PLACE_INCREMENTAL:
170 
171  if( !IsOK( this, _( "Footprints NOT PLACED will be moved" ) ) )
172  return;
173 
174  break;
175  }
176 
177  memopos = CurrPosition;
178  lay_tmp_BOTTOM = g_Route_Layer_BOTTOM;
179  lay_tmp_TOP = g_Route_Layer_TOP;
180 
182 
183  // Ensure Board.m_GridRouting has a reasonable value:
184  if( RoutingMatrix.m_GridRouting < Millimeter2iu( 0.25 ) )
185  RoutingMatrix.m_GridRouting = Millimeter2iu( 0.25 );
186 
187  // Compute module parameters used in auto place
189  return;
190 
191  int moduleCount = 0;
192  Module = GetBoard()->m_Modules;
193 
194  for( ; Module != NULL; Module = Module->Next() )
195  {
196  Module->SetNeedsPlaced( false );
197 
198  switch( place_mode )
199  {
200  case PLACE_1_MODULE:
201 
202  if( currModule == Module )
203  {
204  // Module will be placed, add to undo.
205  picker.SetItem( currModule );
206  newList.PushItem( picker );
207  Module->SetNeedsPlaced( true );
208  }
209 
210  break;
211 
212  case PLACE_OUT_OF_BOARD:
213  Module->SetIsPlaced( false );
214 
215  if( Module->IsLocked() )
216  break;
217 
218  if( !RoutingMatrix.m_BrdBox.Contains( Module->GetPosition() ) )
219  {
220  // Module will be placed, add to undo.
221  picker.SetItem( Module );
222  newList.PushItem( picker );
223  Module->SetNeedsPlaced( true );
224  }
225 
226  break;
227 
228  case PLACE_ALL:
229  Module->SetIsPlaced( false );
230 
231  if( Module->IsLocked() )
232  break;
233 
234  // Module will be placed, add to undo.
235  picker.SetItem( Module );
236  newList.PushItem( picker );
237  Module->SetNeedsPlaced( true );
238  break;
239 
240  case PLACE_INCREMENTAL:
241 
242  if( Module->IsLocked() )
243  {
244  Module->SetIsPlaced( false );
245  break;
246  }
247 
248  if( !Module->NeedsPlaced() )
249  {
250  // Module will be placed, add to undo.
251  picker.SetItem( Module );
252  newList.PushItem( picker );
253  Module->SetNeedsPlaced( true );
254  }
255 
256  break;
257  }
258 
259  if( Module->NeedsPlaced() ) // Erase from screen
260  {
261  moduleCount++;
262  Module->Draw( m_canvas, DC, GR_XOR );
263  }
264  else
265  {
266  genModuleOnRoutingMatrix( Module );
267  }
268  }
269 
270  // Undo command: prepare list
271  if( newList.GetCount() )
272  SaveCopyInUndoList( newList, UR_CHANGED );
273 
274  int cnt = 0;
275  wxString msg;
276 
277  while( ( Module = PickModule( this, DC ) ) != NULL )
278  {
279  // Display some info about activity, module placement can take a while:
280  msg.Printf( _( "Place footprint %d of %d" ), cnt, moduleCount );
281  SetStatusText( msg );
282 
283  double initialOrient = Module->GetOrientation();
284  // Display fill area of interest, barriers, penalties.
286 
287  error = getOptimalModulePlacement( this, Module, DC );
288  double bestScore = MinCout;
289  double bestRotation = 0.0;
290  int rotAllowed;
291  PosOK = CurrPosition;
292 
293  if( error == ESC )
294  goto end_of_tst;
295 
296  // Try orientations 90, 180, 270 degrees from initial orientation
297  rotAllowed = Module->GetPlacementCost180();
298 
299  if( rotAllowed != 0 )
300  {
301  Rotate_Module( DC, Module, 1800.0, true );
302  error = getOptimalModulePlacement( this, Module, DC );
303  MinCout *= OrientPenality[rotAllowed];
304 
305  if( bestScore > MinCout ) // This orientation is better.
306  {
307  PosOK = CurrPosition;
308  bestScore = MinCout;
309  bestRotation = 1800.0;
310  }
311  else
312  {
313  Rotate_Module( DC, Module, initialOrient, false );
314  }
315 
316  if( error == ESC )
317  goto end_of_tst;
318  }
319 
320  // Determine if the best orientation of a module is 90.
321  rotAllowed = Module->GetPlacementCost90();
322 
323  if( rotAllowed != 0 )
324  {
325  Rotate_Module( DC, Module, 900.0, true );
326  error = getOptimalModulePlacement( this, Module, DC );
327  MinCout *= OrientPenality[rotAllowed];
328 
329  if( bestScore > MinCout ) // This orientation is better.
330  {
331  PosOK = CurrPosition;
332  bestScore = MinCout;
333  bestRotation = 900.0;
334  }
335  else
336  {
337  Rotate_Module( DC, Module, initialOrient, false );
338  }
339 
340  if( error == ESC )
341  goto end_of_tst;
342  }
343 
344  // Determine if the best orientation of a module is -90.
345  if( rotAllowed != 0 )
346  {
347  Rotate_Module( DC, Module, 2700.0, true );
348  error = getOptimalModulePlacement( this, Module, DC );
349  MinCout *= OrientPenality[rotAllowed];
350 
351  if( bestScore > MinCout ) // This orientation is better.
352  {
353  PosOK = CurrPosition;
354  bestScore = MinCout;
355  bestRotation = 2700.0;
356  }
357  else
358  {
359  Rotate_Module( DC, Module, initialOrient, false );
360  }
361 
362  if( error == ESC )
363  goto end_of_tst;
364  }
365 
366 end_of_tst:
367 
368  if( error == ESC )
369  break;
370 
371  // Place module.
373  SetCrossHairPosition( PosOK );
374 
375  PlaceModule( Module, DC );
376 
377  bestRotation += initialOrient;
378 
379  if( bestRotation != Module->GetOrientation() )
380  Rotate_Module( DC, Module, bestRotation, false );
381 
383 
384  Module->CalculateBoundingBox();
385 
386  genModuleOnRoutingMatrix( Module );
387  Module->SetIsPlaced( true );
388  Module->SetNeedsPlaced( false );
389  }
390 
391  CurrPosition = memopos;
392 
394 
395  g_Route_Layer_TOP = lay_tmp_TOP;
396  g_Route_Layer_BOTTOM = lay_tmp_BOTTOM;
397 
398  Module = GetBoard()->m_Modules;
399 
400  for( ; Module != NULL; Module = Module->Next() )
401  {
402  Module->CalculateBoundingBox();
403  }
404 
405  GetBoard()->m_Status_Pcb = 0;
406  Compile_Ratsnest( DC, true );
407  m_canvas->ReDraw( DC, true );
408 }
static wxPoint CurrPosition
PCB_LAYER_ID g_Route_Layer_TOP
Definition: pcbnew.cpp:68
PCB_LAYER_ID g_Route_Layer_BOTTOM
Definition: pcbnew.cpp:69
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:155
MODULE * Next() const
Definition: class_module.h:100
void SetNeedsPlaced(bool needsPlaced)
Definition: class_module.h:264
BOARD * GetBoard() const
void Rotate_Module(wxDC *DC, MODULE *module, double angle, bool incremental)
Definition: modules.cpp:433
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
bool NeedsPlaced() const
Definition: class_module.h:263
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:533
#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:352
PCB_LAYER_ID
A quick note on layer IDs:
double GetOrientation() const
Definition: class_module.h:160
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:255
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:236
void SetAbortRequest(bool aAbortRequest)
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:56
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:607
DLIST< MODULE > m_Modules
Definition: class_board.h:245
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:530
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:129
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:237
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(), BOARD_CONNECTED_ITEM::GetNetCode(), PCB_BASE_FRAME::GetScreen(), PCB_SCREEN::m_Route_Layer_BOTTOM, PCB_SCREEN::m_Route_Layer_TOP, 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:212
PCB_LAYER_ID g_Route_Layer_TOP
Definition: pcbnew.cpp:68
PCB_LAYER_ID g_Route_Layer_BOTTOM
Definition: pcbnew.cpp:69
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 ...
DLIST_ITERATOR_WRAPPER< D_PAD > Pads()
Definition: class_module.h:140
BOARD * GetBoard() const
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
class MODULE, a footprint
Definition: typeinfo.h:101
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)
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:56
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
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 249 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().

250 {
251  int s_large;
252  DRAWSEGMENT* DrawItem;
253 
255 
256  if( GetActiveLayer() == Edge_Cuts )
257  {
259  }
260 
261  if( Segment == NULL ) // Create new trace.
262  {
263  SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
264  Segment->SetFlags( IS_NEW );
265  Segment->SetLayer( GetActiveLayer() );
266  Segment->SetWidth( s_large );
267  Segment->SetShape( shape );
268  Segment->SetAngle( 900 );
269  Segment->SetStart( GetCrossHairPosition() );
270  Segment->SetEnd( GetCrossHairPosition() );
272  }
273  else /* The ending point ccordinate Segment->m_End was updated by he function
274  * DrawSegment() called on a move mouse event
275  * during the segment creation
276  */
277  {
278  if( Segment->GetStart() != Segment->GetEnd() )
279  {
280  if( Segment->GetShape() == S_SEGMENT )
281  {
282  SaveCopyInUndoList( Segment, UR_NEW );
283  GetBoard()->Add( Segment );
284 
285  OnModify();
286  Segment->ClearFlags();
287 
288  Segment->Draw( m_canvas, DC, GR_OR );
289 
290  DrawItem = Segment;
291 
292  SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
293 
294  Segment->SetFlags( IS_NEW );
295  Segment->SetLayer( DrawItem->GetLayer() );
296  Segment->SetWidth( s_large );
297  Segment->SetShape( DrawItem->GetShape() );
298  Segment->SetType( DrawItem->GetType() );
299  Segment->SetAngle( DrawItem->GetAngle() );
300  Segment->SetStart( DrawItem->GetEnd() );
301  Segment->SetEnd( DrawItem->GetEnd() );
302  DrawSegment( m_canvas, DC, wxDefaultPosition, false );
303  }
304  else
305  {
306  End_Edge( Segment, DC );
307  Segment = NULL;
308  }
309  }
310  }
311 
312  return Segment;
313 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Definition: pcbframe.cpp:999
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:212
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:127
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:267
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
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:343
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:268
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:316
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, g_CurrentTrackList, g_CurrentTrackSegment, g_FirstTrackSegment, g_Raccord_45_Auto, PCB_BASE_FRAME::GetBoard(), EDA_DRAW_FRAME::GetCrossHairPosition(), PCB_BASE_FRAME::GetDesignSettings(), TRACK::GetEnd(), BOARD::GetLockPoint(), BOARD_CONNECTED_ITEM::GetNetCode(), D_PAD::GetPosition(), PCB_BASE_FRAME::GetScreen(), TRACK::GetWidth(), HighLight(), BOARD::HighLightON(), BOARD::HitTestForAnyFilledArea(), IS_NEW, EDA_DRAW_FRAME::m_canvas, m_drc, PCB_GENERAL_SETTINGS::m_legacyDrcOn, PCB_GENERAL_SETTINGS::m_legacyUseTwoSegmentTracks, BOARD::m_Track, PCB_PAD_T, PCB_TRACE_T, DLIST< T >::PushBack(), BOARD::PushHighLight(), PCB_BASE_FRAME::SetCurItem(), SetCurrentNetClass(), EDA_ITEM::SetFlags(), BOARD::SetHighLightNet(), BOARD_ITEM::SetLayer(), EDA_DRAW_PANEL::SetMouseCapture(), EDA_DRAW_FRAME::SetMsgPanel(), TRACK::SetStart(), EDA_ITEM::SetState(), PCB_BASE_FRAME::Settings(), TRACK::SetWidth(), ShowNewTrackWhenMovingCursor(), TRACK::start, and EDA_ITEM::Type().

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

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  int net = -1;
162 
163  if( lockPoint )
164  net = lockPoint->GetNetCode();
165 
166  BuildAirWiresTargetsList( lockPoint, wxPoint( 0, 0 ), net );
167 
168  DBG( g_CurrentTrackList.VerifyListIntegrity() );
169 
170  GetBoard()->HighLightON();
171  GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() );
172 
173  // Display info about track Net class, and init track and vias sizes:
174  g_CurrentTrackSegment->SetNetCode( GetBoard()->GetHighLightNetCode() );
175  SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
176 
177  g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
178  g_CurrentTrackSegment->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
179 
180  if( GetDesignSettings().m_UseConnectedTrackWidth )
181  {
182  if( trackOnStartPoint && trackOnStartPoint->Type() == PCB_TRACE_T )
183  g_CurrentTrackSegment->SetWidth( trackOnStartPoint->GetWidth());
184  }
185 
186  g_CurrentTrackSegment->SetStart( pos );
187  g_CurrentTrackSegment->SetEnd( pos );
188 
189  if( pad )
190  {
191  // Useful to display track length, if the pad has a die length:
192  g_CurrentTrackSegment->SetState( BEGIN_ONPAD, true );
193  g_CurrentTrackSegment->start = pad;
194  }
195 
196  if( Settings().m_legacyUseTwoSegmentTracks )
197  {
198  // Create 2nd segment
200 
201  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
202 
205 
206  g_FirstTrackSegment->SetState( BEGIN_ONPAD | END_ONPAD, false );
207  }
208 
209  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
210 
213  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
214 
215  if( Settings().m_legacyDrcOn )
216  {
217  if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
218  {
219  return g_CurrentTrackSegment;
220  }
221  }
222  }
223  else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor.
224  {
225  // Test for a D.R.C. error:
226  if( Settings().m_legacyDrcOn )
227  {
228  if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
229  return NULL;
230 
231  // We must handle 2 segments
233  {
234  if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), GetBoard()->m_Track ) )
235  return NULL;
236  }
237  }
238 
239  /* Current track is Ok: current segment is kept, and a new one is
240  * created unless the current segment is null, or 2 last are null
241  * if this is a 2 segments track build.
242  */
243  bool CanCreateNewSegment = true;
244 
246  CanCreateNewSegment = false;
247 
249  && g_CurrentTrackSegment->Back()
250  && g_CurrentTrackSegment->Back()->IsNull() )
251  CanCreateNewSegment = false;
252 
253  if( CanCreateNewSegment )
254  {
255  // Erase old track on screen
256  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
257 
258  ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
259 
260  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
261 
262  if( g_Raccord_45_Auto )
263  Add45DegreeSegment( aDC );
264 
265  TRACK* previousTrack = g_CurrentTrackSegment;
266 
267  TRACK* newTrack = (TRACK*)g_CurrentTrackSegment->Clone();
268  g_CurrentTrackList.PushBack( newTrack );
269  newTrack->SetFlags( IS_NEW );
270 
271  newTrack->SetState( BEGIN_ONPAD | END_ONPAD, false );
272  newTrack->start = previousTrack->end;
273 
274  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
275 
276  newTrack->SetStart( newTrack->GetEnd() );
277 
278  newTrack->SetLayer( GetScreen()->m_Active_Layer );
279 
280  if( !GetDesignSettings().m_UseConnectedTrackWidth )
281  newTrack->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
282 
283  DBG( g_CurrentTrackList.VerifyListIntegrity(); );
284 
285  // Show the new position
286  ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
287  }
288  }
289 
291  return g_CurrentTrackSegment;
292 }
#define g_FirstTrackSegment
first segment created
Definition: pcbnew.h:96
#define g_CurrentTrackSegment
most recently created segment
Definition: pcbnew.h:95
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
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:147
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
DLIST< TRACK > g_CurrentTrackList
Definition: pcbnew.cpp:88
bool Add45DegreeSegment(wxDC *aDC)
Function Add45DegreeSegment adds a track segment between 2 tracks segments if these 2 segments make a...
Definition: editrack.cpp:295
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
void BuildAirWiresTargetsList(BOARD_CONNECTED_ITEM *aItemRef, const wxPoint &aPosition, int aNet)
Function BuildAirWiresTargetsList Build a list of candidates that can be a coonection point when a tr...
Definition: ratsnest.cpp:173
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
Definition: pcbframe.cpp:1161
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:146
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:71
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:127
Class LSET is a set of PCB_LAYER_IDs.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
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:773
PCB_GENERAL_SETTINGS & Settings()
const wxPoint & GetPosition() const override
Definition: class_pad.h:205
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void HighLight(wxDC *DC)
Function HighLight.
Definition: highlight.cpp:101
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void HighLightON()
Function HighLightON Enable highlight.
Definition: class_board.h:394
int GetNetCode() const
Function GetNetCode.
void SetHighLightNet(int aNetCode)
Function SetHighLightNet.
Definition: class_board.h:372
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:256
int GetWidth() const
Definition: class_track.h:115
void ShowNewTrackWhenMovingCursor(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: editrack.cpp:671
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:155
#define DBG(x)
Definition: fctsys.h:33
DLIST< TRACK > m_Track
Definition: class_board.h:246
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
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 microwave.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.
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:773
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
static void Exit_Self(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Definition: microwave.cpp:129
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 ShowBoundingBoxMicroWaveInductor(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: microwave.cpp:79
static MWAVE::INDUCTOR_PATTERN s_inductor_pattern
An inductor pattern temporarily used during mu-wave inductor creation
Definition: microwave.cpp:70
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.
static bool s_inductorInProgress
A flag set to true when mu-wave inductor is being created
Definition: microwave.cpp:73
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:71
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(), DisplayErrorMessage(), DRC::Drc(), ZONE_SETTINGS::ExportSetting(), PCB_BASE_FRAME::GetActiveLayer(), BOARD::GetArea(), BOARD::GetAreaCount(), PCB_BASE_FRAME::GetBoard(), ZONE_CONTAINER::GetCornerPosition(), EDA_DRAW_FRAME::GetCrossHairPosition(), BOARD::GetHighLightNetCode(), ZONE_SETTINGS::GetIsKeepout(), 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, PCB_GENERAL_SETTINGS::m_legacyDrcOn, ZONE_SETTINGS::m_NetcodeSelection, ZONE_SETTINGS::m_ThermalReliefCopperBridge, ZONE_SETTINGS::m_ThermalReliefGap, ZONE_SETTINGS::m_ZoneClearance, ZONE_SETTINGS::m_ZoneMinThickness, EDA_DRAW_PANEL::MoveCursorToCrossHair(), OK_DRC, 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::Settings(), 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  DisplayErrorMessage( 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.
672  zone->AppendCorner( GetCrossHairPosition(), -1 );
673  // Add the duplicate corner:
674  zone->AppendCorner( GetCrossHairPosition(), -1, true );
675 
676  if( Settings().m_legacyDrcOn && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() )
677  {
678  zone->ClearFlags();
679  zone->RemoveAllContours();
680 
681  // use the form of SetCurItem() which does not write to the msg panel,
682  // SCREEN::SetCurItem(), so the DRC error remains on screen.
683  // PCB_EDIT_FRAME::SetCurItem() calls DisplayInfo().
684  GetScreen()->SetCurItem( NULL );
685  DisplayErrorMessage( this,
686  _( "DRC error: this start point is inside or too close an other area" ) );
687  return 0;
688  }
689 
690  SetCurItem( zone );
692  }
693  else // edge in progress:
694  {
695  ii = zone->GetNumCorners() - 1;
696 
697  // edge in progress : the current corner coordinate was set
698  // by Show_New_Edge_While_Move_Mouse
699  if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
700  {
701  if( !Settings().m_legacyDrcOn || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) )
702  {
703  // Ok, we can add a new corner
704  if( m_canvas->IsMouseCaptured() )
705  m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
706 
707  // It is necessary to allow duplication of the points, as we have to handle the
708  // continuous drawing while creating the zone at the same time as we build it. Null
709  // segments are removed when the zone is finished, in End_Zone.
710  zone->AppendCorner( GetCrossHairPosition(), -1, true );
711 
712  SetCurItem( zone ); // calls DisplayInfo().
713 
714  if( m_canvas->IsMouseCaptured() )
715  m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
716  }
717  }
718  }
719 
720  return zone->GetNumCorners();
721 }
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:557
#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:465
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:259
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:347
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:505
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:217
#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:127
int m_NetcodeSelection
Net code selection for the current zone.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:85
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
const bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
bool IsMouseCaptured() const
PCB_GENERAL_SETTINGS & Settings()
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:103
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:1011
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:372
#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:982