From 566adb1f8a12ab2d56ca6c16d56664e3e1261498 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 27 Oct 2006 14:04:00 +0000 Subject: Patches for the new demos --- demos/groupsInAtcStrips.tcl | 24 ++++++++++++------------ demos/magicLens.tcl | 12 +++++++----- demos/testGraphics.tcl | 1 - demos/zinc-widget | 32 +++++++++++++++----------------- 4 files changed, 34 insertions(+), 35 deletions(-) (limited to 'demos') diff --git a/demos/groupsInAtcStrips.tcl b/demos/groupsInAtcStrips.tcl index 7634661..ed34421 100644 --- a/demos/groupsInAtcStrips.tcl +++ b/demos/groupsInAtcStrips.tcl @@ -65,12 +65,12 @@ namespace eval groupsInAtcStrips { "double click 1" on the blueish zone to fully reduce size} - font create dfont -family Helvetica -size 10 -weight bold - font create radar-b15 -family helvetica -size 16 -slant roman -weight bold - font create radar-b12 -family helvetica -size 12 -slant roman -weight bold - font create radar-b10 -family helvetica -size 10 -slant roman -weight bold - font create radar-m18 -family helvetica -size 18 -slant roman -weight normal - font create radar-m20 -family helvetica -size 20 -slant roman -weight normal + catch {font create dfont -family Helvetica -size 10 -weight bold} + catch {font create radar-b15 -family helvetica -size 16 -slant roman -weight bold} + catch {font create radar-b12 -family helvetica -size 12 -slant roman -weight bold} + catch {font create radar-b10 -family helvetica -size 10 -slant roman -weight bold} + catch {font create radar-m18 -family helvetica -size 18 -slant roman -weight normal} + catch {font create radar-m20 -family helvetica -size 20 -slant roman -weight normal} set fontsets(scales) {1.2 normal 10 large} set fontsets(normal,callsign) radar-b15 @@ -131,12 +131,12 @@ namespace eval groupsInAtcStrips { grid columnconfigure $w 1 -weight 1 grid rowconfigure $w 1 -weight 2 - $w.zinc gname {=axial 90|#ffffff 0|#ffeedd 30|#e9d1ca 90|#e9a89a} idnt - $w.zinc gname {#c1daff|#8aaaff} back - $w.zinc gname {=path -40 -40|#000000;50 0|#000000;50 92|#000000;0 100} shad - $w.zinc gname {#ffeedd|#8a9acc} btnOutside - $w.zinc gname {=axial 180|#ffeedd|#8a9acc} btnInside - $w.zinc gname {#8aaaff|#5b76ed} ch1 + catch "$w.zinc gname {=axial 90|#ffffff 0|#ffeedd 30|#e9d1ca 90|#e9a89a} idnt" + catch "$w.zinc gname {#c1daff|#8aaaff} back" + catch "$w.zinc gname {=path -40 -40|#000000;50 0|#000000;50 92|#000000;0 100} shad" + catch "$w.zinc gname {#ffeedd|#8a9acc} btnOutside" + catch "$w.zinc gname {=axial 180|#ffeedd|#8a9acc} btnInside" + catch "$w.zinc gname {#8aaaff|#5b76ed} ch1" set anim(delay) 50; # ms between each animation steps set anim(steps) 6; # number of steps for the animation diff --git a/demos/magicLens.tcl b/demos/magicLens.tcl index f9b8d00..576ffb4 100644 --- a/demos/magicLens.tcl +++ b/demos/magicLens.tcl @@ -24,8 +24,8 @@ namespace eval magicLens { lp6Eo0Z8kGKpdrNZSLaruHV8e4e/RIYuV2eGT4Ktbr9/kpc7p6Wud4iNAhEAOw== } - font create magfont -family Helvetica -size 13 -weight bold - font create nfont -family Helvetica -size 11 -weight normal + catch {font create magfont -family Helvetica -size 13 -weight bold} + catch {font create nfont -family Helvetica -size 11 -weight normal} # # The basics colors, one per column. @@ -72,12 +72,14 @@ namespace eval magicLens { catch {destroy $w} toplevel $w wm title $w "Color Magic Lens Demonstration" - wm geometry $w "1000x900+0+0" wm iconname $w magicLens + + 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 # # Create a Zinc instance - pack [zinc $w.zinc -render 1 -width $width -height $height -borderwidth 0 \ - -tile paper -backcolor {#cccccc}] -expand yes -fill both + grid [zinc $w.zinc -render 1 -width $width -height $height -borderwidth 0 \ + -tile paper -backcolor {#cccccc}] -row 0 -column 0 -columnspan 2 -sticky ew # # The main view. The unzoomed world is here. $w.zinc add group 1 -tags normview diff --git a/demos/testGraphics.tcl b/demos/testGraphics.tcl index 20e64e5..0427549 100644 --- a/demos/testGraphics.tcl +++ b/demos/testGraphics.tcl @@ -22,7 +22,6 @@ namespace eval testGraphics { catch {destroy $w} toplevel $w wm title $w "zincGraphics Demonstration" - wm geometry $w "700x600+0+0" wm iconname $w testGraphics frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/zinc-widget b/demos/zinc-widget index cc63322..f6b7f29 100644 --- a/demos/zinc-widget +++ b/demos/zinc-widget @@ -5,30 +5,30 @@ # # Locate the zinc top level directory. # -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] +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" } { + 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 .. win buildtcl] } { - set zinc_library [file join $zinc_demos ..] + set ::zinc_library [file join $::zinc_demos ..] } } # # And adjust the paths accordingly. # -lappend auto_path $zinc_library +lappend auto_path $::zinc_library package require Tkzinc 3.3 set zincVersion [lindex [zinc] 0] eval destroy [winfo child .] wm title . "Zinc Widget Demonstration" -set zincDemo 1 +set ::zincDemo 1 set font {Helvetica 14} @@ -119,9 +119,10 @@ set lastLine "" # Create the text for the text widget. -.t insert end "Zinc/Tk Widget Demonstrations $zincVersion\n" title +.t insert end "Tkzinc Widget Demonstrations $zincVersion\n" title .t insert end { - This application provides a front end for several short scripts in Tcl/Tk that demonstrate what you can do with the TkZinc widget. Each of the numbered lines below describes a demonstration; you can click on it to invoke the demonstration. Once the demonstration window appears, you can click the "See Code" button to see the Tcl/Tk code that created the demonstration. + This application provides a front end for several short scripts in Tcl/Tk that demonstrate what you can do + with the Tkzinc widget. Each of the numbered lines below describes a demonstration; you can click on it to invoke the demonstration. Once the demonstration window appears, you can click the "See Code" button to see the Tcl/Tk code that created the demonstration. } .t insert end "\n" {} "Small applications\n" title .t insert end "1. The famous tiger (better with openGL).\n" {demo demo-tiger} @@ -149,7 +150,7 @@ set lastLine "" .t insert end "1. Transformation testbed.\n" {demo demo-transforms} .t insert end "\n" {} "Use of open GL\n" title -.t insert end "1. The TkZinc Logo.\n" {demo demo-tkZincLogo} +.t insert end "1. The Tkzinc Logo.\n" {demo demo-tkZincLogo} .t insert end "2. Applying transformations to an icon.\n" {demo demo-iconTransform} .t insert end "3. Using the alpha information from an image (Need Img ext.).\n" {demo demo-photoAlpha} .t insert end "4. Axial color variation on the X axis.\n" {demo demo-colorX} @@ -220,8 +221,6 @@ proc showVars {w args} { # 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} { @@ -231,7 +230,7 @@ proc invoke index { .t configure -cursor watch update set demo [string range [lindex $tags $i] 5 end] - uplevel [list source [file join $zinc_demos $demo.tcl]] + uplevel [list source [file join $::zinc_demos $demo.tcl]] update .t configure -cursor $cursor @@ -270,7 +269,6 @@ proc showStatus index { # used to derive the name of the file containing its code. proc showCode w { - global zinc_demos set file [string range $w 1 end].tcl if ![winfo exists .code] { toplevel .code @@ -306,9 +304,9 @@ proc showCode w { wm deiconify .code raise .code } - wm title .code "Demo code: [file join $zinc_demos $file]" + wm title .code "Demo code: [file join $::zinc_demos $file]" wm iconname .code $file - set id [open [file join $zinc_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