home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Examples / AppKit / Draw / graphicsUndo.subproj / UnlockGraphicsChange.m < prev   
Text File  |  1992-02-09  |  1KB  |  72 lines

  1. #import "drawundo.h"
  2.  
  3. @interface UnlockGraphicsChange(PrivateMethods)
  4.  
  5. - undoDetails;
  6.  
  7. @end
  8.  
  9. @implementation UnlockGraphicsChange
  10.  
  11. - (const char *)changeName
  12. {
  13.     return NXLocalStringFromTable("Operations", "Unlock", NULL, "The operation of unlocking all the graphical entities which were previously locked down (see Lock).");
  14.     return "Unlock";
  15. }
  16.  
  17. - saveBeforeChange
  18. {
  19.     List *allGraphics;
  20.     int i, count;
  21.     id    graphic;
  22.  
  23.     graphics = [[List alloc] init];
  24.  
  25.     allGraphics = [graphicView graphics];
  26.     count = [allGraphics count];
  27.     for (i = 0; i < count; i++) {
  28.         graphic = [allGraphics objectAt:i];
  29.     if ([graphic isLocked])
  30.         [graphics addObject:graphic];
  31.     }
  32.  
  33.     if ([graphics count] == 0)
  34.         [self disable];
  35.     
  36.     return self;
  37. }
  38.  
  39. - redoChange
  40. {
  41.     [graphics makeObjectsPerform:@selector(unlocB
  42.     [graphicView resetLockedFlag];
  43.  
  44.     return [super redoChange];
  45. }
  46.  
  47. - changeDetailClass
  48. {
  49.     return nil;
  50. }
  51.  
  52. - undoDetails
  53. {
  54.     int i, count;
  55.     List *selectedGraphics;
  56.     id graphic;
  57.     
  58.     selectedGraphics = [graphicView selectedGraphics];
  59.     count = [graphics count];
  60.     for (i = 0; i < count; i++) {
  61.         graphic = [graphics objectAt:i];
  62.     [graphic lock];
  63.     [graphic deselect];
  64.     [selectedGraphics removeObject:graphic];
  65.     }
  66.     [graphicView resetLockedFlag];
  67.  
  68.     return self;
  69. }
  70.  
  71. @end
  72.