home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / newdocvdlg.tcl < prev    next >
Encoding:
Text File  |  1997-05-23  |  4.4 KB  |  163 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Westmount Technology    1994
  4. #
  5. #      File:           @(#)newdocvdlg.tcl    /main/hindenburg/1
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)newdocvdlg.tcl    /main/hindenburg/1   23 May 1997 Copyright 1994 Westmount Technology
  10.  
  11. # Start user added include file section
  12. require "wmt_util.tcl"
  13. # End user added include file section
  14.  
  15.  
  16. Class NewDocVDlg : {TemplateDialog} {
  17.     constructor
  18.     method destructor
  19.     method handleCancel
  20.     method handleHelp
  21.     method handleOk
  22.     method handleSelectionChanged
  23.     method popUp
  24.     attribute dbObj
  25. }
  26.  
  27. constructor NewDocVDlg {class this name} {
  28.     set this [TemplateDialog::constructor $class $this $name]
  29.     # Start constructor user section
  30.  
  31.     interface DlgColumn $this.top {
  32.         Label nameLab {
  33.         text "Document Name:"
  34.         }
  35.         SingleLineText name {}
  36.         Label docsysLab {
  37.         text "Documented System:"
  38.         }
  39.         ComboBox docsys {
  40.         rowCount 5
  41.         }
  42.         Label editorLab {
  43.         text "Editor:"
  44.         }
  45.         OptionMenu editor {
  46.         }
  47.     }
  48.     $this config \
  49.         -modal yes \
  50.         -title "New Document Version" \
  51.         -okPressed "$this handleOk" \
  52.         -cancelPressed "$this handleCancel" \
  53.         -helpPressed "$this handleHelp"
  54.  
  55.     # Selection-changed callback 
  56.     $this.top.docsys textModified {
  57.         set dialog [getParent [getParent %this]]
  58.         $dialog handleSelectionChanged
  59.     }
  60.     $this.top.name textModified "$this handleSelectionChanged"
  61.  
  62.     # Fill list of available editors
  63.     if $win95 {
  64.         set entrySet {Word Wd97}
  65.     } else {
  66.         set entrySet {Fm40 Fm50 Il60}
  67.     }
  68.     $this.top.editor config \
  69.         -entrySet $entrySet \
  70.         -selected [lindex $entrySet 0]
  71.  
  72.     # End constructor user section
  73.     return $this
  74. }
  75.  
  76. method NewDocVDlg::destructor {this} {
  77.     # Start destructor user section
  78.     # End destructor user section
  79. }
  80.  
  81. method NewDocVDlg::handleCancel {this} {
  82. }
  83.  
  84. method NewDocVDlg::handleHelp {this} {
  85.     [getParent $this] helpOnName [nt_get_type $this]
  86. }
  87.  
  88. method NewDocVDlg::handleOk {this} {
  89.     set dbObj [$this dbObj]
  90.     set docsys [$this.top.docsys text]
  91.     set docname [$this.top.name text]
  92.     set doctype [lindex ${BrowserProcs::systemTypes} 1]
  93.     set editor [$this.top.editor selected]
  94.  
  95.     set script "set docV \[$dbObj createSystemVersion \
  96.     [list $docname] cl [list $doctype] [$dbObj getParent ConfigVersion] 0\]"
  97.     append script " ;"
  98.     append script " \$docV setProperty editor [list $editor]"
  99.     append script " ;"
  100.     append script " \$docV setProperty doc_sys [list $docsys]"
  101.     append script " ;"
  102.     append script " set propInfo \[PIPropInfo new\]"
  103.     append script " ;"
  104.     append script " \$propInfo edit \$docV"
  105.     append script " ;"
  106.     append script " set prop \[\$propInfo findProperty doc_sys\]"
  107.     append script " ;"
  108.     append script " PIPropItemRef new \$prop cl scopePhase"
  109.     append script " ;"
  110.     append script " \$propInfo save"
  111.     append script " ;"
  112.     append script " \$propInfo delete"
  113.  
  114.     if [[$dbObj findSystemVersion -byNameAndType "$docsys" system] isNil] {
  115.     set endScript "wmtkwarning \
  116.         \"SystemVersion with name '$docsys' does not\
  117.           exist within the current PhaseVersion\""
  118.     } else {
  119.     set endScript ""
  120.     }
  121.  
  122.     $wmttoolObj startCommand tcl \
  123.     "$script" "$endScript" \
  124.     "Creating $doctype version '$docname'..." \
  125.     {1 0} 1
  126. }
  127.  
  128. method NewDocVDlg::handleSelectionChanged {this} {
  129.     if {"[rmWhiteSpace [$this.top.name text]]" == "" ||
  130.     "[rmWhiteSpace [$this.top.docsys text]]" == ""} {
  131.     set selected 0
  132.     } else {
  133.     set selected 1
  134.     }
  135.     $this okSensitive $selected
  136.     $this okDefault $selected
  137.     $this cancelDefault [expr 1 - $selected]
  138. }
  139.  
  140. method NewDocVDlg::popUp {this} {
  141.     # Fill list of documented systems
  142.     set entrySet ""
  143.     foreach sysV [[$this dbObj] getChildSet systemVersions] {
  144.     set sys [$sysV system]
  145.     if {"[$sys type]" != "system"} continue
  146.     lappend entrySet "[$sys name]"
  147.     }
  148.     set entrySet [lsort $entrySet]
  149.     set text [$this.top.docsys text]
  150.     if {"$text" == "" || [lsearch -exact $entrySet "$text"] == -1} {
  151.     set text [lindex $entrySet 0]
  152.     }
  153.     $this.top.docsys config \
  154.     -entrySet $entrySet \
  155.     -text $text
  156.  
  157.     $this handleSelectionChanged
  158.     $this TemplateDialog::popUp
  159. }
  160.  
  161. # Do not delete this line -- regeneration end marker
  162.  
  163.