Commit ae84ca2f authored by Wayne Stambaugh's avatar Wayne Stambaugh

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.
parent 3d7c91af
This diff is collapsed.
This diff is collapsed.
...@@ -6,9 +6,8 @@ ...@@ -6,9 +6,8 @@
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h"
#include "colors_selection.h" #include "colors_selection.h"
#include "class_board.h"
/* This is an odd place for this, but cvpcb won't link if it is /* 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. * in class_board_item.cpp like I first tried it.
...@@ -32,10 +31,8 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) : ...@@ -32,10 +31,8 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) :
m_NbNoconnect = 0; // Number of unconnected nets. m_NbNoconnect = 0; // Number of unconnected nets.
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
// zone contour currently in // zone contour currently in progress
// progress m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name, design constraints ..
m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name,
// design constraints ..
m_NetInfo->BuildListOfNets(); // prepare pads and nets lists containers. m_NetInfo->BuildListOfNets(); // prepare pads and nets lists containers.
for( int layer = 0; layer < NB_COPPER_LAYERS; ++layer ) for( int layer = 0; layer < NB_COPPER_LAYERS; ++layer )
...@@ -45,11 +42,9 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) : ...@@ -45,11 +42,9 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) :
} }
// Initial parameters for the default NETCLASS come from the global // Initial parameters for the default NETCLASS come from the global
// preferences // preferences within g_DesignSettings via the NETCLASS() constructor.
// within g_DesignSettings via the NETCLASS() constructor.
// Should user eventually load a board from a disk file, then these // Should user eventually load a board from a disk file, then these
// defaults // defaults will get overwritten during load.
// will get overwritten during load.
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) ); m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
m_ViaSizeSelector = 0; m_ViaSizeSelector = 0;
m_TrackWidthSelector = 0; m_TrackWidthSelector = 0;
...@@ -1340,8 +1335,10 @@ bool BOARD::Save( FILE* aFile ) const ...@@ -1340,8 +1335,10 @@ bool BOARD::Save( FILE* aFile ) const
fprintf( aFile, "$TRACK\n" ); fprintf( aFile, "$TRACK\n" );
for( item = m_Track; item; item = item->Next() ) for( item = m_Track; item; item = item->Next() )
{
if( !item->Save( aFile ) ) if( !item->Save( aFile ) )
goto out; goto out;
}
fprintf( aFile, "$EndTRACK\n" ); fprintf( aFile, "$EndTRACK\n" );
...@@ -1349,8 +1346,10 @@ bool BOARD::Save( FILE* aFile ) const ...@@ -1349,8 +1346,10 @@ bool BOARD::Save( FILE* aFile ) const
fprintf( aFile, "$ZONE\n" ); fprintf( aFile, "$ZONE\n" );
for( item = m_Zone; item; item = item->Next() ) for( item = m_Zone; item; item = item->Next() )
{
if( !item->Save( aFile ) ) if( !item->Save( aFile ) )
goto out; goto out;
}
fprintf( aFile, "$EndZONE\n" ); fprintf( aFile, "$EndZONE\n" );
...@@ -1492,6 +1491,149 @@ TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask ) ...@@ -1492,6 +1491,149 @@ TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask )
} }
D_PAD* BOARD::GetPad( const wxPoint& aPosition, int aLayerMask )
{
D_PAD* pad = NULL;
for( MODULE* module = m_Modules; module && ( pad == NULL ); module = module->Next() )
{
if( aLayerMask )
pad = module->GetPad( aPosition, aLayerMask );
else
pad = module->GetPad( aPosition, ALL_LAYERS );
}
return pad;
}
D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint )
{
D_PAD* pad = NULL;
wxPoint aPosition;
int aLayerMask = g_TabOneLayerMask[aTrace->GetLayer()];
if( aEndPoint == START )
{
aPosition = aTrace->m_Start;
}
else
{
aPosition = aTrace->m_End;
}
for( MODULE* module = m_Modules; module; module = module->Next() )
{
pad = module->GetPad( aPosition, aLayerMask );
if( pad != NULL )
break;
}
return pad;
}
D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask )
{
for( unsigned i=0; i<GetPadsCount(); ++i )
{
D_PAD* pad = m_NetInfo->GetPad(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) #if defined(DEBUG)
void BOARD::Show( int nestLevel, std::ostream& os ) void BOARD::Show( int nestLevel, std::ostream& os )
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "dlist.h" #include "dlist.h"
#include "class_netinfo.h" #include "class_netinfo.h"
#include "class_pad.h"
#include "class_colors_design_settings.h" #include "class_colors_design_settings.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
...@@ -1091,6 +1092,55 @@ public: ...@@ -1091,6 +1092,55 @@ public:
* @return TRACK* A point a to the SEGVIA object if found, else NULL. * @return TRACK* A point a to the SEGVIA object if found, else NULL.
*/ */
TRACK* GetViaByPosition( const wxPoint& aPosition, int aLayerMask = -1 ); 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.
* <p>
* The fast search method only works if the pad list has already been built.
* </p>
* @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
* <p>
* 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.
* </p>
* @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 #endif // #ifndef CLASS_BOARD_H
...@@ -819,6 +819,22 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const ...@@ -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 // see class_module.h
SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ) const KICAD_T scanTypes[] )
......
/*******************************************************/ /**
/* class_module.h : module description (excepted pads) */ * @file class_module.h
/*******************************************************/ * @brief Module description (excepted pads)
*/
#ifndef _MODULE_H_ #ifndef _MODULE_H_
...@@ -54,7 +55,7 @@ public: ...@@ -54,7 +55,7 @@ public:
int m_Attributs; /* Flag bits ( see Mod_Attribut ) */ int m_Attributs; /* Flag bits ( see Mod_Attribut ) */
int m_Orient; /* orientation in 0.1 degrees */ 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. */ * routing. */
int m_ModuleStatus; /* For autoplace: flags (LOCKED, int m_ModuleStatus; /* For autoplace: flags (LOCKED,
* AUTOPLACED) */ * AUTOPLACED) */
...@@ -117,7 +118,7 @@ public: ...@@ -117,7 +118,7 @@ public:
* Function CalculateBoundingBox * Function CalculateBoundingBox
* calculates the bounding box in board coordinates. * calculates the bounding box in board coordinates.
*/ */
void CalculateBoundingBox(); void CalculateBoundingBox();
/** /**
* Function GetFootPrintRect() * Function GetFootPrintRect()
...@@ -129,7 +130,7 @@ public: ...@@ -129,7 +130,7 @@ public:
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the bounding box of this * 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. * the footprint.
* @return EDA_RECT - The rectangle containing the footprint and texts. * @return EDA_RECT - The rectangle containing the footprint and texts.
*/ */
...@@ -147,8 +148,9 @@ public: ...@@ -147,8 +148,9 @@ public:
} }
// Moves // Moves
void SetPosition( const wxPoint& newpos ); void SetPosition( const wxPoint& newpos );
void SetOrientation( int newangle );
void SetOrientation( int newangle );
/** /**
* Function Move * Function Move
...@@ -208,8 +210,9 @@ public: ...@@ -208,8 +210,9 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
int Write_3D_Descr( FILE* File ) const; int Write_3D_Descr( FILE* File ) const;
int ReadDescr( LINE_READER* aReader );
int ReadDescr( LINE_READER* aReader );
/** /**
* Function Read_GPCB_Descr * Function Read_GPCB_Descr
...@@ -219,7 +222,8 @@ public: ...@@ -219,7 +222,8 @@ public:
* @return bool - true if success reading else false. * @return bool - true if success reading else false.
*/ */
bool Read_GPCB_Descr( const wxString& CmpFullFileName ); bool Read_GPCB_Descr( const wxString& CmpFullFileName );
int Read_3D_Descr( LINE_READER* aReader );
int Read_3D_Descr( LINE_READER* aReader );
/* drawing functions */ /* drawing functions */
...@@ -237,7 +241,9 @@ public: ...@@ -237,7 +241,9 @@ public:
const wxPoint& aOffset = ZeroOffset ); const wxPoint& aOffset = ZeroOffset );
void Draw3D( Pcb3D_GLCanvas* glcanvas ); void Draw3D( Pcb3D_GLCanvas* glcanvas );
void DrawEdgesOnly( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int draw_mode ); void DrawEdgesOnly( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int draw_mode );
void DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, void DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC,
const wxPoint& offset, int dim_ancre, int draw_mode ); const wxPoint& offset, int dim_ancre, int draw_mode );
...@@ -249,7 +255,6 @@ public: ...@@ -249,7 +255,6 @@ public:
*/ */
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
...@@ -258,7 +263,6 @@ public: ...@@ -258,7 +263,6 @@ public:
*/ */
bool HitTest( const wxPoint& aRefPos ); bool HitTest( const wxPoint& aRefPos );
/** /**
* Function HitTest (overlaid) * Function HitTest (overlaid)
* tests if the given EDA_RECT intersect the bounds of this object. * tests if the given EDA_RECT intersect the bounds of this object.
...@@ -295,8 +299,17 @@ public: ...@@ -295,8 +299,17 @@ public:
* @return D_PAD* - The first matching name is returned, or NULL if not * @return D_PAD* - The first matching name is returned, or NULL if not
* found. * 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 * Function Visit
...@@ -307,14 +320,13 @@ public: ...@@ -307,14 +320,13 @@ public:
* @param inspector An INSPECTOR instance to use in the inspection. * @param inspector An INSPECTOR instance to use in the inspection.
* @param testData Arbitrary data used by the inspector. * @param testData Arbitrary data used by the inspector.
* @param scanTypes Which KICAD_T types are of interest and the order * @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, * @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, SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -335,7 +347,7 @@ public: ...@@ -335,7 +347,7 @@ public:
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level * @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. * @param os The ostream& to output to.
*/ */
virtual void Show( int nestLevel, std::ostream& os ); virtual void Show( int nestLevel, std::ostream& os );
......
This diff is collapsed.
This diff is collapsed.
...@@ -107,7 +107,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -107,7 +107,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
SaveCopyInUndoList( aTrack, UR_DELETED ); SaveCopyInUndoList( aTrack, UR_DELETED );
OnModify(); OnModify();
test_1_net_connexion( DC, current_net_code ); TestNetConnection( DC, current_net_code );
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
return NULL; return NULL;
} }
...@@ -120,7 +120,7 @@ void PCB_EDIT_FRAME::Delete_Track( wxDC* DC, TRACK* aTrack ) ...@@ -120,7 +120,7 @@ void PCB_EDIT_FRAME::Delete_Track( wxDC* DC, TRACK* aTrack )
int current_net_code = aTrack->GetNet(); int current_net_code = aTrack->GetNet();
Remove_One_Track( DC, aTrack ); Remove_One_Track( DC, aTrack );
OnModify(); 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 ) ...@@ -160,7 +160,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
SaveCopyInUndoList( itemsList, UR_DELETED ); SaveCopyInUndoList( itemsList, UR_DELETED );
OnModify(); OnModify();
test_1_net_connexion( DC, net_code_delete ); TestNetConnection( DC, net_code_delete );
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
} }
...@@ -214,5 +214,5 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm ) ...@@ -214,5 +214,5 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
SaveCopyInUndoList( itemsList, UR_DELETED ); SaveCopyInUndoList( itemsList, UR_DELETED );
if( net_code > 0 ) if( net_code > 0 )
test_1_net_connexion( DC, net_code ); TestNetConnection( DC, net_code );
} }
...@@ -326,8 +326,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -326,8 +326,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
else else
{ {
int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType; int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
// place micro via and switch layer.
if( id == ID_POPUP_PCB_PLACE_MICROVIA ) 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 ); Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type; GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type;
...@@ -400,7 +402,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -400,7 +402,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
int netcode = zsegm->GetNet(); int netcode = zsegm->GetNet();
Delete_OldZone_Fill( zsegm ); Delete_OldZone_Fill( zsegm );
SetCurItem( NULL ); SetCurItem( NULL );
test_1_net_connexion( NULL, netcode ); TestNetConnection( NULL, netcode );
OnModify(); OnModify();
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
} }
...@@ -430,7 +432,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -430,7 +432,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNet(); int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNet();
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() ); Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
test_1_net_connexion( NULL, netcode ); TestNetConnection( NULL, netcode );
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
} }
break; break;
...@@ -445,10 +447,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -445,10 +447,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Corner( &dc, Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, false );
zone_cont,
zone_cont->m_CornerSelection,
false );
break; break;
} }
...@@ -457,9 +456,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -457,9 +456,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Drag_Outline_Edge( &dc, Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->m_CornerSelection );
zone_cont,
zone_cont->m_CornerSelection );
break; break;
} }
...@@ -487,10 +484,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -487,10 +484,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
zone_cont->m_CornerSelection++; zone_cont->m_CornerSelection++;
zone_cont->Draw( DrawPanel, &dc, GR_XOR ); zone_cont->Draw( DrawPanel, &dc, GR_XOR );
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Corner( &dc, Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, true );
zone_cont,
zone_cont->m_CornerSelection,
true );
break; break;
} }
...@@ -515,7 +509,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -515,7 +509,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
zone_container->UnFill(); zone_container->UnFill();
test_1_net_connexion( NULL, zone_container->GetNet() ); TestNetConnection( NULL, zone_container->GetNet() );
OnModify(); OnModify();
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
DrawPanel->Refresh(); DrawPanel->Refresh();
...@@ -534,7 +528,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -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 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 Tst_Ratsnest( NULL, 0 ); // Recalculate the active ratsnest, i.e. the unconnected links
OnModify(); OnModify();
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
...@@ -544,7 +538,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -544,7 +538,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_FILL_ZONE: case ID_POPUP_PCB_FILL_ZONE:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
Fill_Zone( (ZONE_CONTAINER*) GetCurItem() ); Fill_Zone( (ZONE_CONTAINER*) GetCurItem() );
test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() ); TestNetConnection( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
...@@ -560,6 +554,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -560,6 +554,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_MODULE_REQUEST: case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
if( GetCurItem() == NULL ) if( GetCurItem() == NULL )
break; break;
// If the current Item is a pad, text module ...: Get its parent // If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE ) if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() ); SetCurItem( GetCurItem()->GetParent() );
...@@ -655,7 +650,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -655,7 +650,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; 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); SaveCopyInUndoList(GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->m_Pos);
Rotate_Module( &dc, (MODULE*) GetCurItem(), g_RotationAngle, true ); Rotate_Module( &dc, (MODULE*) GetCurItem(), g_RotationAngle, true );
...@@ -682,8 +678,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -682,8 +678,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; 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 */
SaveCopyInUndoList(GetCurItem(), UR_ROTATED_CLOCKWISE, ((MODULE*)GetCurItem())->m_Pos); if( !(GetCurItem()->m_Flags & IS_MOVED) )
SaveCopyInUndoList( GetCurItem(), UR_ROTATED_CLOCKWISE,
((MODULE*)GetCurItem())->m_Pos );
Rotate_Module( &dc, (MODULE*) GetCurItem(), -g_RotationAngle, true ); Rotate_Module( &dc, (MODULE*) GetCurItem(), -g_RotationAngle, true );
break; break;
...@@ -709,7 +707,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -709,7 +707,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; 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); SaveCopyInUndoList(GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->m_Pos);
Change_Side_Module( (MODULE*) GetCurItem(), &dc ); Change_Side_Module( (MODULE*) GetCurItem(), &dc );
...@@ -981,13 +980,13 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -981,13 +980,13 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id ); StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
break; break;
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
case ID_POPUP_PCB_MOVE_TRACK_NODE: case ID_POPUP_PCB_MOVE_TRACK_NODE:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id ); StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
break; break;
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
...@@ -1007,7 +1006,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -1007,7 +1006,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
track->Draw( DrawPanel, &dc, GR_XOR ); track->Draw( DrawPanel, &dc, GR_XOR );
newtrack->Draw( DrawPanel, &dc, GR_XOR ); newtrack->Draw( DrawPanel, &dc, GR_XOR );
/* compute the new ratsnest, because connectivity could change */ /* compute the new ratsnest, because connectivity could change */
test_1_net_connexion( &dc, track->GetNet() ); TestNetConnection( &dc, track->GetNet() );
} }
break; break;
...@@ -1130,7 +1129,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) ...@@ -1130,7 +1129,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
SetCurItem( NULL ); SetCurItem( NULL );
int netcode = ( (ZONE_CONTAINER*) Item )->GetNet(); int netcode = ( (ZONE_CONTAINER*) Item )->GetNet();
Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item ); Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
test_1_net_connexion( NULL, netcode ); TestNetConnection( NULL, netcode );
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
} }
break; break;
......
...@@ -196,7 +196,7 @@ void PCB_EDIT_FRAME::DisplayNetStatus( wxDC* DC ) ...@@ -196,7 +196,7 @@ void PCB_EDIT_FRAME::DisplayNetStatus( wxDC* DC )
if( pt_segm == NULL ) if( pt_segm == NULL )
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
else else
test_1_net_connexion( DC, pt_segm->GetNet() ); TestNetConnection( DC, pt_segm->GetNet() );
} }
......
This diff is collapsed.
...@@ -12,88 +12,6 @@ ...@@ -12,88 +12,6 @@
#include "protos.h" #include "protos.h"
/* Locate the pad CONNECTED to a track
* input: ptr_trace: pointer to the segment of track
* Extr = flag = START -> beginning of the test segment
* END -> end of the segment to be tested
* Returns:
* A pointer to the description of the pad if found.
* NULL pointer if pad NOT FOUND
*/
D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_trace, int extr )
{
D_PAD* ptr_pad = NULL;
wxPoint ref_pos;
int aLayerMask = g_TabOneLayerMask[ptr_trace->GetLayer()];
if( extr == START )
{
ref_pos = ptr_trace->m_Start;
}
else
{
ref_pos = ptr_trace->m_End;
}
for( MODULE* module = Pcb->m_Modules; module; module = module->Next() )
{
ptr_pad = Locate_Pads( module, ref_pos, aLayerMask );
if( ptr_pad != NULL )
break;
}
return ptr_pad;
}
/*
* Locate a pad pointed to by the coordinates ref_pos.x, ref_pos.y
* aLayerMask is allowed layers ( bitmap mask)
* Returns:
* Pointer to a pad if found or NULL
*/
D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos, int aLayerMask )
{
D_PAD* pad = NULL;
for( MODULE* module=Pcb->m_Modules; module && ( pad == NULL ); module = module->Next() )
{
if( aLayerMask )
pad = Locate_Pads( module, ref_pos, aLayerMask );
else
pad = Locate_Pads( module, ref_pos, ALL_LAYERS );
}
return pad;
}
/* Locate the pad pointed to by the coordinate ref_pos.x,, ref_pos.y
* Input:
* - the footprint to test
* - masque_layer layer(s) (bit_masque) which must be the pad
* Returns:
* A pointer to the pad if found or NULL
*/
D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int aLayerMask )
{
for( D_PAD* pt_pad = module->m_Pads; pt_pad; pt_pad = pt_pad->Next() )
{
/* ... and on the correct layer. */
if( ( pt_pad->m_layerMask & aLayerMask ) == 0 )
continue;
if( pt_pad->HitTest( ref_pos ) )
return pt_pad;
}
return NULL;
}
/** /**
* Function Locate_Prefered_Module * Function Locate_Prefered_Module
* locates a footprint by its bounding rectangle. If several footprints * locates a footprint by its bounding rectangle. If several footprints
...@@ -402,58 +320,6 @@ TRACK* GetTrace( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int ...@@ -402,58 +320,6 @@ TRACK* GetTrace( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int
} }
/*
* 1 - Locate zone area by the mouse.
* 2 - Locate zone area by point
* def_pos.x, ref_pos.y.r
*
* If layer == -1, tst layer is not
*
* The search begins to address start_adresse
*/
TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer )
{
for( TRACK* Zone = start_adresse; Zone; Zone = Zone->Next() )
{
if( (layer != -1) && (Zone->GetLayer() != layer) )
continue;
if( Zone->HitTest( ref_pos ) )
return Zone;
}
return NULL;
}
/* Find the pad center px, py,
* The layer INDICATED BY aLayerMask (bitwise)
* (Runway end)
* The list of pads must already exist.
*
* Returns:
* NULL if no pad located.
* Pointer to the structure corresponding descr_pad if pad found
* (Good position and good layer).
*/
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int aLayerMask )
{
for( unsigned i=0; i<Pcb->GetPadsCount(); ++i )
{
D_PAD* pad = Pcb->m_NetInfo->GetPad(i);
if( pad->m_Pos != ref_pos )
continue;
/* Pad found, it must be on the correct layer */
if( pad->m_layerMask & aLayerMask )
return pad;
}
return NULL;
}
/* Locate segment with one end that coincides with the point x, y /* Locate segment with one end that coincides with the point x, y
* Data on layers by masklayer * Data on layers by masklayer
* Research is done to address start_adr has end_adr * Research is done to address start_adr has end_adr
......
...@@ -153,7 +153,7 @@ bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize gr ...@@ -153,7 +153,7 @@ bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize gr
if( doPad ) if( doPad )
{ {
int layer_mask = g_TabOneLayerMask[screen->m_Active_Layer]; int layer_mask = g_TabOneLayerMask[screen->m_Active_Layer];
D_PAD* pad = Locate_Any_Pad( m_Pcb, pos, layer_mask ); D_PAD* pad = m_Pcb->GetPad( pos, layer_mask );
if( pad ) if( pad )
{ {
......
This diff is collapsed.
...@@ -92,49 +92,10 @@ TRACK* GetConnectedTrace( TRACK* aTrace, TRACK* pt_base, TRACK* pt_lim, int extr ...@@ -92,49 +92,10 @@ TRACK* GetConnectedTrace( TRACK* aTrace, TRACK* pt_base, TRACK* pt_lim, int extr
*/ */
TRACK* GetTrace( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int layer ); TRACK* GetTrace( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int layer );
/* Locate pad connected to the beginning or end of a segment
* Input: pointer to the segment, and flag = START or END
* Returns:
* A pointer to the description of the patch if pad was found.
* NULL pointer if pad was not found.
*/
D_PAD* Locate_Pad_Connecte( BOARD* aPcb, TRACK* ptr_segment, int extr );
/*
* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the current
* cursor position, search done on all tracks.
* Entry:
* - Mouse coord (Curseur_X and Curseur_Y)
* Or ref_pX, ref_pY
* Returns:
* Pointer to the pad if found
* NULL pointer if pad not found
*/
D_PAD* Locate_Any_Pad( BOARD* aPcb, const wxPoint& aPosition, int aLayerMask = ALL_LAYERS );
/* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the cursor
* position of the current footprint.
* Input:
* - The module to search.
* - Layer to search or -1 to search all layers.
* Returns:
* A pointer to the pad if found otherwise NULL.
*/
D_PAD* Locate_Pads( MODULE* Module, const wxPoint& ref_pos, int layer );
/* Locate a footprint by its bounding rectangle. */ /* Locate a footprint by its bounding rectangle. */
MODULE* Locate_Prefered_Module( BOARD* aPcb, const wxPoint& aPosition, int aActiveLayer, MODULE* Locate_Prefered_Module( BOARD* aPcb, const wxPoint& aPosition, int aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked = false ); bool aVisibleOnly, bool aIgnoreLocked = false );
/* Locate a pad pointed to by the cursor on the footprint.
* Module.
* Input:
* - Module to search.
* Returns:
* A pointer to the pad if found otherwise NULL.
*/
D_PAD* Locate_Pads( MODULE* Module, int typeloc );
/* Locate a trace segment at the current cursor position. /* Locate a trace segment at the current cursor position.
* The search begins to address start_adresse. * The search begins to address start_adresse.
*/ */
...@@ -142,26 +103,6 @@ TRACK* GetTrace( TRACK* start_adresse, int typeloc ); ...@@ -142,26 +103,6 @@ TRACK* GetTrace( TRACK* start_adresse, int typeloc );
DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc ); DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc );
/* Locate pad containing the point px, py, layer on layer.
*
* The list of pads must already exist.
*
* Returns:
* Pointer to the pad if found, otherwise NULL.
*/
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int layer );
/*
* 1 - Locate trace segment at the current cursor position.
* 2 - Locate trace segment at the given coordinates ref_pos.
*
* If layer == -1, check all layers.
*
* The search begins to address start_adresse
*/
TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer );
/*************/ /*************/
/* MODULES.C */ /* MODULES.C */
/*************/ /*************/
...@@ -185,9 +126,9 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -185,9 +126,9 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy ); void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy );
/*****************/ /***************/
/* TRACK.CPP : */ /* TRACK.CPP : */
/*****************/ /***************/
/** /**
* Function MarkTrace * Function MarkTrace
......
...@@ -118,8 +118,7 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus ) ...@@ -118,8 +118,7 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus )
DisplayRastnestInProgress = true; DisplayRastnestInProgress = true;
GetBoard()->m_Status_Pcb = 0; /* we want a full ratsnest computation, GetBoard()->m_Status_Pcb = 0; /* we want a full ratsnest computation, from the scratch */
* from the scratch */
ClearMsgPanel(); ClearMsgPanel();
// Rebuild the full pads and net info list // Rebuild the full pads and net info list
...@@ -142,9 +141,8 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus ) ...@@ -142,9 +141,8 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus )
*/ */
Build_Board_Ratsnest( aDC ); Build_Board_Ratsnest( aDC );
/* Compute the pad connections due to the existing tracks (physical /* Compute the pad connections due to the existing tracks (physical connections) */
* connections) */ TestConnections( aDC );
test_connexions( aDC );
/* Compute the active ratsnest, i.e. the unconnected links /* Compute the active ratsnest, i.e. the unconnected links
* it is faster than Build_Board_Ratsnest() * it is faster than Build_Board_Ratsnest()
...@@ -200,7 +198,7 @@ static int sort_by_length( const void* o1, const void* o2 ) ...@@ -200,7 +198,7 @@ static int sort_by_length( const void* o1, const void* o2 )
* new ratsnest items * new ratsnest items
* @param aPadBuffer = a std::vector<D_PAD*> that is the list of pads to consider * @param aPadBuffer = a std::vector<D_PAD*> that is the list of pads to consider
* @param aPadIdxStart = starting index (within the pad list) for search * @param aPadIdxStart = starting index (within the pad list) for search
* @param aPadIdxMax = ending index (within the pad list) for search * @param aPadIdxMax = ending index (within the pad list) for search
* @return blocks not connected count * @return blocks not connected count
*/ */
static int gen_rats_block_to_block static int gen_rats_block_to_block
...@@ -309,7 +307,7 @@ static int gen_rats_block_to_block ...@@ -309,7 +307,7 @@ static int gen_rats_block_to_block
* @param aPadBuffer = a std::vector<D_PAD*> that is the list of pads to * @param aPadBuffer = a std::vector<D_PAD*> that is the list of pads to
* consider * consider
* @param aPadIdxStart = starting index (within the pad list) for search * @param aPadIdxStart = starting index (within the pad list) for search
* @param aPadIdxMax = ending index (within the pad list) for search * @param aPadIdxMax = ending index (within the pad list) for search
* @param current_num_block = Last existing block number of pads * @param current_num_block = Last existing block number of pads
* These block are created by the existing tracks analysis * These block are created by the existing tracks analysis
* *
...@@ -410,7 +408,7 @@ static int gen_rats_pad_to_pad( vector<RATSNEST_ITEM>& aRatsnestBuffer, ...@@ -410,7 +408,7 @@ static int gen_rats_pad_to_pad( vector<RATSNEST_ITEM>& aRatsnestBuffer,
* Update : * Update :
* nb_nodes = Active pads count for the board * nb_nodes = Active pads count for the board
* nb_links = link count for the board (logical connection count) * nb_links = link count for the board (logical connection count)
* (there are n-1 links for an equipotent which have n active pads) . * (there are n-1 links for an connection which have n active pads) .
* *
*/ */
void PCB_BASE_FRAME::Build_Board_Ratsnest( wxDC* DC ) void PCB_BASE_FRAME::Build_Board_Ratsnest( wxDC* DC )
...@@ -512,8 +510,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest( wxDC* DC ) ...@@ -512,8 +510,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest( wxDC* DC )
m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE; m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
if( DC ) if( DC )
m_Pcb->m_FullRatsnest[ii].Draw( DrawPanel, DC, GR_XOR, m_Pcb->m_FullRatsnest[ii].Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
wxPoint( 0, 0 ) );
} }
} }
...@@ -620,7 +617,7 @@ static int tst_rats_block_to_block( NETINFO_ITEM* net, ...@@ -620,7 +617,7 @@ static int tst_rats_block_to_block( NETINFO_ITEM* net,
/** /**
* Function used by Tst_Ratsnest_general * Function used by Tst_Ratsnest_general
* The general ratsnest list must exists * The general ratsnest list must exists
* Activates the ratsnest between 2 pads ( supposes du meme net ) * Activates the ratsnest between 2 pads ( assumes the same net )
* The function links 1 pad not already connected an other pad and activate * The function links 1 pad not already connected an other pad and activate
* some blocks linked by a ratsnest * some blocks linked by a ratsnest
* Its test only the existing ratsnest and activate some ratsnest (status bit * Its test only the existing ratsnest and activate some ratsnest (status bit
...@@ -933,6 +930,7 @@ CalculateExternalRatsnest: ...@@ -933,6 +930,7 @@ CalculateExternalRatsnest:
local_rats.m_Lenght = 0x7FFFFFFF; local_rats.m_Lenght = 0x7FFFFFFF;
local_rats.m_Status = 0; local_rats.m_Status = 0;
bool addRats = false; bool addRats = false;
if( internalRatsCount < m_Pcb->m_LocalRatsnest.size() ) if( internalRatsCount < m_Pcb->m_LocalRatsnest.size() )
m_Pcb->m_LocalRatsnest.erase( m_Pcb->m_LocalRatsnest.begin() + internalRatsCount, m_Pcb->m_LocalRatsnest.erase( m_Pcb->m_LocalRatsnest.begin() + internalRatsCount,
m_Pcb->m_LocalRatsnest.end() ); m_Pcb->m_LocalRatsnest.end() );
......
...@@ -60,13 +60,13 @@ static int s_Clearance; // Clearance value used in autorouter ...@@ -60,13 +60,13 @@ static int s_Clearance; // Clearance value used in autorouter
/* /*
** visit neighboring cells like this (where [9] is on the other side): ** visit neighboring cells like this (where [9] is on the other side):
** **
** +---+---+---+ ** +---+---+---+
** | 1 | 2 | 3 | ** | 1 | 2 | 3 |
** +---+---+---+ ** +---+---+---+
** | 4 |[9]| 5 | ** | 4 |[9]| 5 |
** +---+---+---+ ** +---+---+---+
** | 6 | 7 | 8 | ** | 6 | 7 | 8 |
** +---+---+---+ ** +---+---+---+
*/ */
/* for visiting neighbors on the same side: increments/decrements coord of /* for visiting neighbors on the same side: increments/decrements coord of
...@@ -75,14 +75,14 @@ static int s_Clearance; // Clearance value used in autorouter ...@@ -75,14 +75,14 @@ static int s_Clearance; // Clearance value used in autorouter
*/ */
static int delta[8][2] = static int delta[8][2] =
{ {
{ 1, -1 }, /* northwest */ { 1, -1 }, /* northwest */
{ 1, 0 }, /* north */ { 1, 0 }, /* north */
{ 1, 1 }, /* northeast */ { 1, 1 }, /* northeast */
{ 0, -1 }, /* west */ { 0, -1 }, /* west */
{ 0, 1 }, /* east */ { 0, 1 }, /* east */
{ -1, -1 }, /* southwest */ { -1, -1 }, /* southwest */
{ -1, 0 }, /* south */ { -1, 0 }, /* south */
{ -1, 1 } /* southeast */ { -1, 1 } /* southeast */
}; };
static int ndir[8] = static int ndir[8] =
...@@ -242,6 +242,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) ...@@ -242,6 +242,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance(); s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
Ncurrent = 0; Ncurrent = 0;
/* go until no more work to do */ /* go until no more work to do */
GetWork( &row_source, &col_source, &current_net_code, GetWork( &row_source, &col_source, &current_net_code,
&row_target, &col_target, &pt_cur_ch ); // First net to route. &row_target, &col_target, &pt_cur_ch ); // First net to route.
...@@ -333,7 +334,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) ...@@ -333,7 +334,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
msg.Printf( wxT( "%d" ), nbunsucces ); msg.Printf( wxT( "%d" ), nbunsucces );
AppendMsgPanel( wxT( "Fail" ), msg, RED ); AppendMsgPanel( wxT( "Fail" ), msg, RED );
msg.Printf( wxT( " %d" ), GetBoard()->m_NbNoconnect ); msg.Printf( wxT( " %d" ), GetBoard()->m_NbNoconnect );
AppendMsgPanel( wxT( "Not Connectd" ), msg, CYAN ); AppendMsgPanel( wxT( "Not Connected" ), msg, CYAN );
/* Delete routing from display. */ /* Delete routing from display. */
pt_cur_ch->m_PadStart->Draw( DrawPanel, DC, GR_AND ); pt_cur_ch->m_PadStart->Draw( DrawPanel, DC, GR_AND );
...@@ -407,6 +408,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, ...@@ -407,6 +408,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
/* Set tab_masque[side] for final test of routing. */ /* Set tab_masque[side] for final test of routing. */
tab_mask[TOP] = topLayerMask; tab_mask[TOP] = topLayerMask;
tab_mask[BOTTOM] = bottomLayerMask; tab_mask[BOTTOM] = bottomLayerMask;
/* Set active layers mask. */ /* Set active layers mask. */
routeLayerMask = topLayerMask | bottomLayerMask; routeLayerMask = topLayerMask | bottomLayerMask;
...@@ -667,7 +669,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, ...@@ -667,7 +669,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
if( buddy & HOLE ) if( buddy & HOLE )
continue; continue;
// if (buddy & (blocking[i].b1)) continue; // if (buddy & (blocking[i].b1)) continue;
/* check second buddy */ /* check second buddy */
buddy = GetCell( r + blocking[i].r2, c + blocking[i].c2, side ); buddy = GetCell( r + blocking[i].r2, c + blocking[i].c2, side );
...@@ -677,7 +679,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, ...@@ -677,7 +679,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
if( buddy & HOLE ) if( buddy & HOLE )
continue; continue;
// if (buddy & (blocking[i].b2)) continue; // if (buddy & (blocking[i].b2)) continue;
} }
olddir = GetDir( r, c, side ); olddir = GetDir( r, c, side );
...@@ -1268,14 +1270,12 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC ) ...@@ -1268,14 +1270,12 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
g_CurrentTrackList.PushBack( newTrack ); g_CurrentTrackList.PushBack( newTrack );
} }
g_FirstTrackSegment->start = Locate_Pad_Connecte( pcbframe->GetBoard(), g_FirstTrackSegment->start = pcbframe->GetBoard()->GetPad( g_FirstTrackSegment, START );
g_FirstTrackSegment, START );
if( g_FirstTrackSegment->start ) if( g_FirstTrackSegment->start )
g_FirstTrackSegment->SetState( BEGIN_ONPAD, ON ); g_FirstTrackSegment->SetState( BEGIN_ONPAD, ON );
g_CurrentTrackSegment->end = Locate_Pad_Connecte( pcbframe->GetBoard(), g_CurrentTrackSegment->end = pcbframe->GetBoard()->GetPad( g_CurrentTrackSegment, END );
g_CurrentTrackSegment, END );
if( g_CurrentTrackSegment->end ) if( g_CurrentTrackSegment->end )
g_CurrentTrackSegment->SetState( END_ONPAD, ON ); g_CurrentTrackSegment->SetState( END_ONPAD, ON );
...@@ -1304,7 +1304,7 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC ) ...@@ -1304,7 +1304,7 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
DrawTraces( panel, DC, firstTrack, newCount, GR_OR ); DrawTraces( panel, DC, firstTrack, newCount, GR_OR );
pcbframe->test_1_net_connexion( DC, netcode ); pcbframe->TestNetConnection( DC, netcode );
screen->SetModify(); screen->SetModify();
} }
...@@ -287,8 +287,7 @@ static void ChainMarkedSegments( BOARD* aPcb, ...@@ -287,8 +287,7 @@ static void ChainMarkedSegments( BOARD* aPcb,
TRACK* pt_segm, // The current segment being analyzed. TRACK* pt_segm, // The current segment being analyzed.
* pt_via, // The via identified, eventually destroy * pt_via, // The via identified, eventually destroy
* SegmentCandidate; // The end segment to destroy (or NULL = * SegmentCandidate; // The end segment to destroy (or NULL = pt_segm
// pt_segm
int NbSegm; int NbSegm;
if( aPcb->m_Track == NULL ) if( aPcb->m_Track == NULL )
...@@ -311,7 +310,7 @@ static void ChainMarkedSegments( BOARD* aPcb, ...@@ -311,7 +310,7 @@ static void ChainMarkedSegments( BOARD* aPcb,
*/ */
for( ; ; ) for( ; ; )
{ {
if( Fast_Locate_Pad_Connecte( aPcb, aRef_pos, aLayerMask ) != NULL ) if( aPcb->GetPadFast( aRef_pos, aLayerMask ) != NULL )
return; return;
/* Test for a via: a via changes the layer mask and can connect a lot /* Test for a via: a via changes the layer mask and can connect a lot
......
...@@ -163,7 +163,7 @@ int PCB_EDIT_FRAME::Fill_All_Zones( bool verbose ) ...@@ -163,7 +163,7 @@ int PCB_EDIT_FRAME::Fill_All_Zones( bool verbose )
} }
progressDialog.Update( ii+2, _( "Updating ratsnest..." ) ); progressDialog.Update( ii+2, _( "Updating ratsnest..." ) );
test_connexions( NULL ); TestConnections( NULL );
// Recalculate the active ratsnest, i.e. the unconnected links // Recalculate the active ratsnest, i.e. the unconnected links
Tst_Ratsnest( NULL, 0 ); Tst_Ratsnest( NULL, 0 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment