402
401
if( DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
404
//this structure is attached to a sheet , which we must find.
405
DrawList = Screen->EEDrawList;
406
for( ; DrawList != NULL; DrawList = DrawList->Next() )
408
if( DrawList->Type() != DRAW_SHEET_STRUCT_TYPE )
411
/* See if our item is in this Sheet */
412
SheetLabel = ( (SCH_SHEET*) DrawList )->m_Label;
413
if( SheetLabel == NULL )
416
if( SheetLabel == (SCH_SHEET_PIN*) DrawStruct )
418
( (SCH_SHEET*) DrawList )->m_Label =
419
(SCH_SHEET_PIN*) SheetLabel->Next();
421
SAFE_DELETE( DrawStruct );
426
while( SheetLabel->Next() )
428
NextLabel = (SCH_SHEET_PIN*) SheetLabel->Next();
430
if( NextLabel == (SCH_SHEET_PIN*) DrawStruct )
432
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
433
SAFE_DELETE( DrawStruct );
437
SheetLabel = NextLabel;
403
// This structure is attached to a sheet, get the parent sheet object.
404
SCH_SHEET_PIN* sheetLabel = (SCH_SHEET_PIN*) DrawStruct;
405
SCH_SHEET* sheet = sheetLabel->GetParent();
406
wxASSERT_MSG( sheet != NULL,
407
wxT( "Sheet label parent not properly set, bad programmer!" ) );
408
sheet->RemoveLabel( sheetLabel );