home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / propdefeda.tcl < prev    next >
Encoding:
Text File  |  1996-10-16  |  4.1 KB  |  161 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)propdefeda.tcl    /main/hindenburg/2
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)propdefeda.tcl    /main/hindenburg/2   16 Oct 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. require "propdefobj.tcl"
  13. require "propdefdia.tcl"
  14. # End user added include file section
  15.  
  16. require "custdefsar.tcl"
  17.  
  18. Class PropDefEdArea : {CustDefsArea} {
  19.     constructor
  20.     method destructor
  21.     method read
  22.     method deleteObjects
  23.     method newObject
  24.     method createObject
  25.     method clearArea
  26.     method getDefObject
  27.     method setDefObject
  28.     method removeDefObject
  29.     attribute propDefiner
  30.     attribute defObject
  31. }
  32.  
  33. global PropDefEdArea::ifClasses
  34. set PropDefEdArea::ifClasses ""
  35.  
  36.  
  37. constructor PropDefEdArea {class this name} {
  38.     set this [CustDefsArea::constructor $class $this $name]
  39.     $this defObject [Dictionary new]
  40.     # Start constructor user section
  41.     $this rowCount 12
  42.     $this columnCount 75
  43.     $this font "[m4_var get M4_font -context uce]"
  44.     $this destinationSet "PROPDEF dropEvent"
  45.     $this mode DETAIL
  46.     BrowsHeader new $this.name  -label Name -width 17
  47.     BrowsHeader new $this.name  -label "Long Name" -width 25
  48.     BrowsHeader new $this.type  -label "Interface class" -width 15
  49.     BrowsHeader new $this.level -label Level -width 15
  50.  
  51.     global PropDefEdArea::ifClasses
  52.     set PropDefEdArea::ifClasses {
  53.         CheckButton
  54.         ComboBox
  55.         DropDwnComboBox
  56.         DropDwnList
  57.         FloatField
  58.         IntField
  59.         MultiLineText
  60.         OptionMenu
  61.         RadioGroup
  62.         SingleLineText
  63.         TextList
  64.     }
  65.  
  66.     # End constructor user section
  67.     return $this
  68. }
  69.  
  70. method PropDefEdArea::destructor {this} {
  71.     # Start destructor user section
  72.     # End destructor user section
  73.     $this CustDefsArea::destructor
  74. }
  75.  
  76. method PropDefEdArea::read {this object type} {
  77.     
  78.     set defFileName [$this _curName]
  79.     set defFileType [$this _curType]
  80.  
  81.     global PropDefEdArea::ifClasses
  82.     set ifClasses ${PropDefEdArea::ifClasses}
  83.  
  84.     foreach defLine [$this readConfig $object $defFileName $defFileType] {
  85.         lappend_unique ifClasses "[lindex $defLine 2]"
  86.         regsub -all {(\\)([#!|\])} [lindex $defLine 3] {\2} ifOptions
  87.         $this createObject "shortName      \{[lindex $defLine 0]\}
  88.                     longName      \{[lindex $defLine 1]\}
  89.                     ifClass      \{[lindex $defLine 2]\}
  90.                     ifOptions      \{$ifOptions\} 
  91.                     ifMembers      \{[lindex $defLine 4]\}" \
  92.                     $type
  93.     }
  94.     
  95.     set PropDefEdArea::ifClasses [lsort $ifClasses]
  96. }
  97.  
  98. method PropDefEdArea::deleteObjects {this objs} {
  99.     foreach obj $objs {
  100.         $this removeDefObject [$obj shortName]
  101.     }
  102.     $this CustDefsArea::deleteObjects $objs
  103. }
  104.  
  105. method PropDefEdArea::newObject {this shortName longName ifClass {edit 0}} {
  106.     $this isChanged 1
  107.  
  108.     global PropDefEdArea::ifClasses
  109.     set ifClasses ${PropDefEdArea::ifClasses}
  110.     lappend_unique ifClasses "$ifClass"
  111.     set PropDefEdArea::ifClasses [lsort $ifClasses]
  112.  
  113.     set obj [$this createObject "shortName    \{$shortName\}
  114.                 longName    \{$longName\}
  115.                 ifClass    \{$ifClass\}
  116.                 specLevel    \{[$this _level]\}" \
  117.                 [$this _level]]
  118.  
  119.     $this sortArea
  120.  
  121.     if $edit {
  122.         $obj open
  123.     }
  124. }
  125.  
  126. method PropDefEdArea::createObject {this objSpec level} {
  127.     
  128.     global classCount
  129.     set newIndex [llength [$this objectSet]]
  130.     set object [PropDefObject new $this.Object$classCount $objSpec]
  131.     $this setDefObject [$object shortName] $object
  132.     $object index $newIndex
  133.     incr classCount
  134.  
  135.     $this adjustCreatedObject $object $level
  136.  
  137.     # update the object-details in the view
  138.     $object updateView
  139.  
  140.     return $object
  141. }
  142.  
  143. method PropDefEdArea::clearArea {this} {
  144.     $this CustDefsArea::clearArea
  145. }
  146.  
  147. # Do not delete this line -- regeneration end marker
  148.  
  149. method PropDefEdArea::getDefObject {this shortName} {
  150.     return [[$this defObject] set $shortName]
  151. }
  152.  
  153. method PropDefEdArea::setDefObject {this shortName newDefObject} {
  154.     [$this defObject] set $shortName $newDefObject
  155. }
  156.  
  157. method PropDefEdArea::removeDefObject {this shortName} {
  158.     [$this defObject] unset $shortName
  159. }
  160.  
  161.