Commit bcbde5d8 authored by jean-pierre charras's avatar jean-pierre charras

All: fix a collision name between accessor function GetTimeStamp and GetTimeStamp in common.cpp.

In common.cpp GetTimeStamp is renamed GetNewTimeStamp (a better name).
Pcbnew: prepare work to calculate connections between pads that inteserct and therefore can be connected without any track (composite pads).
parent c7fe98db
...@@ -525,18 +525,19 @@ bool ProcessExecute( const wxString& aCommandLine, int aFlags ) ...@@ -525,18 +525,19 @@ bool ProcessExecute( const wxString& aCommandLine, int aFlags )
} }
int GetTimeStamp() unsigned long GetNewTimeStamp()
{ {
static int OldTimeStamp, NewTimeStamp; static unsigned long oldTimeStamp;
unsigned long newTimeStamp;
NewTimeStamp = time( NULL ); newTimeStamp = time( NULL );
if( NewTimeStamp <= OldTimeStamp ) if( newTimeStamp <= oldTimeStamp )
NewTimeStamp = OldTimeStamp + 1; newTimeStamp = oldTimeStamp + 1;
OldTimeStamp = NewTimeStamp; oldTimeStamp = newTimeStamp;
return NewTimeStamp; return newTimeStamp;
} }
......
...@@ -554,7 +554,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC ) ...@@ -554,7 +554,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
// Clear annotation and init new time stamp for the new components: // Clear annotation and init new time stamp for the new components:
if( Struct->Type() == SCH_COMPONENT_T ) if( Struct->Type() == SCH_COMPONENT_T )
{ {
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetNewTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL ); ( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
} }
......
...@@ -527,7 +527,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -527,7 +527,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
wxPoint pos = GetScreen()->GetCrossHairPosition() - wxPoint pos = GetScreen()->GetCrossHairPosition() -
( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition(); ( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition();
m_itemToRepeat->SetFlags( IS_NEW ); m_itemToRepeat->SetFlags( IS_NEW );
( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetNewTimeStamp();
m_itemToRepeat->Move( pos ); m_itemToRepeat->Move( pos );
m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( m_itemToRepeat, DC ); MoveItem( m_itemToRepeat, DC );
......
...@@ -673,7 +673,7 @@ bool CMP_LIBRARY::Save( OUTPUTFORMATTER& aFormatter ) ...@@ -673,7 +673,7 @@ bool CMP_LIBRARY::Save( OUTPUTFORMATTER& aFormatter )
{ {
if( isModified ) if( isModified )
{ {
timeStamp = GetTimeStamp(); timeStamp = GetNewTimeStamp();
isModified = false; isModified = false;
} }
......
...@@ -204,7 +204,7 @@ int TestDuplicateSheetNames( bool aCreateMarker ) ...@@ -204,7 +204,7 @@ int TestDuplicateSheetNames( bool aCreateMarker )
{ {
/* Create a new marker type ERC error*/ /* Create a new marker type ERC error*/
SCH_MARKER* marker = new SCH_MARKER(); SCH_MARKER* marker = new SCH_MARKER();
marker->m_TimeStamp = GetTimeStamp(); marker->m_TimeStamp = GetNewTimeStamp();
marker->SetData( ERCE_DUPLICATE_SHEET_NAME, marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
( (SCH_SHEET*) test_item )->m_Pos, ( (SCH_SHEET*) test_item )->m_Pos,
_( "Duplicate sheet name" ), _( "Duplicate sheet name" ),
...@@ -237,7 +237,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst, ...@@ -237,7 +237,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
/* Create new marker for ERC error. */ /* Create new marker for ERC error. */
marker = new SCH_MARKER(); marker = new SCH_MARKER();
marker->m_TimeStamp = GetTimeStamp(); marker->m_TimeStamp = GetNewTimeStamp();
marker->SetMarkerType( MARK_ERC ); marker->SetMarkerType( MARK_ERC );
marker->SetErrorLevel( WAR ); marker->SetErrorLevel( WAR );
......
...@@ -29,7 +29,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) ...@@ -29,7 +29,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
{ {
SCH_COMPONENT* newitem; SCH_COMPONENT* newitem;
newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) ); newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) );
newitem->m_TimeStamp = GetTimeStamp(); newitem->m_TimeStamp = GetNewTimeStamp();
newitem->ClearAnnotation( NULL ); newitem->ClearAnnotation( NULL );
newitem->m_Flags = IS_NEW; newitem->m_Flags = IS_NEW;
MoveItem( (SCH_ITEM*) newitem, &dc ); MoveItem( (SCH_ITEM*) newitem, &dc );
......
...@@ -207,13 +207,13 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, ...@@ -207,13 +207,13 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
case SCH_SHEET_T: case SCH_SHEET_T:
{ {
SCH_SHEET* sheet = (SCH_SHEET*) newitem; SCH_SHEET* sheet = (SCH_SHEET*) newitem;
sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetNewTimeStamp();
sheet->SetSon( NULL ); sheet->SetSon( NULL );
break; break;
} }
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
( (SCH_COMPONENT*) newitem )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) newitem )->m_TimeStamp = GetNewTimeStamp();
( (SCH_COMPONENT*) newitem )->ClearAnnotation( NULL ); ( (SCH_COMPONENT*) newitem )->ClearAnnotation( NULL );
break; break;
} }
......
...@@ -130,7 +130,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet ...@@ -130,7 +130,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet
m_unit = unit; m_unit = unit;
m_convert = convert; m_convert = convert;
m_ChipName = libComponent.GetName(); m_ChipName = libComponent.GetName();
m_TimeStamp = GetTimeStamp(); m_TimeStamp = GetNewTimeStamp();
if( setNewItemFlag ) if( setNewItemFlag )
m_Flags = IS_NEW | IS_MOVED; m_Flags = IS_NEW | IS_MOVED;
......
...@@ -1460,14 +1460,14 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps() ...@@ -1460,14 +1460,14 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
// for a component, update its Time stamp and its paths // for a component, update its Time stamp and its paths
// (m_PathsAndReferences field) // (m_PathsAndReferences field)
if( item->Type() == SCH_COMPONENT_T ) if( item->Type() == SCH_COMPONENT_T )
( (SCH_COMPONENT*) item )->SetTimeStamp( GetTimeStamp() ); ( (SCH_COMPONENT*) item )->SetTimeStamp( GetNewTimeStamp() );
// for a sheet, update only its time stamp (annotation of its // for a sheet, update only its time stamp (annotation of its
// components will be lost) // components will be lost)
// @todo: see how to change sheet paths for its cmp list (can // @todo: see how to change sheet paths for its cmp list (can
// be possible in most cases) // be possible in most cases)
else else
item->m_TimeStamp = GetTimeStamp(); item->m_TimeStamp = GetNewTimeStamp();
} }
} }
......
...@@ -53,7 +53,7 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : ...@@ -53,7 +53,7 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
m_Layer = LAYER_SHEET; m_Layer = LAYER_SHEET;
m_Pos = pos; m_Pos = pos;
m_Size = wxSize( MIN_SHEET_WIDTH, MIN_SHEET_HEIGHT ); m_Size = wxSize( MIN_SHEET_WIDTH, MIN_SHEET_HEIGHT );
m_TimeStamp = GetTimeStamp(); m_TimeStamp = GetNewTimeStamp();
m_SheetNameSize = m_FileNameSize = 60; m_SheetNameSize = m_FileNameSize = 60;
m_AssociatedScreen = NULL; m_AssociatedScreen = NULL;
m_SheetName.Printf( wxT( "Sheet%8.8lX" ), m_TimeStamp ); m_SheetName.Printf( wxT( "Sheet%8.8lX" ), m_TimeStamp );
...@@ -184,7 +184,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -184,7 +184,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
SCH_SHEET_PIN* sheetPin; SCH_SHEET_PIN* sheetPin;
char* ptcar; char* ptcar;
m_TimeStamp = GetTimeStamp(); m_TimeStamp = GetNewTimeStamp();
// sheets are added to the GetDrawItems() like other schematic components. // sheets are added to the GetDrawItems() like other schematic components.
// however, in order to preserve the hierarchy (through m_Parent pointers), // however, in order to preserve the hierarchy (through m_Parent pointers),
...@@ -224,7 +224,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -224,7 +224,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
sscanf( ((char*)aLine) + 1, "%lX", &m_TimeStamp ); sscanf( ((char*)aLine) + 1, "%lX", &m_TimeStamp );
if( m_TimeStamp == 0 ) // zero is not unique! if( m_TimeStamp == 0 ) // zero is not unique!
m_TimeStamp = GetTimeStamp(); m_TimeStamp = GetNewTimeStamp();
continue; continue;
} }
......
...@@ -201,7 +201,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -201,7 +201,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
m_InternalUnits ); m_InternalUnits );
if( aSheet->m_SheetName.IsEmpty() ) if( aSheet->m_SheetName.IsEmpty() )
aSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ), GetTimeStamp() ); aSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() );
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
...@@ -311,7 +311,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC ) ...@@ -311,7 +311,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->GetCrossHairPosition() ); SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->GetCrossHairPosition() );
sheet->SetFlags( IS_NEW | IS_RESIZED ); sheet->SetFlags( IS_NEW | IS_RESIZED );
sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetNewTimeStamp();
sheet->SetParent( GetScreen() ); sheet->SetParent( GetScreen() );
sheet->SetScreen( NULL ); sheet->SetScreen( NULL );
......
...@@ -224,191 +224,4 @@ public: ...@@ -224,191 +224,4 @@ public:
wxString GetLayerName() const; wxString GetLayerName() const;
}; };
class NETCLASS;
/**
* Class BOARD_CONNECTED_ITEM
* This is a base class derived from BOARD_ITEM for items that can be connected
* and have a net, a netname, a clearance ...
* mainly: tracks, pads and zones
* Handle connection info
*/
class BOARD_CONNECTED_ITEM : public BOARD_ITEM
{
protected:
int m_NetCode; // Net number
int m_Subnet; /* In rastnest routines : for the current net, block number
* (number common to the current connected items found)
*/
int m_ZoneSubnet; // variable used in rastnest computations : for the current net,
// handle block number in zone connection
public:
BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype );
BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& src );
/**
* Function GetNet
* @return int - the net code.
*/
int GetNet() const;
virtual void SetNet( int aNetCode );
/**
* Function GetSubNet
* @return int - the sub net code.
*/
int GetSubNet() const;
void SetSubNet( int aSubNetCode );
/**
* Function GetZoneSubNet
* @return int - the sub net code in zone connections.
*/
int GetZoneSubNet() const;
void SetZoneSubNet( int aSubNetCode );
/**
* Function GetClearance
* returns the clearance in 1/10000 inches. If \a aItem is not NULL then the
* returned clearance is the greater of this object's NETCLASS clearance and
* aItem's NETCLASS clearance. If \a aItem is NULL, then this objects clearance
* is returned.
* @param aItem is another BOARD_CONNECTED_ITEM or NULL
* @return int - the clearance in 1/10000 inches.
*/
virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
/**
* Function GetNetClass
* returns the NETCLASS for this item.
*/
NETCLASS* GetNetClass() const;
/**
* Function GetNetClassName
* @return the Net Class name of this item
*/
wxString GetNetClassName() const;
};
/*
* class BOARD_ITEM_LIST
* Handles a collection of BOARD_ITEM elements
*/
class BOARD_ITEM_LIST : public BOARD_ITEM
{
typedef boost::ptr_vector<BOARD_ITEM> ITEM_ARRAY;
ITEM_ARRAY myItems;
BOARD_ITEM_LIST( const BOARD_ITEM_LIST& other ) :
BOARD_ITEM( NULL, PCB_ITEM_LIST_T )
{
// copy constructor is not supported, is private to cause compiler error
}
public:
BOARD_ITEM_LIST( BOARD_ITEM* aParent = NULL ) :
BOARD_ITEM( aParent, PCB_ITEM_LIST_T )
{}
//-----< satisfy some virtual functions >------------------------------
const wxPoint GetPosition()
{
return wxPoint(0, 0); // dummy
}
void Draw( EDA_DRAW_PANEL* DrawPanel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset )
{
}
void UnLink()
{
/* if it were needed:
DHEAD* list = GetList();
wxASSERT( list );
list->remove( this );
*/
}
bool Save( FILE* aFile ) const
{
return true;
}
//-----</ satisfy some virtual functions >-----------------------------
/**
* Function GetCount
* returns the number of BOARD_ITEMs.
*/
int GetCount() const
{
return myItems.size();
}
void Append( BOARD_ITEM* aItem )
{
myItems.push_back( aItem );
}
BOARD_ITEM* Replace( int aIndex, BOARD_ITEM* aItem )
{
ITEM_ARRAY::auto_type ret = myItems.replace( aIndex, aItem );
return ret.release();
}
BOARD_ITEM* Remove( int aIndex )
{
ITEM_ARRAY::auto_type ret = myItems.release( myItems.begin()+aIndex );
return ret.release();
}
void Insert( int aIndex, BOARD_ITEM* aItem )
{
myItems.insert( myItems.begin()+aIndex, aItem );
}
BOARD_ITEM* At( int aIndex ) const
{
// we have varying sized objects and are using polymorphism, so we
// must return a pointer not a reference.
return (BOARD_ITEM*) &myItems[aIndex];
}
BOARD_ITEM* operator[]( int aIndex ) const
{
return At( aIndex );
}
void Delete( int aIndex )
{
myItems.erase( myItems.begin()+aIndex );
}
void PushBack( BOARD_ITEM* aItem )
{
Append( aItem );
}
BOARD_ITEM* PopBack()
{
if( GetCount() )
return Remove( GetCount()-1 );
return NULL;
}
};
#endif /* BOARD_ITEM_STRUCT_H */ #endif /* BOARD_ITEM_STRUCT_H */
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "base_struct.h" // SEARCH_RESULT #include "base_struct.h" // SEARCH_RESULT
#include "common.h" // GetTimeStamp() #include "common.h" // GetNewTimeStamp()
class EDA_ITEM; class EDA_ITEM;
...@@ -201,7 +201,7 @@ public: ...@@ -201,7 +201,7 @@ public:
void SetTimeNow() void SetTimeNow()
{ {
m_TimeAtCollection = GetTimeStamp(); m_TimeAtCollection = GetNewTimeStamp();
} }
...@@ -234,7 +234,8 @@ public: ...@@ -234,7 +234,8 @@ public:
int dx = abs( aRefPos.x - m_RefPos.x ); int dx = abs( aRefPos.x - m_RefPos.x );
int dy = abs( aRefPos.y - m_RefPos.y ); int dy = abs( aRefPos.y - m_RefPos.y );
if( dx <= distMax && dy <= distMax && GetTimeStamp()-m_TimeAtCollection <= timeMax ) if( dx <= distMax && dy <= distMax &&
(int)GetNewTimeStamp() - m_TimeAtCollection <= timeMax )
return true; return true;
else else
return false; return false;
......
...@@ -294,7 +294,10 @@ void InitKiCadAbout( wxAboutDialogInfo& info ); ...@@ -294,7 +294,10 @@ void InitKiCadAbout( wxAboutDialogInfo& info );
/* common.cpp */ /* common.cpp */
/**************/ /**************/
int GetTimeStamp(); /**
* @return an unique time stamp that changes after each call
*/
unsigned long GetNewTimeStamp();
int DisplayColorFrame( wxWindow* parent, int OldColor ); int DisplayColorFrame( wxWindow* parent, int OldColor );
int GetCommandOptions( const int argc, const char** argv, int GetCommandOptions( const int argc, const char** argv,
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
/* Forward declarations of classes. */ /* Forward declarations of classes. */
class FOOTPRINT_EDIT_FRAME; class FOOTPRINT_EDIT_FRAME;
class BOARD; class BOARD;
class BOARD_CONNECTED_ITEM;
class MODULE; class MODULE;
class TRACK; class TRACK;
class D_PAD; class D_PAD;
......
...@@ -854,7 +854,7 @@ void PCB_EDIT_FRAME::Block_Duplicate() ...@@ -854,7 +854,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
module->m_Flags = 0; module->m_Flags = 0;
newitem = new_module = new MODULE( m_Pcb ); newitem = new_module = new MODULE( m_Pcb );
new_module->Copy( module ); new_module->Copy( module );
new_module->m_TimeStamp = GetTimeStamp(); new_module->m_TimeStamp = GetNewTimeStamp();
m_Pcb->m_Modules.PushFront( new_module ); m_Pcb->m_Modules.PushFront( new_module );
} }
break; break;
...@@ -877,7 +877,7 @@ void PCB_EDIT_FRAME::Block_Duplicate() ...@@ -877,7 +877,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
{ {
ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) item->GetParent() ); ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) item->GetParent() );
new_zone->Copy( (ZONE_CONTAINER*) item ); new_zone->Copy( (ZONE_CONTAINER*) item );
new_zone->m_TimeStamp = GetTimeStamp(); new_zone->m_TimeStamp = GetNewTimeStamp();
newitem = new_zone; newitem = new_zone;
m_Pcb->Add( new_zone ); m_Pcb->Add( new_zone );
} }
......
/**
* @file class_board_connected_item.h
* @brief Class BOARD_CONNECTED_ITEM.
*/
#ifndef BOARD_CONNECTED_ITEM_H
#define BOARD_CONNECTED_ITEM_H
#include "class_board_item.h"
class NETCLASS;
class TRACK;
class D_PAD;
/**
* Class BOARD_CONNECTED_ITEM
* This is a base class derived from BOARD_ITEM for items that can be connected
* and have a net, a netname, a clearance ...
* mainly: tracks, pads and zones
* Handle connection info
*/
class BOARD_CONNECTED_ITEM : public BOARD_ITEM
{
friend class CONNECTIONS;
private:
// These 2 members are used for temporary storage during connections calculations:
std::vector<TRACK*> m_TracksConnected; // list of other tracks connected to me
std::vector<D_PAD*> m_PadsConnected; // list of other pads connected to me
int m_NetCode; // Net number
int m_Subnet; /* In rastnest routines : for the current net, block number
* (number common to the current connected items found)
*/
int m_ZoneSubnet; // used in rastnest computations : for the current net,
// handle cluster number in zone connection
public:
BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype );
BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& src );
/**
* Function GetNet
* @return int - the net code.
*/
int GetNet() const;
virtual void SetNet( int aNetCode );
/**
* Function GetSubNet
* @return int - the sub net code.
*/
int GetSubNet() const;
void SetSubNet( int aSubNetCode );
/**
* Function GetZoneSubNet
* @return int - the sub net code in zone connections.
*/
int GetZoneSubNet() const;
void SetZoneSubNet( int aSubNetCode );
/**
* Function GetClearance
* returns the clearance in 1/10000 inches. If \a aItem is not NULL then the
* returned clearance is the greater of this object's NETCLASS clearance and
* aItem's NETCLASS clearance. If \a aItem is NULL, then this objects clearance
* is returned.
* @param aItem is another BOARD_CONNECTED_ITEM or NULL
* @return int - the clearance in 1/10000 inches.
*/
virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
/**
* Function GetNetClass
* returns the NETCLASS for this item.
*/
NETCLASS* GetNetClass() const;
/**
* Function GetNetClassName
* @return the Net Class name of this item
*/
wxString GetNetClassName() const;
};
/*
* class BOARD_ITEM_LIST
* Handles a collection of BOARD_ITEM elements
*/
class BOARD_ITEM_LIST : public BOARD_ITEM
{
typedef boost::ptr_vector<BOARD_ITEM> ITEM_ARRAY;
ITEM_ARRAY myItems;
BOARD_ITEM_LIST( const BOARD_ITEM_LIST& other ) :
BOARD_ITEM( NULL, PCB_ITEM_LIST_T )
{
// copy constructor is not supported, is private to cause compiler error
}
public:
BOARD_ITEM_LIST( BOARD_ITEM* aParent = NULL ) :
BOARD_ITEM( aParent, PCB_ITEM_LIST_T )
{}
//-----< satisfy some virtual functions >------------------------------
const wxPoint GetPosition()
{
return wxPoint(0, 0); // dummy
}
void Draw( EDA_DRAW_PANEL* DrawPanel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset )
{
}
void UnLink()
{
/* if it were needed:
DHEAD* list = GetList();
wxASSERT( list );
list->remove( this );
*/
}
bool Save( FILE* aFile ) const
{
return true;
}
//-----</ satisfy some virtual functions >-----------------------------
/**
* Function GetCount
* returns the number of BOARD_ITEMs.
*/
int GetCount() const
{
return myItems.size();
}
void Append( BOARD_ITEM* aItem )
{
myItems.push_back( aItem );
}
BOARD_ITEM* Replace( int aIndex, BOARD_ITEM* aItem )
{
ITEM_ARRAY::auto_type ret = myItems.replace( aIndex, aItem );
return ret.release();
}
BOARD_ITEM* Remove( int aIndex )
{
ITEM_ARRAY::auto_type ret = myItems.release( myItems.begin()+aIndex );
return ret.release();
}
void Insert( int aIndex, BOARD_ITEM* aItem )
{
myItems.insert( myItems.begin()+aIndex, aItem );
}
BOARD_ITEM* At( int aIndex ) const
{
// we have varying sized objects and are using polymorphism, so we
// must return a pointer not a reference.
return (BOARD_ITEM*) &myItems[aIndex];
}
BOARD_ITEM* operator[]( int aIndex ) const
{
return At( aIndex );
}
void Delete( int aIndex )
{
myItems.erase( myItems.begin()+aIndex );
}
void PushBack( BOARD_ITEM* aItem )
{
Append( aItem );
}
BOARD_ITEM* PopBack()
{
if( GetCount() )
return Remove( GetCount()-1 );
return NULL;
}
};
#endif /* BOARD_CONNECTED_ITEM_H */
...@@ -71,7 +71,7 @@ void DIMENSION::Copy( DIMENSION* source ) ...@@ -71,7 +71,7 @@ void DIMENSION::Copy( DIMENSION* source )
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
m_Unit = source->m_Unit; m_Unit = source->m_Unit;
m_TimeStamp = GetTimeStamp(); m_TimeStamp = GetNewTimeStamp();
m_Text->Copy( source->m_Text ); m_Text->Copy( source->m_Text );
m_crossBarOx = source->m_crossBarOx; m_crossBarOx = source->m_crossBarOx;
......
...@@ -50,7 +50,7 @@ void PCB_TARGET::Copy( PCB_TARGET* source ) ...@@ -50,7 +50,7 @@ void PCB_TARGET::Copy( PCB_TARGET* source )
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
m_Size = source->m_Size; m_Size = source->m_Size;
m_TimeStamp = GetTimeStamp(); m_TimeStamp = GetNewTimeStamp();
} }
......
...@@ -125,7 +125,7 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -125,7 +125,7 @@ void MODULE::Copy( MODULE* aModule )
m_LastEdit_Time = aModule->m_LastEdit_Time; m_LastEdit_Time = aModule->m_LastEdit_Time;
m_Link = aModule->m_Link; m_Link = aModule->m_Link;
m_Path = aModule->m_Path; //is this correct behavior? m_Path = aModule->m_Path; //is this correct behavior?
m_TimeStamp = GetTimeStamp(); m_TimeStamp = GetNewTimeStamp();
m_LocalClearance = aModule->m_LocalClearance; m_LocalClearance = aModule->m_LocalClearance;
m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin; m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin;
......
...@@ -393,7 +393,7 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -393,7 +393,7 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
/* For test and debug only: display m_physical_connexion and /* For test and debug only: display m_physical_connexion and
* m_logical_connexion */ * m_logical_connexion */
#if 1 // Used only to debug connectivity calculations #if 1 // Used only to debug connectivity calculations
Line.Printf( wxT( "%d-%d-%d " ), GetSubRatsnest(), GetSubNet(), m_ZoneSubnet ); Line.Printf( wxT( "%d-%d-%d " ), GetSubRatsnest(), GetSubNet(), GetZoneSubNet() );
frame->AppendMsgPanel( wxT( "L-P-Z" ), Line, DARKGREEN ); frame->AppendMsgPanel( wxT( "L-P-Z" ), Line, DARKGREEN );
#endif #endif
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "class_board_item.h" #include "class_board_item.h"
#include "class_board_connected_item.h"
#include "pad_shapes.h" #include "pad_shapes.h"
#include "PolyLine.h" #include "PolyLine.h"
...@@ -131,7 +132,6 @@ public: ...@@ -131,7 +132,6 @@ public:
int m_LocalSolderPasteMargin; // Local solder paste margin absolute value int m_LocalSolderPasteMargin; // Local solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size
// The final margin is the sum of these 2 values // The final margin is the sum of these 2 values
std::vector<TRACK*> m_TracksConnected; // list of other tracks connected to me
private: private:
int m_SubRatsnest; // variable used in rats nest computations int m_SubRatsnest; // variable used in rats nest computations
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "class_board_item.h" #include "class_board_item.h"
#include "class_board_connected_item.h"
#include "PolyLine.h" #include "PolyLine.h"
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) : ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
BOARD_CONNECTED_ITEM( parent, PCB_ZONE_AREA_T ) BOARD_CONNECTED_ITEM( parent, PCB_ZONE_AREA_T )
{ {
m_NetCode = -1; // Net number for fast comparisons SetNet( -1 ); // Net number for fast comparisons
m_CornerSelection = -1; m_CornerSelection = -1;
m_IsFilled = false; // fill status : true when the zone is filled m_IsFilled = false; // fill status : true when the zone is filled
m_FillMode = 0; // How to fill areas: 0 = use filled polygons, != 0 fill with segments m_FillMode = 0; // How to fill areas: 0 = use filled polygons, != 0 fill with segments
...@@ -95,7 +95,7 @@ void ZONE_CONTAINER::SetPosition( const wxPoint& aPos ) {} ...@@ -95,7 +95,7 @@ void ZONE_CONTAINER::SetPosition( const wxPoint& aPos ) {}
void ZONE_CONTAINER::SetNet( int aNetCode ) void ZONE_CONTAINER::SetNet( int aNetCode )
{ {
m_NetCode = aNetCode; BOARD_CONNECTED_ITEM::SetNet( aNetCode );
if( aNetCode < 0 ) if( aNetCode < 0 )
return; return;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <vector> #include <vector>
#include "gr_basic.h" #include "gr_basic.h"
#include "class_board_item.h" #include "class_board_item.h"
#include "class_board_connected_item.h"
#include "layers_id_colors_and_visibility.h" #include "layers_id_colors_and_visibility.h"
#include "PolyLine.h" #include "PolyLine.h"
#include "class_zone_setting.h" #include "class_zone_setting.h"
......
...@@ -146,7 +146,7 @@ void DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& event ) ...@@ -146,7 +146,7 @@ void DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& event )
if( m_CurrentModule->m_TimeStamp == 0 ) // Module Editor needs a non if( m_CurrentModule->m_TimeStamp == 0 ) // Module Editor needs a non
// null timestamp // null timestamp
{ {
m_CurrentModule->m_TimeStamp = GetTimeStamp(); m_CurrentModule->m_TimeStamp = GetNewTimeStamp();
m_Parent->OnModify(); m_Parent->OnModify();
} }
......
...@@ -225,7 +225,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const ...@@ -225,7 +225,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
// Save the outline main info // Save the outline main info
ret = fprintf( aFile, "ZInfo %8.8lX %d %s\n", ret = fprintf( aFile, "ZInfo %8.8lX %d %s\n",
m_TimeStamp, m_NetCode, m_TimeStamp, GetNet(),
EscapedUTF8( m_Netname ).c_str() ); EscapedUTF8( m_Netname ).c_str() );
if( ret < 3 ) if( ret < 3 )
...@@ -1739,7 +1739,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader ) ...@@ -1739,7 +1739,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
else else
{ {
m_TimeStamp = ts; m_TimeStamp = ts;
m_NetCode = netcode; SetNet( netcode );
ReadDelimitedText( netname_buffer, netname_buffer, 1024 ); ReadDelimitedText( netname_buffer, netname_buffer, 1024 );
m_Netname = FROM_UTF8( netname_buffer ); m_Netname = FROM_UTF8( netname_buffer );
} }
......
...@@ -185,7 +185,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -185,7 +185,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
module->m_Flags = IS_NEW; module->m_Flags = IS_NEW;
module->m_Link = 0; module->m_Link = 0;
module->m_TimeStamp = GetTimeStamp(); module->m_TimeStamp = GetNewTimeStamp();
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
module->SetPosition( curspos ); module->SetPosition( curspos );
......
...@@ -336,7 +336,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -336,7 +336,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
pcbframe->GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) ); pcbframe->GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
pcbframe->PlaceModule( newmodule, NULL ); pcbframe->PlaceModule( newmodule, NULL );
pcbframe->GetScreen()->SetCrossHairPosition( cursor_pos ); pcbframe->GetScreen()->SetCrossHairPosition( cursor_pos );
newmodule->m_TimeStamp = GetTimeStamp(); newmodule->m_TimeStamp = GetNewTimeStamp();
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW ); pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
} }
......
...@@ -532,7 +532,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c ...@@ -532,7 +532,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
return NULL; return NULL;
#define DEFAULT_SIZE 30 #define DEFAULT_SIZE 30
Module->m_TimeStamp = GetTimeStamp(); Module->m_TimeStamp = GetNewTimeStamp();
Module->m_Value->m_Size = wxSize( DEFAULT_SIZE, DEFAULT_SIZE ); Module->m_Value->m_Size = wxSize( DEFAULT_SIZE, DEFAULT_SIZE );
Module->m_Value->m_Pos0.y = -DEFAULT_SIZE; Module->m_Value->m_Pos0.y = -DEFAULT_SIZE;
Module->m_Value->m_Pos.y += Module->m_Value->m_Pos0.y; Module->m_Value->m_Pos.y += Module->m_Value->m_Pos0.y;
......
...@@ -1160,7 +1160,7 @@ bool NETLIST_READER::loadNewModules() ...@@ -1160,7 +1160,7 @@ bool NETLIST_READER::loadNewModules()
/* Update schematic links : reference "Time Stamp" and schematic /* Update schematic links : reference "Time Stamp" and schematic
* hierarchical path */ * hierarchical path */
Module->m_Reference->m_Text = cmp->m_CmpName; Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = GetTimeStamp(); Module->m_TimeStamp = GetNewTimeStamp();
Module->m_Path = cmp->m_TimeStampPath; Module->m_Path = cmp->m_TimeStampPath;
} }
else else
...@@ -1176,7 +1176,7 @@ bool NETLIST_READER::loadNewModules() ...@@ -1176,7 +1176,7 @@ bool NETLIST_READER::loadNewModules()
Module = newmodule; Module = newmodule;
Module->m_Reference->m_Text = cmp->m_CmpName; Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = GetTimeStamp(); Module->m_TimeStamp = GetNewTimeStamp();
Module->m_Path = cmp->m_TimeStampPath; Module->m_Path = cmp->m_TimeStampPath;
} }
} }
......
...@@ -534,7 +534,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) ...@@ -534,7 +534,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
if( zone->GetNumCorners() == 0 ) if( zone->GetNumCorners() == 0 )
{ {
zone->m_Flags = IS_NEW; zone->m_Flags = IS_NEW;
zone->m_TimeStamp = GetTimeStamp(); zone->m_TimeStamp = GetNewTimeStamp();
g_Zone_Default_Setting.ExportSetting( *zone ); g_Zone_Default_Setting.ExportSetting( *zone );
zone->m_Poly->Start( g_Zone_Default_Setting.m_CurrentZone_Layer, zone->m_Poly->Start( g_Zone_Default_Setting.m_CurrentZone_Layer,
GetScreen()->GetCrossHairPosition().x, GetScreen()->GetCrossHairPosition().x,
......
...@@ -88,7 +88,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int ...@@ -88,7 +88,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int
new_area->SetNet( netcode ); new_area->SetNet( netcode );
new_area->SetLayer( layer ); new_area->SetLayer( layer );
new_area->m_TimeStamp = GetTimeStamp(); new_area->m_TimeStamp = GetNewTimeStamp();
if( iarea < (int) ( m_ZoneDescriptorList.size() - 1 ) ) if( iarea < (int) ( m_ZoneDescriptorList.size() - 1 ) )
m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + iarea + 1, new_area ); m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + iarea + 1, new_area );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment