Commit 9deee66b authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Fix bug 811437 . This bug (due to duplicate time stamps), cannot...

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.
parent 6850365d
...@@ -902,15 +902,16 @@ public: ...@@ -902,15 +902,16 @@ public:
// zone handling // 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 * 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 * which have the given time stamp.
* have the same TimeStamp * 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 aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == * @param aTimestamp = Timestamp for the zone to delete, used if aZone ==
* NULL * NULL
*/ */
void Delete_Zone_Fill( SEGZONE* aZone, long aTimestamp = 0 ); void Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp = 0 );
/** /**
......
...@@ -47,6 +47,22 @@ ZONE_CONTAINER::~ZONE_CONTAINER() ...@@ -47,6 +47,22 @@ ZONE_CONTAINER::~ZONE_CONTAINER()
m_Poly = NULL; 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) * Function GetPosition (virtual)
......
...@@ -289,6 +289,13 @@ public: ...@@ -289,6 +289,13 @@ public:
*/ */
int Fill_Zone_Areas_With_Segments(); 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: */ /* Geometric transformations: */
......
...@@ -381,7 +381,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -381,7 +381,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
SEGZONE* zsegm = (SEGZONE*) GetCurItem(); SEGZONE* zsegm = (SEGZONE*) GetCurItem();
int netcode = zsegm->GetNet(); int netcode = zsegm->GetNet();
Delete_Zone_Fill( zsegm ); Delete_OldZone_Fill( zsegm );
SetCurItem( NULL ); SetCurItem( NULL );
test_1_net_connexion( NULL, netcode ); test_1_net_connexion( NULL, netcode );
OnModify(); OnModify();
...@@ -498,7 +498,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -498,7 +498,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( ( GetCurItem() )->Type() == TYPE_ZONE_CONTAINER ) if( ( GetCurItem() )->Type() == TYPE_ZONE_CONTAINER )
{ {
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem(); 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() ); test_1_net_connexion( NULL, zone_container->GetNet() );
OnModify(); OnModify();
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
...@@ -1058,7 +1058,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) ...@@ -1058,7 +1058,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
break; break;
case TYPE_ZONE: case TYPE_ZONE:
Delete_Zone_Fill( (SEGZONE*) Item ); Delete_OldZone_Fill( (SEGZONE*) Item );
break; break;
case TYPE_ZONE_EDGE_CORNER: case TYPE_ZONE_EDGE_CORNER:
......
...@@ -335,7 +335,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe ...@@ -335,7 +335,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
DrawPanel->RefreshDrawingRect( zone_container->GetBoundingBox() ); DrawPanel->RefreshDrawingRect( zone_container->GetBoundingBox() );
if( DC ) if( DC )
{ // Remove the full zone because this is no more an area { // 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 ); zone_container->DrawFilledArea( DrawPanel, DC, GR_XOR );
} }
GetBoard()->Delete( zone_container ); GetBoard()->Delete( zone_container );
...@@ -851,7 +851,11 @@ void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contain ...@@ -851,7 +851,11 @@ void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contain
EDA_RECT dirty = zone_container->GetBoundingBox(); 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 if( ncont == 0 ) // This is the main outline: remove all
{ {
......
...@@ -36,13 +36,14 @@ ...@@ -36,13 +36,14 @@
/** /**
* Function Delete_Zone_Fill * Function Delete_OldZone_Fill (obsolete)
* Remove the zone fillig which include the segment aZone, or the zone which have the given time stamp. * 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 * 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 aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == 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; bool modify = false;
unsigned long TimeStamp; unsigned long TimeStamp;
...@@ -64,19 +65,6 @@ void PCB_EDIT_FRAME::Delete_Zone_Fill( SEGZONE* aZone, long aTimestamp ) ...@@ -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 ) if( modify )
{ {
OnModify(); OnModify();
...@@ -120,7 +108,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose ) ...@@ -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) wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor)
zone_container->m_FilledPolysList.clear(); zone_container->m_FilledPolysList.clear();
Delete_Zone_Fill( NULL, zone_container->m_TimeStamp ); zone_container->UnFill();
zone_container->BuildFilledPolysListData( GetBoard() ); zone_container->BuildFilledPolysListData( GetBoard() );
OnModify(); OnModify();
......
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