4 # --------------------------------------------------------------------------
5 # Starting with Tcl 8.x, the BLT commands are stored in their own
6 # namespace called "blt". The idea is to prevent name clashes with
7 # Tcl commands and variables from other packages, such as a "table"
8 # command in two different packages.
10 # You can access the BLT commands in a couple of ways. You can prefix
11 # all the BLT commands with the namespace qualifier "blt::"
14 # blt::table . .g -resize both
16 # or you can import all the command into the global namespace.
18 # namespace import blt::*
20 # table . .g -resize both
22 # --------------------------------------------------------------------------
23 if { $tcl_version >= 8.0 } {
24 namespace import blt::*
25 namespace import -force blt::tile::*
27 source scripts/demo.tcl
30 source scripts/stipples.tcl
40 -scrollcommand { .s set } \
42 -selectcommand { MakePhoto %W %n }
45 scrollbar .s -command { .t view } -orient horizontal
48 option add *Tabset.Tab.font -*-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
50 set files [glob ./images/*.gif]
51 set files [lsort $files]
58 proc ResizePhoto { src dest maxSize } {
59 set maxSize [winfo fpixels . $maxSize]
60 set w [image width $src]
61 set h [image height $src]
62 set sw [expr double($maxSize) / $w]
63 set sh [expr double($maxSize) / $h]
64 set s [expr min($sw, $sh)]
65 set w [expr round($s * $w)]
66 set h [expr round($s * $h)]
67 $dest configure -width $w -height $h
69 global horzFilter vertFilter
70 winop image resample $src $dest $horzFilter $vertFilter
73 image create photo src
74 image create photo dest
76 label .t.label -image dest -bg purple
78 proc MakePhoto { w name } {
79 set file ./images/$name.gif
80 src configure -file $file
82 set width [$w tab pagewidth]
83 set height [$w tab pageheight]
84 if { $width < $height } {
85 ResizePhoto src dest $width
87 ResizePhoto src dest $height
90 .t tab configure $name -window .t.label -padx 4m -pady 4m -fill both
97 table configure . r1 -resize none
101 src configure -file $f
102 set f [file tail [file root $f]]
103 set thumb [image create photo]
104 ResizePhoto src $thumb 0.5i
105 .t insert end $f -image $thumb -fill both