comparison gpf/cfg/TARGET_lo.tcl @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 #-----------------------------------------------------------------------------#
2 # PROJECT: XPANEL (8446) $Workfile:: TARGET_csample_smi_lo.tcl$#
3 # Author:: RK CONDAT GmbH $Revision:: 1 $#
4 # CREATED: 29.06.00 $Modtime:: 16.02.00 15:17 $#
5 # STATE : code #
6 #-----------------------------------------------------------------------------#
7
8 # MODULE : CSAMPLE_LAYOUT (smi)
9
10 # PURPOSE : This modul provides specific layout file for a csample
11 # running a SMI version.
12
13 #*==== CONSTANTS ===================================================*#
14
15 # specify text display colors
16 set DISPL_BG black
17 set DISPL_FG white
18
19 # key count
20 set COLUMNS 3
21 set ROWS 7
22
23 # key IDs
24 set KEY_NOKEY -1
25 set KEY_0 48
26 set KEY_1 49
27 set KEY_2 50
28 set KEY_3 51
29 set KEY_4 52
30 set KEY_5 53
31 set KEY_6 54
32 set KEY_7 55
33 set KEY_8 56
34 set KEY_9 57
35 set KEY_MNUUP 45
36 set KEY_MNUDOWN 98
37 set KEY_LEFT 67
38 set KEY_RIGHT 94
39 set KEY_CALL 97
40 set KEY_HUP 86
41 set KEY_STAR 42
42 set KEY_HASH 35
43 set KEY_POWER 69
44
45 # not used
46 set KEY_VOLUP 254
47 set KEY_VOLDOWN 254
48 set KEY_OK 254
49 set KEY_CLEAR 254
50 set KEY_ABC 254
51 set KEY_F1 254
52 set KEY_F2 254
53 set KEY_F3 254
54 set KEY_F4 254
55 set KEY_MAX 254
56
57 # keys with their IDs
58 set KEY_ID { $KEY_LEFT $KEY_MNUUP $KEY_RIGHT
59 $KEY_CALL $KEY_MNUDOWN $KEY_HUP
60 $KEY_NOKEY $KEY_POWER $KEY_NOKEY
61 $KEY_1 $KEY_2 $KEY_3
62 $KEY_4 $KEY_5 $KEY_6
63 $KEY_7 $KEY_8 $KEY_9
64 $KEY_STAR $KEY_0 $KEY_HASH }
65
66 # keys with their second IDs, activated after pressing 3 sec
67 set KEY_ID2 { $KEY_NOKEY $KEY_NOKEY $KEY_NOKEY
68 $KEY_NOKEY $KEY_NOKEY $KEY_POWER
69 $KEY_NOKEY $KEY_NOKEY $KEY_NOKEY
70 $KEY_NOKEY $KEY_NOKEY $KEY_NOKEY
71 $KEY_NOKEY $KEY_NOKEY $KEY_NOKEY
72 $KEY_NOKEY $KEY_NOKEY $KEY_NOKEY
73 $KEY_NOKEY $KEY_NOKEY $KEY_NOKEY}
74
75 # key labels
76 set KEY_LABEL {"----" "/\\" "----"
77 "CALL" "\\/" "HUP"
78 "" "POWER" ""
79 "1\nl__l" "2\nabc" "3\ndef"
80 "4\nghi" "5\njkl" "6\nmno"
81 "7\npqrs" "8\ntuv" "9\nwxyz"
82 "*" "0\n+" "#" }
83
84 # optional key images instead of labels
85 set KEY_IMG {"" "" ""
86 "" "" ""
87 "" "" ""
88 "" "" ""
89 "" "" ""
90 "" "" ""
91 "" "" "" }
92
93 # key sizes
94 set KEY_HEIGHT {3 3 3
95 3 3 3
96 2 2 2
97 2 2 2
98 2 2 2
99 2 2 2
100 2 2 2}
101
102 set KEY_WIDTH {5 5 5
103 5 5 5
104 0 6 0
105 4 4 4
106 4 4 4
107 4 4 4
108 4 4 4}
109
110 # key positions
111 set KEY_STICKY {"" "" ""
112 "" "" ""
113 "" "" ""
114 "" "" ""
115 "" "" ""
116 "" "" ""
117 "" "" ""}
118
119 # key relief style (raised, sunken, flat, ridge, solid, groove)
120 set RELIEF raised
121
122
123
124
125 #*==== IMPLEMENTATION ==============================================*#
126
127 frame .keys
128 pack .keys -side bottom -pady 2 -anchor center
129
130 for {set q 0} {$q<$ROWS} {incr q} {
131 for {set w 1} {$w<=$COLUMNS} {incr w} {
132 set nr [expr $q*$COLUMNS+$w-1]
133 if {[subst [lindex $KEY_ID $nr]] == [subst $KEY_NOKEY]} continue
134
135 set key [format ".keys.no%s" $nr]
136 set imgFile [lindex $KEY_IMG $nr]
137 if {$imgFile == ""} {
138 button $key \
139 -text [lindex $KEY_LABEL $nr] \
140 -width [lindex $KEY_WIDTH $nr] -height [lindex $KEY_HEIGHT $nr] \
141 -relief $RELIEF
142 } else {
143 set img [format "%s%s" $imgFile $nr]
144 image create photo $img -file $imgFile
145 button $key -image $img \
146 -relief $RELIEF
147 # -width [expr 7*[lindex $KEY_WIDTH $nr]] \
148 # -height [expr 13*[lindex $KEY_HEIGHT $nr]] \
149 }
150 set st [lindex $KEY_STICKY $nr]
151 if {$st == ""} {
152 if {$w == 1} {
153 set st w
154 }
155 if {$w == $COLUMNS} {
156 set st e
157 }
158 }
159 grid $key -row $q -column $w -sticky $st
160
161 if {[subst [lindex $KEY_ID2 $nr]] == [subst $KEY_NOKEY]} {
162 set cmd [format "c_onkey %s 0" [subst [lindex $KEY_ID $nr]]]
163 } else {
164 set cmd [format "c_onkey %s 0 %s" [subst [lindex $KEY_ID $nr]] \
165 [subst [lindex $KEY_ID2 $nr]]]
166 }
167 bind $key <ButtonPress> $cmd
168 set cmd [format "c_onkey %s 1" [subst [lindex $KEY_ID $nr]]]
169 bind $key <ButtonRelease> $cmd
170 }
171 }