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

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1996
  4. #
  5. #      File:           @(#)navigation.tcl    /main/hindenburg/10
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)navigation.tcl    /main/hindenburg/10   27 Nov 1996 Copyright 1996 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14.  
  15. Class NavigationView : {BrowsTree} {
  16.     constructor
  17.     method destructor
  18.     method dropCopyEvent
  19.     method dropCutEvent
  20.     method dropEvent
  21.     method rebuild
  22.     method updateSelected
  23. }
  24.  
  25. constructor NavigationView {class this name} {
  26.     set this [BrowsTree::constructor $class $this $name]
  27.     # Start constructor user section
  28.  
  29.     $this destinationSet \
  30.         "CUT_BROWSUIOBJ dropCutEvent BROWSUIOBJ dropCopyEvent"
  31.  
  32.     # End constructor user section
  33.     return $this
  34. }
  35.  
  36. method NavigationView::destructor {this} {
  37.     # Start destructor user section
  38.     # End destructor user section
  39. }
  40.  
  41. method NavigationView::dropCopyEvent {this contextList srcIsDst droppedAfterObj droppedBeforeObj} {
  42.     $this dropEvent \
  43.     $contextList $srcIsDst $droppedAfterObj $droppedBeforeObj copy
  44. }
  45.  
  46. method NavigationView::dropCutEvent {this contextList srcIsDst droppedAfterObj droppedBeforeObj} {
  47.     $this dropEvent \
  48.     $contextList $srcIsDst $droppedAfterObj $droppedBeforeObj cut
  49. }
  50.  
  51. method NavigationView::dropEvent {this contextList srcIsDst droppedAfterObj droppedBeforeObj operation} {
  52.     if [.main undoCommandBusy EditPasteCmd] {
  53.     [.main undoCommand] operation $operation
  54.     }
  55.  
  56.     if [isCommand $droppedAfterObj] {
  57.     set node $droppedAfterObj
  58.     } else {
  59.     set node [.main currentObj]
  60.     if {! [isCommand $node]} {
  61.         set node [lindex [$this rootSet] 0]
  62.     }
  63.     }
  64.     set browsUiObj [$node browsUiObj]
  65.  
  66.     foreach context $contextList {
  67.     set uiClass [lindex $context [expr [llength $context] - 1]]
  68.     if {! [$browsUiObj allowsDrop $uiClass]} {
  69.         wmtkmessage "Can not import '$uiClass' \
  70.              into this '[$browsUiObj getInfo Type]'"
  71.         if [isCommand [.main undoCommand]] {
  72.         [.main undoCommand] delete
  73.         }
  74.         return
  75.     }
  76.  
  77.     $browsUiObj importObject $context $node
  78.     }
  79.  
  80.     # Update tree-node
  81.     if {(! [$node foldState]) && (! [$node activeState])} {
  82.     $node appendChildren
  83.     }
  84.  
  85.     if [.main undoCommandBusy] {
  86.     [.main undoCommand] busy 0
  87.     }
  88. }
  89.  
  90. method NavigationView::rebuild {this} {
  91.     foreach root [$this rootSet] {
  92.     $root rebuild
  93.     }
  94. }
  95.  
  96. method NavigationView::updateSelected {this} {
  97.     set treeNode [$this selected]
  98.     if {"$treeNode" == ""} {
  99.     return
  100.     }
  101.  
  102.     # Must update selected tree node because
  103.     # one browsUiObj can have two different parents
  104.     BrowserProcs::initializeInfo [$treeNode browsUiObj] $treeNode
  105.  
  106.     # Open tree-node
  107.     if [$treeNode activeState] {
  108.     .main selectionChanged
  109.     } else {
  110.     $treeNode open
  111.     }
  112. }
  113.  
  114. # Do not delete this line -- regeneration end marker
  115.  
  116.