home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / xf2.3-p / xf2 / xf2.3 / additionals / Stripchart < prev    next >
Encoding:
Text File  |  1993-11-20  |  7.5 KB  |  211 lines

  1. # Program: xf
  2. # Description: handle stripchart widgets
  3. #
  4. # $Header: Stripchart[2.3] Wed Mar 10 11:57:31 1993 garfield@garfield frozen $
  5.  
  6. global xfDefaultConf
  7. set xfDefaultConf(stripchart) 4
  8.  
  9. ##########
  10. # Procedure: XFAdd.Stripchart
  11. # Description: add a stripchart
  12. # Arguments: xfW - the widget
  13. #            xfName - a optional name
  14. #            xfType - add or config
  15. # Returns: none
  16. # Sideeffects: none
  17. ##########
  18. proc XFAdd.Stripchart {xfW xfName xfType} {
  19.   global xfStatus
  20.  
  21.   XFEditSetStatus "Inserting Stripchart..."
  22.   set xfName [XFMiscGetUniqueName $xfName stripchart]
  23.   if {"$xfStatus(path)" == "."} {
  24.     if {"$xfType" == "add"} {
  25.       if {[catch "stripchart .$xfName" xfResult]} {
  26.         XFProcError "$xfResult"
  27.         XFEditSetStatus "Inserting Stripchart...aborted"
  28.         return
  29.       }
  30.     } {
  31.       if {[catch "stripchart .$xfName" xfResult]} {
  32.         XFProcError "$xfResult"
  33.         XFEditSetStatus "Inserting Stripchart...aborted"
  34.         return
  35.       }
  36.     }
  37.  
  38.     XFMiscPositionWidget .$xfName
  39.     XFMiscBindWidgetTree .$xfName
  40.   } {
  41.     if {"$xfType" == "add"} {
  42.       if {[catch "stripchart $xfStatus(path).$xfName" xfResult]} {
  43.         XFProcError "$xfResult"
  44.         XFEditSetStatus "Inserting Stripchart...aborted"
  45.         return
  46.       }
  47.     } {
  48.       if {[catch "stripchart $xfStatus(path).$xfName" xfResult]} {
  49.         XFProcError "$xfResult"
  50.         XFEditSetStatus "Inserting Stripchart...aborted"
  51.         return
  52.       }
  53.     }
  54.  
  55.     XFMiscPositionWidget $xfStatus(path).$xfName
  56.     XFMiscBindWidgetTree $xfStatus(path).$xfName
  57.   }
  58.  
  59.   incr xfStatus(elementCounter)
  60.   XFEditSetPath $xfStatus(path)
  61.   XFEditSetStatus "Inserting Stripchart...done"
  62. }
  63.  
  64. ##########
  65. # Procedure: XFConfig.Stripchart4
  66. # Description: configure a stripchart
  67. # Arguments: xfW - the widget
  68. #            xfType - config type (add or config)
  69. #            xfClass - the class we configure
  70. #            xfLeader - the leading window
  71. # Returns: none
  72. # Sideeffects: none
  73. ##########
  74. proc XFConfig.Stripchart4 {xfW xfType xfClass {xfLeader ""}} {
  75.   global xfStatus
  76.  
  77.   if {"$xfType" == "add"} {
  78.     set xfName stripchart$xfStatus(elementCounter)
  79.   } {
  80.     set xfName [XFMiscPathName $xfW]
  81.   }
  82.   XFEditSetStatus "Calling parameter setting for Stripchart..."
  83.  
  84.   # build widget structure
  85.   XFTmpltToplevel .xf${xfClass}Config4 400x610 \
  86.     "Stripchart parameters:[XFMiscPathTail $xfW]" $xfLeader
  87.  
  88.   XFElementInit $xfW .xf${xfClass}Config4 $xfType $xfClass \
  89.     XFStripchartSetStripchart4 parameters $xfName 4
  90.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass bg \
  91.     background Background "Background" XFStripchartSetStripchart4
  92.   XFElementBoolean $xfW .xf${xfClass}Config4 $xfType $xfClass up \
  93.     "Draw up" XFStripchartSetStripchart4
  94.   XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass interval \
  95.     interval Interval "Interval" XFStripchartSetStripchart4
  96.   XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass numstrips \
  97.     numstrips Numstrips "Numstrips" "" 1000 \
  98.       XFStripchartSetStripchart4
  99.   XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass numticks \
  100.     numticks Numticks "Numticks" "" 100 \
  101.       XFStripchartSetStripchart4
  102.   XFElementBoolean $xfW .xf${xfClass}Config4 $xfType $xfClass showticks \
  103.     "Show ticks" XFStripchartSetStripchart4
  104.   XFElementSize $xfW .xf${xfClass}Config4 $xfType $xfClass \
  105.     XFStripchartSetStripchart4
  106.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass stripcolor \
  107.     stripcolor Stripcolor "Strip color" XFStripchartSetStripchart4
  108.   XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass title \
  109.     title Title "Text" XFStripchartSetStripchart4
  110.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass textcolor \
  111.     textcolor Foreground "Text color" XFStripchartSetStripchart4
  112.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass tickcolor \
  113.     tickcolor Foreground "Tick color" XFStripchartSetStripchart4
  114.   XFElementScaleDouble $xfW .xf${xfClass}Config4 $xfType \
  115.     $xfClass value "Value" "Min" "Max" 1000 1000
  116.   XFElementCommand $xfW .xf${xfClass}Config4 $xfType
  117.  
  118.  
  119.   .xf${xfClass}Config4.params1.params2.value.value1.value1 set \
  120.     [lindex [$xfW config -min] 4]
  121.   .xf${xfClass}Config4.params1.params2.value.value2.value2 set \
  122.     [lindex [$xfW config -max] 4]
  123.  
  124.   XFMiscSetResource \
  125.     .xf${xfClass}Config4.params1.params2.value.value1.value1 \
  126.       command "XFStripchartSetStripchart4 $xfW 0 $xfClass"
  127.   XFMiscSetResource \
  128.     .xf${xfClass}Config4.params1.params2.value.value2.value2 \
  129.       command "XFStripchartSetStripchart4 $xfW 0 $xfClass"
  130.  
  131.   # save current parameter
  132.   XFElementSave $xfW $xfClass {background interval numstrips numticks showticks stripcolor title textcolor tickcolor up max min width height command}
  133.  
  134.   # packing
  135.   pack append .xf${xfClass}Config4.params1 \
  136.               .xf${xfClass}Config4.params1.params2 {left fill expand}
  137.   pack append .xf${xfClass}Config4 \
  138.               .xf${xfClass}Config4.pathname {top fill frame center} \
  139.               .xf${xfClass}Config4.leave {bottom fill} \
  140.               .xf${xfClass}Config4.additional {bottom fill} \
  141.               .xf${xfClass}Config4.params1 {top fill expand}
  142.  
  143.   XFBindFormConnect .xf${xfClass}Config4.params1.params2 \
  144.     "XFStripchartSetStripchart4 $xfW 0 $xfClass"
  145.  
  146.   XFEditSetStatus "Calling parameter setting for Stripchart...done"
  147. }
  148.  
  149. ##########
  150. # Procedure: XFStripchartSetStripchart4
  151. # Description: set stripchart parameters
  152. # Arguments: xfW - the widget
  153. #            xfType - the type of setting (1 = set always, 0 = set
  154. #                     only if permanent apply is on)
  155. #            xfClass - the class we configure
  156. #            xfParam1 - ignored parameter
  157. # Returns: none
  158. # Sideeffects: none
  159. ##########
  160. proc XFStripchartSetStripchart4 {xfW xfType xfClass {xfParam1 ""}} {
  161.   global xfConf
  162.   global xfMisc
  163.  
  164.   if {$xfType == 0 && !$xfConf(applyParameters)} {
  165.     return
  166.   }
  167.   if {"[info commands $xfW]" == ""} {
  168.     return
  169.   }
  170.   XFMiscSetSymbolicName $xfW \
  171.     [.xf${xfClass}Config4.params1.params2.symname.symname get]
  172.  
  173.   XFMiscSetResource $xfW background \
  174.     [.xf${xfClass}Config4.params1.params2.bg.bg get]
  175.   XFMiscSetResource $xfW command \
  176.     [XFMiscGetText .xf${xfClass}Config4.params1.params2.command.command.command]
  177.   if {"[.xf${xfClass}Config4.params1.params2.interval.interval get]" != ""} {
  178.     XFMiscSetResource $xfW interval \
  179.       [.xf${xfClass}Config4.params1.params2.interval.interval get]
  180.   } {
  181.     XFMiscSetResource $xfW interval 0
  182.   }
  183.   XFMiscSetResource $xfW max \
  184.     [.xf${xfClass}Config4.params1.params2.value.value2.value2 get]
  185.   XFMiscSetResource $xfW min \
  186.     [.xf${xfClass}Config4.params1.params2.value.value1.value1 get]
  187.   XFMiscSetResource $xfW numstrips \
  188.     [.xf${xfClass}Config4.params1.params2.numstrips.numstrips get]
  189.   XFMiscSetResource $xfW numticks \
  190.     [.xf${xfClass}Config4.params1.params2.numticks.numticks get]
  191.   XFMiscSetResource $xfW showticks $xfMisc(showticks)
  192.   if {"[.xf${xfClass}Config4.params1.params2.stripcolor.stripcolor get]" != ""} {
  193.     XFMiscSetResource $xfW stripcolor \
  194.       [.xf${xfClass}Config4.params1.params2.stripcolor.stripcolor get]
  195.   }
  196.   XFMiscSetResource $xfW textcolor \
  197.     [.xf${xfClass}Config4.params1.params2.textcolor.textcolor get]
  198.   XFMiscSetResource $xfW tickcolor \
  199.     [.xf${xfClass}Config4.params1.params2.tickcolor.tickcolor get]
  200.   XFMiscSetResource $xfW title \
  201.     [.xf${xfClass}Config4.params1.params2.title.title get]
  202.   XFMiscSetResource $xfW up $xfMisc(up)
  203.   XFMiscSetResource $xfW height \
  204.     [.xf${xfClass}Config4.params1.params2.size.size2.size2 get]
  205.   XFMiscSetResource $xfW width \
  206.     [.xf${xfClass}Config4.params1.params2.size.size1.size1 get]
  207. }
  208.  
  209. # eof
  210.  
  211.