home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / komix / DATA.Z / otherude.tcl < prev    next >
Text File  |  1997-11-27  |  2KB  |  77 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1997
  4. #
  5. #      File:           @(#)otherude.tcl    /main/titanic/2
  6. #      Author:         voyager
  7. #      Description:    try to find out if the the requested editor
  8. #               is already running on the desktop
  9. #---------------------------------------------------------------------------
  10. # SccsId = @(#)otherude.tcl    /main/titanic/2   27 Nov 1997 Copyright 1997 Cayenne Software Inc.
  11.  
  12. require classmaker.tcl
  13.  
  14. proc openOtherUde {levelPathObj name {yesScript ""} {noScript ""}} {
  15.     set fv [$levelPathObj nameAt File]
  16.     if [isObjectId $fv Graph:] {
  17.         # levelpath ids specified
  18.         set ids Id
  19.         if {$name == ""} {
  20.             set file [[Graph new $fv] file]
  21.             set name [$file name].[$file type]
  22.         }
  23.     } else {
  24.         # levelpath string specified
  25.         set ids ""
  26.         if {$name == ""} {
  27.             set file [$levelPathObj nameAt File]
  28.             set name [nt_get_name $file].[nt_get_type $file]
  29.         }
  30.     }
  31.     set levelPath [$levelPathObj asString]
  32.     set thisInterp [lrange [get_comm_name] 0 2]
  33.     foreach interp [interps] {
  34.         if {$interp == [get_comm_name]} {
  35.             # this is us
  36.             continue;
  37.         }
  38.         set otherUde [lindex $interp 0]
  39.         if {$otherUde != "ude"} {
  40.             # not an ude
  41.             continue
  42.         }
  43.         set otherInterp [lrange $interp 0 2]
  44.         set remCmd "\[ClientContext::global\] currentLevel"
  45.         append remCmd ${ids}String
  46.         if [catch {set otherLvl [send $interp $remCmd]}] {
  47.             continue
  48.         }
  49.         if {"$otherLvl" != "$levelPath"} {
  50.             # different levelpath
  51.             continue
  52.         }
  53.         ClassMaker::extend YesNoWarningDialog OtherUdeDlg \
  54.             {interp yesScr noScr}
  55.         OtherUdeDlg new .main.ynwarn \
  56.           -interp $interp \
  57.           -yesScr $yesScript \
  58.           -noScr $noScript \
  59.           -message "Switch to already opened '$name'?" \
  60.           -yesPressed {
  61.               if [catch {send [%this interp] {.main popUp}
  62.                         eval [%this yesScr]}] {
  63.                 eval [%this noScr]
  64.             }
  65.           } \
  66.           -noPressed {
  67.               eval [%this noScr]
  68.           } \
  69.           -title "Diagram Editor"
  70.         .main.ynwarn delHelpButton
  71.         .main.ynwarn popUp
  72.         return
  73.     }
  74.     eval $noScript
  75.     return
  76. }
  77.