--- /dev/null
+
+ This is a (for lack of a better name) hypertext widget.
+
+This widget combines text and other Tk widgets in the same window.
+It is sort of a cross between a read-only text widget and the pack command.
+Any widget can be attached to the hypertext window by the %%
+set this $htext(widget)
+label $this.lab -text "append " -relief sunken \
+ -font *-Courier-Bold-R-Normal-*-12-120-*
+$this append $this.lab
+%% command.
+For example,
+%% message $this.msg -relief sunken -bd 2 -aspect 10000 -font \
+ *-Courier-Medium-R-Normal-*-12-* -text {set w $htext(widget)
+label $w.face -bitmap @bitmaps/face.xbm \
+ -relief sunken -borderwidth 2
+$w append $w.face -padx 2 -pady 0.25i}
+$this append $this.msg \
+ -fill both %% added this %%
+global tk_library
+label $this.face \
+ -bitmap @bitmaps/face.xbm \
+ -relief sunken -borderwidth 2
+$this append $this.face -padx 2 -pady 0.25i
+%%.
+There can be many types of widgets in the same document. For example,
+this is a simple %%
+button $this.but -bg pink -text { button } \
+ -command { puts stderr { a stupid message } }
+$this append $this.but
+%%. If you click on the button, it prints a stupid message.
+Any Tk widget can be used, including %%
+set whichTile 0
+proc ChangeTile { w } {
+ global whichTile
+
+ if { $whichTile } {
+ $w configure -tile bgTexture2
+ } else {
+ $w configure -tile bgTexture1
+ }
+}
+checkbutton $this.ckbut -bg lightblue -text { check buttons } \
+ -variable whichTile -command "ChangeTile $this"
+$this append $this.ckbut -justify top
+%%, %%
+radiobutton $this.rdbut -bg mediumseagreen -text { radio buttons } \
+ -command { puts stderr { radio button pressed } }
+$this append $this.rdbut -justify bottom
+%%,
+and scales %%
+# -sliderforeground
+scale $this.sc -showvalue true \
+ -length 100 \
+ -foreground powderblue \
+ -sliderlength 10 \
+ -orient horizontal
+$this append $this.sc
+%%.
+
+ Widget trees can be also be included. The following example is
+*borrowed* from the widget demo. It is a couple of frames surrounding a
+listbox, a message, and a button widget.
+%%
+ set w $this.frame
+ frame $w
+ message $w.msg -font *times-medium-r-normal--*-12-120-* -aspect 300 \
+ -text "A listbox containing the 50 states is displayed below, along with a scrollbar. You can scan the list either using the scrollbar or by dragging in the listbox window with button 3 pressed. Click the \"OK\" button when you've seen enough." -bg lightsteelblue -relief sunken
+ frame $w.frame -borderwidth 10
+ pack append $w.frame \
+ [scrollbar $w.frame.scroll -relief sunken \
+ -command "$w.frame.list yview"] {right expand filly frame w} \
+ [listbox $w.frame.list -yscroll "$w.frame.scroll set" -relief sunken] \
+ {left expand filly frame e}
+ $w.frame.list insert 0 Alabama Alaska Arizona Arkansas California \
+ Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois \
+ Indiana Iowa Kansas Kentucky Louisiana Maine Maryland \
+ Massachusetts Michigan Minnesota Mississippi Missouri \
+ Montana Nebraska Nevada "New Hampshire" "New Jersey" "New Mexico" \
+ "New York" "North Carolina" "North Dakota" \
+ Ohio Oklahoma Oregon Pennsylvania "Rhode Island" \
+ "South Carolina" "South Dakota" \
+ Tennessee Texas Utah Vermont Virginia Washington \
+ "West Virginia" Wisconsin Wyoming
+ button $w.ok -text OK -command "puts stderr $w; destroy $w"
+
+ pack append $w $w.msg {top fill} $w.frame {top expand fill} \
+ $w.ok {bottom fill}
+ $w config -bg lightsteelblue -relief sunken
+
+$this append $w -pady 0.25i
+%%
+
+You can add you own home-grown widgets. Here's the graph widget.
+Beside it is the "color" demo. Moving the scales, adjusts the background
+color of the graph.
+%%
+#
+# Simple script to change colors of a window.
+#
+global xlabel ylabel red green blue graph
+set red 255
+set green 215
+set blue 0
+
+option add *Scale.sliderForeground "#cdb79e"
+option add *Scale.activeForeground "#ffe4c4"
+set w $this.colorFrame
+frame $w
+scale $w.red -command "color red" -label "Red Intensity" \
+ -from 0 -to 255 -orient horizontal -bg "#ffaeb9" -length 250
+scale $w.green -command "color green" -label "Green Intensity" \
+ -from 0 -to 255 -orient horizontal -bg "#43cd80"
+scale $w.blue -command "color blue" -label "Blue Intensity" \
+ -from 0 -to 255 -orient horizontal -bg "#7ec0ee"
+
+$w.blue set $blue
+$w.green set $green
+$w.red set $red
+
+pack append $w $w.red {top expand fill}
+pack append $w $w.green {top expand fill}
+pack append $w $w.blue {top expand fill}
+
+proc color {which intensity} {
+ global red green blue graph xlabel ylabel
+ set $which $intensity
+ set rgb [format #%02x%02x%02x $red $green $blue]
+ $graph config -bg $rgb
+ $xlabel config -bg $rgb
+ $ylabel config -bg $rgb
+}
+
+$this append $w
+
+%%
+%%
+proc makeplot { widget } {
+
+ graph $widget
+ set X {
+ 2.00000e-01 4.00000e-01 6.00000e-01 8.00000e-01 1.00000e+00
+ 1.20000e+00 1.40000e+00 1.60000e+00 1.80000e+00 2.00000e+00
+ 2.20000e+00 2.40000e+00 2.60000e+00 2.80000e+00 3.00000e+00
+ 3.20000e+00 3.40000e+00 3.60000e+00 3.80000e+00 4.00000e+00
+ 4.20000e+00 4.40000e+00 4.60000e+00 4.80000e+00 5.00000e+00
+ }
+
+ $widget element create Y1 -x $X -y {
+ 1.14471e+01 2.09373e+01 2.84608e+01 3.40080e+01 3.75691e+01
+ 3.91345e+01 3.92706e+01 3.93474e+01 3.94242e+01 3.95010e+01
+ 3.95778e+01 3.96545e+01 3.97313e+01 3.98081e+01 3.98849e+01
+ 3.99617e+01 4.00384e+01 4.01152e+01 4.01920e+01 4.02688e+01
+ 4.03455e+01 4.04223e+01 4.04990e+01 4.05758e+01 4.06526e+01
+ } -symbol circle -label VGS=2.0 -color blue4 -fill blue
+
+ $widget element create Y2 -x $X -y {
+ 2.61825e+01 5.04696e+01 7.28517e+01 9.33192e+01 1.11863e+02
+ 1.28473e+02 1.43140e+02 1.55854e+02 1.66606e+02 1.75386e+02
+ 1.82185e+02 1.86994e+02 1.89802e+02 1.90683e+02 1.91047e+02
+ 1.91411e+02 1.91775e+02 1.92139e+02 1.92503e+02 1.92867e+02
+ 1.93231e+02 1.93595e+02 1.93958e+02 1.94322e+02 1.94686e+02
+ } -symbol diamond -label VGS=3.5 -color green4 -fill green
+
+ $widget element create Y3 -x $X -y {
+ 4.07008e+01 7.95658e+01 1.16585e+02 1.51750e+02 1.85051e+02
+ 2.16479e+02 2.46024e+02 2.73676e+02 2.99427e+02 3.23267e+02
+ 3.45187e+02 3.65177e+02 3.83228e+02 3.99331e+02 4.13476e+02
+ 4.25655e+02 4.35856e+02 4.44073e+02 4.50294e+02 4.54512e+02
+ 4.56716e+02 4.57596e+02 4.58448e+02 4.59299e+02 4.60151e+02
+ } -symbol triangle -label VGS=5.0 -color red4 -fill red
+
+}
+
+option add *graph.title "Plot Title"
+option add *graph.xTitle "X Axis Label"
+option add *graph.yTitle "Y Axis Label"
+#option add *graph.legendMapped false
+option add *graph.elemPixels 8
+option add *graph.relief ridge
+option add *graph.borderWidth 2
+
+set graph $this.graph
+set xlabel $this.xlab
+set ylabel $this.ylab
+makeplot $graph
+$this append $graph -padx 0.25i -pady 0.25i
+
+%%
+If you click on any button in the graph, you will get the coordinate
+values at the pointer location.
+
+The current coordinate values are %%
+label $xlabel -text { ??? ??? } -relief sunken
+label $ylabel -text { ??? ??? } -relief sunken
+bind $graph <ButtonPress> {labelxy [ %W invtransform %x %y ]}
+
+proc labelxy { values } {
+ global xlabel ylabel
+ scan $values "%e %e" x y
+ $xlabel config -text $x
+ $ylabel config -text $y
+}
+$this append $this.xlab -width 100 -fill x
+%% and %%
+$this append $this.ylab -width 100 -fill x
+%%.
+
+
+There are four global variables automatically created when a hypertext
+file is read. They are:
+
+%%
+button $this.l1 -text " \$htext(widget) " \
+ -command "puts $this" -bg orange
+$this append $this.l1 -width 200 -pady 4
+%%the pathname of the hypertext widget.
+%%
+button $this.l2 -text " \$htext(file) " \
+ -command "puts $htext(file)" -bg orange
+$this append $this.l2 -width 200 -pady 4
+%%the file being read.
+%%
+button $this.l3 -text " \$htext(line) " \
+ -command "puts $htext(line)" -bg orange
+$this append $this.l3 -width 200 -pady 4
+%%the current line number.
+%%
+button $this.l4 -text " \$htext(index) " \
+ -command "puts $htext(index)" -bg orange
+$this append $this.l4 -width 200 -pady 4
+%%the current index in the text.
+
+Click on any button and the current value is printed on standard output.
+
+The hypertext widget works with plain text too. If you don't want
+to read it, click on the %%
+button $this.goto -text button -fg purple -bg white \
+ -command "global endOfText; $this gotoline \$endOfText"
+$this append $this.goto
+%% to jump to the end of the plain text.
+
+ ------------------------------------------------------
+
+[This is a pre-release version of BLT. It's basically the latest
+
+snapshot of BLT, as it moves towards a full release. What this means
+is that the documentation and demos still need work. Let me know
+about any configuration/compiler/installation goofs so I make sure
+they're fixed for the next release.]
+
+This is version 2.4 of the BLT library. It's an extension to the
+Tcl/Tk toolkit. You simply compile and link with the Tcl/Tk
+libraries. It does not require the Tcl or Tk source files.
+
+BLT is available from
+
+ ftp.tcltk.com
+
+in the "pub/blt" directory. The URL is
+
+ ftp://ftp.tcltk.com/pub/blt/BLT2.4.tar.gz
+
+This release has been compiled and tested with versions:
+
+ Tcl 7.5 / Tk 4.1
+ Tcl 7.6 / Tk 4.2
+ Tcl/Tk 8.0
+ Tcl/Tk 8.1a2
+
+What is BLT?
+
+ BLT is an extension to Tk. It adds plotting widgets (X-Y graph,
+ barchart, stripchart), a powerful geometry manager, a new canvas
+ item, and several new commands to Tk.
+
+ Plotting widgets:
+
+ graph, barchart, stripchart
+ BLT has X-Y graph, barchart, and stripchart widgets that are
+ both easy to use and customize. All the widgets work with
+ BLT vector data objects, which makes it easy to manage data.
+
+ Hierarchical list box:
+
+ hierbox Displays a general ordered tree which may be built
+ on-the-fly or all at once.
+
+ Tab set:
+
+ tabset Can be used either as a tab notebook or simple tabset.
+ Multi-tiered and/or scrolled tabsets are available.
+ Notebook pages can be torn-off into separate windows and
+ later put back.
+
+ Geometry Manager:
+
+ table A table-based geometry manager. Lets you specify widget
+ layouts by row and column positions in the table. Unlike the
+ packer or grid, you can finely control and constrain window
+ sizes.
+
+ Vector Data Object:
+
+ vector Lets you manage a vector of floating point values in a
+ high-level fashion. Vectors inter-operate seamlessly with
+ the plotting widgets. The graphs will automatically redraw
+ themselves when the vector data changes. Vector's components
+ can be managed through a Tcl array variable, a Tcl command,
+ or the using its own C API.
+
+ Background Program Execution:
+
+ bgexec Like Tcl's "exec ... &", but collects the output, error, and
+ status of the detached UNIX subprocesses. Sets a Tcl variable
+ upon completion.
+
+ Busy Command:
+
+ busy For preventing user-interactions when the application is
+ busy. Manages an invisible "busy" window which prevents
+ further user interactions (keyboard, mouse, button, etc.).
+ Also you can provide a busy cursor that temporarily
+ overrides those of the Tk widgets.
+
+ New Canvas Item:
+
+ eps An new item is added to the Tk canvas for handling
+ encapsulated PostScript. It lets you embed an EPS file into
+ the canvas displaying either an EPS preview image found in
+ the file, or a Tk image that you provide. When you print
+ the canvas the EPS item will automatically include the EPS
+ file, translating and scaling the PostScript. For example,
+ you could use "eps" items to tile several PostScript pages
+ into single page.
+
+ The "eps" item can also be used as a replacement for "image"
+ canvas items. Unlike "image" canvas items, the image of an
+ eps item can be printed and scaled arbitrarily.
+
+ Drag & Drop Facility:
+
+ drag&drop Adds drag-n-drop capabilities to Tk. It uses "send"-style
+ communication between drag-drop sources and targets. The
+ result is a much more powerful drag-and-drop mechanism than
+ is available with OpenLook or Motif.
+
+ Bitmap Command:
+
+ bitmap Lets you read and write bitmaps from Tcl. You can define
+ bitmaps from ordinary text strings. Bitmaps can also be
+ scaled and rotated. For example, you can create a button
+ with rotated text by defining a bitmap from a text string
+ and rotating it. You can then use the bitmap in the button
+ widget.
+
+ Miscellaneous Commands:
+
+ winop Basic window operations. You can raise, lower, map, or,
+ unmap windows. Other operations let you move the pointer
+ or take photo image snapshots of Tk widgets.
+
+ bltdebug Lets you trace the execution of Tcl commands and procedures.
+ Prints out each Tcl command before it's executed.
+
+ watch Lets you specify Tcl procedures to be run before and/or
+ after every Tcl command. May be used for logging, tracing,
+ profiling, or debugging or Tcl code.
+
+ spline Computes a spline fitting a set of data points (x and y
+ vectors) and produces a vector of the interpolated images
+ (y-coordinates) at a given set of x-coordinates.
+
+ htext A simple hypertext widget. Allows text and Tk widgets to
+ be combined in a scroll-able text window. Any Tk widget
+ can be embedded and used to form hyper-links. Other
+ options allow for selections and text searches.
+
+What's new in 2.4?
+
+ 1. "eps" canvas item.
+
+ An encapsulated PostScript canvas item lets you embed an EPS file into
+ the canvas. The "eps" item displays either a EPS preview image found
+ in the file, or a Tk image that you provide.
+
+ 2. "hierbox" widget.
+
+ Hierarchical listbox widget. Displays a general ordered tree which
+ may be built on-the-fly or all at once.
+
+ 3. "tabset" widget.
+
+ Can be used either as a tab notebook or simple tabset. Tabs can
+ be arranged in a variety of ways: multi-tiered, scrolled, and
+ attached to any of the four sides. Tab labels can contain both
+ images and text (text can be arbitrarily rotated). Notebook pages
+ can be torn-off into separate windows and replaced later.
+
+ 4. Changes to vectors.
+
+ New features:
+
+ o Vector expressions. The vector now has an "expr" operation
+ that lets you perform math (including math library
+ functions) on vectors. There are several new functions
+ (such as "max", "min", "mean" "median", "q1", "q3", "prod",
+ "sum", "adev", "sdev", "skew", ...)
+
+ vector expr { sin(x)^2 + cos(x)^2 }
+ y expr { log(x) * $value }
+
+ o New syntax to create and destroy vectors:
+
+ vector create x
+ vector destroy x
+
+ The old syntax for creating vectors still works.
+
+ vector x
+
+ o Vectors are *not* automatically deleted when their Tcl
+ variable is unset anymore. This means that you can
+ temporarily map vectors to variables and use them as you
+ would an ordinary Tcl array (kind of like "upvar").
+
+ proc AddValue { vecName value } {
+ $vecName variable x
+
+ set x(++end) $value
+ }
+
+ There's an "-watchunset" flag to restore the old
+ behavior if you need it.
+
+ vector create x -watchunset yes
+
+ o Vectors still automatically create Tcl variables by
+ default. I'd like to change this, but it silently
+ breaks lots of code, so it will stay.
+
+ Bug fixes:
+
+ o Vector reallocation failed when shrinking the vector.
+
+ o Vector "destroy" callback made after vector was
+ already freed.
+
+ 5. Changes to Graph, Barchart, Stripchart widgets.
+
+ New features:
+
+ o Drop shadows for text (titles, markers, etc). Drop
+ shadows improve contrast when displaying text over a
+ background with similar color intensities.
+
+ o Postscript "-preview" option to generate a EPS
+ PostScript preview image that can be read and
+ displayed by the EPS canvas item.
+
+ o New "-topvariable", "-bottomvariable",
+ "-leftvariable", and "-rightvariable" options. They
+ specify variables to contain the current margin
+ sizes. These variables are updated whenever the
+ graph is redrawn.
+
+ o New "-aspect" option. Let's you maintain a particular aspect
+ ratio for the the graph.
+
+ o Image markers can now be stretched and zoomed like
+ bitmap markers.
+
+ o Bind operation for legend entries, markers, and elements.
+
+ Much thanks to Julian Loaring <bigj@bigj.demon.co.uk>
+ for the suggestions.
+
+ o New "-xor" option for line markers, lets you draw the line
+ by rubberbanded by XOR-ing without requiring the graph to
+ be redrawn. This can be used, for example, to select regions
+ like in zooming.
+
+ Thanks to Johannes Zellner (joze@krisal.physik.uni-karlsruhe.de)
+ for the suggestion.
+
+ Bug fixes:
+
+ o Closest line (point) broken when using pens styles.
+
+ o Marker elastic coordinates were wrong.
+
+ o PostScript bounding box included the border of the page.
+
+ o Bad PostScript generated for barchart symbols with stipples.
+
+ o Wrong dimensions computed with postscript " -maxpect" option.
+
+ o Text markers fixed.
+
+ Thanks to De Clarke for the bug report and fix.
+
+
+ o Renamed axis configuration from "-range" to "-autorange" to
+ match the documentation.
+
+ Thanks to Brian Smith for the correction.
+
+ o Fixed polygon marker pick routine.
+
+ o Fixed active tab labels overlapping the selected tab.
+
+
+What's incompatible with releases prior to BLT 2.4?
+
+ 1. Vector names must start with a letter and contain letters, digits,
+ or underscores.
+
+ Namespace Issues: Vector names are still global. If Tcl provides
+ an API, vectors may in the future be created on
+ a per-namespace basis. Right now, there's no
+ mechanism for detecting when a namespace has been
+ destroyed. Which is why you can't currently
+ prefix a vector name with a namespace qualifier.
+
+ [Ok, there is... Thanks to Michael McLennan for
+ pointing this out to me. So maybe soon there
+ will be vectors on a per namespace basis.]
+
+ 2. The "-mapped" options throughout the graph have been replaced
+ by the "-hide" option. The many usages of the word "map" was
+ getting confusing.
+
+ # No longer works.
+ .graph legend configure -mapped no
+
+ # Instead use this.
+ .graph legend configure -hide yes
+
+
+How to compile and test BLT?
+
+ See the file "INSTALL" for instructions.
+
+When will the so-called "official" BLT work with Windows?
+
+ It currently compiles and runs with MS VC++ and EGCS 1.1 under
+ Windows 95/NT (loadable binary versions will be forthcoming).
+ Everything pretty much works: graphs, bgexec, busy, drag&drop etc.
+
+When will...?
+
+ In general, I can't answer the "When will" questions, mostly out of
+ embarrassment. My estimates of when new features and releases will
+ occur usually turn out to be way way off.
+
+What does BLT stand for?
+
+ Whatever you want it to.
+
+--gah
+
+%%
+global endOfText
+set endOfText [expr $htext(line)-1 ]
+
+global updateInterval count barchart
+global Red Green Blue
+set updateInterval 200
+set count 0
+set Red bb
+set Green 00
+set Blue 33
+
+option add *barchart.title "Bar Chart"
+option add *barchart.x.title "X"
+option add *barchart.y.title "Y"
+option add *barchart.y2.title "Y"
+option add *barchart.Axis.subTicks 0
+option add *barchart.x.stepSize 0
+option add *barchart.x.Ticks 0
+option add *barchart.legend.hide yes
+option add *barchart.Axis.Font *-Courier-Bold-R-Normal-*-8-80-*
+option add *barchart.y2.hide yes
+
+set barchart $this.barchart
+barchart $barchart -bd 2 -relief raised -tile bgTexture2
+$barchart y2axis use y
+$this append $barchart -fill both -padx 10 -pady 10 -relwidth 0.8
+
+proc AnimateBarchart { } {
+ global updateInterval
+ global barchart count Red Blue Green
+
+ if { [info commands $barchart] != $barchart } {
+ return
+ }
+ incr count
+ if { $count > 100 } {
+ $barchart element delete [lindex [$barchart element show] end]
+ }
+ set color [format "%x" [expr $count%16]]
+ set Green ${color}${color}
+ $barchart element create $count -data { $count sin($count*0.1)} \
+ -fg #${Red}${Green}${Blue} -bg brown
+ after $updateInterval AnimateBarchart
+}
+AnimateBarchart
+
+%%
+
+ Press %%
+button $this.quit -command { exit } -text {Quit} -bg pink
+$this append $this.quit
+%% to remove the window.
+