From ae84ca2ffa6492d1c68a8c5fa381a4e0318c6efa Mon Sep 17 00:00:00 2001
From: Wayne Stambaugh
Date: Thu, 15 Sep 2011 13:58:35 -0400
Subject: [PATCH] PCBNew locate pad code refactoring and other minor fixes.
* Refactor pad locate code into the appropriate object.
* Dead code removal.
* Lots of coding style policy fixes.
---
include/wxBasePcbFrame.h | 272 +++++++++--------
include/wxPcbStruct.h | 340 +++++++++++----------
pcbnew/class_board.cpp | 162 +++++++++-
pcbnew/class_board.h | 50 +++
pcbnew/class_module.cpp | 16 +
pcbnew/class_module.h | 48 +--
pcbnew/clean.cpp | 218 ++-----------
pcbnew/connect.cpp | 217 ++++---------
pcbnew/deltrack.cpp | 8 +-
pcbnew/edit.cpp | 49 ++-
pcbnew/editrack-part2.cpp | 2 +-
pcbnew/editrack.cpp | 126 +++-----
pcbnew/locate.cpp | 134 --------
pcbnew/magnetic_tracks_functions.cpp | 2 +-
pcbnew/move_or_drag_track.cpp | 127 ++++----
pcbnew/protos.h | 63 +---
pcbnew/ratsnest.cpp | 20 +-
pcbnew/solve.cpp | 46 +--
pcbnew/track.cpp | 5 +-
pcbnew/zones_by_polygon_fill_functions.cpp | 2 +-
20 files changed, 829 insertions(+), 1078 deletions(-)
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; iGetPad(i);
+
+ if( pad->m_Pos != aPosition )
+ continue;
+
+ /* Pad found, it must be on the correct layer */
+ if( pad->m_layerMask & aLayerMask )
+ return pad;
+ }
+
+ return NULL;
+}
+
+
+D_PAD* BOARD::GetPad( LISTE_PAD* aPad, const wxPoint& aPosition, int aLayerMask )
+{
+ D_PAD* pad;
+ int ii;
+
+ int nb_pad = GetPadsCount();
+ LISTE_PAD* ptr_pad = aPad;
+ LISTE_PAD* lim = aPad + nb_pad - 1;
+
+ ptr_pad = aPad;
+
+ while( nb_pad )
+ {
+ pad = *ptr_pad;
+ ii = nb_pad;
+ nb_pad >>= 1;
+
+ if( (ii & 1) && ( ii > 1 ) )
+ nb_pad++;
+
+ if( pad->m_Pos.x < aPosition.x ) /* Must search after this item */
+ {
+ ptr_pad += nb_pad;
+
+ if( ptr_pad > lim )
+ ptr_pad = lim;
+
+ continue;
+ }
+
+ if( pad->m_Pos.x > aPosition.x ) /* Must search before this item */
+ {
+ ptr_pad -= nb_pad;
+
+ if( ptr_pad < aPad )
+ ptr_pad = aPad;
+
+ continue;
+ }
+
+ /* A suitable block is found (X coordinate matches the px reference: but we
+ * must matches the Y coordinate */
+ if( pad->m_Pos.x == aPosition.x )
+ {
+ /* Search the beginning of the block */
+ while( ptr_pad >= aPad )
+ {
+ pad = *ptr_pad;
+
+ if( pad->m_Pos.x == aPosition.x )
+ ptr_pad--;
+ else
+ break;
+ }
+
+ ptr_pad++; /* ptr_pad = first pad which have pad->m_Pos.x = px */
+
+ for( ; ; ptr_pad++ )
+ {
+ if( ptr_pad > lim )
+ return NULL; /* outside suitable block */
+
+ pad = *ptr_pad;
+
+ if( pad->m_Pos.x != aPosition.x )
+ return NULL; /* outside suitable block */
+
+ if( pad->m_Pos.y != aPosition.y )
+ continue;
+
+ /* A Pad if found here: but it must mach the layer */
+ if( pad->m_layerMask & aLayerMask ) // Matches layer => a connected pad is found!
+ return pad;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+
#if defined(DEBUG)
void BOARD::Show( int nestLevel, std::ostream& os )
diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h
index 4b129953cb..e0bc73778c 100644
--- a/pcbnew/class_board.h
+++ b/pcbnew/class_board.h
@@ -7,6 +7,7 @@
#include "dlist.h"
#include "class_netinfo.h"
+#include "class_pad.h"
#include "class_colors_design_settings.h"
#include "class_board_design_settings.h"
@@ -1091,6 +1092,55 @@ public:
* @return TRACK* A point a to the SEGVIA object if found, else NULL.
*/
TRACK* GetViaByPosition( const wxPoint& aPosition, int aLayerMask = -1 );
+
+ /**
+ * Function GetPad
+ * finds a pad \a aPosition on \a aLayer.
+ *
+ * @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 or NULL if not found.
+ */
+ D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS );
+
+ /**
+ * Function GetPad
+ * finds a pad connected to \a aEndPoint of \a aTrace.
+ *
+ * @param aTrace A pointer to a TRACK object to hit test against.
+ * @param aEndPoint The end point of \a aTrace the hit test against.
+ * @return A pointer to a D_PAD object if found or NULL if not found.
+ */
+ D_PAD* GetPad( TRACK* aTrace, int aEndPoint );
+
+ /**
+ * Function GetPadFast
+ * return pad found at \a aPosition on \a aLayer uning the fast search method.
+ *
+ * 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; iGetPadsCount(); ++i )
{
@@ -345,26 +348,26 @@ void PCB_BASE_FRAME::test_1_net_connexion( wxDC* DC, int net_code )
int pad_net_code = pad->GetNet();
- if( pad_net_code < net_code )
+ if( pad_net_code < aNetCode )
continue;
- if( pad_net_code > net_code )
+ if( pad_net_code > aNetCode )
break;
pad->SetSubNet( 0 );
}
- m_Pcb->Test_Connections_To_Copper_Areas( net_code );
+ m_Pcb->Test_Connections_To_Copper_Areas( aNetCode );
/* Search for the first and the last segment relative to the given net code */
if( m_Pcb->m_Track )
{
TRACK* pt_start_conn;
TRACK* pt_end_conn = NULL;
- pt_start_conn = m_Pcb->m_Track.GetFirst()->GetStartNetCode( net_code );
+ pt_start_conn = m_Pcb->m_Track.GetFirst()->GetStartNetCode( aNetCode );
if( pt_start_conn )
- pt_end_conn = pt_start_conn->GetEndNetCode( net_code );
+ pt_end_conn = pt_start_conn->GetEndNetCode( aNetCode );
if( pt_start_conn && pt_end_conn ) // c.a.d. if there are segments
{
@@ -372,10 +375,10 @@ void PCB_BASE_FRAME::test_1_net_connexion( wxDC* DC, int net_code )
}
}
- Merge_SubNets_Connected_By_CopperAreas( m_Pcb, net_code );
+ Merge_SubNets_Connected_By_CopperAreas( m_Pcb, aNetCode );
- /* Test the rastnest for this net */
- int nb_net_noconnect = Test_1_Net_Ratsnest( DC, net_code );
+ /* Test the ratsnest for this net */
+ int nb_net_noconnect = Test_1_Net_Ratsnest( aDC, aNetCode );
/* Display results */
msg.Printf( wxT( "links %d nc %d net:nc %d" ),
@@ -418,8 +421,9 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK*
/* Update connections type track to track */
for( Track = pt_start_conn; Track != NULL; Track = Track->Next() )
{
- if( Track->Type() == TYPE_VIA ) // A via can connect many tracks, we must search for all track segments in this net
+ if( Track->Type() == TYPE_VIA )
{
+ // A via can connect many tracks, we must search for all track segments in this net
TRACK* pt_segm;
int layermask = Track->ReturnMaskLayer();
@@ -465,103 +469,6 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK*
#define POS_AFF_CHREF 62
-/**
- * Function SuperFast_Locate_Pad_Connecte
- * locates the pad connected to a track ended at coord px, py.
- * A track is seen as connected if the px, py position is same as the pad position.
- *
- * @param aPcb = the board.
- * @param pt_liste = Pointers to pads buffer. This buffer is a list like the list
- * created by build_liste_pad, but sorted by increasing X pad coordinate
- * @param posref = reference coordinate
- * @param aLayerMask = Layers (bit to bit) to consider
- * @return : pointer on the connected pad. This function uses a fast search in this sorted
- * pad list and it is faster than Fast_Locate_Pad_connecte(),
- * But this sorted pad list must be built before calling this function.
- *
- * (Note: The usual pad list (created by build_liste_pad) m_Pcb->m_Pads is sorted by
- * increasing netcodes )
- */
-static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
- const wxPoint& posref, int aLayerMask )
-{
- D_PAD* pad;
- int ii;
-
- int nb_pad = aPcb->GetPadsCount();
- LISTE_PAD* ptr_pad = pt_liste;
- LISTE_PAD* lim = pt_liste + nb_pad - 1;
-
- ptr_pad = pt_liste;
-
- while( nb_pad )
- {
- pad = *ptr_pad;
- ii = nb_pad;
- nb_pad >>= 1;
-
- if( (ii & 1) && ( ii > 1 ) )
- nb_pad++;
-
- if( pad->m_Pos.x < posref.x ) /* Must search after this item */
- {
- ptr_pad += nb_pad;
-
- if( ptr_pad > lim )
- ptr_pad = lim;
-
- continue;
- }
-
- if( pad->m_Pos.x > posref.x ) /* Must search before this item */
- {
- ptr_pad -= nb_pad;
-
- if( ptr_pad < pt_liste )
- ptr_pad = pt_liste;
-
- continue;
- }
-
- if( pad->m_Pos.x == posref.x ) /* A suitable block is found (X coordinate matches the px reference: but wue must matches the Y coordinate */
- {
- /* Search the beginning of the block */
- while( ptr_pad >= pt_liste )
- {
- pad = *ptr_pad;
-
- if( pad->m_Pos.x == posref.x )
- ptr_pad--;
- else
- break;
- }
-
- ptr_pad++; /* ptr_pad = first pad which have pad->m_Pos.x = px */
-
- for( ; ; ptr_pad++ )
- {
- if( ptr_pad > lim )
- return NULL; /* outside suitable block */
-
- pad = *ptr_pad;
-
- if( pad->m_Pos.x != posref.x )
- return NULL; /* outside suitable block */
-
- if( pad->m_Pos.y != posref.y )
- continue;
-
- /* A Pad if found here: but it must mach the layer */
- if( pad->m_layerMask & aLayerMask ) // Matches layer => a connected pad is found !
- return pad;
- }
- }
- }
-
- return NULL;
-}
-
-
/**
* Function SortPadsByXCoord
* is used to Sort a pad list by x coordinate value.
@@ -584,12 +491,6 @@ void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector* aVector )
}
-/* 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 found : this segment netcode
- * is set to the pad netcode
- */
void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
{
TRACK* pt_trace;
@@ -644,10 +545,8 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
layerMask = g_TabOneLayerMask[pt_trace->GetLayer()];
/* Search for a pad on the segment starting point */
- pt_trace->start = SuperFast_Locate_Pad_Connecte( m_Pcb,
- &sortedPads[0],
- pt_trace->m_Start,
- layerMask );
+ pt_trace->start = m_Pcb->GetPad( &sortedPads[0], pt_trace->m_Start, layerMask );
+
if( pt_trace->start != NULL )
{
pt_trace->SetState( BEGIN_ONPAD, ON );
@@ -655,10 +554,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
}
/* Search for a pad on the segment ending point */
- pt_trace->end = SuperFast_Locate_Pad_Connecte( m_Pcb,
- &sortedPads[0],
- pt_trace->m_End,
- layerMask );
+ pt_trace->end = m_Pcb->GetPad( &sortedPads[0], pt_trace->m_End, layerMask );
if( pt_trace->end != NULL )
{
@@ -672,7 +568,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
/* Pass 2: search the connections between track ends */
/*****************************************************/
- /* the .start et .end member pointers are updated, only if NULLs
+ /* the .start and .end member pointers are updated, only if NULLs
* (if not nuls, the end is already connected to a pad).
* the connection (if found) is between segments
* when a track has a net code and the other has a null net code, the null net code is changed
@@ -726,10 +622,12 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
}
if( reset_flag )
+ {
for( pt_trace = m_Pcb->m_Track; pt_trace != NULL; pt_trace = pt_trace->Next() )
{
pt_trace->SetState( BUSY, OFF );
}
+ }
/* set the netcode of connected tracks: if at track is connected to a pad, its net
* code is already set.
@@ -751,16 +649,19 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
if( pt_trace->GetNet() )
{
- if( pt_next->GetNet() == 0 ) // the current track has a netcode, we use it for the other track
+ if( pt_next->GetNet() == 0 )
{
- new_passe_request = 1; // A change is made: a new iteration is requested.
+ // the current track has a netcode, we use it for the other track
+ // A change is made: a new iteration is requested.
+ new_passe_request = 1;
pt_next->SetNet( pt_trace->GetNet() );
}
}
else
{
- if( pt_next->GetNet() != 0 ) // the other track has a netcode, we use it for the current track
+ if( pt_next->GetNet() != 0 )
{
+ // the other track has a netcode, we use it for the current track
pt_trace->SetNet( pt_next->GetNet() );
new_passe_request = 1;
}
diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp
index 06c6fd6942..a974450b20 100644
--- a/pcbnew/deltrack.cpp
+++ b/pcbnew/deltrack.cpp
@@ -107,7 +107,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
SaveCopyInUndoList( aTrack, UR_DELETED );
OnModify();
- test_1_net_connexion( DC, current_net_code );
+ TestNetConnection( DC, current_net_code );
GetBoard()->DisplayInfo( this );
return NULL;
}
@@ -120,7 +120,7 @@ void PCB_EDIT_FRAME::Delete_Track( wxDC* DC, TRACK* aTrack )
int current_net_code = aTrack->GetNet();
Remove_One_Track( DC, aTrack );
OnModify();
- test_1_net_connexion( DC, current_net_code );
+ TestNetConnection( DC, current_net_code );
}
}
@@ -160,7 +160,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
SaveCopyInUndoList( itemsList, UR_DELETED );
OnModify();
- test_1_net_connexion( DC, net_code_delete );
+ TestNetConnection( DC, net_code_delete );
GetBoard()->DisplayInfo( this );
}
@@ -214,5 +214,5 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
SaveCopyInUndoList( itemsList, UR_DELETED );
if( net_code > 0 )
- test_1_net_connexion( DC, net_code );
+ TestNetConnection( DC, net_code );
}
diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp
index a6522d26b8..ca26d13dff 100644
--- a/pcbnew/edit.cpp
+++ b/pcbnew/edit.cpp
@@ -326,8 +326,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
else
{
int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
+
+ // place micro via and switch layer.
if( id == ID_POPUP_PCB_PLACE_MICROVIA )
- GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = VIA_MICROVIA; // place micro via and switch layer
+ GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = VIA_MICROVIA;
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type;
@@ -400,7 +402,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
int netcode = zsegm->GetNet();
Delete_OldZone_Fill( zsegm );
SetCurItem( NULL );
- test_1_net_connexion( NULL, netcode );
+ TestNetConnection( NULL, netcode );
OnModify();
GetBoard()->DisplayInfo( this );
}
@@ -430,7 +432,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNet();
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
SetCurItem( NULL );
- test_1_net_connexion( NULL, netcode );
+ TestNetConnection( NULL, netcode );
GetBoard()->DisplayInfo( this );
}
break;
@@ -445,10 +447,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true;
- Start_Move_Zone_Corner( &dc,
- zone_cont,
- zone_cont->m_CornerSelection,
- false );
+ Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, false );
break;
}
@@ -457,9 +456,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true;
- Start_Move_Zone_Drag_Outline_Edge( &dc,
- zone_cont,
- zone_cont->m_CornerSelection );
+ Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->m_CornerSelection );
break;
}
@@ -487,10 +484,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
zone_cont->m_CornerSelection++;
zone_cont->Draw( DrawPanel, &dc, GR_XOR );
DrawPanel->m_AutoPAN_Request = true;
- Start_Move_Zone_Corner( &dc,
- zone_cont,
- zone_cont->m_CornerSelection,
- true );
+ Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, true );
break;
}
@@ -515,7 +509,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
zone_container->UnFill();
- test_1_net_connexion( NULL, zone_container->GetNet() );
+ TestNetConnection( NULL, zone_container->GetNet() );
OnModify();
GetBoard()->DisplayInfo( this );
DrawPanel->Refresh();
@@ -534,7 +528,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer
- test_connexions( NULL );
+ TestConnections( NULL );
Tst_Ratsnest( NULL, 0 ); // Recalculate the active ratsnest, i.e. the unconnected links
OnModify();
GetBoard()->DisplayInfo( this );
@@ -544,7 +538,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_FILL_ZONE:
DrawPanel->MoveCursorToCrossHair();
Fill_Zone( (ZONE_CONTAINER*) GetCurItem() );
- test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
+ TestNetConnection( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
GetBoard()->DisplayInfo( this );
DrawPanel->Refresh();
break;
@@ -560,6 +554,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
if( GetCurItem() == NULL )
break;
+
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
@@ -655,7 +650,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
}
- if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple rotation, no other edition in progress */
+ /* This is a simple rotation, no other editing in progress */
+ if( !(GetCurItem()->m_Flags & IS_MOVED) )
SaveCopyInUndoList(GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->m_Pos);
Rotate_Module( &dc, (MODULE*) GetCurItem(), g_RotationAngle, true );
@@ -682,8 +678,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
}
- if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple rotation, no other edition in progress */
- SaveCopyInUndoList(GetCurItem(), UR_ROTATED_CLOCKWISE, ((MODULE*)GetCurItem())->m_Pos);
+ /* This is a simple rotation, no other editing in progress */
+ if( !(GetCurItem()->m_Flags & IS_MOVED) )
+ SaveCopyInUndoList( GetCurItem(), UR_ROTATED_CLOCKWISE,
+ ((MODULE*)GetCurItem())->m_Pos );
Rotate_Module( &dc, (MODULE*) GetCurItem(), -g_RotationAngle, true );
break;
@@ -709,7 +707,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
}
- if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple flip, no other edition in progress */
+ /* This is a simple flip, no other editing in progress */
+ if( !(GetCurItem()->m_Flags & IS_MOVED) )
SaveCopyInUndoList(GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->m_Pos);
Change_Side_Module( (MODULE*) GetCurItem(), &dc );
@@ -981,13 +980,13 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
DrawPanel->MoveCursorToCrossHair();
- Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
+ StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
break;
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
case ID_POPUP_PCB_MOVE_TRACK_NODE:
DrawPanel->MoveCursorToCrossHair();
- Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
+ StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
break;
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
@@ -1007,7 +1006,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
track->Draw( DrawPanel, &dc, GR_XOR );
newtrack->Draw( DrawPanel, &dc, GR_XOR );
/* compute the new ratsnest, because connectivity could change */
- test_1_net_connexion( &dc, track->GetNet() );
+ TestNetConnection( &dc, track->GetNet() );
}
break;
@@ -1130,7 +1129,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
SetCurItem( NULL );
int netcode = ( (ZONE_CONTAINER*) Item )->GetNet();
Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
- test_1_net_connexion( NULL, netcode );
+ TestNetConnection( NULL, netcode );
GetBoard()->DisplayInfo( this );
}
break;
diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp
index 9eb47a8844..204865baee 100644
--- a/pcbnew/editrack-part2.cpp
+++ b/pcbnew/editrack-part2.cpp
@@ -196,7 +196,7 @@ void PCB_EDIT_FRAME::DisplayNetStatus( wxDC* DC )
if( pt_segm == NULL )
GetBoard()->DisplayInfo( this );
else
- test_1_net_connexion( DC, pt_segm->GetNet() );
+ TestNetConnection( DC, pt_segm->GetNet() );
}
diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp
index 11cd569ef0..142bd58367 100644
--- a/pcbnew/editrack.cpp
+++ b/pcbnew/editrack.cpp
@@ -1,5 +1,5 @@
/****************/
-/* Edit traces. */
+/* Edit traces. */
/****************/
#include "fctsys.h"
@@ -62,22 +62,7 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
}
-/*
- * 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.
- * param aTrack = the current track segment, or NULL to start a new track
- * param aDC = the current device context
- * return a pointer to the new track segment or null if not created (DRC error)
- */
-TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
+TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
{
D_PAD* pt_pad = NULL;
TRACK* TrackOnStartPoint = NULL;
@@ -96,7 +81,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
// erase old highlight
if( GetBoard()->IsHighLightNetON() )
- High_Light( DC );
+ High_Light( aDC );
g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) );
g_CurrentTrackSegment->m_Flags = IS_NEW;
@@ -112,7 +97,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
{
pt_pad = (D_PAD*) LockPoint;
- /* A pad is found: put the starting point on pad centre */
+ /* A pad is found: put the starting point on pad center */
pos = pt_pad->m_Pos;
GetBoard()->SetHighLightNet( pt_pad->GetNet() );
}
@@ -123,9 +108,10 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
CreateLockPoint( GetBoard(), pos, TrackOnStartPoint, &s_ItemsListPicker );
}
}
- else // no starting point, but a filled zone area can exist. This is
- // also a good starting point.
+ else
{
+ // Not a starting point, but a filled zone area can exist. This is also a
+ // good starting point.
ZONE_CONTAINER* zone;
zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()-> m_Active_Layer );
@@ -140,7 +126,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
D( g_CurrentTrackList.VerifyListIntegrity(); );
GetBoard()->HighLightON();
- GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() );
+ GetBoard()->DrawHighLight( DrawPanel, aDC, GetBoard()->GetHighLightNetCode() );
// Display info about track Net class, and init track and vias sizes:
g_CurrentTrackSegment->SetNet( GetBoard()->GetHighLightNetCode() );
@@ -185,7 +171,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->DisplayInfoBase( this );
SetCurItem( g_CurrentTrackSegment, false );
- DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
+ DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, false );
if( Drc_On )
{
@@ -197,7 +183,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
}
else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor.
{
- /* Tst for a D.R.C. error: */
+ /* Test for a D.R.C. error: */
if( Drc_On )
{
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
@@ -221,8 +207,8 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
CanCreateNewSegment = false;
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->IsNull()
- && g_CurrentTrackSegment->Back()
- && g_CurrentTrackSegment->Back()->IsNull() )
+ && g_CurrentTrackSegment->Back()
+ && g_CurrentTrackSegment->Back()->IsNull() )
CanCreateNewSegment = false;
if( CanCreateNewSegment )
@@ -230,13 +216,13 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
/* Erase old track on screen */
D( g_CurrentTrackList.VerifyListIntegrity(); );
- ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
+ ShowNewTrackWhenMovingCursor( DrawPanel, aDC, wxDefaultPosition, false );
D( g_CurrentTrackList.VerifyListIntegrity(); );
if( g_Raccord_45_Auto )
{
- Add_45_degrees_Segment( DC );
+ Add45DegreeSegment( aDC );
}
TRACK* oneBeforeLatest = g_CurrentTrackSegment;
@@ -247,7 +233,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
newTrack->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
- oneBeforeLatest->end = Locate_Pad_Connecte( GetBoard(), oneBeforeLatest, END );
+ oneBeforeLatest->end = GetBoard()->GetPad( oneBeforeLatest, END );
if( oneBeforeLatest->end )
{
@@ -271,7 +257,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
D( g_CurrentTrackList.VerifyListIntegrity(); );
/* Show the new position */
- ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
+ ShowNewTrackWhenMovingCursor( DrawPanel, aDC, wxDefaultPosition, false );
}
}
@@ -280,18 +266,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
}
-/* Add 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.
- *
- * Input: pointer to the current segment being created
- * Assume that the previous segment is the one that has been
- * previously created
- * Returns:
- * true if ok
- * false if not
- */
-bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
+bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
{
int dx0, dy0, dx1, dy1;
@@ -406,13 +381,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
}
-/*
- * Function End_Route
- * Terminates a track currently being created
- * param aTrack = the current track segment in progress
- * @return true if the track was created, false if not (due to a DRC error)
- */
-bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
+bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
{
int layerMask = g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
@@ -427,12 +396,12 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
D( g_CurrentTrackList.VerifyListIntegrity(); );
- if( Begin_Route( aTrack, DC ) == NULL )
+ if( Begin_Route( aTrack, aDC ) == NULL )
return false;
- ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, true );
- ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
- trace_ratsnest_pad( DC );
+ ShowNewTrackWhenMovingCursor( DrawPanel, aDC, wxDefaultPosition, true );
+ ShowNewTrackWhenMovingCursor( DrawPanel, aDC, wxDefaultPosition, false );
+ trace_ratsnest_pad( aDC );
/* cleanup
* if( g_CurrentTrackSegment->Next() != NULL )
@@ -459,8 +428,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
{
EnsureEndTrackOnPad( (D_PAD*) LockPoint );
}
- else /* End of is on a different track, it will
- * possibly create an anchor. */
+ else /* End of is on a different track, it will possibly create an anchor. */
{
TRACK* adr_buf = (TRACK*) LockPoint;
GetBoard()->SetHighLightNet( adr_buf->GetNet() );
@@ -484,8 +452,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
TRACK* firstTrack = g_FirstTrackSegment;
int newCount = g_CurrentTrackList.GetCount();
- // Put entire new current segment list in BOARD, and prepare undo
- // command
+ // Put entire new current segment list in BOARD, and prepare undo command
TRACK* track;
TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( GetBoard() );
@@ -496,9 +463,9 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
GetBoard()->m_Track.Insert( track, insertBeforeMe );
}
- trace_ratsnest_pad( DC );
+ trace_ratsnest_pad( aDC );
- DrawTraces( DrawPanel, DC, firstTrack, newCount, GR_OR );
+ DrawTraces( DrawPanel, aDC, firstTrack, newCount, GR_OR );
int i = 0;
@@ -511,14 +478,14 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
// erase the old track, if exists
if( g_AutoDeleteOldTrack )
{
- EraseRedundantTrack( DC, firstTrack, newCount, &s_ItemsListPicker );
+ EraseRedundantTrack( aDC, firstTrack, newCount, &s_ItemsListPicker );
}
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
- s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more
- // owner of picked items
- /* compute the new rastnest */
- test_1_net_connexion( DC, netcode );
+ s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
+
+ /* compute the new ratsnest */
+ TestNetConnection( aDC, netcode );
OnModify();
GetBoard()->DisplayInfo( this );
}
@@ -528,12 +495,12 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
wxASSERT( g_CurrentTrackList.GetCount() == 0 );
if( GetBoard()->IsHighLightNetON() )
- High_Light( DC );
+ High_Light( aDC );
GetBoard()->PopHighLight();
if( GetBoard()->IsHighLightNetON() )
- GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() );
+ GetBoard()->DrawHighLight( DrawPanel, aDC, GetBoard()->GetHighLightNetCode() );
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
@@ -659,7 +626,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
}
-/* Redraw the current track beiing created when the mouse cursor is moved
+/* Redraw the current track being created when the mouse cursor is moved
*/
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
@@ -691,7 +658,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
{
- int color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
+ int color = g_ColorsSettings.GetLayerColor( g_CurrentTrackSegment->GetLayer() );
GRCircle( &aPanel->m_ClipBox, aDC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y,
@@ -742,10 +709,10 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
* horizontal, vertical or 45 degrees.
*/
CalculateSegmentEndPoint( screen->GetCrossHairPosition(),
- g_CurrentTrackSegment->m_Start.x,
- g_CurrentTrackSegment->m_Start.y,
- &g_CurrentTrackSegment->m_End.x,
- &g_CurrentTrackSegment->m_End.y );
+ g_CurrentTrackSegment->m_Start.x,
+ g_CurrentTrackSegment->m_Start.y,
+ &g_CurrentTrackSegment->m_End.x,
+ &g_CurrentTrackSegment->m_End.y );
}
}
else /* Here the angle is arbitrary */
@@ -767,7 +734,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
color );
}
- /* Display info about currrent segment and the full new track:
+ /* Display info about current segment and the full new track:
* Choose the interesting segment: because we are using a 2 segments step,
* the last segment can be null, and the previous segment can be the
* interesting segment.
@@ -780,13 +747,13 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
// display interesting segment info only:
isegm->DisplayInfoBase( frame );
- // Diosplay current track length (on board) and the the actual track len
+ // Display current track length (on board) and the the actual track len
// if there is an extra len due to the len die on the starting pad (if any)
double trackLen = 0.0;
double lenDie = 0.0;
wxString msg;
- // If the starting point is on a pad, add current track length+ lenght die
+ // If the starting point is on a pad, add current track length+ length die
if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) )
{
D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start;
@@ -807,7 +774,6 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
frame->AppendMsgPanel( _( "On Die" ), msg, DARKCYAN );
}
-
// Add current segments count (number of segments in this new track):
msg.Printf( wxT( "%d" ), g_CurrentTrackList.GetCount() );
frame->AppendMsgPanel( _( "Segs Count" ), msg, DARKCYAN );
@@ -862,7 +828,7 @@ void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx
deltax = MIN( deltax, deltay );
deltay = deltax;
- /* Recalculate the signs fo deltax and deltaY. */
+ /* Recalculate the signs for deltax and deltaY. */
if( ( aPosition.x - ox ) < 0 )
deltax = -deltax;
@@ -915,7 +881,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
{
if(( (lastTrack->m_End.x == lastTrack->m_Start.x)
|| (lastTrack->m_End.y == lastTrack->m_Start.y) )
- && !g_Alternate_Track_Posture)
+ && !g_Alternate_Track_Posture)
{
iAngle = 45;
}
@@ -957,7 +923,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
iDx = MIN( iDx, iDy );
iDy = iDx;
- /* Recalculate the signs fo deltax and deltaY. */
+ /* Recalculate the signs for deltax and deltaY. */
if( ( end.x - track->m_Start.x ) < 0 )
iDx = -iDx;
@@ -1050,7 +1016,7 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST