aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testtext.tcl
blob: 44df4e8759a5591daa64296dc7f4d4c7f402f47b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/wish -f

load tkzinc3.1.so
package require Img

set top 1
set mask "/usr/X11R6/include/X11/bitmaps/fvwm.xbm"

set r [zinc .r -backcolor gray -relief sunken]
pack .r -expand t -fill both
.r configure -width 800 -height 500
.r configure -drawbboxes t
.r addtag controls withtag $top

.r add rectangle $top "-50 0 +50 1" -composescale 0
.r add rectangle $top "0 -50 1 +50" -composescale 0

set x 50.0
set y 100.0
.r add text $top -text "Ancrage Sud Ouest" -position "$x $y" -anchor sw \
	-color yellow
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x [expr $x + 200.0]
.r add text $top -text "Ancrage Sud" -position "$x $y" -anchor s -color pink
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x [expr $x + 200.0]
.r add text $top -text "Ancrage Sud Est" -position "$x $y" -anchor se \
	-color violet -overstriked y
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x 50
set y 150
.r add text $top -text "Ancrage Ouest" -position "$x $y" -anchor w -color lightblue
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x [expr $x + 200.0]
.r add text $top -text "Ancrage Central" -position "$x $y" -anchor center -color blue
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x [expr $x + 200.0]
.r add text $top -text "Ancrage Est" -position "$x $y" -anchor e -color darkblue
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x 50.0
set y 200.0
.r add text $top -text "Ancrage Nord Ouest" -position "$x $y" -anchor nw \
	-color violet -underlined y
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x [expr $x + 200.0]
.r add text $top -text "Ancrage Nord" -position "$x $y" -anchor n -color pink
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x [expr $x + 200.0]
.r add text $top -text "Ancrage Nord Est" -position "$x $y" -anchor ne -color yellow
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x 150
set y 300
.r add text $top -text "Ce texte tient sur plusieurs lignes.\nLes alignements :\n- à gauche\n-à droite\n-au centre\nsont également mis en évidence.\n" -position "$x $y" -anchor center
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x 400
set y 300
set anim [.r add text $top -text "Ce texte tient sur plusieurs lignes.\nLes alignements :\n- à gauche\n-à droite\n-au centre\nsont également mis en évidence.\nLe texte central montre l'utilisation\nd'un espacement des lignes programmable." -position "$x $y" -anchor center -alignment center -spacing -5 -font {times 14 bold italic}]
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

set x 650
set y 300
.r add text $top -text "Ce texte tient sur plusieurs lignes.\nLes alignements :\n- à gauche\n-à droite\n-au centre\nsont également mis en évidence.\n" -position "$x $y" -anchor center -alignment right
.r add rectangle $top [list [expr $x - 3.0] [expr $y - 3.0] \
	[expr $x + 3.0] [expr $y + 3.0]] -filled 1 -fillcolor red

#
# Add controls to the main group
#
source controls.tcl

#
# Line spacing animation (crude).
#
if {0} {
    set i 0
    while {1} {
	update
	after 200
	.r itemconfigure $anim -spacing [expr ($i % 20) - 5]
	incr i
    }
}