home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)dropobject.tcl /main/titanic/5
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)dropobject.tcl /main/titanic/5 17 Sep 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
-
- # Abstract class that provides general functionality for objects that
- # accept draggable objects.
-
- Class DropObject : {Object} {
- constructor
- method destructor
- method setDestinationSet
- method dropCopyEvent
- method dropCutEvent
- method dropEvent
- }
-
- constructor DropObject {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method DropObject::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method DropObject::setDestinationSet {this} {
- $this destinationSet \
- "CUT_BROWSUIOBJ dropCutEvent BROWSUIOBJ dropCopyEvent"
- }
-
- method DropObject::dropCopyEvent {this contextList srcIsDst droppedAfterObj droppedBeforeObj} {
- $this dropEvent \
- $contextList $srcIsDst $droppedAfterObj $droppedBeforeObj copy
- }
-
- method DropObject::dropCutEvent {this contextList srcIsDst droppedAfterObj droppedBeforeObj} {
- $this dropEvent \
- $contextList $srcIsDst $droppedAfterObj $droppedBeforeObj cut
- }
-
- method DropObject::dropEvent {this contextList srcIsDst droppedAfterObj droppedBeforeObj operation} {
- if [.main undoCommandBusy EditPasteCmd] {
- [.main undoCommand] operation $operation
- }
-
- # getDropTarget returns the target object, either a treenode or a
- # browsObject. The treeNode result parameter returns the the treenode
- # or the parent treenode for a BrowsObject
- set target \
- [$this getDropTarget $droppedAfterObj $droppedBeforeObj treeNode]
- set browsUiObj [$target browsUiObj]
-
- # Drop is not allowed upon frozen target
- if {"[$browsUiObj getInfo Status]" == "frozen"} {
- wmtkmessage "Can not drop into this '[$browsUiObj getInfo Type]' \
- because it is frozen"
- if [isCommand [.main undoCommand]] {
- [.main undoCommand] delete
- }
- return
- }
-
- set done 0
- set fileContextList ""
- foreach context $contextList {
-
- # determine right object type
- set isFileVersion 0
- if {[llength $context] == 7} {
- set type [lindex $context 6]
- if {$type != "GroupVersion"} {
- set isFileVersion 1
- }
- }
-
- set uiClass [lindex $context [expr [llength $context] - 1]]
- if {! [$browsUiObj allowsDrop $uiClass]} {
- wmtkmessage "Can not import '$uiClass' \
- into this '[$browsUiObj getInfo Type]'"
- if [isCommand [.main undoCommand]] {
- [.main undoCommand] delete
- }
- return
- }
-
- if $isFileVersion {
- lappend fileContextList $context
- } else {
- set done \
- [expr $done || [$browsUiObj importObject $context $treeNode]]
- }
- }
-
- if {$fileContextList != ""} {
- busy {
- set done [$browsUiObj importObjects $fileContextList $treeNode]
- }
- }
-
- $this postDropUpdate $target $treeNode
-
- if [.main undoCommandBusy] {
- [.main undoCommand] busy 0
- }
-
- if {$done && $operation == "cut"} {
- # reset clipboard when cut action is finished
- [.main flatView] conversionSet ""
- [.main flatView] setClipboardValue
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
-