home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / openbyname.tcl < prev    next >
Text File  |  1996-09-17  |  2KB  |  90 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Westmount Technology    1994
  4. #
  5. #      File:           @(#)openbyname.tcl    /main/hindenburg/2
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)openbyname.tcl    /main/hindenburg/2   17 Sep 1996 Copyright 1994 Westmount Technology
  10.  
  11. # Start user added include file section
  12.  
  13. if {[info commands SelectionDialog] == ""} {
  14.     require pcsel.tcl
  15. }
  16.  
  17. # End user added include file section
  18.  
  19.  
  20. Class OpenByName : {SelectionDialog} {
  21.     constructor
  22.     method destructor
  23.     method popUp
  24.     method handleOk
  25.     attribute filevList
  26.     attribute fileNameList
  27.     attribute editor
  28. }
  29.  
  30. constructor OpenByName {class this name} {
  31.     set this [SelectionDialog::constructor $class $this $name]
  32.     # Start constructor user section
  33.     $this config -okPressed {%this handleOk} \
  34.              -helpPressed {.main helpOnName openByName} \
  35.              -rowCount 10 \
  36.              -message "Select diagram to open:" \
  37.              -title "Open By Name"
  38.     # End constructor user section
  39.     return $this
  40. }
  41.  
  42. method OpenByName::destructor {this} {
  43.     # Start destructor user section
  44.     # End destructor user section
  45. }
  46.  
  47. method OpenByName::popUp {this} {
  48.     set ed [$this editor]
  49.     set sysV [$ed systemVersion]
  50.     set type [$ed diagramType]
  51.     set fileVersions [$sysV localFileVersions]
  52.     set myTypeFileList ""
  53.     set myTypeNameList ""
  54.     foreach fv $fileVersions {
  55.         if {[[$fv file] type] == "$type"} {
  56.             lappend myTypeFileList $fv
  57.             lappend myTypeNameList [[$fv file] name]
  58.         }
  59.     }
  60.     $this filevList $myTypeFileList
  61.     $this fileNameList $myTypeNameList
  62.     $this entrySet [lsort $myTypeNameList]
  63.     $this SelectionDialog::popUp
  64. }
  65.  
  66. method OpenByName::handleOk {this} {
  67.     set selected [rmWhiteSpace [$this text]]
  68.     set index [lsearch -exact [$this fileNameList] $selected]
  69.     if {$index == -1} {
  70.         busy {
  71.             set ed [$this editor]
  72.             wmtkmessage "Creating '$selected.$type'"
  73.             set sysV [$ed systemVersion]
  74.             set configV [$ed configVersion]
  75.             set type [$ed diagramType]
  76.             set itemType [file2itemtype $type]
  77.             set scopePhase [fileHasScopePhase $type]
  78.             set newFile [$sysV createFileVersion \
  79.                     $selected $itemType $scopePhase \
  80.                     $type graph $configV]
  81.             $ed doEdit $newFile
  82.         }
  83.     } else {
  84.         [$this editor] doEdit [lindex [$this filevList] $index]
  85.     }
  86. }
  87.  
  88. # Do not delete this line -- regeneration end marker
  89.  
  90.