class BOARD: rename m_Zone to m_SegZoneDeprecated to avoid mistakes in code.

m_Zone is a fully deprecated list of SEG_ZONE items (similar to TRACK), used to fill copper zones in *very old* boards.
it is even unlikely there are still boards that use them.
So it should be removed one day.
This commit is contained in:
jean-pierre charras 2018-05-12 21:37:43 +02:00
parent 9311393016
commit e57cd291ff
14 changed files with 38 additions and 64 deletions

View File

@ -872,9 +872,9 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
case PCB_ZONE_T: case PCB_ZONE_T:
if( aMode == ADD_APPEND ) if( aMode == ADD_APPEND )
m_Zone.PushBack( (SEGZONE*) aBoardItem ); m_SegZoneDeprecated.PushBack( (SEGZONE*) aBoardItem );
else else
m_Zone.PushFront( (SEGZONE*) aBoardItem ); m_SegZoneDeprecated.PushFront( (SEGZONE*) aBoardItem );
break; break;
@ -967,7 +967,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem )
break; break;
case PCB_ZONE_T: case PCB_ZONE_T:
m_Zone.Remove( (SEGZONE*) aBoardItem ); m_SegZoneDeprecated.Remove( (SEGZONE*) aBoardItem );
break; break;
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
@ -1015,7 +1015,7 @@ int BOARD::GetNumSegmTrack() const
int BOARD::GetNumSegmZone() const int BOARD::GetNumSegmZone() const
{ {
return m_Zone.GetCount(); return m_SegZoneDeprecated.GetCount();
} }
@ -1075,7 +1075,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
} }
// Check segment zones // Check segment zones
for( TRACK* track = m_Zone; track; track = track->Next() ) for( TRACK* track = m_SegZoneDeprecated; track; track = track->Next() )
{ {
if( !hasItems ) if( !hasItems )
area = track->GetBoundingBox(); area = track->GetBoundingBox();
@ -1303,7 +1303,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
break; break;
case PCB_ZONE_T: case PCB_ZONE_T:
result = IterateForward( m_Zone, inspector, testData, p ); result = IterateForward( m_SegZoneDeprecated, inspector, testData, p );
++p; ++p;
break; break;

View File

@ -244,7 +244,8 @@ public:
DLIST<MODULE> m_Modules; // linked list of MODULEs DLIST<MODULE> m_Modules; // linked list of MODULEs
DLIST<TRACK> m_Track; // linked list of TRACKs and VIAs DLIST<TRACK> m_Track; // linked list of TRACKs and VIAs
DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs DLIST<SEGZONE> m_SegZoneDeprecated; // linked list of SEGZONEs, for really very old boards
// should be removed one day
DLIST_ITERATOR_WRAPPER<TRACK> Tracks() { return DLIST_ITERATOR_WRAPPER<TRACK>(m_Track); } DLIST_ITERATOR_WRAPPER<TRACK> Tracks() { return DLIST_ITERATOR_WRAPPER<TRACK>(m_Track); }
DLIST_ITERATOR_WRAPPER<MODULE> Modules() { return DLIST_ITERATOR_WRAPPER<MODULE>(m_Modules); } DLIST_ITERATOR_WRAPPER<MODULE> Modules() { return DLIST_ITERATOR_WRAPPER<MODULE>(m_Modules); }
@ -268,7 +269,7 @@ public:
bool IsEmpty() const bool IsEmpty() const
{ {
return m_Drawings.GetCount() == 0 && m_Modules.GetCount() == 0 && return m_Drawings.GetCount() == 0 && m_Modules.GetCount() == 0 &&
m_Track.GetCount() == 0 && m_Zone.GetCount() == 0; m_Track.GetCount() == 0 && m_SegZoneDeprecated.GetCount() == 0;
} }
void Move( const wxPoint& aMoveVector ) override; void Move( const wxPoint& aMoveVector ) override;

View File

@ -501,8 +501,8 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb )
// When reading from a file most of the items will already be in the correct order. // When reading from a file most of the items will already be in the correct order.
// Searching from the back therefore takes us from n^2 to essentially 0. // Searching from the back therefore takes us from n^2 to essentially 0.
if( Type() == PCB_ZONE_T ) if( Type() == PCB_ZONE_T ) // Deprecated items, only found in very old boards
track = aPcb->m_Zone.GetLast(); track = aPcb->m_SegZoneDeprecated.GetLast();
else else
track = aPcb->m_Track.GetLast(); track = aPcb->m_Track.GetLast();
@ -512,8 +512,8 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb )
return track->Next(); return track->Next();
} }
if( Type() == PCB_ZONE_T ) if( Type() == PCB_ZONE_T ) // Deprecated
return aPcb->m_Zone.GetFirst(); return aPcb->m_SegZoneDeprecated.GetFirst();
else else
return aPcb->m_Track.GetFirst(); return aPcb->m_Track.GetFirst();
} }

