From 9ad81315ebe57c2b80aaeed1c96326722c04f67d Mon Sep 17 00:00:00 2001 From: lecoanet Date: Tue, 12 Apr 2005 09:06:30 +0000 Subject: Modified the way the library and demos paths are established. --- demos/zinc-widget | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'demos/zinc-widget') diff --git a/demos/zinc-widget b/demos/zinc-widget index 9132771..98a4c85 100644 --- a/demos/zinc-widget +++ b/demos/zinc-widget @@ -5,13 +5,23 @@ # # Locate the zinc top level directory. # -set zincRoot [file join [file dirname [info script]] ..] +set zinc_demos [file dirname [info script]] +if { [file exist [file join $zinc_demos .. .. lib Tkzinc pkgIndex.tcl]] } { + set zinc_library [file join $zinc_demos .. .. lib Tkzinc] +} { + if { [lindex $tcl_platform(os) 0] eq "Windows" } { + # + # For test purposes on the build site on windows. + set zinc_library [file join $zinc_demos .. win buildtcl] + } { + set zinc_library [file join $zinc_demos ..] + } +} # # And adjust the paths accordingly. # -lappend auto_path $zincRoot -set zinc_library $zincRoot +lappend auto_path $zinc_library package require Tkzinc 3.2 set zincVersion [lindex [zinc] 0] @@ -201,20 +211,6 @@ proc showVars {w args} { pack $w.ok -side bottom -pady 2 } -# -# demosPath -- -# Return the path to the installed demo directory. - -proc demosPath {} { - global zinc_library tcl_platform - - if { [lindex $tcl_platform(os) 0] eq "Windows" && - ! [file exists [file join $zinc_library pkgIndex.tcl]] } { - return [file join $zinc_library demos Tkzinc] - } { - return [file join $zinc_library demos] - } -} # invoke -- # This procedure is called when the user clicks on a demo description. @@ -224,6 +220,8 @@ proc demosPath {} { # index - The index of the character that the user clicked on. proc invoke index { + global zinc_demos + set tags [.t tag names $index] set i [lsearch -glob $tags demo-*] if {$i < 0} { @@ -233,7 +231,7 @@ proc invoke index { .t configure -cursor watch update set demo [string range [lindex $tags $i] 5 end] - uplevel [list source [file join [demosPath] $demo.tcl]] + uplevel [list source [file join $zinc_demos $demo.tcl]] update .t configure -cursor $cursor @@ -246,7 +244,6 @@ proc invoke index { # is called when the user moves the cursor over a demo description. # proc showStatus index { - global zinc_library set tags [.t tag names $index] set i [lsearch -glob $tags demo-*] set cursor [.t cget -cursor] @@ -273,7 +270,7 @@ proc showStatus index { # used to derive the name of the file containing its code. proc showCode w { - global zinc_library + global zinc_demos set file [string range $w 1 end].tcl if ![winfo exists .code] { toplevel .code @@ -309,9 +306,9 @@ proc showCode w { wm deiconify .code raise .code } - wm title .code "Demo code: [file join $zinc_library demos $file]" + wm title .code "Demo code: [file join $zinc_demos $file]" wm iconname .code $file - set id [open [file join $zinc_library demos $file]] + set id [open [file join $zinc_demos $file]] .code.text delete 1.0 end .code.text insert 1.0 [read $id] .code.text mark set insert 1.0 -- cgit v1.1