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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_
#define CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_
#include "base/basictypes.h"
#include "chrome/common/pref_names.h"
#include "grit/generated_resources.h"
// Section and config names for the IBus configuration daemon.
namespace chromeos {
template <typename DataType>
struct LanguageMultipleChoicePreference {
const wchar_t* pref_name; // Chrome preference name.
DataType default_pref_value;
const char* ibus_config_name;
// Currently we have 10 combobox items at most.
static const size_t kMaxItems = 11;
struct {
DataType ibus_config_value;
int item_message_id; // Resource grd ID for the combobox item.
} values_and_ids[kMaxItems];
int label_message_id; // Resource grd ID for the label.
};
// For ibus-daemon
const char kGeneralSectionName[] = "general";
const char kHotKeySectionName[] = "general/hotkey";
const char kPreloadEnginesConfigName[] = "preload_engines";
const char kNextEngineInMenuConfigName[] = "next_engine_in_menu";
const char kPreviousEngineConfigName[] = "previous_engine";
// TODO(suzhe): In order to avoid blocking any accelerator keys with alt+shift
// modifiers, we should use release events of alt+shift key binding instead of
// press events. The corresponding release events are:
// "Alt+Shift+Shift_L+Release" and "Alt+Shift+Meta_L+Release"
// But unfortunately http://crbug.com/40754 prevents these release events
// from taking effect.
// TODO(yusukes): Check if the "Kana/Eisu" key in the Japanese keyboard for
// Chrome OS actually generates Zenkaku_Hankaku when the keyboard gets ready.
// ibus-daemon accepts up to 5 next-engine hot-keys.
const wchar_t kHotkeyNextEngineInMenu[] =
L"Alt+Shift_L,Shift+Meta_L,Control+Shift+space,Zenkaku_Hankaku";
// TODO(suzhe): Add more key bindings?
const wchar_t kHotkeyPreviousEngine[] = L"Control+space";
// For Simplified Chinese input method (ibus-chewing)
const char kChewingSectionName[] = "engine/Chewing";
// We have to sync the |ibus_config_name|s with those in
// ibus-chewing/files/src/Config.cc.
const struct {
const wchar_t* pref_name; // Chrome preference name.
bool default_pref_value;
const char* ibus_config_name;
int message_id;
} kChewingBooleanPrefs[] = {
{ prefs::kLanguageChewingAutoShiftCur, false, "autoShiftCur",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_AUTO_SHIFT_CUR},
{ prefs::kLanguageChewingAddPhraseDirection, false, "addPhraseDirection",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_ADD_PHRASE_DIRECTION},
{ prefs::kLanguageChewingEasySymbolInput, true, "easySymbolInput",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_EASY_SYMBOL_INPUT},
{ prefs::kLanguageChewingEscCleanAllBuf, false, "escCleanAllBuf",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_ESC_CLEAN_ALL_BUF},
{ prefs::kLanguageChewingForceLowercaseEnglish, false,
"forceLowercaseEnglish",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_FORCE_LOWER_CASE_ENGLISH},
{ prefs::kLanguageChewingPlainZhuyin, false, "plainZhuyin",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_PLAIN_ZHUYIN},
{ prefs::kLanguageChewingPhraseChoiceRearward, true, "phraseChoiceRearward",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_PHRASE_CHOICE_REARWARD},
{ prefs::kLanguageChewingSpaceAsSelection, true, "spaceAsSelection",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_SPACE_AS_SELECTION},
};
const size_t kNumChewingBooleanPrefs = ARRAYSIZE_UNSAFE(kChewingBooleanPrefs);
const struct {
const wchar_t* pref_name; // Chrome preference name.
int default_pref_value;
int min_pref_value;
int max_pref_value;
const char* ibus_config_name;
int message_id;
} kChewingIntegerPrefs[] = {
{ prefs::kLanguageChewingMaxChiSymbolLen, 20, 8, 40, "maxChiSymbolLen",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_MAX_CHI_SYMBOL_LEN},
{ prefs::kLanguageChewingCandPerPage, 10, 8, 10, "candPerPage",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_CAND_PER_PAGE},
};
const size_t kNumChewingIntegerPrefs = ARRAYSIZE_UNSAFE(kChewingIntegerPrefs);
const LanguageMultipleChoicePreference<const char*>
kChewingMultipleChoicePrefs[] = {
{ prefs::kLanguageChewingKeyboardType,
"default",
"KBType",
{{ "default",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_DEFAULT },
{ "hsu", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_HSU },
{ "ibm", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_IBM },
{ "gin_yieh",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_GIN_YIEH },
{ "eten", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_ETEN },
{ "eten26", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_ETEN26 },
{ "dvorak", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_DVORAK },
{ "dvorak_hsu",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_DVORAK_HSU },
{ "dachen_26",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_DACHEN_26 },
{ "hanyu", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_HANYU }},
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE,
},
{ prefs::kLanguageChewingSelKeys,
"1234567890",
"selKeys",
{{ "1234567890",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS_1234567890 },
{ "asdfghjkl;",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS_ASDFGHJKLS },
{ "asdfzxcv89",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS_ASDFZXCV89 },
{ "asdfjkl789",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS_ASDFJKL789 },
{ "aoeu;qjkix",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS_AOEUSQJKIX },
{ "aoeuhtnsid",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS_AOEUHTNSID },
{ "aoeuidhtns",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS_AOEUIDHTNS },
{ "1234qweras",
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS_1234QWERAS }},
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS,
},
};
const size_t kNumChewingMultipleChoicePrefs =
arraysize(kChewingMultipleChoicePrefs);
const LanguageMultipleChoicePreference<int> kChewingHsuSelKeyType = {
prefs::kLanguageChewingHsuSelKeyType,
1,
"hsuSelKeyType",
{{ 1, IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_HSU_SEL_KEY_TYPE_1 },
{ 2, IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_HSU_SEL_KEY_TYPE_2 }},
IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_HSU_SEL_KEY_TYPE,
};
// For Korean input method (ibus-hangul)
const char kHangulSectionName[] = "engine/Hangul";
const char kHangulKeyboardConfigName[] = "HangulKeyboard";
const struct HangulKeyboardNameIDPair {
int message_id;
const wchar_t* keyboard_id;
} kHangulKeyboardNameIDPairs[] = {
// We have to sync the |keyboard_id|s with those in
// ibus-hangul/files/setup/main.py.
{ IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_2_SET, L"2" },
{ IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_3_SET_FINAL,
L"3f" },
{ IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_3_SET_390, L"39" },
{ IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_3_SET_NO_SHIFT,
L"3s" },
// We don't support "Sebeolsik 2 set" keyboard.
};
// For Simplified Chinese input method (ibus-pinyin)
const char kPinyinSectionName[] = "engine/Pinyin";
// We have to sync the |ibus_config_name|s with those in
// ibus-pinyin/files/src/Config.cc.
const struct {
const wchar_t* pref_name; // Chrome preference name.
bool default_pref_value;
const char* ibus_config_name;
int message_id;
} kPinyinBooleanPrefs[] = {
{ prefs::kLanguagePinyinCorrectPinyin, true, "CorrectPinyin",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_CORRECT_PINYIN },
{ prefs::kLanguagePinyinFuzzyPinyin, false, "FuzzyPinyin",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_FUZZY_PINYIN },
{ prefs::kLanguagePinyinShiftSelectCandidate, false, "ShiftSelectCandidate",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_SHIFT_SELECT_PINYIN },
{ prefs::kLanguagePinyinMinusEqualPage, true, "MinusEqualPage",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_MINUS_EQUAL_PAGE },
{ prefs::kLanguagePinyinCommaPeriodPage, true, "CommaPeriodPage",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_COMMA_PERIOD_PAGE },
{ prefs::kLanguagePinyinAutoCommit, false, "AutoCommit",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_AUTO_COMMIT },
{ prefs::kLanguagePinyinDoublePinyin, false, "DoublePinyin",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_DOUBLE_PINYIN },
{ prefs::kLanguagePinyinInitChinese, true, "InitChinese",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_INIT_CHINESE },
{ prefs::kLanguagePinyinInitFull, false, "InitFull",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_INIT_FULL },
{ prefs::kLanguagePinyinInitFullPunct, true, "InitFullPunct",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_INIT_FULL_PUNCT },
{ prefs::kLanguagePinyinInitSimplifiedChinese, true, "InitSimplifiedChinese",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_INIT_SIMPLIFIED_CHINESE },
{ prefs::kLanguagePinyinTradCandidate, false, "TradCandidate",
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_TRAD_CANDIDATE },
// TODO(yusukes): Support PINYIN_{INCOMPLETE,CORRECT,FUZZY}_... prefs (32
// additional boolean prefs.)
};
const size_t kNumPinyinBooleanPrefs = ARRAYSIZE_UNSAFE(kPinyinBooleanPrefs);
// TODO(yusukes): Support HalfWidthPuncts and IncompletePinyin prefs if needed.
const LanguageMultipleChoicePreference<int> kPinyinDoublePinyinSchema = {
prefs::kLanguagePinyinDoublePinyinSchema,
0,
"DoublePinyinSchema",
{{ 0, IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_DOUBLE_SCHEMA_MSPY},
{ 1, IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_DOUBLE_SCHEMA_ZRM},
{ 2, IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_DOUBLE_SCHEMA_ABC},
{ 3, IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_DOUBLE_SCHEMA_ZGPY},
{ 4, IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_DOUBLE_SCHEMA_PYJJ}},
IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_DOUBLE_SCHEMA,
};
const struct {
const wchar_t* pref_name; // Chrome preference name.
int default_pref_value;
const char* ibus_config_name;
// TODO(yusukes): Add message_id if needed.
} kPinyinIntegerPrefs[] = {
// TODO(yusukes): the type of lookup_table_page_size on ibus should be uint.
{ prefs::kLanguagePinyinLookupTablePageSize, 5, "LookupTablePageSize" },
};
const size_t kNumPinyinIntegerPrefs = ARRAYSIZE_UNSAFE(kPinyinIntegerPrefs);
// For Japanese input method (ibus-mozc)
const char kMozcSectionName[] = "engine/Mozc";
const LanguageMultipleChoicePreference<const char*>
kMozcMultipleChoicePrefs[] = {
{ prefs::kLanguageMozcPreeditMethod,
"ROMAN",
"preedit_method",
{{ "ROMAN", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PREEDIT_METHOD_ROMAN },
{ "KANA", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PREEDIT_METHOD_KANA }},
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PREEDIT_METHOD,
},
{ prefs::kLanguageMozcSessionKeymap,
"MSIME",
"session_keymap",
{{ "ATOK", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SESSION_KEYMAP_ATOK },
{ "MSIME", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SESSION_KEYMAP_MSIME },
{ "KOTOERI", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SESSION_KEYMAP_KOTOERI }},
// TODO: Support "CUSTOM" keymap.
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SESSION_KEYMAP,
},
{ prefs::kLanguageMozcPunctuationMethod,
"KUTEN_TOTEN",
"punctuation_method",
{{ "KUTEN_TOUTEN",
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PUNCTUATION_METHOD_KUTEN_TOUTEN },
{ "COMMA_PERIOD",
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PUNCTUATION_METHOD_COMMA_PERIOD },
{ "KUTEN_PERIOD",
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PUNCTUATION_METHOD_KUTEN_PERIOD },
{ "COMMA_TOUTEN",
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PUNCTUATION_METHOD_COMMA_TOUTEN }},
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PUNCTUATION_METHOD,
},
{ prefs::kLanguageMozcSymbolMethod,
"CORNER_BRACKET_MIDDLE_DOT",
"symbol_method",
{{ "CORNER_BRACKET_MIDDLE_DOT",
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SYMBOL_CORNER_BRACKET_MIDDLE_DOT },
{ "SQUARE_BRACKET_SLASH",
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SYMBOL_SQUARE_BRACKET_SLASH },
{ "CORNER_BRACKET_SLASH",
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SYMBOL_CORNER_BRACKET_SLASH },
{ "SQUARE_BRACKET_MIDDLE_DOT",
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SYMBOL_SQUARE_BRACKET_MIDDLE_DOT }},
IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SYMBOL_METHOD,
},
};
const size_t kNumMozcMultipleChoicePrefs = arraysize(kMozcMultipleChoicePrefs);
// For Traditional Chinese input methods (ibus-pinyin-bopomofo and ibus-chewing)
// TODO(yusukes): Add constants for Traditional Chinese input methods.
} // chromeos
#endif // CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_
|