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.
This commit is contained in:
parent
3d7c91af44
commit
ae84ca2ffa
|
@ -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
|
||||
|
@ -98,16 +98,12 @@ 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 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();
|
||||
|
@ -161,11 +157,10 @@ 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 );
|
||||
void SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo = true );
|
||||
|
||||
BOARD_ITEM* GetCurItem();
|
||||
|
||||
/**
|
||||
|
@ -256,8 +251,7 @@ public:
|
|||
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 StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC );
|
||||
TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC );
|
||||
|
||||
/**
|
||||
|
@ -279,8 +273,7 @@ public:
|
|||
void ResetModuleTextSizes( int aType, wxDC* aDC );
|
||||
|
||||
void InstallPadOptionsFrame( D_PAD* pad );
|
||||
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod,
|
||||
wxDC* DC );
|
||||
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC );
|
||||
|
||||
void AddPad( MODULE* Module, bool draw );
|
||||
|
||||
|
@ -299,9 +292,7 @@ public:
|
|||
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 Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw );
|
||||
|
||||
// loading footprints
|
||||
|
||||
|
@ -333,8 +324,7 @@ 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,
|
||||
|
@ -385,13 +375,41 @@ public:
|
|||
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 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 );
|
||||
|
||||
/**
|
||||
* Function TestConnections
|
||||
* tests the connections relative to all nets.
|
||||
* <p>
|
||||
* 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.
|
||||
* </p>
|
||||
* @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.
|
||||
* <p>
|
||||
* 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:
|
||||
|
@ -415,6 +433,7 @@ public:
|
|||
void Plot_Layer( PLOTTER* plotter,
|
||||
int Layer,
|
||||
GRTraceMode trace_mode );
|
||||
|
||||
/**
|
||||
* Function Plot_Standard_Layer
|
||||
* plot copper or technical layers.
|
||||
|
@ -432,9 +451,7 @@ public:
|
|||
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,8 +499,7 @@ 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 );
|
||||
int SelectLayer( int default_layer, int min_layer, int max_layer, bool null_layer = false );
|
||||
void SelectLayerPair();
|
||||
virtual void SwitchLayer( wxDC* DC, int layer );
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/***********************************************************/
|
||||
/* wxPcbStruct.h */
|
||||
/***********************************************************/
|
||||
/**
|
||||
* @file wxPcbStruct.h
|
||||
*/
|
||||
|
||||
#ifndef WXPCB_STRUCT_H
|
||||
#define WXPCB_STRUCT_H
|
||||
|
@ -194,8 +194,7 @@ 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 );
|
||||
|
@ -372,6 +371,7 @@ public:
|
|||
* <p>
|
||||
* Reloads the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function
|
||||
* to update auxiliary information.
|
||||
* </p>
|
||||
*/
|
||||
virtual void OnModify();
|
||||
|
||||
|
@ -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)
|
||||
*/
|
||||
|
@ -780,8 +780,7 @@ public:
|
|||
* @param aUndoPickList = the undo list used to save OldModule. If null,
|
||||
* OldModule is deleted
|
||||
*/
|
||||
void Exchange_Module( MODULE* aOldModule,
|
||||
MODULE* aNewModule,
|
||||
void Exchange_Module( MODULE* aOldModule, MODULE* aNewModule,
|
||||
PICKED_ITEMS_LIST* aUndoPickList );
|
||||
|
||||
// loading modules: see PCB_BASE_FRAME
|
||||
|
@ -797,7 +796,6 @@ public:
|
|||
*/
|
||||
void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem );
|
||||
|
||||
|
||||
// Highlight functions:
|
||||
int Select_High_Light( wxDC* DC );
|
||||
void High_Light( wxDC* DC );
|
||||
|
@ -910,12 +908,39 @@ public:
|
|||
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 );
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
bool Add_45_degrees_Segment( wxDC* DC );
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -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
|
||||
|
@ -1107,7 +1131,6 @@ public:
|
|||
DIMENSION* Begin_Dimension( DIMENSION* Dimension, wxDC* DC );
|
||||
void Delete_Dimension( DIMENSION* Dimension, wxDC* DC );
|
||||
|
||||
|
||||
// netlist handling:
|
||||
void InstallNetlistFrame( wxDC* DC );
|
||||
|
||||
|
@ -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.
|
||||
* </p>
|
||||
*/
|
||||
void UpdateTitle();
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
#include "common.h"
|
||||
|
||||
#include "pcbnew.h"
|
||||
#include "class_board_design_settings.h"
|
||||
#include "colors_selection.h"
|
||||
|
||||
#include "class_board.h"
|
||||
|
||||
/* This is an odd place for this, but cvpcb won't link if it is
|
||||
* in class_board_item.cpp like I first tried it.
|
||||
|
@ -32,10 +31,8 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) :
|
|||
m_NbNoconnect = 0; // Number of unconnected nets.
|
||||
|
||||
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
|
||||
// zone contour currently in
|
||||
// progress
|
||||
m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name,
|
||||
// design constraints ..
|
||||
// zone contour currently in progress
|
||||
m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name, design constraints ..
|
||||
m_NetInfo->BuildListOfNets(); // prepare pads and nets lists containers.
|
||||
|
||||
for( int layer = 0; layer < NB_COPPER_LAYERS; ++layer )
|
||||
|
@ -45,11 +42,9 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) :
|
|||
}
|
||||
|
||||
// Initial parameters for the default NETCLASS come from the global
|
||||
// preferences
|
||||
// within g_DesignSettings via the NETCLASS() constructor.
|
||||
// preferences within g_DesignSettings via the NETCLASS() constructor.
|
||||
// Should user eventually load a board from a disk file, then these
|
||||
// defaults
|
||||
// will get overwritten during load.
|
||||
// defaults will get overwritten during load.
|
||||
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
|
||||
m_ViaSizeSelector = 0;
|
||||
m_TrackWidthSelector = 0;
|
||||
|
@ -1340,8 +1335,10 @@ bool BOARD::Save( FILE* aFile ) const
|
|||
fprintf( aFile, "$TRACK\n" );
|
||||
|
||||
for( item = m_Track; item; item = item->Next() )
|
||||
{
|
||||
if( !item->Save( aFile ) )
|
||||
goto out;
|
||||
}
|
||||
|
||||
fprintf( aFile, "$EndTRACK\n" );
|
||||
|
||||
|
@ -1349,8 +1346,10 @@ bool BOARD::Save( FILE* aFile ) const
|
|||
fprintf( aFile, "$ZONE\n" );
|
||||
|
||||
for( item = m_Zone; item; item = item->Next() )
|
||||
{
|
||||
if( !item->Save( aFile ) )
|
||||
goto out;
|
||||
}
|
||||
|
||||
fprintf( aFile, "$EndZONE\n" );
|
||||
|
||||
|
@ -1492,6 +1491,149 @@ TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask )
|
|||
}
|
||||
|
||||
|
||||
D_PAD* BOARD::GetPad( const wxPoint& aPosition, int aLayerMask )
|
||||
{
|
||||
D_PAD* pad = NULL;
|
||||
|
||||
for( MODULE* module = m_Modules; module && ( pad == NULL ); module = module->Next() )
|
||||
{
|
||||
if( aLayerMask )
|
||||
pad = module->GetPad( aPosition, aLayerMask );
|
||||
else
|
||||
pad = module->GetPad( aPosition, ALL_LAYERS );
|
||||
}
|
||||
|
||||
return pad;
|
||||
}
|
||||
|
||||
|
||||
D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint )
|
||||
{
|
||||
D_PAD* pad = NULL;
|
||||
wxPoint aPosition;
|
||||
|
||||
int aLayerMask = g_TabOneLayerMask[aTrace->GetLayer()];
|
||||
|
||||
if( aEndPoint == START )
|
||||
{
|
||||
aPosition = aTrace->m_Start;
|
||||
}
|
||||
else
|
||||
{
|
||||
aPosition = aTrace->m_End;
|
||||
}
|
||||
|
||||
for( MODULE* module = m_Modules; module; module = module->Next() )
|
||||
{
|
||||
pad = module->GetPad( aPosition, aLayerMask );
|
||||
|
||||
if( pad != NULL )
|
||||
break;
|
||||
}
|
||||
|
||||
return pad;
|
||||
}
|
||||
|
||||
|
||||
D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask )
|
||||
{
|
||||
for( unsigned i=0; i<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)
|
||||
|
||||
void BOARD::Show( int nestLevel, std::ostream& os )
|
||||
|
|
|
@ -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.
|
||||
* <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
|
||||
|
|
|
@ -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[] )
|
||||
|
|
|
@ -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) */
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -148,6 +149,7 @@ public:
|
|||
|
||||
// Moves
|
||||
void SetPosition( const wxPoint& newpos );
|
||||
|
||||
void SetOrientation( int newangle );
|
||||
|
||||
/**
|
||||
|
@ -209,6 +211,7 @@ public:
|
|||
bool Save( FILE* aFile ) const;
|
||||
|
||||
int Write_3D_Descr( FILE* File ) const;
|
||||
|
||||
int ReadDescr( LINE_READER* aReader );
|
||||
|
||||
/**
|
||||
|
@ -219,6 +222,7 @@ public:
|
|||
* @return bool - true if success reading else false.
|
||||
*/
|
||||
bool Read_GPCB_Descr( const wxString& CmpFullFileName );
|
||||
|
||||
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.
|
||||
|
@ -297,6 +301,15 @@ public:
|
|||
*/
|
||||
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
|
||||
|
@ -314,7 +327,6 @@ public:
|
|||
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
|
||||
const KICAD_T scanTypes[] );
|
||||
|
||||
|
||||
/**
|
||||
* Function GetClass
|
||||
* returns the class name.
|
||||
|
|
216
pcbnew/clean.cpp
216
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 )
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************************/
|
||||
/* Rastnest calculations: Function to handle existing tracks in rastsnest calculations */
|
||||
/* Ratsnest calculations: Function to handle existing tracks in ratsnest calculations */
|
||||
/***************************************************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
@ -32,7 +32,7 @@ static void RebuildTrackChain( BOARD* pcb );
|
|||
* The result is merging 2 blocks (or subnets)
|
||||
* @return modification count
|
||||
* @param old_val = subnet value to modify
|
||||
* @param new_val = new subnet value for each item whith have old_val as subnet value
|
||||
* @param new_val = new subnet value for each item which have old_val as subnet value
|
||||
* @param pt_start_conn = first track segment to test
|
||||
* @param pt_end_conn = last track segment to test
|
||||
* If pt_end_conn = NULL: search is made from pt_start_conn to end of linked list
|
||||
|
@ -98,7 +98,7 @@ static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_
|
|||
* for pads, this is the .m_physical_connexion member which is a cluster identifier
|
||||
* for tracks, this is the .m_Subnet member which is a cluster identifier
|
||||
* For a given net, if all tracks are created, there is only one cluster.
|
||||
* but if not all tracks are created, there are more than one cluster, and some ratsnets
|
||||
* but if not all tracks are created, there are more than one cluster, and some ratsnest
|
||||
* will be shown.
|
||||
* @param pt_start_conn = first track to test
|
||||
* @param pt_end_conn = last segment to test
|
||||
|
@ -149,22 +149,30 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
|||
|
||||
if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */
|
||||
{
|
||||
if( pt_pad->GetSubNet() > 0 ) /* The pad is already a cluster member, so we can merge the 2 clusters */
|
||||
if( pt_pad->GetSubNet() > 0 )
|
||||
{
|
||||
/* The pad is already a cluster member, so we can merge the 2 clusters */
|
||||
Merge_Two_SubNets( pt_start_conn, pt_end_conn,
|
||||
pt_pad->GetSubNet(), pt_conn->GetSubNet() );
|
||||
}
|
||||
else /* The pad is not yet attached to a cluster , so we can add this pad to the cluster */
|
||||
else
|
||||
{
|
||||
/* The pad is not yet attached to a cluster , so we can add this pad to
|
||||
* the cluster */
|
||||
pt_pad->SetSubNet( pt_conn->GetSubNet() );
|
||||
}
|
||||
}
|
||||
else /* the track segment is not attached to a cluster */
|
||||
{
|
||||
if( pt_pad->GetSubNet() > 0 ) /* it is connected to a pad in a cluster, merge this track */
|
||||
if( pt_pad->GetSubNet() > 0 )
|
||||
{
|
||||
/* it is connected to a pad in a cluster, merge this track */
|
||||
pt_conn->SetSubNet( pt_pad->GetSubNet() );
|
||||
}
|
||||
else /* it is connected to a pad not in a cluster, so we must create a new cluster (only with the 2 items: the track and the pad) */
|
||||
else
|
||||
{
|
||||
/* it is connected to a pad not in a cluster, so we must create a new
|
||||
* cluster (only with the 2 items: the track and the pad) */
|
||||
sub_netcode++;
|
||||
pt_conn->SetSubNet( sub_netcode );
|
||||
pt_pad->SetSubNet( pt_conn->GetSubNet() );
|
||||
|
@ -174,8 +182,8 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
|||
|
||||
PtStruct = pt_conn->end;
|
||||
|
||||
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
||||
/* The segment end on a pad */
|
||||
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
||||
{
|
||||
pt_pad = (D_PAD*) PtStruct;
|
||||
|
||||
|
@ -215,26 +223,35 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
|||
/* The segment starts on an other track */
|
||||
pt_other_trace = (TRACK*) PtStruct;
|
||||
|
||||
if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */
|
||||
/* the track segment is already a cluster member */
|
||||
if( pt_conn->GetSubNet() )
|
||||
{
|
||||
if( pt_other_trace->GetSubNet() ) /* The other track is already a cluster member, so we can merge the 2 clusters */
|
||||
/* The other track is already a cluster member, so we can merge the 2 clusters */
|
||||
if( pt_other_trace->GetSubNet() )
|
||||
{
|
||||
Merge_Two_SubNets( pt_start_conn, pt_end_conn,
|
||||
pt_other_trace->GetSubNet(), pt_conn->GetSubNet() );
|
||||
}
|
||||
else /* The other track is not yet attached to a cluster , so we can add this other track to the cluster */
|
||||
else
|
||||
{
|
||||
/* The other track is not yet attached to a cluster , so we can add this
|
||||
* other track to the cluster */
|
||||
pt_other_trace->SetSubNet( pt_conn->GetSubNet() );
|
||||
}
|
||||
}
|
||||
else /* the track segment is not yet attached to a cluster */
|
||||
else
|
||||
{
|
||||
if( pt_other_trace->GetSubNet() ) /* The other track is already a cluster member, so we can add the segment to the cluster */
|
||||
/* the track segment is not yet attached to a cluster */
|
||||
if( pt_other_trace->GetSubNet() )
|
||||
{
|
||||
/* The other track is already a cluster member, so we can add the segment
|
||||
* to the cluster */
|
||||
pt_conn->SetSubNet( pt_other_trace->GetSubNet() );
|
||||
}
|
||||
else /* it is connected to an other segment not in a cluster, so we must create a new cluster (only with the 2 track segments) */
|
||||
else
|
||||
{
|
||||
/* it is connected to an other segment not in a cluster, so we must
|
||||
* create a new cluster (only with the 2 track segments) */
|
||||
sub_netcode++;
|
||||
pt_conn->SetSubNet( sub_netcode );
|
||||
pt_other_trace->SetSubNet( pt_conn->GetSubNet() );
|
||||
|
@ -260,8 +277,9 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
|||
pt_other_trace->SetSubNet( pt_conn->GetSubNet() );
|
||||
}
|
||||
}
|
||||
else /* the track segment is not yet attached to a cluster */
|
||||
else
|
||||
{
|
||||
/* the track segment is not yet attached to a cluster */
|
||||
if( pt_other_trace->GetSubNet() )
|
||||
{
|
||||
pt_conn->SetSubNet( pt_other_trace->GetSubNet() );
|
||||
|
@ -281,16 +299,7 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function testing the connections relative to all nets
|
||||
* This function update the status of the ratsnest ( flag CH_ACTIF = 0 if a connection
|
||||
* is found, = 1 else) track segments are assumed to be sorted by net codes.
|
||||
* This is the case because when a new track is added, it is inserted in the linked list
|
||||
* according to its net code. and when nets are changed (when a new netlist is read)
|
||||
* tracks are sorted before using this function
|
||||
* @param DC = current Device Context
|
||||
*/
|
||||
void PCB_BASE_FRAME::test_connexions( wxDC* DC )
|
||||
void PCB_BASE_FRAME::TestConnections( wxDC* aDC )
|
||||
{
|
||||
// Clear the cluster identifier for all pads
|
||||
for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i )
|
||||
|
@ -323,21 +332,15 @@ void PCB_BASE_FRAME::test_connexions( wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function testing the connections relative to a given net
|
||||
* track segments are assumed to be sorted by net codes
|
||||
* @param DC = current Device Context
|
||||
* @param net_code = net code to test
|
||||
*/
|
||||
void PCB_BASE_FRAME::test_1_net_connexion( wxDC* DC, int net_code )
|
||||
void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
if( net_code == 0 )
|
||||
if( aNetCode == 0 )
|
||||
return;
|
||||
|
||||
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||
Compile_Ratsnest( DC, true );
|
||||
Compile_Ratsnest( aDC, true );
|
||||
|
||||
for( unsigned i = 0; i<m_Pcb->GetPadsCount(); ++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<D_PAD*>* 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;
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 ) )
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<TRACK>& aTrackList )
|
|||
while( track != NULL )
|
||||
{
|
||||
TRACK* next_track = track->Next();
|
||||
LockPoint = Locate_Pad_Connecte( pcb, track, END );
|
||||
LockPoint = pcb->GetPad( track, END );
|
||||
|
||||
if( LockPoint )
|
||||
{
|
||||
|
|
|
@ -12,88 +12,6 @@
|
|||
#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
|
||||
* 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
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
* Data on layers by masklayer
|
||||
* 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
|
|||
if( doPad )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
|
|
|
@ -239,10 +239,8 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
|
|||
static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||
const wxPoint& aPosition, bool aErase )
|
||||
{
|
||||
double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated
|
||||
// intersection points
|
||||
double tx1, tx2, ty1, ty2; // temporary storage of
|
||||
// points
|
||||
double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated intersection points
|
||||
double tx1, tx2, ty1, ty2; // temporary storage of points
|
||||
int dx, dy;
|
||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||
bool update = true;
|
||||
|
@ -513,8 +511,8 @@ bool InitialiseDragParameters()
|
|||
}
|
||||
}
|
||||
|
||||
//would be nice to eliminate collinear segments here, so we don't
|
||||
//have to deal with that annoying "Unable to drag this segment: two
|
||||
// would be nice to eliminate collinear segments here, so we don't
|
||||
// have to deal with that annoying "Unable to drag this segment: two
|
||||
// collinear segments"
|
||||
|
||||
s_StartPointVertical = false;
|
||||
|
@ -542,8 +540,7 @@ bool InitialiseDragParameters()
|
|||
ty2 = (double) tSegmentToStart->m_Start.y;
|
||||
}
|
||||
}
|
||||
else // move the start point on a line starting at Track->m_Start, and
|
||||
// perpendicular to Track
|
||||
else // move the start point on a line starting at Track->m_Start, and perpendicular to Track
|
||||
{
|
||||
tx1 = (double) Track->m_Start.x;
|
||||
ty1 = (double) Track->m_Start.y;
|
||||
|
@ -567,7 +564,6 @@ bool InitialiseDragParameters()
|
|||
s_StartPointHorizontal = true;
|
||||
}
|
||||
|
||||
|
||||
// Init parameters for the ending point of the moved segment
|
||||
if( tSegmentToEnd )
|
||||
{
|
||||
|
@ -587,8 +583,7 @@ bool InitialiseDragParameters()
|
|||
ty2 = (double) tSegmentToEnd->m_Start.y;
|
||||
}
|
||||
}
|
||||
else // move the start point on a line starting at Track->m_End, and
|
||||
// perpendicular to Track
|
||||
else // move the start point on a line starting at Track->m_End, and perpendicular to Track
|
||||
{
|
||||
tx1 = (double) Track->m_End.x;
|
||||
ty1 = (double) Track->m_End.y;
|
||||
|
@ -624,7 +619,7 @@ bool InitialiseDragParameters()
|
|||
}
|
||||
else
|
||||
{
|
||||
s_MovingSegmentVertical = true; //signal vertical line
|
||||
s_MovingSegmentVertical = true; // signal vertical line
|
||||
}
|
||||
|
||||
if( ty1 == ty2 )
|
||||
|
@ -651,13 +646,9 @@ bool InitialiseDragParameters()
|
|||
}
|
||||
|
||||
|
||||
/* Init parameters to move one node:
|
||||
* a via or/and a terminal point of a track segment
|
||||
* The terminal point of other connected segments (if any) are moved too.
|
||||
*/
|
||||
void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int command )
|
||||
void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aCommand )
|
||||
{
|
||||
if( !track )
|
||||
if( !aTrack )
|
||||
return;
|
||||
|
||||
NewTrack = NULL;
|
||||
|
@ -668,64 +659,64 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
|
|||
GetBoard()->PushHighLight();
|
||||
|
||||
if( GetBoard()->IsHighLightNetON() )
|
||||
High_Light( DC );
|
||||
High_Light( aDC );
|
||||
|
||||
PosInit = GetScreen()->GetCrossHairPosition();
|
||||
|
||||
if( track->Type() == TYPE_VIA ) // For a via: always drag it
|
||||
if( aTrack->Type() == TYPE_VIA ) // For a via: always drag it
|
||||
{
|
||||
track->m_Flags = IS_DRAGGED | STARTPOINT | ENDPOINT;
|
||||
aTrack->m_Flags = IS_DRAGGED | STARTPOINT | ENDPOINT;
|
||||
|
||||
if( command != ID_POPUP_PCB_MOVE_TRACK_SEGMENT )
|
||||
if( aCommand != ID_POPUP_PCB_MOVE_TRACK_SEGMENT )
|
||||
{
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, DC, track->m_Start,
|
||||
track->ReturnMaskLayer(),
|
||||
track->GetNet() );
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, aDC, aTrack->m_Start,
|
||||
aTrack->ReturnMaskLayer(),
|
||||
aTrack->GetNet() );
|
||||
}
|
||||
|
||||
NewTrack = track;
|
||||
NewTrack = aTrack;
|
||||
NbPtNewTrack = 1;
|
||||
PosInit = track->m_Start;
|
||||
PosInit = aTrack->m_Start;
|
||||
}
|
||||
else
|
||||
{
|
||||
int diag = track->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 );
|
||||
int diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 );
|
||||
wxPoint pos;
|
||||
|
||||
switch( command )
|
||||
switch( aCommand )
|
||||
{
|
||||
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: // Move segment
|
||||
track->m_Flags |= IS_DRAGGED | ENDPOINT | STARTPOINT;
|
||||
AddSegmentToDragList( DrawPanel, DC, track->m_Flags, track );
|
||||
aTrack->m_Flags |= IS_DRAGGED | ENDPOINT | STARTPOINT;
|
||||
AddSegmentToDragList( DrawPanel, aDC, aTrack->m_Flags, aTrack );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: // drag a segment
|
||||
pos = track->m_Start;
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, DC, pos,
|
||||
track->ReturnMaskLayer(),
|
||||
track->GetNet() );
|
||||
pos = track->m_End;
|
||||
track->m_Flags |= IS_DRAGGED | ENDPOINT | STARTPOINT;
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, DC, pos,
|
||||
track->ReturnMaskLayer(),
|
||||
track->GetNet() );
|
||||
pos = aTrack->m_Start;
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, aDC, pos,
|
||||
aTrack->ReturnMaskLayer(),
|
||||
aTrack->GetNet() );
|
||||
pos = aTrack->m_End;
|
||||
aTrack->m_Flags |= IS_DRAGGED | ENDPOINT | STARTPOINT;
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, aDC, pos,
|
||||
aTrack->ReturnMaskLayer(),
|
||||
aTrack->GetNet() );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_MOVE_TRACK_NODE: // Drag via or move node
|
||||
pos = (diag & STARTPOINT) ? track->m_Start : track->m_End;
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, DC, pos,
|
||||
track->ReturnMaskLayer(),
|
||||
track->GetNet() );
|
||||
pos = (diag & STARTPOINT) ? aTrack->m_Start : aTrack->m_End;
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, aDC, pos,
|
||||
aTrack->ReturnMaskLayer(),
|
||||
aTrack->GetNet() );
|
||||
PosInit = pos;
|
||||
break;
|
||||
}
|
||||
|
||||
track->m_Flags |= IS_DRAGGED;
|
||||
aTrack->m_Flags |= IS_DRAGGED;
|
||||
}
|
||||
|
||||
// Prepare the Undo command
|
||||
ITEM_PICKER picker( track, UR_CHANGED );
|
||||
picker.m_Link = track->Copy();
|
||||
ITEM_PICKER picker( aTrack, UR_CHANGED );
|
||||
picker.m_Link = aTrack->Copy();
|
||||
s_ItemsListPicker.PushItem( picker );
|
||||
|
||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||
|
@ -742,11 +733,11 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
|
|||
s_LastPos = PosInit;
|
||||
DrawPanel->SetMouseCapture( Show_MoveNode, Abort_MoveTrack );
|
||||
|
||||
GetBoard()->SetHighLightNet( track->GetNet() );
|
||||
GetBoard()->SetHighLightNet( aTrack->GetNet() );
|
||||
GetBoard()->HighLightON();
|
||||
|
||||
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() );
|
||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
|
||||
GetBoard()->DrawHighLight( DrawPanel, aDC, GetBoard()->GetHighLightNetCode() );
|
||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -756,8 +747,8 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
|
|||
// and end and flags relative to these pointers
|
||||
void SortTrackEndPoints( TRACK* track )
|
||||
{
|
||||
//sort the track endpoints -- should not matter in terms of drawing
|
||||
//or producing the pcb -- but makes doing comparisons easier.
|
||||
// sort the track endpoints -- should not matter in terms of drawing
|
||||
// or producing the pcb -- but makes doing comparisons easier.
|
||||
int dx = track->m_End.x - track->m_Start.x;
|
||||
|
||||
if( dx )
|
||||
|
@ -777,14 +768,6 @@ void SortTrackEndPoints( TRACK* track )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @todo: this function is broken, because it merge segments having different
|
||||
* width or without any connectivity test.
|
||||
* 2 collinear segments can be merged only in 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 PCB_EDIT_FRAME::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
|
||||
{
|
||||
testtrack = (TRACK*) GetConnectedTrace( track, GetBoard()->m_Track, NULL, end );
|
||||
|
@ -1017,16 +1000,17 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
|||
|
||||
/* Test the connections modified by the move
|
||||
* (only pad connection must be tested, track connection will be
|
||||
* tested by test_1_net_connexion() ) */
|
||||
* tested by TestNetConnection() ) */
|
||||
int layerMask = g_TabOneLayerMask[Track->GetLayer()];
|
||||
Track->start = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_Start, layerMask );
|
||||
Track->start = GetBoard()->GetPadFast( Track->m_Start, layerMask );
|
||||
|
||||
if( Track->start )
|
||||
Track->SetState( BEGIN_ONPAD, ON );
|
||||
else
|
||||
Track->SetState( BEGIN_ONPAD, OFF );
|
||||
|
||||
Track->end = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_End, layerMask );
|
||||
Track->end = GetBoard()->GetPadFast( Track->m_End, layerMask );
|
||||
|
||||
if( Track->end )
|
||||
Track->SetState( END_ONPAD, ON );
|
||||
else
|
||||
|
@ -1050,7 +1034,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
|||
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||
|
||||
if( current_net_code > 0 )
|
||||
test_1_net_connexion( DC, current_net_code );
|
||||
TestNetConnection( DC, current_net_code );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1070,7 +1054,7 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
|
|||
{
|
||||
for( MODULE* module = Pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
D_PAD* pad = Locate_Pads( module, pos, LayerMask );
|
||||
D_PAD* pad = module->GetPad( pos, LayerMask );
|
||||
|
||||
if( pad )
|
||||
return pad;
|
||||
|
@ -1135,6 +1119,7 @@ TRACK* CreateLockPoint( BOARD* aPcb,
|
|||
|
||||
// calculate coordinates of aRefPoint relative to aSegm->m_Start
|
||||
wxPoint newPoint = aRefPoint - aSegm->m_Start;
|
||||
|
||||
// newPoint must be on aSegm:
|
||||
// Ensure newPoint.y/newPoint.y = delta.y/delta.x
|
||||
if( delta.x == 0 )
|
||||
|
@ -1185,7 +1170,7 @@ TRACK* CreateLockPoint( BOARD* aPcb,
|
|||
newTrack->start = aSegm;
|
||||
newTrack->SetState( BEGIN_ONPAD, OFF );
|
||||
|
||||
D_PAD * pad = Locate_Pad_Connecte( aPcb, newTrack, START );
|
||||
D_PAD * pad = aPcb->GetPad( newTrack, START );
|
||||
|
||||
if ( pad )
|
||||
{
|
||||
|
|
|
@ -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 );
|
||||
|
||||
/* 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. */
|
||||
MODULE* Locate_Prefered_Module( BOARD* aPcb, const wxPoint& aPosition, int aActiveLayer,
|
||||
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.
|
||||
* The search begins to address start_adresse.
|
||||
*/
|
||||
|
@ -142,26 +103,6 @@ TRACK* GetTrace( TRACK* start_adresse, 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 */
|
||||
/*************/
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
/*****************/
|
||||
/***************/
|
||||
/* TRACK.CPP : */
|
||||
/*****************/
|
||||
/***************/
|
||||
|
||||
/**
|
||||
* Function MarkTrace
|
||||
|
|
|
@ -118,8 +118,7 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus )
|
|||
|
||||
DisplayRastnestInProgress = true;
|
||||
|
||||
GetBoard()->m_Status_Pcb = 0; /* we want a full ratsnest computation,
|
||||
* from the scratch */
|
||||
GetBoard()->m_Status_Pcb = 0; /* we want a full ratsnest computation, from the scratch */
|
||||
ClearMsgPanel();
|
||||
|
||||
// Rebuild the full pads and net info list
|
||||
|
@ -142,9 +141,8 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus )
|
|||
*/
|
||||
Build_Board_Ratsnest( aDC );
|
||||
|
||||
/* Compute the pad connections due to the existing tracks (physical
|
||||
* connections) */
|
||||
test_connexions( aDC );
|
||||
/* Compute the pad connections due to the existing tracks (physical connections) */
|
||||
TestConnections( aDC );
|
||||
|
||||
/* Compute the active ratsnest, i.e. the unconnected links
|
||||
* it is faster than Build_Board_Ratsnest()
|
||||
|
@ -410,7 +408,7 @@ static int gen_rats_pad_to_pad( vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
|||
* Update :
|
||||
* nb_nodes = Active pads count for the board
|
||||
* 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 )
|
||||
|
@ -512,8 +510,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest( wxDC* DC )
|
|||
m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
|
||||
|
||||
if( DC )
|
||||
m_Pcb->m_FullRatsnest[ii].Draw( DrawPanel, DC, GR_XOR,
|
||||
wxPoint( 0, 0 ) );
|
||||
m_Pcb->m_FullRatsnest[ii].Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -620,7 +617,7 @@ static int tst_rats_block_to_block( NETINFO_ITEM* net,
|
|||
/**
|
||||
* Function used by Tst_Ratsnest_general
|
||||
* 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
|
||||
* some blocks linked by a ratsnest
|
||||
* Its test only the existing ratsnest and activate some ratsnest (status bit
|
||||
|
@ -933,6 +930,7 @@ CalculateExternalRatsnest:
|
|||
local_rats.m_Lenght = 0x7FFFFFFF;
|
||||
local_rats.m_Status = 0;
|
||||
bool addRats = false;
|
||||
|
||||
if( internalRatsCount < m_Pcb->m_LocalRatsnest.size() )
|
||||
m_Pcb->m_LocalRatsnest.erase( m_Pcb->m_LocalRatsnest.begin() + internalRatsCount,
|
||||
m_Pcb->m_LocalRatsnest.end() );
|
||||
|
|
|
@ -242,6 +242,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
|
|||
s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
|
||||
|
||||
Ncurrent = 0;
|
||||
|
||||
/* go until no more work to do */
|
||||
GetWork( &row_source, &col_source, ¤t_net_code,
|
||||
&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 )
|
|||
msg.Printf( wxT( "%d" ), nbunsucces );
|
||||
AppendMsgPanel( wxT( "Fail" ), msg, RED );
|
||||
msg.Printf( wxT( " %d" ), GetBoard()->m_NbNoconnect );
|
||||
AppendMsgPanel( wxT( "Not Connectd" ), msg, CYAN );
|
||||
AppendMsgPanel( wxT( "Not Connected" ), msg, CYAN );
|
||||
|
||||
/* Delete routing from display. */
|
||||
pt_cur_ch->m_PadStart->Draw( DrawPanel, DC, GR_AND );
|
||||
|
@ -407,6 +408,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
/* Set tab_masque[side] for final test of routing. */
|
||||
tab_mask[TOP] = topLayerMask;
|
||||
tab_mask[BOTTOM] = bottomLayerMask;
|
||||
|
||||
/* Set active layers mask. */
|
||||
routeLayerMask = topLayerMask | bottomLayerMask;
|
||||
|
||||
|
@ -1268,14 +1270,12 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
|||
g_CurrentTrackList.PushBack( newTrack );
|
||||
}
|
||||
|
||||
g_FirstTrackSegment->start = Locate_Pad_Connecte( pcbframe->GetBoard(),
|
||||
g_FirstTrackSegment, START );
|
||||
g_FirstTrackSegment->start = pcbframe->GetBoard()->GetPad( g_FirstTrackSegment, START );
|
||||
|
||||
if( g_FirstTrackSegment->start )
|
||||
g_FirstTrackSegment->SetState( BEGIN_ONPAD, ON );
|
||||
|
||||
g_CurrentTrackSegment->end = Locate_Pad_Connecte( pcbframe->GetBoard(),
|
||||
g_CurrentTrackSegment, END );
|
||||
g_CurrentTrackSegment->end = pcbframe->GetBoard()->GetPad( g_CurrentTrackSegment, END );
|
||||
|
||||
if( g_CurrentTrackSegment->end )
|
||||
g_CurrentTrackSegment->SetState( END_ONPAD, ON );
|
||||
|
@ -1304,7 +1304,7 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
|||
|
||||
DrawTraces( panel, DC, firstTrack, newCount, GR_OR );
|
||||
|
||||
pcbframe->test_1_net_connexion( DC, netcode );
|
||||
pcbframe->TestNetConnection( DC, netcode );
|
||||
|
||||
screen->SetModify();
|
||||
}
|
||||
|
|
|
@ -287,8 +287,7 @@ static void ChainMarkedSegments( BOARD* aPcb,
|
|||
TRACK* pt_segm, // The current segment being analyzed.
|
||||
* pt_via, // The via identified, eventually destroy
|
||||
|
||||
* SegmentCandidate; // The end segment to destroy (or NULL =
|
||||
// pt_segm
|
||||
* SegmentCandidate; // The end segment to destroy (or NULL = pt_segm
|
||||
int NbSegm;
|
||||
|
||||
if( aPcb->m_Track == NULL )
|
||||
|
@ -311,7 +310,7 @@ static void ChainMarkedSegments( BOARD* aPcb,
|
|||
*/
|
||||
for( ; ; )
|
||||
{
|
||||
if( Fast_Locate_Pad_Connecte( aPcb, aRef_pos, aLayerMask ) != NULL )
|
||||
if( aPcb->GetPadFast( aRef_pos, aLayerMask ) != NULL )
|
||||
return;
|
||||
|
||||
/* 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 )
|
|||
}
|
||||
|
||||
progressDialog.Update( ii+2, _( "Updating ratsnest..." ) );
|
||||
test_connexions( NULL );
|
||||
TestConnections( NULL );
|
||||
|
||||
// Recalculate the active ratsnest, i.e. the unconnected links
|
||||
Tst_Ratsnest( NULL, 0 );
|
||||
|
|
Loading…
Reference in New Issue