diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | library/demos/arrow.tcl | 6 | ||||
-rw-r--r-- | library/demos/bind.tcl | 15 | ||||
-rw-r--r-- | library/demos/bitmap.tcl | 3 | ||||
-rw-r--r-- | library/demos/floor.tcl | 4 | ||||
-rw-r--r-- | library/demos/icon.tcl | 17 | ||||
-rw-r--r-- | library/demos/image1.tcl | 7 | ||||
-rw-r--r-- | library/demos/image2.tcl | 5 | ||||
-rw-r--r-- | library/demos/items.tcl | 21 | ||||
-rw-r--r-- | library/demos/label.tcl | 5 | ||||
-rw-r--r-- | library/demos/menu.tcl | 5 | ||||
-rw-r--r-- | library/demos/ruler.tcl | 8 | ||||
-rw-r--r-- | library/demos/widget | 16 |
13 files changed, 63 insertions, 53 deletions
@@ -1,5 +1,9 @@ 2003-11-03 Donal K. Fellows <donal.k.fellows@man.ac.uk> + * library/demos/widget, etc.: Made widget demos locate themselves + independently of the main Tk library using the new global variable + tk_demoDirectory. [Patch 832691, adapted] + * generic/tkTextDisp.c (TextGetScrollInfoObj): Stop complaints about signed vs. unsigned for the length of strings. diff --git a/library/demos/arrow.tcl b/library/demos/arrow.tcl index b8d33ee..b41c11f 100644 --- a/library/demos/arrow.tcl +++ b/library/demos/arrow.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a canvas widget that displays a # large line with an arrowhead whose shape can be edited interactively. # -# RCS: @(#) $Id: arrow.tcl,v 1.4 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: arrow.tcl,v 1.5 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -107,7 +107,6 @@ proc arrowSetup c { } set w .arrow -global tk_library catch {destroy $w} toplevel $w wm title $w "Arrowhead Editor Demonstration" @@ -140,8 +139,9 @@ if {[winfo depth $c] > 1} { set demo_arrowInfo(boxStyle) "-fill {} -outline black -width 1" set demo_arrowInfo(activeStyle) "-fill red -outline black -width 1" } else { + # Main widget program sets variable tk_demoDirectory set demo_arrowInfo(bigLineStyle) "-fill black \ - -stipple @[file join $tk_library demos images grey.25]" + -stipple @[file join $tk_demoDirectory images grey.25]" set demo_arrowInfo(boxStyle) "-fill {} -outline black -width 1" set demo_arrowInfo(activeStyle) "-fill black -outline black -width 1" } diff --git a/library/demos/bind.tcl b/library/demos/bind.tcl index 246683a..81ad642 100644 --- a/library/demos/bind.tcl +++ b/library/demos/bind.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a text widget with bindings set # up for hypertext-like effects. # -# RCS: @(#) $Id: bind.tcl,v 1.3 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: bind.tcl,v 1.4 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -66,12 +66,13 @@ foreach tag {d1 d2 d3 d4 d5 d6} { $w.text tag bind $tag <Any-Enter> "$w.text tag configure $tag $bold" $w.text tag bind $tag <Any-Leave> "$w.text tag configure $tag $normal" } -$w.text tag bind d1 <1> {source [file join $tk_library demos items.tcl]} -$w.text tag bind d2 <1> {source [file join $tk_library demos plot.tcl]} -$w.text tag bind d3 <1> {source [file join $tk_library demos ctext.tcl]} -$w.text tag bind d4 <1> {source [file join $tk_library demos arrow.tcl]} -$w.text tag bind d5 <1> {source [file join $tk_library demos ruler.tcl]} -$w.text tag bind d6 <1> {source [file join $tk_library demos cscroll.tcl]} +# Main widget program sets variable tk_demoDirectory +$w.text tag bind d1 <1> {source [file join $tk_demoDirectory items.tcl]} +$w.text tag bind d2 <1> {source [file join $tk_demoDirectory plot.tcl]} +$w.text tag bind d3 <1> {source [file join $tk_demoDirectory ctext.tcl]} +$w.text tag bind d4 <1> {source [file join $tk_demoDirectory arrow.tcl]} +$w.text tag bind d5 <1> {source [file join $tk_demoDirectory ruler.tcl]} +$w.text tag bind d6 <1> {source [file join $tk_demoDirectory cscroll.tcl]} $w.text mark set insert 0.0 $w.text configure -state disabled diff --git a/library/demos/bitmap.tcl b/library/demos/bitmap.tcl index dd8fd7a..fffea45 100644 --- a/library/demos/bitmap.tcl +++ b/library/demos/bitmap.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a toplevel window that displays # all of Tk's built-in bitmaps. # -# RCS: @(#) $Id: bitmap.tcl,v 1.3 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: bitmap.tcl,v 1.4 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -33,7 +33,6 @@ proc bitmapRow {w args} { } set w .bitmap -global tk_library catch {destroy $w} toplevel $w wm title $w "Bitmap Demonstration" diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl index e9c0a83..3bd0f7a 100644 --- a/library/demos/floor.tcl +++ b/library/demos/floor.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a canvas widet that displays the # floorplan for DEC's Western Research Laboratory. # -# RCS: @(#) $Id: floor.tcl,v 1.4 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: floor.tcl,v 1.5 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -1290,7 +1290,7 @@ proc fg3 {w color} { # Below is the "main program" that creates the floorplan demonstration. set w .floor -global c tk_library currentRoom colors activeFloor +global c currentRoom colors activeFloor catch {destroy $w} toplevel $w wm title $w "Floorplan Canvas Demonstration" diff --git a/library/demos/icon.tcl b/library/demos/icon.tcl index 89289c0..4355490 100644 --- a/library/demos/icon.tcl +++ b/library/demos/icon.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a toplevel window containing # buttons that display bitmaps instead of text. # -# RCS: @(#) $Id: icon.tcl,v 1.3 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: icon.tcl,v 1.4 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -23,12 +23,13 @@ pack $w.msg -side top set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x +# Main widget program sets variable tk_demoDirectory image create bitmap flagup \ - -file [file join $tk_library demos images flagup.bmp] \ - -maskfile [file join $tk_library demos images flagup.bmp] + -file [file join $tk_demoDirectory images flagup.bmp] \ + -maskfile [file join $tk_demoDirectory images flagup.bmp] image create bitmap flagdown \ - -file [file join $tk_library demos images flagdown.bmp] \ - -maskfile [file join $tk_library demos images flagdown.bmp] + -file [file join $tk_demoDirectory images flagdown.bmp] \ + -maskfile [file join $tk_demoDirectory images flagdown.bmp] frame $w.frame -borderwidth 10 pack $w.frame -side top @@ -36,15 +37,15 @@ checkbutton $w.frame.b1 -image flagdown -selectimage flagup \ -indicatoron 0 $w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background] checkbutton $w.frame.b2 \ - -bitmap @[file join $tk_library demos images letters.bmp] \ + -bitmap @[file join $tk_demoDirectory images letters.bmp] \ -indicatoron 0 -selectcolor SeaGreen1 frame $w.frame.left pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m radiobutton $w.frame.left.b3 \ - -bitmap @[file join $tk_library demos images letters.bmp] \ + -bitmap @[file join $tk_demoDirectory images letters.bmp] \ -variable letters -value full radiobutton $w.frame.left.b4 \ - -bitmap @[file join $tk_library demos images noletter.bmp] \ + -bitmap @[file join $tk_demoDirectory images noletter.bmp] \ -variable letters -value empty pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes diff --git a/library/demos/image1.tcl b/library/demos/image1.tcl index 4f44716..d6327f8 100644 --- a/library/demos/image1.tcl +++ b/library/demos/image1.tcl @@ -2,7 +2,7 @@ # # This demonstration script displays two image widgets. # -# RCS: @(#) $Id: image1.tcl,v 1.3 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: image1.tcl,v 1.4 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -22,13 +22,14 @@ pack $w.msg -side top set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x +# Main widget program sets variable tk_demoDirectory catch {image delete image1a} -image create photo image1a -file [file join $tk_library demos images earth.gif] +image create photo image1a -file [file join $tk_demoDirectory images earth.gif] label $w.l1 -image image1a -bd 1 -relief sunken catch {image delete image1b} image create photo image1b \ - -file [file join $tk_library demos images earthris.gif] + -file [file join $tk_demoDirectory images earthris.gif] label $w.l2 -image image1b -bd 1 -relief sunken pack $w.l1 $w.l2 -side top -padx .5m -pady .5m diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl index d5cbab0..6bdb17d 100644 --- a/library/demos/image2.tcl +++ b/library/demos/image2.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a simple collection of widgets # that allow you to select and view images in a Tk label. # -# RCS: @(#) $Id: image2.tcl,v 1.7 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: image2.tcl,v 1.8 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -76,7 +76,8 @@ frame $w.mid pack $w.mid -fill both -expand 1 labelframe $w.dir -text "Directory:" -set dirName [file join $tk_library demos images] +# Main widget program sets variable tk_demoDirectory +set dirName [file join $tk_demoDirectory images] entry $w.dir.e -width 30 -textvariable dirName button $w.dir.b -pady 0 -padx 2m -text "Select Dir." \ -command "selectAndLoadDir $w" diff --git a/library/demos/items.tcl b/library/demos/items.tcl index 24c3f4c..1d4ab7f 100644 --- a/library/demos/items.tcl +++ b/library/demos/items.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a canvas that displays the # canvas item types. # -# RCS: @(#) $Id: items.tcl,v 1.4 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: items.tcl,v 1.5 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -75,8 +75,9 @@ $c create line 6.33c 1c 6.33c 4c -arrow both -tags item $c create line 5c 6c 9c 6c 9c 1c 8c 1c 8c 4.8c 8.8c 4.8c 8.8c 1.2c \ 8.2c 1.2c 8.2c 4.6c 8.6c 4.6c 8.6c 1.4c 8.4c 1.4c 8.4c 4.4c \ -width 3 -fill $red -tags item +# Main widget program sets variable tk_demoDirectory $c create line 1c 5c 7c 5c 7c 7c 9c 7c -width .5c \ - -stipple @[file join $tk_library demos images gray25.bmp] \ + -stipple @[file join $tk_demoDirectory images gray25.bmp] \ -arrow both -arrowshape {15 15 7} -tags item $c create line 1c 7c 1.75c 5.8c 2.5c 7c 3.25c 5.8c 4c 7c -width .5c \ -cap round -join round -tags item @@ -88,7 +89,7 @@ $c create line 15.5c 1c 19.5c 1.5c 15.5c 4.5c 19.5c 4c -smooth on \ -arrow both -width 3 -tags item $c create line 12c 6c 13.5c 4.5c 16.5c 7.5c 18c 6c \ 16.5c 4.5c 13.5c 7.5c 12c 6c -smooth on -width 3m -cap round \ - -stipple @[file join $tk_library demos images gray25.bmp] \ + -stipple @[file join $tk_demoDirectory images gray25.bmp] \ -fill $red -tags item $c create text 25c .2c -text Polygons -anchor n @@ -99,21 +100,21 @@ $c create polygon 25c 4c 25c 4c 25c 1c 26c 1c 27c 4c 28c 1c \ 29c 1c 29c 4c 29c 4c -fill $red -smooth on -tags item $c create polygon 22c 4.5c 25c 4.5c 25c 6.75c 28c 6.75c \ 28c 5.25c 24c 5.25c 24c 6.0c 26c 6c 26c 7.5c 22c 7.5c \ - -stipple @[file join $tk_library demos images gray25.bmp] \ + -stipple @[file join $tk_demoDirectory images gray25.bmp] \ -outline black -tags item $c create text 5c 8.2c -text Rectangles -anchor n $c create rectangle 1c 9.5c 4c 12.5c -outline $red -width 3m -tags item $c create rectangle 0.5c 13.5c 4.5c 15.5c -fill $green -tags item $c create rectangle 6c 10c 9c 15c -outline {} \ - -stipple @[file join $tk_library demos images gray25.bmp] \ + -stipple @[file join $tk_demoDirectory images gray25.bmp] \ -fill $blue -tags item $c create text 15c 8.2c -text Ovals -anchor n $c create oval 11c 9.5c 14c 12.5c -outline $red -width 3m -tags item $c create oval 10.5c 13.5c 14.5c 15.5c -fill $green -tags item $c create oval 16c 10c 19c 15c -outline {} \ - -stipple @[file join $tk_library demos images gray25.bmp] \ + -stipple @[file join $tk_demoDirectory images gray25.bmp] \ -fill $blue -tags item $c create text 25c 8.2c -text Text -anchor n @@ -133,7 +134,7 @@ $c create arc 0.5c 17c 7c 20c -fill $green -outline black \ -start 45 -extent 270 -style pieslice -tags item $c create arc 6.5c 17c 9.5c 20c -width 4m -style arc \ -outline $blue -start -135 -extent 270 -tags item \ - -outlinestipple @[file join $tk_library demos images gray25.bmp] + -outlinestipple @[file join $tk_demoDirectory images gray25.bmp] $c create arc 0.5c 20c 9.5c 24c -width 4m -style pieslice \ -fill {} -outline $red -start 225 -extent -90 -tags item $c create arc 5.5c 20.5c 9.5c 23.5c -width 4m -style chord \ @@ -141,11 +142,11 @@ $c create arc 5.5c 20.5c 9.5c 23.5c -width 4m -style chord \ $c create text 15c 16.2c -text Bitmaps -anchor n $c create bitmap 13c 20c -tags item \ - -bitmap @[file join $tk_library demos images face.bmp] + -bitmap @[file join $tk_demoDirectory images face.bmp] $c create bitmap 17c 18.5c -tags item \ - -bitmap @[file join $tk_library demos images noletter.bmp] + -bitmap @[file join $tk_demoDirectory images noletter.bmp] $c create bitmap 17c 21.5c -tags item \ - -bitmap @[file join $tk_library demos images letters.bmp] + -bitmap @[file join $tk_demoDirectory images letters.bmp] $c create text 25c 16.2c -text Windows -anchor n button $c.button -text "Press Me" -command "butPress $c $red" diff --git a/library/demos/label.tcl b/library/demos/label.tcl index 3d31538..d526334 100644 --- a/library/demos/label.tcl +++ b/library/demos/label.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a toplevel window containing # several label widgets. # -# RCS: @(#) $Id: label.tcl,v 1.3 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: label.tcl,v 1.4 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -32,7 +32,8 @@ label $w.left.l2 -text "Second label, raised" -relief raised label $w.left.l3 -text "Third label, sunken" -relief sunken pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -pady 2 -anchor w +# Main widget program sets variable tk_demoDirectory label $w.right.bitmap -borderwidth 2 -relief sunken \ - -bitmap @[file join $tk_library demos images face.bmp] + -bitmap @[file join $tk_demoDirectory images face.bmp] label $w.right.caption -text "Tcl/Tk Proprietor" pack $w.right.bitmap $w.right.caption -side top diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl index 97272e8..716294f 100644 --- a/library/demos/menu.tcl +++ b/library/demos/menu.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a window with a bunch of menus # and cascaded menus using menubars. # -# RCS: @(#) $Id: menu.tcl,v 1.5 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: menu.tcl,v 1.6 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -114,8 +114,9 @@ $m invoke 7 set m $w.menu.icon $w.menu add cascade -label "Icons" -menu $m -underline 0 menu $m -tearoff 0 +# Main widget program sets variable tk_demoDirectory $m add command \ - -bitmap @[file join $tk_library demos images pattern.bmp] \ + -bitmap @[file join $tk_demoDirectory images pattern.bmp] \ -hidemargin 1 \ -command { tk_dialog .pattern {Bitmap Menu Entry} {The menu entry you invoked displays a bitmap rather than a text string. Other than this, it is just like any other menu entry.} {} 0 OK diff --git a/library/demos/ruler.tcl b/library/demos/ruler.tcl index 02f7c06..0f5359d 100644 --- a/library/demos/ruler.tcl +++ b/library/demos/ruler.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a canvas widget that displays a ruler # with tab stops that can be set, moved, and deleted. # -# RCS: @(#) $Id: ruler.tcl,v 1.4 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: ruler.tcl,v 1.5 2003/11/03 15:31:18 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -24,7 +24,6 @@ proc rulerMkTab {c x y} { } set w .ruler -global tk_library catch {destroy $w} toplevel $w wm title $w "Ruler Demonstration" @@ -49,14 +48,15 @@ set demo_rulerInfo(top) [winfo fpixels $c 1c] set demo_rulerInfo(bottom) [winfo fpixels $c 1.5c] set demo_rulerInfo(size) [winfo fpixels $c .2c] set demo_rulerInfo(normalStyle) "-fill black" +# Main widget program sets variable tk_demoDirectory if {[winfo depth $c] > 1} { set demo_rulerInfo(activeStyle) "-fill red -stipple {}" set demo_rulerInfo(deleteStyle) [list -fill red \ - -stipple @[file join $tk_library demos images gray25.bmp]] + -stipple @[file join $tk_demoDirectory images gray25.bmp]] } else { set demo_rulerInfo(activeStyle) "-fill black -stipple {}" set demo_rulerInfo(deleteStyle) [list -fill black \ - -stipple @[file join $tk_library demos images gray25.bmp]] + -stipple @[file join $tk_demoDirectory images gray25.bmp]] } $c create line 1c 0.5c 1c 1c 13c 1c 13c 0.5c -width 1 diff --git a/library/demos/widget b/library/demos/widget index 0b538f3..65bdb4c 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -11,14 +11,15 @@ exec wish "$0" "$@" # ".tcl" files is this directory, which are sourced by this script # as needed. # -# RCS: @(#) $Id: widget,v 1.17 2003/09/30 14:54:30 dkf Exp $ +# RCS: @(#) $Id: widget,v 1.18 2003/11/03 15:30:45 dkf Exp $ package require Tcl 8.4 package require Tk 8.4 package require msgcat eval destroy [winfo child .] -::msgcat::mcload [file join $tk_library demos] +set tk_demoDirectory [file join [pwd] [file dirname [info script]]] +::msgcat::mcload $tk_demoDirectory namespace import ::msgcat::mc wm title . [mc "Widget Demonstration"] if {[tk windowingsystem] eq "x11"} { @@ -390,7 +391,7 @@ proc showVars {w args} { # index - The index of the character that the user clicked on. proc invoke index { - global tk_library + global tk_demoDirectory set tags [.t tag names $index] set i [lsearch -glob $tags demo-*] if {$i < 0} { @@ -400,7 +401,7 @@ proc invoke index { .t configure -cursor watch update set demo [string range [lindex $tags $i] 5 end] - uplevel [list source [file join $tk_library demos $demo.tcl]] + uplevel [list source [file join $tk_demoDirectory $demo.tcl]] update .t configure -cursor $cursor @@ -413,7 +414,6 @@ proc invoke index { # is called when the user moves the cursor over a demo description. # proc showStatus index { - global tk_library set tags [.t tag names $index] set i [lsearch -glob $tags demo-*] set cursor [.t cget -cursor] @@ -449,7 +449,7 @@ proc evalShowCode {w} { # used to derive the name of the file containing its code. proc showCode w { - global tk_library + global tk_demoDirectory set file [string range $w 1 end].tcl set top .code if {![winfo exists $top]} { @@ -495,9 +495,9 @@ proc showCode w { wm deiconify $top raise $top } - wm title $top [mc "Demo code: %s" [file join $tk_library demos $file]] + wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]] wm iconname $top $file - set id [open [file join $tk_library demos $file]] + set id [open [file join $tk_demoDirectory $file]] $top.f.text delete 1.0 end $top.f.text insert 1.0 [read $id] $top.f.text mark set insert 1.0 |