OLD | NEW |
1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. | 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. |
2 // limitations under the License. | 2 // limitations under the License. |
3 // See the License for the specific language governing permissions and | 3 // See the License for the specific language governing permissions and |
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
5 // distributed under the License is distributed on an "AS-IS" BASIS, | 5 // distributed under the License is distributed on an "AS-IS" BASIS, |
6 // Unless required by applicable law or agreed to in writing, software | 6 // Unless required by applicable law or agreed to in writing, software |
7 // | 7 // |
8 // http://www.apache.org/licenses/LICENSE-2.0 | 8 // http://www.apache.org/licenses/LICENSE-2.0 |
9 // | 9 // |
10 // You may obtain a copy of the License at | 10 // You may obtain a copy of the License at |
11 // you may not use this file except in compliance with the License. | 11 // you may not use this file except in compliance with the License. |
12 // Licensed under the Apache License, Version 2.0 (the "License"); | 12 // Licensed under the Apache License, Version 2.0 (the "License"); |
13 // | 13 // |
14 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompact'); | 14 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompact'); |
15 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompactAzerty'); | 15 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompactAzerty'); |
16 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompactNordic'); | 16 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompactNordic'); |
17 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompactZhuyin'); | 17 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompactZhuyin'); |
18 | 18 |
19 goog.require('i18n.input.chrome.inputview.layouts.util'); | 19 goog.require('i18n.input.chrome.inputview.layouts.util'); |
20 | 20 |
| 21 goog.scope(function() { |
| 22 var layouts = i18n.input.chrome.inputview.layouts; |
| 23 var util = layouts.util; |
| 24 |
21 | 25 |
22 /** | 26 /** |
23 * Creates the top three rows for compact qwerty keyboard. | 27 * Creates the top three rows for compact qwerty keyboard. |
24 * | 28 * |
25 * @return {!Array.<!Object>} The rows. | 29 * @return {!Array.<!Object>} The rows. |
26 */ | 30 */ |
27 i18n.input.chrome.inputview.layouts.RowsOfCompact.create = function() { | 31 layouts.RowsOfCompact.create = function() { |
28 var baseKeySpec = { | 32 var baseKeySpec = { |
29 'widthInWeight': 1, | 33 'widthInWeight': 1, |
30 'heightInWeight': 1 | 34 'heightInWeight': 1 |
31 }; | 35 }; |
32 | 36 |
33 // Row1 | 37 // Row1 |
34 var keySequenceOf10 = i18n.input.chrome.inputview.layouts.util. | 38 var keySequenceOf10 = util.createKeySequence(baseKeySpec, 10); |
35 createKeySequence(baseKeySpec, 10); | 39 var backspaceKey = util.createKey({ |
36 var backspaceKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 40 'widthInWeight': 1.15625 |
37 'widthInWeight': 1.2 | |
38 }); | 41 }); |
39 var row1 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 42 var row1 = util.createLinearLayout({ |
40 'id': 'row1', | 43 'id': 'row1', |
41 'children': [keySequenceOf10, backspaceKey] | 44 'children': [keySequenceOf10, backspaceKey] |
42 }); | 45 }); |
43 | 46 |
44 // Row2 | 47 // Row2 |
45 // How to add padding | 48 // How to add padding |
46 var leftKeyWithPadding = i18n.input.chrome.inputview.layouts.util.createKey({ | 49 var leftKeyWithPadding = util.createKey({ |
47 'widthInWeight': 1.5 | 50 'widthInWeight': 1.5 |
48 }); | 51 }); |
49 var keySequenceOf8 = i18n.input.chrome.inputview.layouts.util. | 52 var keySequenceOf8 = util.createKeySequence(baseKeySpec, 8); |
50 createKeySequence(baseKeySpec, 8); | 53 var enterKey = util.createKey({ |
51 var enterKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 54 'widthInWeight': 1.65625 |
52 'widthInWeight': 1.7 | |
53 }); | 55 }); |
54 var row2 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 56 var row2 = util.createLinearLayout({ |
55 'id': 'row2', | 57 'id': 'row2', |
56 'children': [leftKeyWithPadding, keySequenceOf8, enterKey] | 58 'children': [leftKeyWithPadding, keySequenceOf8, enterKey] |
57 }); | 59 }); |
58 | 60 |
59 // Row3 | 61 // Row3 |
60 var shiftLeftKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 62 var shiftLeftKey = util.createKey({ |
61 'widthInWeight': 1.1 | 63 'widthInWeight': 1.078125 |
62 }); | 64 }); |
63 var keySequenceOf9 = i18n.input.chrome.inputview.layouts.util. | 65 var keySequenceOf9 = util.createKeySequence(baseKeySpec, 9); |
64 createKeySequence(baseKeySpec, 9); | 66 var shiftRightKey = util.createKey({ |
65 var shiftRightKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 67 'widthInWeight': 1.078125 |
66 'widthInWeight': 1.1 | |
67 }); | 68 }); |
68 var row3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 69 var row3 = util.createLinearLayout({ |
69 'id': 'row3', | 70 'id': 'row3', |
70 'children': [shiftLeftKey, keySequenceOf9, shiftRightKey] | 71 'children': [shiftLeftKey, keySequenceOf9, shiftRightKey] |
71 }); | 72 }); |
72 | 73 |
73 return [row1, row2, row3]; | 74 return [row1, row2, row3]; |
74 }; | 75 }; |
75 | 76 |
| 77 |
76 /** | 78 /** |
77 * Creates the top three rows for compact azerty keyboard. | 79 * Creates the top three rows for compact azerty keyboard. |
78 * | 80 * |
79 * @return {!Array.<!Object>} The rows. | 81 * @return {!Array.<!Object>} The rows. |
80 */ | 82 */ |
81 i18n.input.chrome.inputview.layouts.RowsOfCompactAzerty.create = function() { | 83 i18n.input.chrome.inputview.layouts.RowsOfCompactAzerty.create = function() { |
82 var baseKeySpec = { | 84 var baseKeySpec = { |
83 'widthInWeight': 1, | 85 'widthInWeight': 1, |
84 'heightInWeight': 1 | 86 'heightInWeight': 1 |
85 }; | 87 }; |
(...skipping 30 matching lines...) Expand all Loading... |
116 'widthInWeight': 1.1 | 118 'widthInWeight': 1.1 |
117 }); | 119 }); |
118 var row3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 120 var row3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ |
119 'id': 'row3', | 121 'id': 'row3', |
120 'children': [shiftLeftKey, keySequenceOf9, shiftRightKey] | 122 'children': [shiftLeftKey, keySequenceOf9, shiftRightKey] |
121 }); | 123 }); |
122 | 124 |
123 return [row1, row2, row3]; | 125 return [row1, row2, row3]; |
124 }; | 126 }; |
125 | 127 |
| 128 |
126 /** | 129 /** |
127 * Creates the top three rows for compact nordic keyboard. | 130 * Creates the top three rows for compact nordic keyboard. |
128 * | 131 * |
129 * @return {!Array.<!Object>} The rows. | 132 * @return {!Array.<!Object>} The rows. |
130 */ | 133 */ |
131 i18n.input.chrome.inputview.layouts.RowsOfCompactNordic.create = function() { | 134 i18n.input.chrome.inputview.layouts.RowsOfCompactNordic.create = function() { |
132 var baseKeySpec = { | 135 var baseKeySpec = { |
133 'widthInWeight': 1, | 136 'widthInWeight': 1, |
134 'heightInWeight': 1 | 137 'heightInWeight': 1 |
135 }; | 138 }; |
(...skipping 18 matching lines...) Expand all Loading... |
154 var row2 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 157 var row2 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ |
155 'id': 'row2', | 158 'id': 'row2', |
156 'children': [keySequenceOf11, enterKey] | 159 'children': [keySequenceOf11, enterKey] |
157 }); | 160 }); |
158 | 161 |
159 // Row3 | 162 // Row3 |
160 var shiftLeftKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 163 var shiftLeftKey = i18n.input.chrome.inputview.layouts.util.createKey({ |
161 'widthInWeight': 1.1 | 164 'widthInWeight': 1.1 |
162 }); | 165 }); |
163 var leftKeyWithPadding = i18n.input.chrome.inputview.layouts.util.createKey({ | 166 var leftKeyWithPadding = i18n.input.chrome.inputview.layouts.util.createKey({ |
164 'widthInWeight': 1.5 | 167 'widthInWeight': 1.5 |
165 }); | 168 }); |
166 var keySequenceOf7 = i18n.input.chrome.inputview.layouts.util. | 169 var keySequenceOf7 = i18n.input.chrome.inputview.layouts.util. |
167 createKeySequence(baseKeySpec, 7); | 170 createKeySequence(baseKeySpec, 7); |
168 var rightKeyWithPadding = i18n.input.chrome.inputview.layouts.util.createKey({ | 171 var rightKeyWithPadding = i18n.input.chrome.inputview.layouts.util.createKey({ |
169 'widthInWeight': 1.5 | 172 'widthInWeight': 1.5 |
170 }); | 173 }); |
171 var shiftRightKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 174 var shiftRightKey = i18n.input.chrome.inputview.layouts.util.createKey({ |
172 'widthInWeight': 1.1 | 175 'widthInWeight': 1.1 |
173 }); | 176 }); |
174 var row3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 177 var row3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ |
175 'id': 'row3', | 178 'id': 'row3', |
176 'children': [shiftLeftKey, leftKeyWithPadding, keySequenceOf7, | 179 'children': [shiftLeftKey, leftKeyWithPadding, keySequenceOf7, |
177 rightKeyWithPadding, shiftRightKey] | 180 rightKeyWithPadding, shiftRightKey] |
178 }); | 181 }); |
179 return [row1, row2, row3]; | 182 return [row1, row2, row3]; |
180 }; | 183 }; |
181 | 184 |
182 | 185 |
183 /** | 186 /** |
184 * Creates the top rows of compact zhuyin. | 187 * Creates the top rows of compact zhuyin. |
185 * | 188 * |
186 * @return {!Array.<!Object>} The rows. | 189 * @return {!Array.<!Object>} The rows. |
187 */ | 190 */ |
188 i18n.input.chrome.inputview.layouts.RowsOfCompactZhuyin.create = function() { | 191 i18n.input.chrome.inputview.layouts.RowsOfCompactZhuyin.create = function() { |
189 var baseKeySpec = { | 192 var baseKeySpec = { |
190 'widthInWeight': 1.01, | 193 'widthInWeight': 1.01, |
191 'heightInWeight': 3 | 194 'heightInWeight': 3 |
192 }; | 195 }; |
193 | 196 |
194 // Row1 | 197 // Row1 |
195 var keysOfRow1 = i18n.input.chrome.inputview.layouts.util. | 198 var keysOfRow1 = i18n.input.chrome.inputview.layouts.util. |
196 createKeySequence(baseKeySpec, 10); | 199 createKeySequence(baseKeySpec, 10); |
197 var row1 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 200 var row1 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ |
198 'id': 'row1', | 201 'id': 'row1', |
199 'children': [keysOfRow1] | 202 'children': [keysOfRow1] |
(...skipping 18 matching lines...) Expand all Loading... |
218 // Row4 | 221 // Row4 |
219 var keysOfRow4 = i18n.input.chrome.inputview.layouts.util. | 222 var keysOfRow4 = i18n.input.chrome.inputview.layouts.util. |
220 createKeySequence(baseKeySpec, 10); | 223 createKeySequence(baseKeySpec, 10); |
221 var row4 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 224 var row4 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ |
222 'id': 'row4', | 225 'id': 'row4', |
223 'children': [keysOfRow4] | 226 'children': [keysOfRow4] |
224 }); | 227 }); |
225 | 228 |
226 var topFourRows = | 229 var topFourRows = |
227 i18n.input.chrome.inputview.layouts.util.createVerticalLayout({ | 230 i18n.input.chrome.inputview.layouts.util.createVerticalLayout({ |
228 'id': 'topFourRows', | 231 'id': 'topFourRows', |
229 'children': [row1, row2, row3, row4] | 232 'children': [row1, row2, row3, row4] |
230 }); | 233 }); |
231 | 234 |
232 var sideKeySpec = { | 235 var sideKeySpec = { |
233 'widthInWeight': 1.1, | 236 'widthInWeight': 1.1, |
234 'heightInWeight': 4 | 237 'heightInWeight': 4 |
235 }; | 238 }; |
236 var backspaceKey = | 239 var backspaceKey = |
237 i18n.input.chrome.inputview.layouts.util.createKey(sideKeySpec); | 240 i18n.input.chrome.inputview.layouts.util.createKey(sideKeySpec); |
238 var enterKey = | 241 var enterKey = |
239 i18n.input.chrome.inputview.layouts.util.createKey(sideKeySpec); | 242 i18n.input.chrome.inputview.layouts.util.createKey(sideKeySpec); |
240 var shiftKey = | 243 var shiftKey = |
241 i18n.input.chrome.inputview.layouts.util.createKey(sideKeySpec); | 244 i18n.input.chrome.inputview.layouts.util.createKey(sideKeySpec); |
242 | 245 |
243 var sideKeys = i18n.input.chrome.inputview.layouts.util.createVerticalLayout({ | 246 var sideKeys = i18n.input.chrome.inputview.layouts.util.createVerticalLayout({ |
244 'id': 'sideKeys', | 247 'id': 'sideKeys', |
245 'children': [backspaceKey, enterKey, shiftKey] | 248 'children': [backspaceKey, enterKey, shiftKey] |
246 }); | 249 }); |
247 | 250 |
248 var topRows = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 251 var topRows = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ |
249 'id': 'topRows', | 252 'id': 'topRows', |
250 'children': [topFourRows, sideKeys] | 253 'children': [topFourRows, sideKeys] |
251 }); | 254 }); |
252 return [topRows]; | 255 return [topRows]; |
253 }; | 256 }; |
| 257 |
| 258 }); // goog.scope |
OLD | NEW |