~bidulock/kicad/kicad-brian

« back to all changes in this revision

Viewing changes to eeschema/delete.cpp

  • Committer: Brian F. G. Bidulock
  • Date: 2010-06-30 12:43:10 UTC
  • mfrom: (2360.3.47 testing)
  • Revision ID: brian@habeascorpus-20100630124310-9p4sig3zj1gqnlqd
mergedĀ upstreamĀ changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
389
389
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
390
390
{
391
391
    EDA_BaseStruct* DrawList;
392
 
    SCH_SHEET_PIN* SheetLabel, * NextLabel;
393
392
 
394
393
    if( DrawStruct == NULL )
395
394
        return;
401
400
 
402
401
    if( DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
403
402
    {
404
 
        //this structure is attached to a sheet , which we must find.
405
 
        DrawList = Screen->EEDrawList;
406
 
        for( ; DrawList != NULL; DrawList = DrawList->Next() )
407
 
        {
408
 
            if( DrawList->Type() != DRAW_SHEET_STRUCT_TYPE )
409
 
                continue;
410
 
 
411
 
            /* See if our item is in this Sheet */
412
 
            SheetLabel = ( (SCH_SHEET*) DrawList )->m_Label;
413
 
            if( SheetLabel == NULL )
414
 
                continue;
415
 
 
416
 
            if( SheetLabel == (SCH_SHEET_PIN*) DrawStruct )
417
 
            {
418
 
                ( (SCH_SHEET*) DrawList )->m_Label =
419
 
                    (SCH_SHEET_PIN*) SheetLabel->Next();
420
 
 
421
 
                SAFE_DELETE( DrawStruct );
422
 
                return;
423
 
            }
424
 
            else
425
 
            {
426
 
                while( SheetLabel->Next() )
427
 
                {
428
 
                    NextLabel = (SCH_SHEET_PIN*) SheetLabel->Next();
429
 
 
430
 
                    if( NextLabel == (SCH_SHEET_PIN*) DrawStruct )
431
 
                    {
432
 
                        SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
433
 
                        SAFE_DELETE( DrawStruct );
434
 
                        return;
435
 
 
436
 
                    }
437
 
                    SheetLabel = NextLabel;
438
 
                }
439
 
            }
440
 
        }
441
 
 
 
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 );
442
409
        return;
443
410
    }
444
411
    else