aboutsummaryrefslogtreecommitdiff
path: root/demos/items.tcl
diff options
context:
space:
mode:
authorlecoanet2003-03-24 12:24:56 +0000
committerlecoanet2003-03-24 12:24:56 +0000
commit0d406ebf18a0fefdbc7df031d3df106b8d204d64 (patch)
tree9d7a2c1dd70b64c2958ab937db4fa978be1571b3 /demos/items.tcl
parent31867b10c11defb596f15ed6567e2e4e1f2bbb93 (diff)
downloadtkzinc-0d406ebf18a0fefdbc7df031d3df106b8d204d64.zip
tkzinc-0d406ebf18a0fefdbc7df031d3df106b8d204d64.tar.gz
tkzinc-0d406ebf18a0fefdbc7df031d3df106b8d204d64.tar.bz2
tkzinc-0d406ebf18a0fefdbc7df031d3df106b8d204d64.tar.xz
Portage depuis perl
Diffstat (limited to 'demos/items.tcl')
-rw-r--r--demos/items.tcl97
1 files changed, 97 insertions, 0 deletions
diff --git a/demos/items.tcl b/demos/items.tcl
new file mode 100644
index 0000000..0f18218
--- /dev/null
+++ b/demos/items.tcl
@@ -0,0 +1,97 @@
+# $Id$
+# tcl version by Jean-Paul Imbert imbert@cena.fr
+
+if {![info exists zincDemo]} {
+ error "This script should be run from the zinc-widget demo."
+}
+
+set w .items
+catch {destroy $w}
+toplevel $w
+wm title $w "Zinc Item Demonstration"
+wm iconname $w Items
+
+set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*"
+
+frame $w.buttons
+pack $w.buttons -side bottom -fill x -pady 2m
+button $w.buttons.dismiss -text Dismiss -command "destroy $w"
+button $w.buttons.code -text "See Code" -command "showCode $w"
+pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+
+zinc $w.zinc -width 700 -height 600 -font 10x20 -borderwidth 3 -relief sunken
+
+pack $w.zinc
+
+$w.zinc add rectangle 1 {10 10 100 50} -fillcolor green -filled 1 -linewidth 10 -relief roundridge -linecolor darkgreen
+
+
+$w.zinc add text 1 -font $defaultfont -text "A filled rectangle with a \"roundridge\" relief border of 10 pixels." -anchor nw -position {120 20}
+
+
+set labelformat {x82x60+0+0 x60a0^0^0 x32a0^0>1 a0a0>2>1 x32a0>3>1 a0a0^0>2};
+
+set x 20;
+set y 120;
+set track [$w.zinc add track 1 6 -labelformat $labelformat -position "$x $y" -speedvector {40 -10} -speedvectormark 1 -speedvectorticks 1]
+
+# moving the track, to display past positions
+for {set i 0} {$i<=5} {incr i} {
+ set x1 [expr $x+$i*10]
+ set y1 [expr $y-$i*2]
+ $w.zinc coords "$track" "$x1 $y1"
+}
+
+$w.zinc add text 1 -font $defaultfont -text "A flight track for a radar display. (A waypoint looks similar,\nbut has no speedvector neither past positions)" -anchor nw -position {200 80}
+
+$w.zinc itemconfigure $track 0 -filled 0 -bordercolor DarkGreen -border contour
+
+$w.zinc itemconfigure $track 1 -filled 1 -backcolor gray60 -text AFR001
+$w.zinc itemconfigure $track 2 -filled 0 -backcolor gray65 -text 360
+$w.zinc itemconfigure $track 3 -filled 0 -backcolor gray65 -text /
+$w.zinc itemconfigure $track 4 -filled 0 -backcolor gray65 -text 410
+$w.zinc itemconfigure $track 5 -filled 0 -backcolor gray65 -text Beacon
+
+
+$w.zinc add arc 1 {150 140 450 240} -fillcolor gray20 -filled 0 -linewidth 1 -startangle 45 -extent 270
+$w.zinc add arc 1 {260 150 340 230} -fillcolor gray20 -filled 0 -linewidth 1 -startangle 45 -extent 270 -pieslice 1 -closed 1 -linestyle mixed -linewidth 3
+
+$w.zinc add text 1 -font $defaultfont -text "Two arcs, starting at 45° with an extent of 270°." -anchor nw -position {320 180}
+
+
+$w.zinc add curve 1 {10 324 24 300 45 432 247 356 128 401} -filled 0 -relief roundgroove
+# -linewidth 10, ## BUG with zinc 3.2.3g
+
+$w.zinc add text 1 -font $defaultfont -text "An open curve." -anchor nw -position {50 350}
+
+$w.zinc add text 1 -font $defaultfont -text "A waypoint" -anchor nw -position {10 480}
+
+set waypoint [$w.zinc add waypoint 1 6 -position {100 520} -labelformat $labelformat -symbol AtcSymbol2 -labeldistance 30]
+
+for {set fieldId 1} {$fieldId<=5} {incr fieldId} {
+ $w.zinc itemconfigure $waypoint $fieldId -filled 0 -bordercolor DarkGreen -border contour -text "field$fieldId"
+}
+
+
+$w.zinc add text 1 -font $defaultfont -text "3 tabulars of 2 fields,\nattached together." -anchor nw -position {510 380}
+
+set labelformat2 {x72x40 x72a0^0^0 x34a0^0>1}
+
+set tabular1 [$w.zinc add tabular 1 6 -position {570 250} -labelformat $labelformat2]
+set tabular2 [$w.zinc add tabular 1 6 -connecteditem $tabular1 -labelformat $labelformat2]
+set tabular3 [$w.zinc add tabular 1 6 -connecteditem $tabular2 -labelformat $labelformat2]
+
+set count 1
+
+foreach tab "$tabular1 $tabular2 $tabular3" {
+ $w.zinc itemconfigure $tab 1 -filled 0 -bordercolor DarkGreen -border "contour" -text tabular
+ $w.zinc itemconfigure $tab 2 -filled 0 -bordercolor DarkGreen -border "contour" -text "n°$count"
+ incr count
+}
+
+
+$w.zinc add reticle 1 -position {530 550} -firstradius 20 -numcircles 6 -period 2 -stepsize 20 -brightlinestyle dashed -brightlinecolor darkred
+
+$w.zinc add text 1 -font $defaultfont -text "a reticle of 6 circles." -anchor nw -position {530 540}
+
+$w.zinc add text 1 -font $defaultfont -text "maps, triangles and groups items\nare not demonstrated here." -anchor nw -position {10 550}