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

  1. #import "drawundo.h"
  2.  
  3. @interface MoveGraphicsChange(PrivateMethods)
  4.  
  5. - (BOOL)subsumeIdenticalChange:change;
  6.  
  7. @end
  8.  
  9. @implementation MoveGraphicsChange
  10.  
  11. - initGraphicView:aGraphicView vector:(const NXPoint *)aVector
  12. {
  13.     [super initGraphicView:aGraphicView];
  14.     redoVector.x = aVector->x;
  15.     redoVector.y = aVector->y;
  16.     undoVector.x = -redoVector.x;
  17.     undoVector.y = -redoVector.y;
  18.  
  19.     return self;
  20. }
  21.  
  22. - (const char *)changeName
  23. {
  24.     return NXLocalStringFromTable("Operations", "Move", NULL, "The operation of moving a graphical entity.");
  25. }
  26.  
  27. - changeDetailClass
  28. {
  29.     return [MoveChangeDetail class];
  30. }
  31.  
  32. - (const NXPoint *)undoVector
  33. {
  34.     return &undoVector;
  35. }
  36.  
  37. - (const NXPoint *)redoVector
  38. {
  39.     return &redoVector;
  40. }
  41.  
  42. - (BOOL)subsumeIdenticalChange:change
  43. {
  44.     MoveGraphicsChange    *moveChange;
  45.     
  46.     moveChange = (MoveGraphicsChange *)change;
  47.     undoVector.x += moveChange->undoVector.x;
  48.     undoVector.y += moveChange->undoVector.y;
  49.     redoVector.x += moveChange->redoVector.x;
  50.     redoVector.y += moveChange->redoVector.y;
  51.     
  52.     return YES;
  53. }
  54.  
  55. @end
  56.