ftp.nice.ch/pub/next/science/mathematics/HippoDraw.2.0.s.tar.gz#/HippoDraw/Hippo.bproj/Draw.subproj/graphicsUndo.subproj/ReorderGraphicsChange.m

This is ReorderGraphicsChange.m in view mode; [Download] [Up]

#import "drawundo.h"

@interface ReorderGraphicsChange(PrivateMethods)

- undoDetails;

@end

@implementation ReorderGraphicsChange

- saveBeforeChange
{
    [super saveBeforeChange];
    [changeDetails makeObjectsPerform:@selector(recordGraphicPositionIn:) with:[graphicView graphics]];

    return self;
}

- changeDetailClass
{
    return [OrderChangeDetail class];
}

- undoDetails
{
    int count, i;
    id detail, graphic;
    List *allGraphics;

    count = [changeDetails count];
    allGraphics = [graphicView graphics];
    for (i = 0; i < count; i++) {
	detail = [changeDetails objectAt:i];
	graphic = [detail graphic];
        [allGraphics removeObject:graphic];
    }
    for (i = 0; i < count; i++) {
	detail = [changeDetails objectAt:i];
	graphic = [detail graphic];
        [allGraphics insertObject:graphic at:[detail graphicPosition]];
    }
	
    return self;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.