home *** CD-ROM | disk | FTP | other *** search
- # about.tcl -- Provide an about window.
-
- # Copyright 2004 David N. Welton <davidw@dedasys.com>
-
- package provide about 0.1
-
- namespace eval about {
- proc mc {arg} {
- return $arg
- }
- }
-
- # about::about --
- #
- # Creates an about dialog.
- #
- # Arguments:
- # codename - name of the program.
- # devname - name (and email address) of the developer.
- # text - text to write in the widget, in the form "blah blah"
- # TAG "blah blah" TAG, where TAG can be one of title, center,
- # bold.
- #
- # Side Effects:
- # Creates/Destroys .about widget.
- #
- # Results:
- # None.
-
- proc about::about {codename devname txt} {
- variable a
- catch { destroy .about }
- set a [toplevel .about]
-
- wm title $a "About $codename"
- button $a.b -text [mc "Close"] -command [list wm withdraw $a]
-
- text $a.text -height 9 -bd 1 -width 60
- pack $a.b -side bottom
- pack $a.text -fill both -side left -expand 1
- $a.text configure -background "\#ffffff"
- $a.text configure -foreground "\#ffffff"
- $a.text configure -font {Helvetica -12}
- $a.text tag config center -justify center
- $a.text tag config bold -font {Helvetica -12 bold}
- $a.text tag config title -justify center -font {Helvetica -18 bold}
- $a.text insert 1.0 [mc "About $codename"] title \
- "\n\nCopyright (C) [clock format [clock seconds] -format %Y] $devname\n\n" \
- center
- eval $a.text insert end "$txt"
- $a.text config -state disabled
- after 0 [list about::fade 255]
- }
-
- # about::fade --
- #
- # Fade in effect for text.
- #
- # Arguments:
- # val - value from 0 to 255
- #
- # Side Effects:
- # Changes text foreground color.
- #
- # Results:
- # None.
-
- proc about::fade {val} {
- variable a
- if { $val > 0 } {
- incr val -1
- after 1 [list about::fade $val]
- }
- set fval [format "%.2x" $val]
- $a.text configure -foreground "\#$fval$fval$fval"
- }
-