This is DeleteGraphicsChange.m in view mode; [Download] [Up]
#import "drawundo.h" @interface DeleteGraphicsChange(PrivateMethods) - undoDetails; - redoDetails; @end @implementation DeleteGraphicsChange - free { if ([self hasBeenDone]) [graphics freeObjects]; return [super free]; } - (const char *)changeName { return DELETE_OPERATION; } - saveBeforeChange { [super saveBeforeChange]; [changeDetails makeObjectsPerform:@selector(recordGraphicPositionIn:) with:[graphicView graphics]]; return self; } - 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 insertObject:graphic at:[detail graphicPosition]]; [graphic wasAddedTo:graphicView]; } [graphicView getSelection]; return self; } - redoDetails { int count, i; id detail, graphic; List *selectedGraphics; List *allGraphics; selectedGraphics = [graphicView selectedGraphics]; allGraphics = [graphicView graphics]; count = [changeDetails count]; for (i = 0; i < count; i++) { detail = [changeDetails objectAt:i]; graphic = [detail graphic]; [selectedGraphics removeObject:graphic]; [allGraphics removeObject:graphic]; [graphic wasRemovedFrom:graphicView]; } [graphicView resetGroupInSlist]; return self; } - changeDetailClass { return [OrderChangeDetail class]; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.