Move all SetParent() calls to a single location in BOARD::Add().

This commit is contained in:
Maciej Suminski 2016-05-30 10:44:05 +02:00
parent f95628c132
commit ec4531948f
1 changed files with 2 additions and 8 deletions

View File

@ -869,18 +869,15 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
switch( aBoardItem->Type() ) switch( aBoardItem->Type() )
{ {
case PCB_NETINFO_T: case PCB_NETINFO_T:
aBoardItem->SetParent( this );
m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem ); m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
// this one uses a vector // this one uses a vector
case PCB_MARKER_T: case PCB_MARKER_T:
aBoardItem->SetParent( this );
m_markers.push_back( (MARKER_PCB*) aBoardItem ); m_markers.push_back( (MARKER_PCB*) aBoardItem );
break; break;
// this one uses a vector // this one uses a vector
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
aBoardItem->SetParent( this );
m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem ); m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
break; break;
@ -897,7 +894,6 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
m_Track.Insert( (TRACK*) aBoardItem, insertAid ); m_Track.Insert( (TRACK*) aBoardItem, insertAid );
} }
aBoardItem->SetParent( this );
break; break;
case PCB_ZONE_T: case PCB_ZONE_T:
@ -906,7 +902,6 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
else else
m_Zone.PushFront( (SEGZONE*) aBoardItem ); m_Zone.PushFront( (SEGZONE*) aBoardItem );
aBoardItem->SetParent( this );
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
@ -915,8 +910,6 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
else else
m_Modules.PushFront( (MODULE*) aBoardItem ); m_Modules.PushFront( (MODULE*) aBoardItem );
aBoardItem->SetParent( this );
// Because the list of pads has changed, reset the status // Because the list of pads has changed, reset the status
// This indicate the list of pad and nets must be recalculated before use // This indicate the list of pad and nets must be recalculated before use
m_Status_Pcb = 0; m_Status_Pcb = 0;
@ -934,7 +927,6 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
else else
m_Drawings.PushFront( aBoardItem ); m_Drawings.PushFront( aBoardItem );
aBoardItem->SetParent( this );
break; break;
// other types may use linked list // other types may use linked list
@ -944,10 +936,12 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ), msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
aBoardItem->Type() ); aBoardItem->Type() );
wxFAIL_MSG( msg ); wxFAIL_MSG( msg );
return;
} }
break; break;
} }
aBoardItem->SetParent( this );
m_ratsnest->Add( aBoardItem ); m_ratsnest->Add( aBoardItem );
} }