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/groupsInAtcStrips.tcl | 4 ++-- demos/iconTransform.tcl | 2 +- demos/magicLens.tcl | 2 +- demos/photoAlpha.tcl | 4 ++-- demos/testGraphics.tcl | 2 +- demos/transforms.tcl | 2 +- demos/zinc-widget | 41 +++++++++++++++++++---------------------- 7 files changed, 27 insertions(+), 30 deletions(-) (limited to 'demos') diff --git a/demos/groupsInAtcStrips.tcl b/demos/groupsInAtcStrips.tcl index 0c7f4d9..808b625 100644 --- a/demos/groupsInAtcStrips.tcl +++ b/demos/groupsInAtcStrips.tcl @@ -55,7 +55,7 @@ namespace eval groupsInAtcStrips { wm iconname $w groupsInAtcStrips variable defaultfont [font create -family Helvetica -size 10 -weight bold] - variable imagePath [file join [demosPath] images] + variable imagePath [file join $::zinc_demos images] grid [button $w.dismiss -text Dismiss -command "destroy $w"] -row 2 -column 0 -pady 10 grid [button $w.code -text "See Code" -command "showCode $w"] -row 2 -column 1 -pady 10 @@ -83,7 +83,7 @@ namespace eval groupsInAtcStrips { # Zinc ########################################## image create photo texture -file \ - [file join [demosPath] images background_texture.gif] + [file join $::zinc_demos images background_texture.gif] grid [zinc $w.zinc -render 1 -width 700 -height 500 -borderwidth 0 \ -lightangle 130 -tile texture] -row 1 -column 0 -columnspan 2 -sticky news diff --git a/demos/iconTransform.tcl b/demos/iconTransform.tcl index e4527c8..65668b3 100644 --- a/demos/iconTransform.tcl +++ b/demos/iconTransform.tcl @@ -46,7 +46,7 @@ namespace eval iconTransform { variable topGroup [$w.zinc add group 1] - image create photo zincAA -file [file join [demosPath] images zinc.gif] + image create photo zincAA -file [file join $::zinc_demos images zinc.gif] variable zincAA [$w.zinc add icon $topGroup -image zincAA \ -position {10 10} -composescale 1 -composerotation 1] diff --git a/demos/magicLens.tcl b/demos/magicLens.tcl index c142d53..3a50e72 100644 --- a/demos/magicLens.tcl +++ b/demos/magicLens.tcl @@ -196,7 +196,7 @@ namespace eval magicLens { grid columnconfigure $w 1 -weight 1 grid rowconfigure $w 1 -weight 2 - variable imagePath [file join [demosPath] images] + variable imagePath [file join $::zinc_demos images] variable texture [image create photo -file [file join $imagePath paper-grey1.gif]] variable lensTexture [image create photo -file [file join $imagePath paper-grey.gif]] $zinc configure -tile $texture diff --git a/demos/photoAlpha.tcl b/demos/photoAlpha.tcl index 631c767..e3d41d6 100644 --- a/demos/photoAlpha.tcl +++ b/demos/photoAlpha.tcl @@ -8,8 +8,8 @@ if {![info exists zincDemo]} { namespace eval photoAlpha { package require Img - variable girl [image create photo -file [file join [demosPath] images photoAlpha.png]] - variable texture [image create photo -file [file join [demosPath] images stripped_texture.gif]] + variable girl [image create photo -file [file join $::zinc_demos images photoAlpha.png]] + variable texture [image create photo -file [file join $::zinc_demos images stripped_texture.gif]] variable w .photoAlpha catch {destroy $w} diff --git a/demos/testGraphics.tcl b/demos/testGraphics.tcl index 78502db..20e64e5 100644 --- a/demos/testGraphics.tcl +++ b/demos/testGraphics.tcl @@ -2047,7 +2047,7 @@ namespace eval testGraphics { -numpages 7 -overlap 2 -radius 8 \ -tabheight 26 -tabwidth {92 100 82 82 82 120 80}] break # to find some images (used as textures) needed by this demo - variable imagePath [file join [demosPath] images] + variable imagePath [file join $::zinc_demos images] variable texture [image create photo -file [file join $imagePath paper.gif]] # création des items zinc correspondants variable i 0 diff --git a/demos/transforms.tcl b/demos/transforms.tcl index 679d583..26bc14f 100644 --- a/demos/transforms.tcl +++ b/demos/transforms.tcl @@ -71,7 +71,7 @@ namespace eval transforms { variable itemType Rectangle variable currentItem 0 - image create photo logo -file [file join [demosPath] images zinc.gif] + image create photo logo -file [file join $::zinc_demos images zinc.gif] grid [frame $w.f] -row 2 -column 0 -columnspan 2 -sticky w 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