diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 30228160ce..01a6c8d2b1 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -1,7 +1,7 @@ -/***********************************************************/ -/* wxPcbStruct.h: */ -/* Classes used in pcbnew, cvpcb and gerbview */ -/***********************************************************/ +/** + * @file wxBasePcbStruct.h + * @brief Classes used in pcbnew, cvpcb and gerbview. + */ #ifndef WX_BASE_PCB_FRAME_H #define WX_BASE_PCB_FRAME_H @@ -57,18 +57,18 @@ public: int m_DisplayModText; // How to display module texts (line/ filled / sketch) bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, * TRUE = filled */ - EDA_UNITS_T m_UserGridUnit; - wxRealPoint m_UserGridSize; + EDA_UNITS_T m_UserGridUnit; + wxRealPoint m_UserGridSize; - int m_FastGrid1; - int m_FastGrid2; + int m_FastGrid1; + int m_FastGrid2; - EDA_3D_FRAME* m_Draw3DFrame; - FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame; + EDA_3D_FRAME* m_Draw3DFrame; + FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame; protected: - BOARD* m_Pcb; - GENERAL_COLLECTOR* m_Collector; + BOARD* m_Pcb; + GENERAL_COLLECTOR* m_Collector; void updateGridSelectBox(); void updateZoomSelectBox(); @@ -97,41 +97,37 @@ public: // General - virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; - - virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { } - virtual void ReCreateHToolbar() = 0; - virtual void ReCreateVToolbar() = 0; - virtual void OnLeftClick( wxDC* DC, - const wxPoint& MousePos ) = 0; - virtual void OnLeftDClick( wxDC* DC, - const wxPoint& MousePos ) = 0; - virtual bool OnRightClick( const wxPoint& MousePos, - wxMenu* PopMenu ) = 0; - virtual void ReCreateMenuBar(); - virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg ); - virtual void UpdateStatusBar(); + virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; + virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { } + virtual void ReCreateHToolbar() = 0; + virtual void ReCreateVToolbar() = 0; + virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; + virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0; + virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; + virtual void ReCreateMenuBar(); + virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg ); + virtual void UpdateStatusBar(); virtual PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); } - virtual double BestZoom(); + virtual double BestZoom(); - virtual void Show3D_Frame( wxCommandEvent& event ); + virtual void Show3D_Frame( wxCommandEvent& event ); public: // Read/write functions: EDA_ITEM* ReadDrawSegmentDescr( LINE_READER* aReader ); - int ReadListeSegmentDescr( LINE_READER* aReader, - TRACK* PtSegm, - int StructType, - int NumSegm ); + int ReadListeSegmentDescr( LINE_READER* aReader, + TRACK* PtSegm, + int StructType, + int NumSegm ); - int ReadSetup( LINE_READER* aReader ); - int ReadGeneralDescrPcb( LINE_READER* aReader ); + int ReadSetup( LINE_READER* aReader ); + int ReadGeneralDescrPcb( LINE_READER* aReader ); /** @@ -149,9 +145,9 @@ public: * the type of search to be performed. If zero, then * the mouse tools will be tested instead. */ - BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 ); + BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 ); - void ProcessItemSelection( wxCommandEvent& event ); + void ProcessItemSelection( wxCommandEvent& event ); /** * Function SetCurItem @@ -161,12 +157,11 @@ public: * of "selecting" an item more formal, and to indivisibly tie the operation * of selecting an item to displaying it using BOARD_ITEM::Display_Infos(). * @param aItem The BOARD_ITEM to make the selected item or NULL if none. - * @param aDisplayInfo = true to display item info, false if not (default = - *true) + * @param aDisplayInfo = true to display item info, false if not (default = true) */ - void SetCurItem( BOARD_ITEM* aItem, - bool aDisplayInfo = true ); - BOARD_ITEM* GetCurItem(); + void SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo = true ); + + BOARD_ITEM* GetCurItem(); /** * Function GetCollectorsGuide @@ -182,14 +177,14 @@ public: * requested point is out of view. * @param aPos The point to go to. */ - void CursorGoto( const wxPoint& aPos ); + void CursorGoto( const wxPoint& aPos ); - void place_marqueur( wxDC* DC, - const wxPoint& pos, - char* pt_bitmap, - int DrawMode, - int color, - int type ); + void place_marqueur( wxDC* DC, + const wxPoint& pos, + char* pt_bitmap, + int DrawMode, + int color, + int type ); MODULE* Copie_Module( MODULE* module ); @@ -204,10 +199,10 @@ public: * footprint name * @return : true if OK, false if abort */ - bool Save_Module_In_Library( const wxString& aLibName, - MODULE* aModule, - bool aOverwrite, - bool aDisplayDialog ); + bool Save_Module_In_Library( const wxString& aLibName, + MODULE* aModule, + bool aOverwrite, + bool aDisplayDialog ); /** * Function Archive_Modules @@ -243,21 +238,20 @@ public: */ MODULE* Create_1_Module( const wxString& aModuleName ); - void Edit_Module( MODULE* module, wxDC* DC ); - void Rotate_Module( wxDC* DC, - MODULE* module, - int angle, - bool incremental ); - void Place_Module( MODULE* module, - wxDC* DC, - bool aDoNotRecreateRatsnest = false ); + void Edit_Module( MODULE* module, wxDC* DC ); + void Rotate_Module( wxDC* DC, + MODULE* module, + int angle, + bool incremental ); + void Place_Module( MODULE* module, + wxDC* DC, + bool aDoNotRecreateRatsnest = false ); // module texts - 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 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 ); TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC ); /** @@ -267,7 +261,7 @@ public: * @param aItem is the item to be reset, either TEXTE_PCB or TEXTE_MODULE. * @param aDC is the drawing context. */ - void ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC ); + void ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC ); /** * Function ResetModuleTextSizes @@ -276,13 +270,12 @@ public: * @param aType is the field type (TEXT_is_REFERENCE, TEXT_is_VALUE, or TEXT_is_DIVERS). * @param aDC is the drawing context. */ - void ResetModuleTextSizes( int aType, wxDC* aDC ); + void ResetModuleTextSizes( int aType, wxDC* aDC ); - void InstallPadOptionsFrame( D_PAD* pad ); - void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, - wxDC* DC ); + void InstallPadOptionsFrame( D_PAD* pad ); + void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC ); - void AddPad( MODULE* Module, bool draw ); + void AddPad( MODULE* Module, bool draw ); /** * Function DeletePad @@ -292,16 +285,14 @@ public: * @param aPad = the pad to delete * @param aQuery = true to prompt for confirmation, false to delete silently */ - void DeletePad( D_PAD* aPad, bool aQuery = true ); - - void StartMovePad( D_PAD* Pad, wxDC* DC ); - 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 Global_Import_Pad_Settings( D_PAD* aPad, - bool aDraw ); + void DeletePad( D_PAD* aPad, bool aQuery = true ); + void StartMovePad( D_PAD* Pad, wxDC* DC ); + 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 Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ); // loading footprints @@ -317,9 +308,9 @@ public: * @return a pointer to the new module, or NULL * */ - MODULE* Get_Librairie_Module( const wxString& aLibraryFullFilename, - const wxString& aModuleName, - bool aDisplayMessageError ); + MODULE* Get_Librairie_Module( const wxString& aLibraryFullFilename, + const wxString& aModuleName, + bool aDisplayMessageError ); /** * Function Select_1_Module_From_List @@ -333,15 +324,14 @@ public: * having one (or more) of these keywords in their * keyword list ( aKeyWord = wxEmptyString if not used ) * - * @return wxEmptyString if abort or fails, or the selected module name if - * Ok + * @return wxEmptyString if abort or fails, or the selected module name if Ok */ wxString Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, const wxString& aLibraryFullFilename, const wxString& aMask, const wxString& aKeyWord ); - MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC ); + MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC ); // ratsnest functions /** @@ -352,7 +342,7 @@ public: * @param aDC = the current device context (can be NULL) * @param aDisplayStatus : if true, display the computation results */ - void Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus ); + void Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus ); /** * Function Test_1_Net_Ratsnest @@ -360,7 +350,7 @@ public: * @param aDC - Device context to draw on. * @param aNetcode = netcode used to compute the ratsnest. */ - int Test_1_Net_Ratsnest( wxDC* aDC, int aNetcode ); + int Test_1_Net_Ratsnest( wxDC* aDC, int aNetcode ); /** * Function build_ratsnest_module @@ -370,51 +360,80 @@ public: * It shows the connections from a pad to the nearest connected pad * @param aModule = module to consider. */ - void build_ratsnest_module( MODULE* aModule ); + void build_ratsnest_module( MODULE* aModule ); - void trace_ratsnest_module( wxDC* DC ); - void Build_Board_Ratsnest( wxDC* DC ); + void trace_ratsnest_module( wxDC* DC ); + void Build_Board_Ratsnest( wxDC* DC ); /** * function Displays the general ratsnest * Only ratsnest with the status bit CH_VISIBLE is set are displayed * @param aDC = the current device context (can be NULL) * @param aNetcode if > 0, Display only the ratsnest relative to the - * corresponding net_code + * corresponding net_code */ - void DrawGeneralRatsnest( wxDC* aDC, int aNetcode = 0 ); + void DrawGeneralRatsnest( wxDC* aDC, int aNetcode = 0 ); - void trace_ratsnest_pad( wxDC* DC ); - void build_ratsnest_pad( BOARD_ITEM* ref, - const wxPoint& refpos, - bool init ); + void trace_ratsnest_pad( wxDC* DC ); + void build_ratsnest_pad( BOARD_ITEM* ref, const wxPoint& refpos, bool init ); - void Tst_Ratsnest( wxDC* DC, int ref_netcode ); - void test_connexions( wxDC* DC ); - void test_1_net_connexion( wxDC* DC, int net_code ); - void RecalculateAllTracksNetcode(); + void Tst_Ratsnest( wxDC* DC, int ref_netcode ); + + /** + * Function TestConnections + * tests the connections relative to all nets. + *
+ * This function update the status of the ratsnest ( flag CH_ACTIF = 0 if a connection + * is found, = 1 else) track segments are assumed to be sorted by net codes. + * This is the case because when a new track is added, it is inserted in the linked list + * according to its net code. and when nets are changed (when a new netlist is read) + * tracks are sorted before using this function. + *
+ * @param aDC = current Device Context + */ + void TestConnections( wxDC* aDC ); + + /** + * Function TestNetConnection + * tests the connections relative to \a aNetCode. Track segments are assumed to be + * sorted by net codes. + * @param aDC Cyrrent Device Context + * @param aNetCode The net code to test + */ + void TestNetConnection( wxDC* aDC, int aNetCode ); + + /** + * Function RecalculateAllTracksNetcode + * search connections between tracks and pads and propagate pad net codes to the track + * segments. + *+ * This is a 2 pass computation. First we search a connection between a track segment + * and a pad. If the connection is found, the segment netcode is set to the pad netcode. + */ + void RecalculateAllTracksNetcode(); /* Plotting functions: * Return true if OK, false if the file is not created (or has a problem) */ - bool Genere_GERBER( const wxString& FullFileName, - int Layer, - bool PlotOriginIsAuxAxis, - GRTraceMode trace_mode ); - bool Genere_HPGL( const wxString& FullFileName, - int Layer, - GRTraceMode trace_mode ); - bool Genere_PS( const wxString& FullFileName, + bool Genere_GERBER( const wxString& FullFileName, int Layer, - bool useA4, + bool PlotOriginIsAuxAxis, GRTraceMode trace_mode ); - bool Genere_DXF( const wxString& FullFileName, - int Layer, - GRTraceMode trace_mode ); - void Plot_Layer( PLOTTER* plotter, - int Layer, - GRTraceMode trace_mode ); + bool Genere_HPGL( const wxString& FullFileName, + int Layer, + GRTraceMode trace_mode ); + bool Genere_PS( const wxString& FullFileName, + int Layer, + bool useA4, + GRTraceMode trace_mode ); + bool Genere_DXF( const wxString& FullFileName, + int Layer, + GRTraceMode trace_mode ); + void Plot_Layer( PLOTTER* plotter, + int Layer, + GRTraceMode trace_mode ); + /** * Function Plot_Standard_Layer * plot copper or technical layers. @@ -428,13 +447,11 @@ public: * @param aSkipNPTH_Pads = true to skip NPTH Pads, when the pad size and the pad hole * have the same size. Used in GERBER format only. */ - void Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask, - bool aPlotVia, GRTraceMode aPlotMode, - bool aSkipNPTH_Pads = false ); + void Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask, + bool aPlotVia, GRTraceMode aPlotMode, + bool aSkipNPTH_Pads = false ); - void Plot_Serigraphie( PLOTTER* plotter, - int masque_layer, - GRTraceMode trace_mode ); + void Plot_Serigraphie( PLOTTER* plotter, int masque_layer, GRTraceMode trace_mode ); /** * Function PlotDrillMark @@ -447,9 +464,7 @@ public: * @param aSmallDrillShape = true to plot a small drill shape, false to * plot the actual drill shape */ - void PlotDrillMark( PLOTTER* aPlotter, - GRTraceMode aTraceMode, - bool aSmallDrillShape ); + void PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode, bool aSmallDrillShape ); /* Functions relative to Undo/redo commands: */ @@ -484,12 +499,11 @@ public: // layerhandling: // (See pcbnew/sel_layer.cpp for description of why null_layer parameter // is provided) - int SelectLayer( int default_layer, int min_layer, int max_layer, - bool null_layer = false ); - void SelectLayerPair(); + int SelectLayer( int default_layer, int min_layer, int max_layer, bool null_layer = false ); + void SelectLayerPair(); virtual void SwitchLayer( wxDC* DC, int layer ); - void InstallGridFrame( const wxPoint& pos ); + void InstallGridFrame( const wxPoint& pos ); /** * Load applications settings common to PCB draw frame objects. diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 1eb809acbf..8f535306fa 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -1,6 +1,6 @@ -/***********************************************************/ -/* wxPcbStruct.h */ -/***********************************************************/ +/** + * @file wxPcbStruct.h + */ #ifndef WXPCB_STRUCT_H #define WXPCB_STRUCT_H @@ -118,8 +118,8 @@ public: wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width wxComboBox* m_SelViaSizeBox; // a combo box to display and select current via diameter - bool m_show_microwave_tools; - bool m_show_layer_manager_tools; + bool m_show_microwave_tools; + bool m_show_layer_manager_tools; public: @@ -129,26 +129,26 @@ public: ~PCB_EDIT_FRAME(); - void OnQuit( wxCommandEvent& event ); + void OnQuit( wxCommandEvent& event ); /** * Function ToPlotter * Open a dialog frame to create plot and drill files * relative to the current board */ - void ToPlotter( wxCommandEvent& event ); + void ToPlotter( wxCommandEvent& event ); /** * Function ToPrinter * Install the print dialog */ - void ToPrinter( wxCommandEvent& event ); + void ToPrinter( wxCommandEvent& event ); /** * Function SVG_Print * shows the print SVG file dialog. */ - void SVG_Print( wxCommandEvent& event ); + void SVG_Print( wxCommandEvent& event ); // User interface update command event handlers. void OnUpdateSave( wxUpdateUIEvent& aEvent ); @@ -194,17 +194,16 @@ public: * @param aPrintMirrorMode = true to plot mirrored * @param aData = a pointer on an auxiliary data (NULL if not used) */ - virtual void PrintPage( wxDC* aDC, - int aPrintMaskLayer, bool aPrintMirrorMode, + virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode, void * aData = NULL ); - void GetKicadAbout( wxCommandEvent& event ); + void GetKicadAbout( wxCommandEvent& event ); /** * Function IsGridVisible() , virtual * @return true if the grid must be shown */ - virtual bool IsGridVisible(); + virtual bool IsGridVisible(); /** * Function SetGridVisibility() , virtual @@ -212,26 +211,26 @@ public: * if you want to store/retrieve the grid visibility in configuration. * @param aVisible = true if the grid must be shown */ - virtual void SetGridVisibility( bool aVisible ); + virtual void SetGridVisibility( bool aVisible ); /** * Function GetGridColor() , virtual * @return the color of the grid */ - virtual int GetGridColor(); + virtual int GetGridColor(); /** * Function SetGridColor() , virtual * @param aColor = the new color of the grid */ - virtual void SetGridColor(int aColor); + virtual void SetGridColor(int aColor); // Configurations: - void InstallConfigFrame(); - void Process_Config( wxCommandEvent& event ); + void InstallConfigFrame(); + void Process_Config( wxCommandEvent& event ); PARAM_CFG_ARRAY& GetProjectFileParameters(); - void SaveProjectSettings(); + void SaveProjectSettings(); /** * Load the project file configuration settings. @@ -240,7 +239,7 @@ public: * if not found use kicad.pro and initialize default values * @return always returns true. */ - bool LoadProjectSettings( const wxString& aProjectFileName ); + bool LoadProjectSettings( const wxString& aProjectFileName ); /** * Get the list of application specific settings. @@ -276,7 +275,7 @@ public: * * @return - Absolute path and file name of the last net list file successfully read. */ - wxString GetLastNetListRead(); + wxString GetLastNetListRead(); /** * Set the last net list successfully read by the net list dialog box. @@ -289,7 +288,7 @@ public: * * @param aNetListFile - The last net list file with full path successfully read. */ - void SetLastNetListRead( const wxString& aNetListFile ); + void SetLastNetListRead( const wxString& aNetListFile ); /** * Function Test_Duplicate_Missing_And_Extra_Footprints @@ -320,17 +319,17 @@ public: * Depending on the current active tool:: * Tool track * if a track is in progress: Delete the last segment - * else delete the entire track + * else delete the entire track * Tool module (footprint): * Delete the module. * @param aDC = current device context * @return true if an item was deleted */ - bool OnHotkeyDeleteItem( wxDC* aDC ); + bool OnHotkeyDeleteItem( wxDC* aDC ); - bool OnHotkeyPlaceItem( wxDC* aDC ); + bool OnHotkeyPlaceItem( wxDC* aDC ); - bool OnHotkeyEditItem( int aIdCommand ); + bool OnHotkeyEditItem( int aIdCommand ); /** * Function OnHotkeyMoveItem @@ -339,7 +338,7 @@ public: * @param aIdCommand = the hotkey command id * @return true if an item was moved */ - bool OnHotkeyMoveItem( int aIdCommand ); + bool OnHotkeyMoveItem( int aIdCommand ); /** * Function OnHotkeyRotateItem @@ -347,23 +346,23 @@ public: * @param aIdCommand = the hotkey command id * @return true if an item was moved */ - bool OnHotkeyRotateItem( int aIdCommand ); + bool OnHotkeyRotateItem( int aIdCommand ); - void OnCloseWindow( wxCloseEvent& Event ); - void Process_Special_Functions( wxCommandEvent& event ); - void Tracks_and_Vias_Size_Event( wxCommandEvent& event ); - void OnSelectTool( wxCommandEvent& aEvent ); + void OnCloseWindow( wxCloseEvent& Event ); + void Process_Special_Functions( wxCommandEvent& event ); + void Tracks_and_Vias_Size_Event( wxCommandEvent& event ); + void OnSelectTool( wxCommandEvent& aEvent ); - void ProcessMuWaveFunctions( wxCommandEvent& event ); - void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); + void ProcessMuWaveFunctions( wxCommandEvent& event ); + void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); - void RedrawActiveWindow( wxDC* DC, bool EraseBg ); - void ReCreateHToolbar(); - void ReCreateAuxiliaryToolbar(); - void ReCreateVToolbar(); - void ReCreateMicrowaveVToolbar(); - void ReCreateOptToolbar(); - void ReCreateMenuBar(); + void RedrawActiveWindow( wxDC* DC, bool EraseBg ); + void ReCreateHToolbar(); + void ReCreateAuxiliaryToolbar(); + void ReCreateVToolbar(); + void ReCreateMicrowaveVToolbar(); + void ReCreateOptToolbar(); + void ReCreateMenuBar(); LAYER_BOX_SELECTOR* ReCreateLayerBox( EDA_TOOLBAR* parent ); /** @@ -372,6 +371,7 @@ public: *
* Reloads the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function * to update auxiliary information. + *
*/ virtual void OnModify(); @@ -408,28 +408,28 @@ public: * changes out all the layers in m_Layers and may be called upon * loading a new BOARD. */ - void ReFillLayerWidget(); + void ReFillLayerWidget(); /** * Function Show3D_Frame * displays the 3D view of current printed circuit board. */ - void Show3D_Frame( wxCommandEvent& event ); - void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + void Show3D_Frame( wxCommandEvent& event ); + void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); /** * Function ShowDesignRulesEditor * displays the Design Rules Editor. */ - void ShowDesignRulesEditor( wxCommandEvent& event ); + void ShowDesignRulesEditor( wxCommandEvent& event ); /* toolbars update UI functions: */ - void PrepareLayerIndicator(); + void PrepareLayerIndicator(); /* mouse functions events: */ - void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); - void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); + void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); + void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); /** * Function OnRightClick @@ -438,10 +438,10 @@ public: * @param aMousePos The current mouse position * @param aPopMenu The menu to add to. */ - bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ); + bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ); - void OnSelectOptionToolbar( wxCommandEvent& event ); - void ToolOnRightClick( wxCommandEvent& event ); + void OnSelectOptionToolbar( wxCommandEvent& event ); + void ToolOnRightClick( wxCommandEvent& event ); /** * Function SaveCopyInUndoList. @@ -452,9 +452,9 @@ public: * @param aTransformPoint = the reference point of the transformation, for * commands like move */ - virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, - UNDO_REDO_T aTypeCommand, - const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); + virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, + UNDO_REDO_T aTypeCommand, + const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); /** * Function SaveCopyInUndoList (overloaded). @@ -475,7 +475,7 @@ public: * Put data pointed by List in the previous state, i.e. the state memorized by List * @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo * @param aRedoCommand = a bool: true for redo, false for undo - * @param aRebuildRatsnet = a bool: true to rebuild ratsnet (normal use), false + * @param aRebuildRatsnet = a bool: true to rebuild ratsnest (normal use), false * to just retrieve last state (used in abort commands that do not need to * rebuild ratsnest) */ @@ -511,7 +511,7 @@ public: * @param aKey = the key modifiers (Alt, Shift ...) * @return the block command id (BLOCK_MOVE, BLOCK_COPY...) */ - virtual int ReturnBlockCommand( int aKey ); + virtual int ReturnBlockCommand( int aKey ); /** * Function HandleBlockPlace() @@ -628,7 +628,7 @@ public: * the file else all items of the board file are added to the * existing board */ - int ReadPcbFile( LINE_READER* aReader, bool Append ); + int ReadPcbFile( LINE_READER* aReader, bool Append ); /** * Function SavePcbFile @@ -640,7 +640,7 @@ public: */ bool SavePcbFile( const wxString& aFileName ); - int SavePcbFormatAscii( FILE* File ); + int SavePcbFormatAscii( FILE* File ); bool WriteGeneralDescrPcb( FILE* File ); // BOARD handling @@ -665,15 +665,15 @@ public: * this is the same as created by cvpcb. * can be used if this file is lost */ - void RecreateCmpFileFromBoard( wxCommandEvent& aEvent ); + void RecreateCmpFileFromBoard( wxCommandEvent& aEvent ); /** * Function RecreateBOMFileFromBoard * Creates a BOM file from the current loaded board */ - void RecreateBOMFileFromBoard( wxCommandEvent& aEvent ); + void RecreateBOMFileFromBoard( wxCommandEvent& aEvent ); - void ExportToGenCAD( wxCommandEvent& event ); + void ExportToGenCAD( wxCommandEvent& event ); /** * Function OnExportVRML @@ -700,7 +700,7 @@ public: * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the * specification. */ - void ExportToSpecctra( wxCommandEvent& event ); + void ExportToSpecctra( wxCommandEvent& event ); /** * Function ImportSpecctraSession @@ -709,7 +709,7 @@ public: * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the * specification. */ - void ImportSpecctraSession( wxCommandEvent& event ); + void ImportSpecctraSession( wxCommandEvent& event ); /** * Function ImportSpecctraDesign @@ -719,15 +719,15 @@ public: * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the * specification. */ - void ImportSpecctraDesign( wxCommandEvent& event ); + void ImportSpecctraDesign( wxCommandEvent& event ); /** * Function Access_to_External_Tool * Run an external tool (like freeroute ) */ - void Access_to_External_Tool( wxCommandEvent& event ); + void Access_to_External_Tool( wxCommandEvent& event ); - MODULE* ListAndSelectModuleName(); + MODULE* ListAndSelectModuleName(); /** * Function ListNetsAndSelect @@ -735,26 +735,26 @@ public: * displays the sorted list of nets in a dialog frame * If a net is selected, it is highlighted */ - void ListNetsAndSelect( wxCommandEvent& event ); + void ListNetsAndSelect( wxCommandEvent& event ); - void Swap_Layers( wxCommandEvent& event ); + void Swap_Layers( wxCommandEvent& event ); // Handling texts on the board - void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); TEXTE_PCB* Create_Texte_Pcb( wxDC* DC ); - void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); - void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); - void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); - void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ); + void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ); // Graphic Segments type DRAWSEGMENT - void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); - void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); - void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC ); + void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); + void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); + void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC ); // Footprint edition (see also PCB_BASE_FRAME) - void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ); - void StartMove_Module( MODULE* module, wxDC* DC ); + void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ); + void StartMove_Module( MODULE* module, wxDC* DC ); /** * Function Delete Module @@ -764,11 +764,11 @@ public: * @param aDC = currentDevice Context. if NULL: do not redraw new ratsnest * @param aAskBeforeDeleting : if true: ask for confirmation before deleting */ - bool Delete_Module( MODULE* aModule, wxDC* aDC, bool aAskBeforeDeleting ); + bool Delete_Module( MODULE* aModule, wxDC* aDC, bool aAskBeforeDeleting ); - void Change_Side_Module( MODULE* Module, wxDC* DC ); + void Change_Side_Module( MODULE* Module, wxDC* DC ); - void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule ); + void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule ); /** * Function Exchange_Module @@ -780,14 +780,13 @@ public: * @param aUndoPickList = the undo list used to save OldModule. If null, * OldModule is deleted */ - void Exchange_Module( MODULE* aOldModule, - MODULE* aNewModule, - PICKED_ITEMS_LIST* aUndoPickList ); + void Exchange_Module( MODULE* aOldModule, MODULE* aNewModule, + PICKED_ITEMS_LIST* aUndoPickList ); // loading modules: see PCB_BASE_FRAME // Board handling - void RemoveStruct( BOARD_ITEM* Item, wxDC* DC ); + void RemoveStruct( BOARD_ITEM* Item, wxDC* DC ); /** * Function OnEditItemRequest @@ -797,10 +796,9 @@ public: */ void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ); - // Highlight functions: - int Select_High_Light( wxDC* DC ); - void High_Light( wxDC* DC ); + int Select_High_Light( wxDC* DC ); + void High_Light( wxDC* DC ); // Track and via edition: void Via_Edit_Control( wxCommandEvent& event ); @@ -829,20 +827,20 @@ public: * @return bool - true if the operation was successful, else false such as * the case where DRC would not allow a via. */ - bool Other_Layer_Route( TRACK* track, wxDC* DC ); - void HighlightUnconnectedPads( wxDC* DC ); + bool Other_Layer_Route( TRACK* track, wxDC* DC ); + void HighlightUnconnectedPads( wxDC* DC ); /** * Function DisplayNetStatus * shows the status of the net at the current mouse position or the * PCB status if no segment selected. */ - void DisplayNetStatus( wxDC* DC ); + void DisplayNetStatus( wxDC* DC ); TRACK* Delete_Segment( wxDC* DC, TRACK* Track ); - void Delete_Track( wxDC* DC, TRACK* Track ); - void Delete_net( wxDC* DC, TRACK* Track ); - void Remove_One_Track( wxDC* DC, TRACK* pt_segm ); + void Delete_Track( wxDC* DC, TRACK* Track ); + void Delete_net( wxDC* DC, TRACK* Track ); + void Remove_One_Track( wxDC* DC, TRACK* pt_segm ); /** * Function Reset_All_Tracks_And_Vias_To_Netclass_Values @@ -851,7 +849,7 @@ public: * @param aTrack : bool true to modify tracks * @param aVia : bool true to modify vias */ - bool Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia ); + bool Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia ); /** * Function Change_Net_Tracks_And_Vias_Sizes @@ -861,7 +859,7 @@ public: * @param aUseNetclassValue : bool. True to use netclass values, false to * use current values */ - bool Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue ); + bool Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue ); /** * Function Edit_Track_Width @@ -871,7 +869,7 @@ public: * @param aDC = the curred device context (can be NULL) * @param aTrackSegment = a segment or via on the track to change */ - void Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment ); + void Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment ); /** * Function Edit_TrackSegm_Width @@ -879,7 +877,7 @@ public: * @param aDC = the current device context (can be NULL) * @param aTrackItem = the track segment or via to modify */ - void Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem ); + void Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem ); /** * Function Begin_Route @@ -905,17 +903,44 @@ public: * @param aDC = the current device context * @return true if the track was created, false if not (due to a DRC error) */ - bool End_Route( TRACK* aTrack, wxDC* aDC ); + bool End_Route( TRACK* aTrack, wxDC* aDC ); - 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 Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int command ); - 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, int layer ); - bool Add_45_degrees_Segment( wxDC* DC ); + 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 ); + + /** + * 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. + */ + void StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aCommand ); + + bool PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ); + + /** + * @todo This function is broken, because it merge segments having different + * widths or without any connectivity test. + * 2 collinear segments can be merged only if no other segment or via is + * connected to the common point and if they have the same width. See + * cleanup.cpp for merge functions and consider MarkTrace() to locate segments + * that can be merged + */ + bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end ); + + void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); + void SwitchLayer( wxDC* DC, int layer ); + + /** + * 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. + * + * @param aDC The wxDC device context to draw on. + * @return A bool value true if ok or false if not. + */ + bool Add45DegreeSegment( wxDC* aDC ); /** * Function EraseRedundantTrack @@ -930,10 +955,10 @@ public: * @param aItemsListPicker = the list picker to use for an undo command * (can be NULL) */ - int EraseRedundantTrack( wxDC* aDC, - TRACK* aNewTrack, - int aNewTrackSegmentsCount, - PICKED_ITEMS_LIST* aItemsListPicker ); + int EraseRedundantTrack( wxDC* aDC, + TRACK* aNewTrack, + int aNewTrackSegmentsCount, + PICKED_ITEMS_LIST* aItemsListPicker ); /** * Function SetTrackSegmentWidth @@ -965,7 +990,6 @@ public: */ void Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp = 0 ); - /** * Function Delete_LastCreatedCorner * Used only while creating a new zone outline @@ -979,7 +1003,7 @@ public: * initiates a zone edge creation process, * or terminates the current zone edge and creates a new zone edge stub */ - int Begin_Zone( wxDC* DC ); + int Begin_Zone( wxDC* DC ); /** * Function End_Zone @@ -999,7 +1023,7 @@ public: * @param verbose = true to show error messages * @return error level (0 = no error) */ - int Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose = TRUE ); + int Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose = TRUE ); /** * Function Fill_All_Zones @@ -1008,7 +1032,7 @@ public: * @param verbose = true to show error messages * @return error level (0 = no error) */ - int Fill_All_Zones( bool verbose = TRUE ); + int Fill_All_Zones( bool verbose = TRUE ); /** @@ -1066,7 +1090,7 @@ public: * Remove the currently selected corner in a zone outline * the .m_CornerSelection is used as corner selection */ - void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container ); + void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container ); /** * Function Delete_Zone @@ -1079,7 +1103,7 @@ public: * if the outline is the main outline, all the zone is removed * otherwise, the hole is deleted */ - void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container ); + void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container ); /** * Function Start_Move_Zone_Outlines @@ -1087,29 +1111,28 @@ public: * @param DC = current Device Context (can be NULL) * @param zone_container: the given zone to move */ - void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container ); + void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container ); // Target handling - PCB_TARGET* CreateTarget( 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 ); + PCB_TARGET* CreateTarget( 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 ); // Graphic segments type DRAWSEGMENT handling: DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC ); - void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); - void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); - void Delete_Drawings_All_Layer( int aLayer ); + void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); + void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); + void Delete_Drawings_All_Layer( int aLayer ); // Dimension handling: - void Install_Edit_Dimension( DIMENSION* Dimension, wxDC* DC ); - DIMENSION* Begin_Dimension( DIMENSION* Dimension, wxDC* DC ); - void Delete_Dimension( DIMENSION* Dimension, wxDC* DC ); - + void Install_Edit_Dimension( DIMENSION* Dimension, wxDC* DC ); + DIMENSION* Begin_Dimension( DIMENSION* Dimension, wxDC* DC ); + void Delete_Dimension( DIMENSION* Dimension, wxDC* DC ); // netlist handling: - void InstallNetlistFrame( wxDC* DC ); + void InstallNetlistFrame( wxDC* DC ); /** * Function ReadPcbNetlist @@ -1149,13 +1172,13 @@ public: // Autoplacement: - void AutoPlace( wxCommandEvent& event ); + void AutoPlace( wxCommandEvent& event ); /** * Function OnOrientFootprints * install the dialog box for the common Orient Footprints */ - void OnOrientFootprints( wxCommandEvent& event ); + void OnOrientFootprints( wxCommandEvent& event ); /** * Function ReOrientModules @@ -1165,23 +1188,23 @@ public: * @param include_fixe = true to orient locked footprints * @return true if some footprints modified, false if no change */ - bool ReOrientModules( const wxString& ModuleMask, int Orient, + bool ReOrientModules( const wxString& ModuleMask, int Orient, bool include_fixe ); - void LockModule( MODULE* aModule, bool aLocked ); - void AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ); - void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ); - int RecherchePlacementModule( MODULE* Module, wxDC* DC ); - void GenModuleOnBoard( MODULE* Module ); - float Compute_Ratsnest_PlaceModule( wxDC* DC ); - int GenPlaceBoard(); - void DrawInfoPlace( wxDC* DC ); + void LockModule( MODULE* aModule, bool aLocked ); + void AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ); + void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ); + int RecherchePlacementModule( MODULE* Module, wxDC* DC ); + void GenModuleOnBoard( MODULE* Module ); + float Compute_Ratsnest_PlaceModule( wxDC* DC ); + int GenPlaceBoard(); + void DrawInfoPlace( wxDC* DC ); // Autorouting: - int Solve( wxDC* DC, int two_sides ); - void Reset_Noroutable( wxDC* DC ); - void Autoroute( wxDC* DC, int mode ); - void ReadAutoroutedTracks( wxDC* DC ); - void GlobalRoute( wxDC* DC ); + int Solve( wxDC* DC, int two_sides ); + void Reset_Noroutable( wxDC* DC ); + void Autoroute( wxDC* DC, int mode ); + void ReadAutoroutedTracks( wxDC* DC ); + void GlobalRoute( wxDC* DC ); /** * Function Show_1_Ratsnest @@ -1190,11 +1213,11 @@ public: * The net edge pad with mouse or module locates the mouse. * Delete the ratsnest if no module or pad is selected. */ - void Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ); + void Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ); - void Clean_Pcb( wxDC* DC ); + void Clean_Pcb( wxDC* DC ); - void InstallFindFrame( const wxPoint& pos, wxDC* DC ); + void InstallFindFrame( const wxPoint& pos, wxDC* DC ); /** * Function SendMessageToEESCHEMA @@ -1203,15 +1226,15 @@ public: * @param objectToSync The object whose reference is used to synchronize * eeschema. */ - void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ); + void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ); /* Micro waves functions */ - void Edit_Gap( wxDC* DC, MODULE* Module ); - MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count ); - MODULE* Create_MuWaveComponent( int shape_type ); - MODULE* Create_MuWavePolygonShape(); - void Begin_Self( wxDC* DC ); - MODULE* Genere_Self( wxDC* DC ); + void Edit_Gap( wxDC* DC, MODULE* Module ); + MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count ); + MODULE* Create_MuWaveComponent( int shape_type ); + MODULE* Create_MuWavePolygonShape(); + void Begin_Self( wxDC* DC ); + MODULE* Genere_Self( wxDC* DC ); /** * Function SetLanguage @@ -1227,6 +1250,7 @@ public: * application name appended with no file. Otherwise, the title is set to the full path * and file name and read only is appended to the title if the user does not have write * access to the file. + * */ void UpdateTitle(); diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index df1054687e..4089914c30 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -6,9 +6,8 @@ #include "common.h" #include "pcbnew.h" -#include "class_board_design_settings.h" #include "colors_selection.h" - +#include "class_board.h" /* This is an odd place for this, but cvpcb won't link if it is * in class_board_item.cpp like I first tried it. @@ -32,10 +31,8 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) : m_NbNoconnect = 0; // Number of unconnected nets. m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the - // zone contour currently in - // progress - m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name, - // design constraints .. + // zone contour currently in progress + m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name, design constraints .. m_NetInfo->BuildListOfNets(); // prepare pads and nets lists containers. for( int layer = 0; layer < NB_COPPER_LAYERS; ++layer ) @@ -45,11 +42,9 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) : } // Initial parameters for the default NETCLASS come from the global - // preferences - // within g_DesignSettings via the NETCLASS() constructor. + // preferences within g_DesignSettings via the NETCLASS() constructor. // Should user eventually load a board from a disk file, then these - // defaults - // will get overwritten during load. + // defaults will get overwritten during load. m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) ); m_ViaSizeSelector = 0; m_TrackWidthSelector = 0; @@ -1340,8 +1335,10 @@ bool BOARD::Save( FILE* aFile ) const fprintf( aFile, "$TRACK\n" ); for( item = m_Track; item; item = item->Next() ) + { if( !item->Save( aFile ) ) goto out; + } fprintf( aFile, "$EndTRACK\n" ); @@ -1349,8 +1346,10 @@ bool BOARD::Save( FILE* aFile ) const fprintf( aFile, "$ZONE\n" ); for( item = m_Zone; item; item = item->Next() ) + { if( !item->Save( aFile ) ) goto out; + } fprintf( aFile, "$EndZONE\n" ); @@ -1492,6 +1491,149 @@ TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask ) } +D_PAD* BOARD::GetPad( const wxPoint& aPosition, int aLayerMask ) +{ + D_PAD* pad = NULL; + + for( MODULE* module = m_Modules; module && ( pad == NULL ); module = module->Next() ) + { + if( aLayerMask ) + pad = module->GetPad( aPosition, aLayerMask ); + else + pad = module->GetPad( aPosition, ALL_LAYERS ); + } + + return pad; +} + + +D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint ) +{ + D_PAD* pad = NULL; + wxPoint aPosition; + + int aLayerMask = g_TabOneLayerMask[aTrace->GetLayer()]; + + if( aEndPoint == START ) + { + aPosition = aTrace->m_Start; + } + else + { + aPosition = aTrace->m_End; + } + + for( MODULE* module = m_Modules; module; module = module->Next() ) + { + pad = module->GetPad( aPosition, aLayerMask ); + + if( pad != NULL ) + break; + } + + return pad; +} + + +D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask ) +{ + for( unsigned i=0; i+ * The fast search method only works if the pad list has already been built. + *
+ * @param aPosition A wxPoint object containing the position to hit test. + * @param aLayer A layer or layers to mask the hit test. + * @return A pointer to a D_PAD object if found or NULL if not found. + */ + D_PAD* GetPadFast( const wxPoint& aPosition, int aLayer ); + + /** + * Function GetPad + * locates the pad connected at \a aPosition on \a aLayer starting at list postion + * \a aPad + *+ * This function uses a fast search in this sorted pad list and it is faster than + * GetPadFast(). This list is a sorted pad list must be built before calling this + * function. + *
+ * @note The normal pad list #m_Pads is sorted by increasing netcodes. + * @param aPad A D_PAD object pointer the first pad in the list to begin searching. + * @param aPosition A wxPoint object containing the position to test. + * @param aLayerMast A layer or layers to mask the hit test. + * @return A D_PAD object pointer to the connected pad. + */ + D_PAD* GetPad( LISTE_PAD* aPad, const wxPoint& aPosition, int aLayerMask ); }; #endif // #ifndef CLASS_BOARD_H diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 0aecfdf49c..1f081fab43 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -819,6 +819,22 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const } +D_PAD* MODULE::GetPad( const wxPoint& aPosition, int aLayerMask ) +{ + for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) + { + /* ... and on the correct layer. */ + if( ( pad->m_layerMask & aLayerMask ) == 0 ) + continue; + + if( pad->HitTest( aPosition ) ) + return pad; + } + + return NULL; +} + + // see class_module.h SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ) diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index cb36aa9d8a..ab64056c37 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -1,6 +1,7 @@ -/*******************************************************/ -/* class_module.h : module description (excepted pads) */ -/*******************************************************/ +/** + * @file class_module.h + * @brief Module description (excepted pads) + */ #ifndef _MODULE_H_ @@ -54,7 +55,7 @@ public: int m_Attributs; /* Flag bits ( see Mod_Attribut ) */ int m_Orient; /* orientation in 0.1 degrees */ - int flag; /* Use to trace rastnest and auto + int flag; /* Use to trace ratsnest and auto * routing. */ int m_ModuleStatus; /* For autoplace: flags (LOCKED, * AUTOPLACED) */ @@ -117,7 +118,7 @@ public: * Function CalculateBoundingBox * calculates the bounding box in board coordinates. */ - void CalculateBoundingBox(); + void CalculateBoundingBox(); /** * Function GetFootPrintRect() @@ -129,7 +130,7 @@ public: /** * Function GetBoundingBox * returns the bounding box of this - * tootprint. Mainly used to redraw the screen area occupied by + * footprint. Mainly used to redraw the screen area occupied by * the footprint. * @return EDA_RECT - The rectangle containing the footprint and texts. */ @@ -147,8 +148,9 @@ public: } // Moves - void SetPosition( const wxPoint& newpos ); - void SetOrientation( int newangle ); + void SetPosition( const wxPoint& newpos ); + + void SetOrientation( int newangle ); /** * Function Move @@ -208,8 +210,9 @@ public: */ bool Save( FILE* aFile ) const; - int Write_3D_Descr( FILE* File ) const; - int ReadDescr( LINE_READER* aReader ); + int Write_3D_Descr( FILE* File ) const; + + int ReadDescr( LINE_READER* aReader ); /** * Function Read_GPCB_Descr @@ -219,7 +222,8 @@ public: * @return bool - true if success reading else false. */ bool Read_GPCB_Descr( const wxString& CmpFullFileName ); - int Read_3D_Descr( LINE_READER* aReader ); + + int Read_3D_Descr( LINE_READER* aReader ); /* drawing functions */ @@ -237,7 +241,9 @@ public: const wxPoint& aOffset = ZeroOffset ); void Draw3D( Pcb3D_GLCanvas* glcanvas ); + void DrawEdgesOnly( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int draw_mode ); + void DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int dim_ancre, int draw_mode ); @@ -249,7 +255,6 @@ public: */ void DisplayInfo( EDA_DRAW_FRAME* frame ); - /** * Function HitTest * tests if the given wxPoint is within the bounds of this object. @@ -258,7 +263,6 @@ public: */ bool HitTest( const wxPoint& aRefPos ); - /** * Function HitTest (overlaid) * tests if the given EDA_RECT intersect the bounds of this object. @@ -295,8 +299,17 @@ public: * @return D_PAD* - The first matching name is returned, or NULL if not * found. */ - D_PAD* FindPadByName( const wxString& aPadName ) const; + D_PAD* FindPadByName( const wxString& aPadName ) const; + /** + * Function GetPad + * get a pad at \a aPosition on \a aLayer in the footprint. + * + * @param aPosition A wxPoint object containing the position to hit test. + * @param aLayerMask A layer or layers to mask the hit test. + * @return A pointer to a D_PAD object if found otherwise NULL. + */ + D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS ); /** * Function Visit @@ -307,14 +320,13 @@ public: * @param inspector An INSPECTOR instance to use in the inspection. * @param testData Arbitrary data used by the inspector. * @param scanTypes Which KICAD_T types are of interest and the order - * is significant too, terminated by EOT. + * is significant too, terminated by EOT. * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, - * else SCAN_CONTINUE; + * else SCAN_CONTINUE; */ SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ); - /** * Function GetClass * returns the class name. @@ -335,7 +347,7 @@ public: * Function Show * is used to output the object tree, currently for debugging only. * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. + * of nesting of this object within the overall tree. * @param os The ostream& to output to. */ virtual void Show( int nestLevel, std::ostream& os ); diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 0c8ae7fcde..813fb5e76a 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -27,7 +27,6 @@ static void Clean_Pcb_Items( PCB_EDIT_FRAME* frame, wxDC* DC, #ifdef CONN2PAD_ENBL static void ConnectDanglingEndToPad( PCB_EDIT_FRAME* frame, wxDC* DC ); static void ConnectDanglingEndToVia( BOARD* pcb ); -//static void Gen_Raccord_Track( PCB_EDIT_FRAME* frame, wxDC* DC ); #endif @@ -52,7 +51,7 @@ void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC ) * - vias on pad * - null segments * - Redundant segments - * Create segments when track ends are incorrecty connected: + * Create segments when track ends are incorrectly connected: * i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center */ void Clean_Pcb_Items( PCB_EDIT_FRAME* frame, wxDC* DC, @@ -79,16 +78,14 @@ void Clean_Pcb_Items( PCB_EDIT_FRAME* frame, wxDC* DC, #ifdef CONN2PAD_ENBL /* Create missing segments when a track end covers a pad or a via, - but is not on the pad or the via center */ + * but is not on the pad or the via center */ if( aConnectToPads ) { frame->SetStatusText( _( "Reconnect pads" ) ); + /* Create missing segments when a track end covers a pad, but is not on the pad center */ ConnectDanglingEndToPad( frame, DC ); - // creation of points of connections at the intersection of tracks -// Gen_Raccord_Track(frame, DC); - /* Create missing segments when a track end covers a via, but is not on the via center */ ConnectDanglingEndToVia( frame->GetBoard() ); } @@ -153,7 +150,7 @@ void clean_vias( BOARD * aPcb ) if( track->m_Shape != VIA_THROUGH ) continue; - D_PAD* pad = Fast_Locate_Pad_Connecte( aPcb, track->m_Start, ALL_CU_LAYERS ); + D_PAD* pad = aPcb->GetPadFast( track->m_Start, ALL_CU_LAYERS ); if( pad && (pad->m_layerMask & EXTERNAL_LAYERS) == EXTERNAL_LAYERS ) // redundant Via { @@ -225,7 +222,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC ) D_PAD* pad; - pad = Fast_Locate_Pad_Connecte( frame->GetBoard(), segment->m_Start, masklayer ); + pad = frame->GetBoard()->GetPadFast( segment->m_Start, masklayer ); if( pad != NULL ) { @@ -233,7 +230,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC ) type_end |= START_ON_PAD; } - pad = Fast_Locate_Pad_Connecte( frame->GetBoard(), segment->m_End, masklayer ); + pad = frame->GetBoard()->GetPadFast( segment->m_End, masklayer ); if( pad != NULL ) { @@ -243,7 +240,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC ) // if not connected to a pad, test if segment's START is connected to another track // For via tests, an enhancement could to test if connected to 2 items on different layers. - // Currently a via must be connected to 2 items, taht can be on the same layer + // Currently a via must be connected to 2 items, that can be on the same layer int top_layer, bottom_layer; if( (type_end & START_ON_PAD ) == 0 ) @@ -307,8 +304,10 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC ) if( other == NULL ) // Test a connection to zones { if( segment->Type() != TYPE_VIA ) + { zone = frame->GetBoard()->HitTestForAnyFilledArea( segment->m_End, segment->GetLayer() ); + } else { ((SEGVIA*)segment)->ReturnLayerPair( &top_layer, &bottom_layer ); @@ -376,7 +375,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC ) } -/* Delete null lenght segments, and intermediate points .. */ +/* Delete null length segments, and intermediate points .. */ static void clean_segments( PCB_EDIT_FRAME* frame ) { TRACK* segment, * nextsegment; @@ -484,7 +483,7 @@ static void clean_segments( PCB_EDIT_FRAME* frame ) break; } - if( flag ) // We have the starting point of the segment is connecte to an other segment + if( flag ) // We have the starting point of the segment is connected to an other segment { segDelete = AlignSegment( frame->GetBoard(), segment, segStart, START ); @@ -524,7 +523,7 @@ static void clean_segments( PCB_EDIT_FRAME* frame ) } } - if( flag & 2 ) // We have the ending point of the segment is connecte to an other segment + if( flag & 2 ) // We have the ending point of the segment is connected to an other segment { segDelete = AlignSegment( frame->GetBoard(), segment, segEnd, END ); @@ -544,7 +543,7 @@ static void clean_segments( PCB_EDIT_FRAME* frame ) /* Function used by clean_segments. - * Test alignement of pt_segm and pt_ref (which must have acommon end). + * Test alignment of pt_segm and pt_ref (which must have a common end). * and see if the common point is not on a pad (i.e. if this common point can be removed). * the ending point of pt_ref is the start point (extremite == START) * or the end point (extremite == FIN) @@ -582,7 +581,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre flag = 2; } - /* tst if alignement in other cases + /* test if alignment in other cases * We must have refdy/refdx == (+/-)segmdy/segmdx, (i.e. same orientation) */ if( flag == 0 ) { @@ -594,19 +593,18 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre } /* Here we have 2 aligned segments: - We must change the pt_ref common point only if not on a pad - (this function) is called when thre is only 2 connected segments, - and if this point is not on a pad, it can be removed and the 2 segments will be merged - */ + * We must change the pt_ref common point only if not on a pad + * (this function) is called when there is only 2 connected segments, + *and if this point is not on a pad, it can be removed and the 2 segments will be merged + */ if( extremite == START ) { /* We do not have a pad */ - if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_Start, - g_TabOneLayerMask[pt_ref->GetLayer()] ) ) + if( Pcb->GetPadFast( pt_ref->m_Start, g_TabOneLayerMask[pt_ref->GetLayer()] ) ) return NULL; - /* change the common point coordinate of pt_segm tu use the other point - of pt_segm (pt_segm will be removed later) */ + /* change the common point coordinate of pt_segm to use the other point + * of pt_segm (pt_segm will be removed later) */ if( pt_ref->m_Start == pt_segm->m_Start ) { pt_ref->m_Start = pt_segm->m_End; @@ -621,12 +619,11 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre else /* extremite == END */ { /* We do not have a pad */ - if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_End, - g_TabOneLayerMask[pt_ref->GetLayer()] ) ) + if( Pcb->GetPadFast( pt_ref->m_End, g_TabOneLayerMask[pt_ref->GetLayer()] ) ) return NULL; - /* change the common point coordinate of pt_segm tu use the other point - of pt_segm (pt_segm will be removed later) */ + /* change the common point coordinate of pt_segm to use the other point + * of pt_segm (pt_segm will be removed later) */ if( pt_ref->m_End == pt_segm->m_Start ) { pt_ref->m_End = pt_segm->m_End; @@ -643,14 +640,6 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre } -/** - * Function RemoveMisConnectedTracks - * finds all track segments which are mis-connected (to more than one net). - * When such a bad segment is found, mark it as needing to be removed. - * and remove all tracks having at least one flagged segment. - * @param aDC = the current device context (can be NULL) - * @return true if any change is made - */ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks( wxDC* aDC ) { TRACK* segment; @@ -711,12 +700,13 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks( wxDC* aDC ) { next = (TRACK*) segment->Next(); - if( segment->GetState( FLAG0 ) ) // Ssegment is flagged to be removed + if( segment->GetState( FLAG0 ) ) // Segment is flagged to be removed { segment->SetState( FLAG0, OFF ); isModified = true; GetBoard()->m_Status_Pcb = 0; Remove_One_Track( aDC, segment ); + // the current segment could be deleted, so restart to the beginning next = GetBoard()->m_Track; } @@ -726,158 +716,6 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks( wxDC* aDC ) } -#if 0 - - -/** - * Function Gen_Raccord_Track - * tests the ends of segments. If and end is on a segment of other track, but not - * on other's end, the other segment is cut into 2, the point of cut being the end of - * segment first being operated on. This is done so that the subsequent tests - * of connection, which do not test segment overlaps, will see this continuity. - */ -static void Gen_Raccord_Track( PCB_EDIT_FRAME* frame, wxDC* DC ) -{ - TRACK* segment; - TRACK* other; - int nn = 0; - int layerMask; - int ii, percent, oldpercent; - wxString msg; - - frame->Affiche_Message( wxT( "Gen Raccords sur Pistes:" ) ); - - if( frame->GetBoard()->GetNumSegmTrack() == 0 ) - return; - - frame->DrawPanel->m_AbortRequest = false; - - oldpercent = -1; ii = 0; - - for( segment = frame->GetBoard()->m_Track; segment; segment = segment->Next() ) - { - // display activity - ii++; - percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount(); - - if( percent != oldpercent ) - { - frame->DisplayActivity( percent, wxT( "Tracks: " ) ); - oldpercent = percent; - - msg.Printf( wxT( "%d" ), frame->GetBoard()->m_Track.GetCount() ); - frame->MsgPanel->SetMessage( POS_AFF_MAX, wxT( "Max" ), msg, GREEN ); - - msg.Printf( wxT( "%d" ), ii ); - frame->MsgPanel->SetMessage( POS_AFF_NUMSEGM, wxT( "Segm" ), msg, CYAN ); - } - - if( frame->DrawPanel->m_AbortRequest ) - return; - - layerMask = segment->ReturnMaskLayer(); - - // look at the "start" of the "segment" - for( other = frame->GetBoard()->m_Track; other; other = other->Next() ) - { - TRACK* newTrack; - - other = GetTrace( other, segment->m_Start, layerMask ); - - if( other == NULL ) - break; - - if( other == segment ) - continue; - - if( other->Type() == TYPE_VIA ) - continue; - - if( segment->m_Start == other->m_Start ) - continue; - - if( segment->m_Start == other->m_End ) - continue; - - // Test if the "end" of this segment is already connected to other - if( segment->m_End == other->m_Start ) - continue; - - if( segment->m_End == other->m_End ) - continue; - - other->Draw( frame->DrawPanel, DC, GR_XOR ); - - nn++; - msg.Printf( wxT( "%d" ), nn ); - frame->MsgPanel->SetMessage( POS_AFF_VAR, wxT( "New <" ), msg, YELLOW ); - - // create a new segment and insert it next to "other", then shorten other. - newTrack = other->Copy(); - - frame->GetBoard()->m_Track.Insert( newTrack, other->Next() ); - - other->m_End = segment->m_Start; - newTrack->m_Start = segment->m_Start; - - DrawTraces( frame->DrawPanel, DC, other, 2, GR_OR ); - - // skip forward one, skipping the newTrack - other = newTrack; - } - - // look at the "end" of the "segment" - for( other = frame->GetBoard()->m_Track; other; other = other->Next() ) - { - TRACK* newTrack; - - other = GetTrace( other, segment->m_End, layerMask ); - - if( other == NULL ) - break; - - if( other == segment ) - continue; - - if( other->Type() == TYPE_VIA ) - continue; - - if( segment->m_End == other->m_Start ) - continue; - - if( segment->m_End == other->m_End ) - continue; - - if( segment->m_Start == other->m_Start ) - continue; - - if( segment->m_Start == other->m_End ) - continue; - - other->Draw( frame->DrawPanel, DC, GR_XOR ); - - nn++; - msg.Printf( wxT( "%d" ), nn ); - frame->MsgPanel->SetMessage( POS_AFF_VAR, wxT( "New >" ), msg, YELLOW ); - - // create a new segment and insert it next to "other", then shorten other. - newTrack = other->Copy(); - frame->GetBoard()->m_Track.Insert( newTrack, other->Next() ); - - other->m_End = segment->m_End; - newTrack->m_Start = segment->m_End; - - DrawTraces( frame->DrawPanel, DC, other, 2, GR_OR ); - - // skip forward one, skipping the newTrack - other = newTrack; - } - } -} - -#endif - - #if defined(CONN2PAD_ENBL) /** @@ -980,7 +818,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* frame, wxDC* DC ) if( frame->DrawPanel->m_AbortRequest ) return; - pad = Locate_Pad_Connecte( frame->GetBoard(), segment, START ); + pad = frame->GetBoard()->GetPad( segment, START ); if( pad ) { @@ -1004,7 +842,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* frame, wxDC* DC ) } } - pad = Locate_Pad_Connecte( frame->GetBoard(), segment, END ); + pad = frame->GetBoard()->GetPad( segment, END ); if( pad ) { diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp index fe261aaed3..ee339e2e7e 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -1,5 +1,5 @@ /***************************************************************************************/ -/* Rastnest calculations: Function to handle existing tracks in rastsnest calculations */ +/* Ratsnest calculations: Function to handle existing tracks in ratsnest calculations */ /***************************************************************************************/ #include "fctsys.h" @@ -32,7 +32,7 @@ static void RebuildTrackChain( BOARD* pcb ); * The result is merging 2 blocks (or subnets) * @return modification count * @param old_val = subnet value to modify - * @param new_val = new subnet value for each item whith have old_val as subnet value + * @param new_val = new subnet value for each item which have old_val as subnet value * @param pt_start_conn = first track segment to test * @param pt_end_conn = last track segment to test * If pt_end_conn = NULL: search is made from pt_start_conn to end of linked list @@ -98,7 +98,7 @@ static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_ * for pads, this is the .m_physical_connexion member which is a cluster identifier * for tracks, this is the .m_Subnet member which is a cluster identifier * For a given net, if all tracks are created, there is only one cluster. - * but if not all tracks are created, there are more than one cluster, and some ratsnets + * but if not all tracks are created, there are more than one cluster, and some ratsnest * will be shown. * @param pt_start_conn = first track to test * @param pt_end_conn = last segment to test @@ -149,22 +149,30 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn ) if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */ { - if( pt_pad->GetSubNet() > 0 ) /* The pad is already a cluster member, so we can merge the 2 clusters */ + if( pt_pad->GetSubNet() > 0 ) { + /* The pad is already a cluster member, so we can merge the 2 clusters */ Merge_Two_SubNets( pt_start_conn, pt_end_conn, pt_pad->GetSubNet(), pt_conn->GetSubNet() ); } - else /* The pad is not yet attached to a cluster , so we can add this pad to the cluster */ + else + { + /* The pad is not yet attached to a cluster , so we can add this pad to + * the cluster */ pt_pad->SetSubNet( pt_conn->GetSubNet() ); + } } else /* the track segment is not attached to a cluster */ { - if( pt_pad->GetSubNet() > 0 ) /* it is connected to a pad in a cluster, merge this track */ + if( pt_pad->GetSubNet() > 0 ) { + /* it is connected to a pad in a cluster, merge this track */ pt_conn->SetSubNet( pt_pad->GetSubNet() ); } - else /* it is connected to a pad not in a cluster, so we must create a new cluster (only with the 2 items: the track and the pad) */ + else { + /* it is connected to a pad not in a cluster, so we must create a new + * cluster (only with the 2 items: the track and the pad) */ sub_netcode++; pt_conn->SetSubNet( sub_netcode ); pt_pad->SetSubNet( pt_conn->GetSubNet() ); @@ -174,8 +182,8 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn ) PtStruct = pt_conn->end; - if( PtStruct && (PtStruct->Type() == TYPE_PAD) ) /* The segment end on a pad */ + if( PtStruct && (PtStruct->Type() == TYPE_PAD) ) { pt_pad = (D_PAD*) PtStruct; @@ -215,26 +223,35 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn ) /* The segment starts on an other track */ pt_other_trace = (TRACK*) PtStruct; - if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */ + /* the track segment is already a cluster member */ + if( pt_conn->GetSubNet() ) { - if( pt_other_trace->GetSubNet() ) /* The other track is already a cluster member, so we can merge the 2 clusters */ + /* The other track is already a cluster member, so we can merge the 2 clusters */ + if( pt_other_trace->GetSubNet() ) { Merge_Two_SubNets( pt_start_conn, pt_end_conn, pt_other_trace->GetSubNet(), pt_conn->GetSubNet() ); } - else /* The other track is not yet attached to a cluster , so we can add this other track to the cluster */ + else { + /* The other track is not yet attached to a cluster , so we can add this + * other track to the cluster */ pt_other_trace->SetSubNet( pt_conn->GetSubNet() ); } } - else /* the track segment is not yet attached to a cluster */ + else { - if( pt_other_trace->GetSubNet() ) /* The other track is already a cluster member, so we can add the segment to the cluster */ + /* the track segment is not yet attached to a cluster */ + if( pt_other_trace->GetSubNet() ) { + /* The other track is already a cluster member, so we can add the segment + * to the cluster */ pt_conn->SetSubNet( pt_other_trace->GetSubNet() ); } - else /* it is connected to an other segment not in a cluster, so we must create a new cluster (only with the 2 track segments) */ + else { + /* it is connected to an other segment not in a cluster, so we must + * create a new cluster (only with the 2 track segments) */ sub_netcode++; pt_conn->SetSubNet( sub_netcode ); pt_other_trace->SetSubNet( pt_conn->GetSubNet() ); @@ -260,8 +277,9 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn ) pt_other_trace->SetSubNet( pt_conn->GetSubNet() ); } } - else /* the track segment is not yet attached to a cluster */ + else { + /* the track segment is not yet attached to a cluster */ if( pt_other_trace->GetSubNet() ) { pt_conn->SetSubNet( pt_other_trace->GetSubNet() ); @@ -281,16 +299,7 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn ) } -/** - * Function testing the connections relative to all nets - * This function update the status of the ratsnest ( flag CH_ACTIF = 0 if a connection - * is found, = 1 else) track segments are assumed to be sorted by net codes. - * This is the case because when a new track is added, it is inserted in the linked list - * according to its net code. and when nets are changed (when a new netlist is read) - * tracks are sorted before using this function - * @param DC = current Device Context - */ -void PCB_BASE_FRAME::test_connexions( wxDC* DC ) +void PCB_BASE_FRAME::TestConnections( wxDC* aDC ) { // Clear the cluster identifier for all pads for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i ) @@ -323,21 +332,15 @@ void PCB_BASE_FRAME::test_connexions( wxDC* DC ) } -/** - * Function testing the connections relative to a given net - * track segments are assumed to be sorted by net codes - * @param DC = current Device Context - * @param net_code = net code to test - */ -void PCB_BASE_FRAME::test_1_net_connexion( wxDC* DC, int net_code ) +void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode ) { wxString msg; - if( net_code == 0 ) + if( aNetCode == 0 ) return; if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 ) - Compile_Ratsnest( DC, true ); + Compile_Ratsnest( aDC, true ); for( unsigned i = 0; i