Pcbnew: Fix bug 811437 . This bug (due to duplicate time stamps), cannot happen with usual boards, only when 2 identical board (from the same .brd file) are append.

This commit is contained in:
jean-pierre charras 2011-07-16 18:04:49 +02:00
parent 6850365db3
commit 9deee66b17
6 changed files with 42 additions and 26 deletions

View File

@ -902,15 +902,16 @@ public:
// zone handling
/**
* Function Delete_Zone_Fill (obsolete)
* Function Delete_OldZone_Fill (obsolete)
* Used for compatibility with old boards
* Remove the zone filling which include the segment aZone, or the zone
* which have the given time stamp. A zone is a group of segments which
* have the same TimeStamp
* which have the given time stamp.
* For old boards, a zone is a group of SEGZONE segments which have the same TimeStamp
* @param aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone ==
* NULL
*/
void Delete_Zone_Fill( SEGZONE* aZone, long aTimestamp = 0 );
void Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp = 0 );
/**

View File

@ -47,6 +47,22 @@ ZONE_CONTAINER::~ZONE_CONTAINER()
m_Poly = NULL;
}
/**
* Function UnFill
* Removes the zone filling
* @return true if a previous filling is removed, false if no change
* (when no filling found)
*/
bool ZONE_CONTAINER::UnFill()
{
bool change = ( m_FilledPolysList.size() > 0 ) || ( m_FillSegmList.size() > 0 );
m_FilledPolysList.clear();
m_FillSegmList.clear();
m_IsFilled = false;
return change;
}
/**
* Function GetPosition (virtual)

View File

@ -289,6 +289,13 @@ public:
*/
int Fill_Zone_Areas_With_Segments();
/**
* Function UnFill
* Removes the zone filling
* @return true if a previous filling is removed, false if no change
* (when no filling found)
*/
bool UnFill();
/* Geometric transformations: */

View File

@ -381,7 +381,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
SEGZONE* zsegm = (SEGZONE*) GetCurItem();
int netcode = zsegm->GetNet();
Delete_Zone_Fill( zsegm );
Delete_OldZone_Fill( zsegm );
SetCurItem( NULL );
test_1_net_connexion( NULL, netcode );
OnModify();
@ -498,7 +498,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( ( GetCurItem() )->Type() == TYPE_ZONE_CONTAINER )
{
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
Delete_Zone_Fill( NULL, zone_container->m_TimeStamp );
zone_container->UnFill();
test_1_net_connexion( NULL, zone_container->GetNet() );
OnModify();
GetBoard()->DisplayInfo( this );
@ -1058,7 +1058,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
break;
case TYPE_ZONE:
Delete_Zone_Fill( (SEGZONE*) Item );
Delete_OldZone_Fill( (SEGZONE*) Item );
break;
case TYPE_ZONE_EDGE_CORNER:

View File

@ -335,7 +335,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
DrawPanel->RefreshDrawingRect( zone_container->GetBoundingBox() );
if( DC )
{ // Remove the full zone because this is no more an area
Delete_Zone_Fill( NULL, zone_container->m_TimeStamp );
zone_container->UnFill();
zone_container->DrawFilledArea( DrawPanel, DC, GR_XOR );
}
GetBoard()->Delete( zone_container );
@ -851,7 +851,11 @@ void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contain
EDA_RECT dirty = zone_container->GetBoundingBox();
Delete_Zone_Fill( NULL, zone_container->m_TimeStamp ); // Remove fill segments
// For compatibility with old boards: remove old SEGZONE fill segments
Delete_OldZone_Fill( NULL, zone_container->m_TimeStamp );
// Remove current filling:
zone_container->UnFill();
if( ncont == 0 ) // This is the main outline: remove all
{

View File

@ -36,13 +36,14 @@
/**
* Function Delete_Zone_Fill
* Remove the zone fillig which include the segment aZone, or the zone which have the given time stamp.
* Function Delete_OldZone_Fill (obsolete)
* Used for compatibility with old boards
* Remove the zone filling which include the segment aZone, or the zone which have the given time stamp.
* A zone is a group of segments which have the same TimeStamp
* @param aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
*/
void PCB_EDIT_FRAME::Delete_Zone_Fill( SEGZONE* aZone, long aTimestamp )
void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp )
{
bool modify = false;
unsigned long TimeStamp;
@ -64,19 +65,6 @@ void PCB_EDIT_FRAME::Delete_Zone_Fill( SEGZONE* aZone, long aTimestamp )
}
}
// Now delete the outlines of the corresponding copper areas (deprecated)
for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = GetBoard()->GetArea( ii );
if( zone->m_TimeStamp == TimeStamp )
{
modify = TRUE;
zone->m_FilledPolysList.clear();
zone->m_FillSegmList.clear();
zone->m_IsFilled = false;
}
}
if( modify )
{
OnModify();
@ -120,7 +108,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose )
wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor)
zone_container->m_FilledPolysList.clear();
Delete_Zone_Fill( NULL, zone_container->m_TimeStamp );
zone_container->UnFill();
zone_container->BuildFilledPolysListData( GetBoard() );
OnModify();