FreeCalypso > hg > leo2moko-debug
comparison gpf/cfg/TARGET_csample_mfw_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_mfw_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 (mfw/bmi) | |
9 | |
10 # PURPOSE : This modul provides specific layout file for a csample | |
11 # running a MFW/BMI 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 1 | |
26 set KEY_1 2 | |
27 set KEY_2 3 | |
28 set KEY_3 4 | |
29 set KEY_4 5 | |
30 set KEY_5 6 | |
31 set KEY_6 7 | |
32 set KEY_7 8 | |
33 set KEY_8 9 | |
34 set KEY_9 10 | |
35 set KEY_MNUUP 11 | |
36 set KEY_MNUDOWN 12 | |
37 set KEY_LEFT 13 | |
38 set KEY_RIGHT 14 | |
39 set KEY_CALL 15 | |
40 set KEY_HUP 16 | |
41 set KEY_STAR 17 | |
42 set KEY_HASH 18 | |
43 set KEY_POWER 19 | |
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 5 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 #*==== IMPLEMENTATION ==============================================*# | |
125 | |
126 frame .keys | |
127 pack .keys -side bottom -pady 2 -anchor center | |
128 | |
129 for {set q 0} {$q<$ROWS} {incr q} { | |
130 for {set w 1} {$w<=$COLUMNS} {incr w} { | |
131 set nr [expr $q*$COLUMNS+$w-1] | |
132 if {[subst [lindex $KEY_ID $nr]] == [subst $KEY_NOKEY]} continue | |
133 | |
134 set key [format ".keys.no%s" $nr] | |
135 set imgFile [lindex $KEY_IMG $nr] | |
136 if {$imgFile == ""} { | |
137 button $key \ | |
138 -text [lindex $KEY_LABEL $nr] \ | |
139 -width [lindex $KEY_WIDTH $nr] -height [lindex $KEY_HEIGHT $nr] \ | |
140 -relief $RELIEF | |
141 } else { | |
142 set img [format "%s%s" $imgFile $nr] | |
143 image create photo $img -file $imgFile | |
144 button $key -image $img \ | |
145 -relief $RELIEF | |
146 # -width [expr 7*[lindex $KEY_WIDTH $nr]] \ | |
147 # -height [expr 13*[lindex $KEY_HEIGHT $nr]] \ | |
148 } | |
149 set st [lindex $KEY_STICKY $nr] | |
150 if {$st == ""} { | |
151 if {$w == 1} { | |
152 set st w | |
153 } | |
154 if {$w == $COLUMNS} { | |
155 set st e | |
156 } | |
157 } | |
158 grid $key -row $q -column $w -sticky $st | |
159 | |
160 if {[subst [lindex $KEY_ID2 $nr]] == [subst $KEY_NOKEY]} { | |
161 set cmd [format "c_onkey %s 0" [subst [lindex $KEY_ID $nr]]] | |
162 } else { | |
163 set cmd [format "c_onkey %s 0 %s" [subst [lindex $KEY_ID $nr]] \ | |
164 [subst [lindex $KEY_ID2 $nr]]] | |
165 } | |
166 bind $key <ButtonPress> $cmd | |
167 set cmd [format "c_onkey %s 1" [subst [lindex $KEY_ID $nr]]] | |
168 bind $key <ButtonRelease> $cmd | |
169 } | |
170 } |