home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / newdiagram.tcl < prev    next >
Text File  |  1996-07-30  |  4KB  |  138 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)newdiagram.tcl    /main/hindenburg/2
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)newdiagram.tcl    /main/hindenburg/2   30 Jul 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. require "newobjentr.tcl"
  15.  
  16. Class NewDiagramDlg : {NewObjEntryDlg} {
  17.     constructor
  18.     method destructor
  19.     method handleEdit
  20.     method handleOk
  21.     method handleTextModified
  22.     method popUp
  23.     attribute type
  24.     attribute qualified
  25.     attribute createInterface
  26. }
  27.  
  28. constructor NewDiagramDlg {class this name} {
  29.     set this [NewObjEntryDlg::constructor $class $this $name]
  30.     $this createInterface 1
  31.     # Start constructor user section
  32.  
  33.     $this config \
  34.         -okPressed "$this handleOk"
  35.     PushButton new $this.edit \
  36.         -label Edit \
  37.         -activated "$this handleEdit"
  38.  
  39.     # End constructor user section
  40.     return $this
  41. }
  42.  
  43. method NewDiagramDlg::destructor {this} {
  44.     # Start destructor user section
  45.     # End destructor user section
  46.     $this NewObjEntryDlg::destructor
  47. }
  48.  
  49. method NewDiagramDlg::handleEdit {this} {
  50.     $this popDown
  51.     $this handleOk
  52.     if [isCommand [$this createdObj]] {
  53.     [$this createdObj] editFile
  54.     }
  55. }
  56.  
  57. method NewDiagramDlg::handleOk {this} {
  58.     set fileType [$this type]
  59.     set itemType [file2itemtype $fileType]
  60.     set configV [[$this dbObj] getParent ConfigVersion]
  61.  
  62.     set message "Creating $fileType file version"
  63.     set script "$this createdObj \"\""
  64.     append script " ;"
  65.  
  66.     if [$this qualified] {
  67.     set className [$this entry]
  68.     set fileName [$this.top.name2 text]
  69.     set message "$message '${className}:${fileName}'..."
  70.  
  71.     append script " \
  72.         set sysItem [[[$this dbObj] itemKeeper] findDeclareItem \
  73.         -byName $className cl scopePhaseDef]"
  74.     append script " ;"
  75.     append script " \
  76.         set item \[\[\$sysItem item\] findCreateItem \
  77.         \"$fileName\" $itemType\]"
  78.     append script " ;"
  79.     append script " \
  80.         $this createdObj \[[$this dbObj] createFileVersion \
  81.         \$item \
  82.         [fileHasScopePhase $fileType] $fileType graph $configV\]"
  83.     } else {
  84.     set fileName [$this entry]
  85.     set message "$message '$fileName'..."
  86.  
  87.     append script " \
  88.         $this createdObj \[[$this dbObj] createFileVersion \
  89.         \"$fileName\" $itemType \
  90.         [fileHasScopePhase $fileType] $fileType graph $configV\]"
  91.     }
  92.     $wmttoolObj startCommand tcl "$script" "" $message {1 0} 1
  93. }
  94.  
  95. method NewDiagramDlg::handleTextModified {this} {
  96.     if {[$this qualified] && "[rmWhiteSpace [$this.top.name2 text]]" == ""} {
  97.     $this entry [$this.top.name text]
  98.     set selected 0
  99.     $this okSensitive $selected
  100.     $this.edit sensitive $selected
  101.     $this okDefault $selected
  102.     $this cancelDefault [expr 1 - $selected]
  103.     } else {
  104.     $this NewObjEntryDlg::handleTextModified
  105.     $this.edit sensitive [$this okSensitive]
  106.     }
  107. }
  108.  
  109. method NewDiagramDlg::popUp {this} {
  110.     if [$this createInterface] {
  111.     $this createInterface 0
  112.     case [$this type] in {
  113.         {etd std} {
  114.         set message "Class Name:"
  115.         set qualified 1
  116.         }
  117.         default {
  118.         set message "Diagram Name:"
  119.         set qualified 0
  120.         }
  121.     }
  122.     $this config \
  123.         -title "New [$this type]" \
  124.         -qualified $qualified \
  125.         -message $message
  126.     if $qualified {
  127.         Label new $this.top.nameLab2 \
  128.         -text "Name:"
  129.         SingleLineText new $this.top.name2 \
  130.         -textModified "$this handleTextModified"
  131.     }
  132.     }
  133.     $this NewObjEntryDlg::popUp
  134. }
  135.  
  136. # Do not delete this line -- regeneration end marker
  137.  
  138.