home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Examples / AppKit / Draw / graphicsUndo.subproj / ReorderGraphicsChange.m < prev    next >
Text File  |  1995-08-03  |  909b  |  43 lines

  1. #import "drawundo.h"
  2.  
  3. @interface ReorderGraphicsChange(PrivateMethods)
  4.  
  5. - (void)undoDetails;
  6.  
  7. @end
  8.  
  9. @implementation ReorderGraphicsChange
  10.  
  11. - (void)saveBeforeChange
  12. {
  13.     [super saveBeforeChange];
  14.     [changeDetails makeObjectsPerform:@selector(recordGraphicPositionIn:) withObject:[graphicView graphics]]; 
  15. }
  16.  
  17. - (Class)changeDetailClass
  18. {
  19.     return [OrderChangeDetail class];
  20. }
  21.  
  22. - (void)undoDetails
  23. {
  24.     int count, i;
  25.     id detail, graphic;
  26.     NSMutableArray *allGraphics;
  27.  
  28.     count = [changeDetails count];
  29.     allGraphics = [graphicView graphics];
  30.     for (i = 0; i < count; i++) {
  31.     detail = [changeDetails objectAtIndex:i];
  32.     graphic = [detail graphic];
  33.         [allGraphics removeObject:graphic];
  34.     }
  35.     for (i = 0; i < count; i++) {
  36.     detail = [changeDetails objectAtIndex:i];
  37.     graphic = [detail graphic];
  38.         [allGraphics insertObject:graphic atIndex:[detail graphicPosition]];
  39.     } 
  40. }
  41.  
  42. @end
  43.