View File

@ -662,7 +662,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones : case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
GetBoard()->m_Zone.DeleteAll(); // remove zone segments used to fill zones. GetBoard()->m_SegZoneDeprecated.DeleteAll(); // remove deprecated zone segments used
// to fill zones in very old boards.
for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ ) for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
{ {

View File

@ -1064,12 +1064,6 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
for( track = aPcb->m_Track; track; track = track->Next() ) for( track = aPcb->m_Track; track; track = track->Next() )
nbitems++; nbitems++;
for( track = aPcb->m_Zone; track; track = track->Next() )
{
if( track->Type() == PCB_ZONE_T )
nbitems++;
}
tracklist = (TRACK**) operator new( (nbitems + 1)* sizeof( TRACK* ) ); tracklist = (TRACK**) operator new( (nbitems + 1)* sizeof( TRACK* ) );
nbitems = 0; nbitems = 0;
@ -1077,12 +1071,6 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
for( track = aPcb->m_Track; track; track = track->Next() ) for( track = aPcb->m_Track; track; track = track->Next() )
tracklist[nbitems++] = track; tracklist[nbitems++] = track;
for( track = aPcb->m_Zone; track; track = track->Next() )
{
if( track->Type() == PCB_ZONE_T )
tracklist[nbitems++] = track;
}
tracklist[nbitems] = NULL; tracklist[nbitems] = NULL;
qsort( tracklist, nbitems, sizeof(TRACK*), TrackListSortByNetcode ); qsort( tracklist, nbitems, sizeof(TRACK*), TrackListSortByNetcode );
@ -1255,23 +1243,6 @@ static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb )
} }
} }
for( track = aPcb->m_Zone; track; track = track->Next() )
{
if( last_width != track->GetWidth() ) // Find a thickness already used.
{
for( ii = 0; ii < trackinfo.size(); ii++ )
{
if( trackinfo[ii] == track->GetWidth() )
break;
}
if( ii == trackinfo.size() ) // not found
trackinfo.push_back( track->GetWidth() );
last_width = track->GetWidth();
}
}
// Write data // Write data
fputs( "$TRACKS\n", aFile ); fputs( "$TRACKS\n", aFile );

View File

@ -227,8 +227,8 @@ void NETINFO_MAPPING::Update()
} }
} }
// Segzones // Segzones (should be removed: used only in very old boards)
for( SEGZONE* zone = m_board->m_Zone; zone; zone = zone->Next() ) for( SEGZONE* zone = m_board->m_SegZoneDeprecated; zone; zone = zone->Next() )
nets.insert( zone->GetNetCode() ); nets.insert( zone->GetNetCode() );
// Prepare the new mapping // Prepare the new mapping

View File

@ -160,8 +160,8 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() ) for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
m_view->Add( module ); m_view->Add( module );
// Segzones (equivalent of ZONE_CONTAINER for legacy boards) // Segzones (deprecated, equivalent of ZONE_CONTAINERfilled areas for very old boards)
for( SEGZONE* zone = aBoard->m_Zone; zone; zone = zone->Next() ) for( SEGZONE* zone = aBoard->m_SegZoneDeprecated; zone; zone = zone->Next() )
m_view->Add( zone ); m_view->Add( zone );
// DRC markers // DRC markers

View File

