home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Examples / AppKit / Draw / graphicsUndo.subproj / ReorderGraphicsChange.m < prev    next >
Text File  |  1992-02-09  |  888b  |  47 lines

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