home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)otherude.tcl /main/titanic/2
- # Author: voyager
- # Description: try to find out if the the requested editor
- # is already running on the desktop
- #---------------------------------------------------------------------------
- # SccsId = @(#)otherude.tcl /main/titanic/2 27 Nov 1997 Copyright 1997 Cayenne Software Inc.
-
- require classmaker.tcl
-
- proc openOtherUde {levelPathObj name {yesScript ""} {noScript ""}} {
- set fv [$levelPathObj nameAt File]
- if [isObjectId $fv Graph:] {
- # levelpath ids specified
- set ids Id
- if {$name == ""} {
- set file [[Graph new $fv] file]
- set name [$file name].[$file type]
- }
- } else {
- # levelpath string specified
- set ids ""
- if {$name == ""} {
- set file [$levelPathObj nameAt File]
- set name [nt_get_name $file].[nt_get_type $file]
- }
- }
- set levelPath [$levelPathObj asString]
- set thisInterp [lrange [get_comm_name] 0 2]
- foreach interp [interps] {
- if {$interp == [get_comm_name]} {
- # this is us
- continue;
- }
- set otherUde [lindex $interp 0]
- if {$otherUde != "ude"} {
- # not an ude
- continue
- }
- set otherInterp [lrange $interp 0 2]
- set remCmd "\[ClientContext::global\] currentLevel"
- append remCmd ${ids}String
- if [catch {set otherLvl [send $interp $remCmd]}] {
- continue
- }
- if {"$otherLvl" != "$levelPath"} {
- # different levelpath
- continue
- }
- ClassMaker::extend YesNoWarningDialog OtherUdeDlg \
- {interp yesScr noScr}
- OtherUdeDlg new .main.ynwarn \
- -interp $interp \
- -yesScr $yesScript \
- -noScr $noScript \
- -message "Switch to already opened '$name'?" \
- -yesPressed {
- if [catch {send [%this interp] {.main popUp}
- eval [%this yesScr]}] {
- eval [%this noScr]
- }
- } \
- -noPressed {
- eval [%this noScr]
- } \
- -title "Diagram Editor"
- .main.ynwarn delHelpButton
- .main.ynwarn popUp
- return
- }
- eval $noScript
- return
- }
-