@ -157,9 +157,9 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const
track->Draw( aPanel, DC, aDrawMode ); track->Draw( aPanel, DC, aDrawMode );
} }
// SEGZONE is outdated, only her for compatibility with // SEGZONE is deprecated, only for compatibility with
// very old designs // very old designs
for( SEGZONE* zone = m_Zone; zone; zone = zone->Next() ) for( SEGZONE* zone = m_SegZoneDeprecated; zone; zone = zone->Next() )
{ {
if( zone->IsMoving() ) if( zone->IsMoving() )
continue; continue;

View File

@ -139,9 +139,9 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
aPlotter->EndBlock( NULL ); aPlotter->EndBlock( NULL );
// Plot segments used to fill zone areas (outdated, but here for old boards // Plot segments used to fill zone areas (deprecated, but here for very old boards
// compatibility): // compatibility):
for( SEGZONE* seg = aBoard->m_Zone; seg; seg = seg->Next() ) for( SEGZONE* seg = aBoard->m_SegZoneDeprecated; seg; seg = seg->Next() )
{ {
if( !aLayerMask[ seg->GetLayer() ] ) if( !aLayerMask[ seg->GetLayer() ] )
continue; continue;
@ -545,8 +545,8 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
aPlotter->EndBlock( NULL ); aPlotter->EndBlock( NULL );
// Plot zones (outdated, for old boards compatibility): // Plot zones (deprecated, for very old boards compatibility):
for( TRACK* track = aBoard->m_Zone; track; track = track->Next() ) for( TRACK* track = aBoard->m_SegZoneDeprecated; track; track = track->Next() )
{ {
if( !aLayerMask[track->GetLayer()] ) if( !aLayerMask[track->GetLayer()] )
continue; continue;

View File

@ -213,8 +213,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
} }
} }
// Outdated: only for compatibility to old boards // Deprecated: only for compatibility with very old boards
for( TRACK* track = Pcb->m_Zone; track; track = track->Next() ) for( TRACK* track = Pcb->m_SegZoneDeprecated; track; track = track->Next() )
{ {
if( !( aPrintMask & track->GetLayerSet() ).any() ) if( !( aPrintMask & track->GetLayerSet() ).any() )
continue; continue;

View File

@ -406,8 +406,8 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
} }
} }
// Change zones. // Change deprecated zones segments, only found in very old boards.
for( TRACK* segm = GetBoard()->m_Zone; segm; segm = segm->Next() ) for( TRACK* segm = GetBoard()->m_SegZoneDeprecated; segm; segm = segm->Next() )
{ {
OnModify(); OnModify();
int jj = segm->GetLayer(); int jj = segm->GetLayer();

View File

@ -152,8 +152,8 @@ static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
for( int ii = 0; ii < aPcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < aPcb->GetAreaCount(); ii++ )
itemsList.push_back( aPcb->GetArea( ii ) ); itemsList.push_back( aPcb->GetArea( ii ) );
// Append zones segm: // Append zones segm (deprecated items):
for( item = aPcb->m_Zone; item != NULL; item = item->Next() ) for( item = aPcb->m_SegZoneDeprecated; item != NULL; item = item->Next() )
itemsList.push_back( item ); itemsList.push_back( item );
NETINFO_LIST& netInfo = aPcb->GetNetInfo(); NETINFO_LIST& netInfo = aPcb->GetNetInfo();

View File

@ -206,8 +206,8 @@ bool ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
} }
} }
// Remove segment zones // Remove deprecaded segment zones (only found in very old boards)
m_board->m_Zone.DeleteAll(); m_board->m_SegZoneDeprecated.DeleteAll();
if( m_progressReporter ) if( m_progressReporter )
{ {

View File

@ -72,9 +72,10 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, timestamp_t aTimestamp
else else
TimeStamp = aZone->GetTimeStamp(); // Save reference time stamp (aZone will be deleted) TimeStamp = aZone->GetTimeStamp(); // Save reference time stamp (aZone will be deleted)
// SEGZONE is a deprecated item, only used for compatibility with very old boards
SEGZONE* next; SEGZONE* next;
for( SEGZONE* zone = GetBoard()->m_Zone; zone != NULL; zone = next ) for( SEGZONE* zone = GetBoard()->m_SegZoneDeprecated; zone != NULL; zone = next )
{ {
next = zone->Next(); next = zone->Next();