home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / undocomman.tcl < prev    next >
Text File  |  1996-09-27  |  2KB  |  74 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)undocomman.tcl    /main/hindenburg/3
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)undocomman.tcl    /main/hindenburg/3   27 Sep 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14.  
  15. Class UndoCommand : {Object} {
  16.     constructor
  17.     method destructor
  18.     method toggleUndo
  19.     method addObject
  20.     method removeObject
  21.     attribute undone
  22.     attribute busy
  23.     attribute validAfterLevelChange
  24.     attribute objectSet
  25.     attribute currentObj
  26. }
  27.  
  28. constructor UndoCommand {class this name} {
  29.     set this [Object::constructor $class $this $name]
  30.     $this undone 0
  31.     $this busy 1
  32.     $this validAfterLevelChange 0
  33.     $this objectSet [List new]
  34.     # Start constructor user section
  35.  
  36.     if {! [isCommand [.main undoCommand]]} {
  37.         if [isCommand [.main currentObj]] {
  38.         $this currentObj [[.main currentObj] browsUiObj]
  39.         }
  40.         [.main undoButton] sensitive 1
  41.     }
  42.  
  43.     # End constructor user section
  44.     return $this
  45. }
  46.  
  47. method UndoCommand::destructor {this} {
  48.     # Start destructor user section
  49.     [.main undoButton] sensitive 0
  50.     # End destructor user section
  51. }
  52.  
  53. method UndoCommand::toggleUndo {this} {
  54.     if [$this undone] {
  55.     $this redo
  56.     $this undone 0
  57.     } else {
  58.     $this undo
  59.     $this undone 1
  60.     }
  61. }
  62.  
  63. # Do not delete this line -- regeneration end marker
  64.  
  65. method UndoCommand::addObject {this newObject} {
  66.     [$this objectSet] append $newObject
  67.  
  68. }
  69.  
  70. method UndoCommand::removeObject {this oldObject} {
  71.     [$this objectSet] removeValue $oldObject
  72. }
  73.  
  74.