home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)dragbrowsv.tcl /main/titanic/7
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)dragbrowsv.tcl /main/titanic/7 21 Nov 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require "dropobject.tcl"
-
- Class DragBrowsView : {DropObject BrowsView} {
- method destructor
- constructor
- method getDropTarget
- method postDropUpdate
- method contextList
- method updateConversionSet
- method shellLink
- }
-
- global DragBrowsView::lastShellLink
- set DragBrowsView::lastShellLink ""
-
-
- method DragBrowsView::destructor {this} {
- # Start destructor user section
- global DragBrowsView::lastShellLink
- if {${DragBrowsView::lastShellLink} != ""} {
- unlink -nocomplain ${DragBrowsView::lastShellLink}
- set DragBrowsView::lastShellLink ""
- }
- # End destructor user section
- $this DropObject::destructor
- }
-
- constructor DragBrowsView {class this name} {
- set this [BrowsView::constructor $class $this $name]
- $this setDestinationSet
- return $this
- }
-
- method DragBrowsView::getDropTarget {this droppedAfterObj droppedBeforeObj treeNode} {
- upvar $treeNode node
- set node [.main currentObj]
- if { ![isCommand $node] } {
- set node [lindex [[.main treeView] rootSet 0]]
- }
- # if droppedBeforeObj is empty the drop was somewhere in the view,
- # not on a particular object.
- if { ($droppedBeforeObj == "") || (![isCommand $droppedAfterObj]) } {
- set target $node
- } else {
- set target $droppedAfterObj
- }
- return $target
- }
-
- method DragBrowsView::postDropUpdate {this target node} {
- if { $target == $node } {
- return
- }
-
- # check if target node is also in the tree view and unfolded
- set treeNode [[$target browsUiObj] treeNode]
- if { $treeNode == "" } {
- return
- }
-
- # if so update it
- if {(! [$treeNode foldState]) && (! [$treeNode activeState])} {
- $treeNode appendChildren
- }
- }
-
- method DragBrowsView::contextList {this} {
- set contextList ""
- foreach flatObj [$this selectedSet] {
- if [$flatObj isA DragInfoObj] {
- lappend contextList [lindex [$flatObj contextList] 0]
- }
- }
- return $contextList
- }
-
- method DragBrowsView::updateConversionSet {this} {
- if [BrowserProcs::objectsReturn canBeDragged] {
- set cvSet "BROWSUIOBJ contextList"
- if $win95 {
- append cvSet " HDROP shellLink"
- }
- $this conversionSet $cvSet
- } else {
- $this conversionSet ""
- }
- }
-
- method DragBrowsView::shellLink {this} {
- global DragBrowsView::lastShellLink
- if {${DragBrowsView::lastShellLink} != ""} {
- unlink -nocomplain ${DragBrowsView::lastShellLink}
- set DragBrowsView::lastShellLink ""
- }
- set files ""
- foreach flatObj [$this selectedSet] {
- if [$flatObj isA DragInfoObj] {
- set uiObj [$flatObj browsUiObj]
- set file [$uiObj file]
- if ![$uiObj isA Graph] {
- wmtkmessage "Can not create shortcut for object of type\
- '[ShortLongName::longName [$file type]]'."
- continue
- }
- if [catch {set shl [ShellLink new]} msg] {
- # ignore
- # probably NT 3.51
- wmtkerror $msg
- return
- }
- $shl path [m4_path_name bin otk.exe]
- set lvlPath [$flatObj lvlPath]
- $shl arguments "[m4_path_name tcl ude.tcl] -- $lvlPath"
- set guiName \
- "[$file qualifiedName " "] [ShortLongName::longName [$file type]].lnk"
- set f $env(TMP)\\$guiName
- $shl createIt $f
- lappend files $f
- }
- }
- set DragBrowsView::lastShellLink $files
- return $files
- }
-
- # Do not delete this line -- regeneration end marker
-
-