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.SpaceRow'); | 14 goog.provide('i18n.input.chrome.inputview.layouts.SpaceRow'); |
15 | 15 |
16 goog.require('i18n.input.chrome.inputview.ConditionName'); | 16 goog.require('i18n.input.chrome.inputview.ConditionName'); |
17 goog.require('i18n.input.chrome.inputview.layouts.util'); | 17 goog.require('i18n.input.chrome.inputview.layouts.util'); |
18 | 18 |
19 | 19 |
| 20 goog.scope(function() { |
| 21 var layouts = i18n.input.chrome.inputview.layouts; |
| 22 var util = layouts.util; |
| 23 |
| 24 |
20 /** | 25 /** |
21 * Creates the spaceKey row. | 26 * Creates the spaceKey row. |
22 * | 27 * |
23 * @return {!Object} The spaceKey row. | 28 * @return {!Object} The spaceKey row. |
24 */ | 29 */ |
25 i18n.input.chrome.inputview.layouts.SpaceRow.create = function() { | 30 layouts.SpaceRow.create = function() { |
26 var globeKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 31 var globeKey = util.createKey({ |
27 'condition': i18n.input.chrome.inputview.ConditionName.SHOW_GLOBE_OR_SYMBOL, | 32 'condition': i18n.input.chrome.inputview.ConditionName.SHOW_GLOBE_OR_SYMBOL, |
28 'widthInWeight': 1 | 33 'widthInWeight': 1 |
29 }); | 34 }); |
30 var menuKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 35 var menuKey = util.createKey({ |
31 'condition': i18n.input.chrome.inputview.ConditionName.SHOW_MENU, | 36 'condition': i18n.input.chrome.inputview.ConditionName.SHOW_MENU, |
32 'widthInWeight': 1 | 37 'widthInWeight': 1 |
33 }); | 38 }); |
34 var ctrlKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 39 var ctrlKey = util.createKey({ |
35 'widthInWeight': 1 | 40 'widthInWeight': 1 |
36 }); | 41 }); |
37 var altKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 42 var altKey = util.createKey({ |
38 'widthInWeight': 1 | 43 'widthInWeight': 1 |
39 }); | 44 }); |
40 var spaceKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 45 var spaceKey = util.createKey({ |
41 'widthInWeight': 4.87 | 46 'widthInWeight': 5.21 |
42 }); | 47 }); |
43 var enSwitcher = i18n.input.chrome.inputview.layouts.util.createKey({ | 48 var enSwitcher = util.createKey({ |
44 'widthInWeight': 1, | 49 'widthInWeight': 1, |
45 'condition': i18n.input.chrome.inputview.ConditionName. | 50 'condition': i18n.input.chrome.inputview.ConditionName. |
46 SHOW_EN_SWITCHER_KEY | 51 SHOW_EN_SWITCHER_KEY |
47 }); | 52 }); |
48 var altGrKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 53 var altGrKey = util.createKey({ |
49 'widthInWeight': 1.25, | 54 'widthInWeight': 1.25, |
50 'condition': i18n.input.chrome.inputview.ConditionName. | 55 'condition': i18n.input.chrome.inputview.ConditionName. |
51 SHOW_ALTGR | 56 SHOW_ALTGR |
52 }); | 57 }); |
53 // If globeKey or altGrKey is not shown, give its weight to space key. | 58 // If globeKey or altGrKey is not shown, give its weight to space key. |
54 globeKey['spec']['giveWeightTo'] = spaceKey['spec']['id']; | 59 globeKey['spec']['giveWeightTo'] = spaceKey['spec']['id']; |
55 menuKey['spec']['giveWeightTo'] = spaceKey['spec']['id']; | 60 menuKey['spec']['giveWeightTo'] = spaceKey['spec']['id']; |
56 altGrKey['spec']['giveWeightTo'] = spaceKey['spec']['id']; | 61 altGrKey['spec']['giveWeightTo'] = spaceKey['spec']['id']; |
57 enSwitcher['spec']['giveWeightTo'] = spaceKey['spec']['id']; | 62 enSwitcher['spec']['giveWeightTo'] = spaceKey['spec']['id']; |
58 | 63 |
59 var leftKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 64 var leftKey = util.createKey({ |
60 'widthInWeight': 1.08 | 65 'widthInWeight': 1 |
61 }); | 66 }); |
62 var rightKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 67 var rightKey = util.createKey({ |
63 'widthInWeight': 1.08 | 68 'widthInWeight': 1 |
64 }); | 69 }); |
65 var hideKeyboardKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 70 var hideKeyboardKey = util.createKey({ |
66 'widthInWeight': 1.08 | 71 'widthInWeight': 1 |
67 }); | 72 }); |
68 var spaceKeyRow = i18n.input.chrome.inputview.layouts.util. | 73 var spaceKeyRow = util.createLinearLayout({ |
69 createLinearLayout({ | |
70 'id': 'spaceKeyrow', | 74 'id': 'spaceKeyrow', |
71 'children': [globeKey, menuKey, ctrlKey, altKey, spaceKey, | 75 'children': [ctrlKey, altKey, globeKey, menuKey, spaceKey, |
72 enSwitcher, altGrKey, leftKey, rightKey, hideKeyboardKey] | 76 enSwitcher, altGrKey, leftKey, rightKey, hideKeyboardKey] |
73 }); | 77 }); |
74 return spaceKeyRow; | 78 return spaceKeyRow; |
75 }; | 79 }; |
76 | 80 |
| 81 }); // goog.scope |
OLD | NEW |