1
/* Copyright (C) 2011 Edward Der-Hua Liu, Hsin-Chu, Taiwan
3
* This library is free software; you can redistribute it and/or
4
* modify it under the terms of the GNU Lesser General Public
5
* License as published by the Free Software Foundation; either
6
* version 2.1 of the License, or (at your option) any later version.
8
* This library is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public
14
* License along with this library; if not, write to the Free Software
15
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
#include "pho-kbm-name.h"
22
/* "5849302-67" is Dvorak Simplified Keyboard remapped under QWERTY keyboard
23
* Please see: http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard
24
* https://github.com/caleb-/hime/issues/62
30
{"123456789",0}, {"asdfghjkl;",0}, {"asdfzxcv",0},
31
{"fdsavcxz",1}, {"rewfdsvcx",1}, {"fdsvcxrew",1}, {"3825416790", 1},
36
static GtkWidget *check_button_tsin_phrase_pre_select,
37
*check_button_phonetic_char_dynamic_sequence,
38
*check_button_pho_hide_row2,
39
*check_button_pho_in_row1,
40
*check_button_phonetic_huge_tab,
41
*check_button_tsin_tone_char_input,
42
*check_button_tsin_tab_phrase_end,
43
*check_button_tsin_tail_select_key,
44
*check_button_tsin_buffer_editing_mode,
45
*check_button_tsin_use_pho_near,
46
*spinner_tsin_buffer_size,
47
*spinner_pho_candicate_col_N;
49
GtkWidget *check_button_hime_capslock_lower;
51
static GtkWidget *opt_kbm_opts, *opt_selkeys, *opt_eng_ch_opts;
52
extern gboolean button_order;
59
{N_("CapsLock"), TSIN_CHINESE_ENGLISH_TOGGLE_KEY_CapsLock},
60
// {N_("Tab"), TSIN_CHINESE_ENGLISH_TOGGLE_KEY_Tab},
61
{N_("Shift"), TSIN_CHINESE_ENGLISH_TOGGLE_KEY_Shift},
62
{N_("左Shift"), TSIN_CHINESE_ENGLISH_TOGGLE_KEY_ShiftL},
63
{N_("右Shift"), TSIN_CHINESE_ENGLISH_TOGGLE_KEY_ShiftR},
65
int tsin_eng_ch_swN = sizeof(tsin_eng_ch_sw) / sizeof(tsin_eng_ch_sw[0]);
71
} tsin_space_options[]={
72
{N_("選擇同音字"), TSIN_SPACE_OPT_SELECT_CHAR},
73
{N_("輸入空白"), TSIN_SPACE_OPT_INPUT}
75
int tsin_space_optionsN = sizeof(tsin_space_options) / sizeof(tsin_space_options[0]);
77
extern char *pho_speaker[16];
78
extern int pho_speakerN;
80
int get_current_speaker_idx()
84
for(i=0; i < pho_speakerN; i++)
85
if (!strcmp(pho_speaker[i], phonetic_speak_sel))
91
void save_tsin_eng_pho_key()
94
idx = gtk_combo_box_get_active (GTK_COMBO_BOX (opt_eng_ch_opts));
95
save_hime_conf_int(TSIN_CHINESE_ENGLISH_TOGGLE_KEY,
96
tsin_eng_ch_sw[idx].key);
98
save_hime_conf_int(HIME_CAPSLOCK_LOWER,
99
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_hime_capslock_lower)));
103
static GtkWidget *hime_kbm_window = NULL;
105
static int new_select_idx_tsin_space_opt;
106
//static GdkColor tsin_phrase_line_gcolor;
107
static GdkColor tsin_cursor_gcolor;
110
static gboolean cb_ok( GtkWidget *widget,
114
int idx = gtk_combo_box_get_active (GTK_COMBO_BOX (opt_kbm_opts));
116
int idx_selkeys = gtk_combo_box_get_active (GTK_COMBO_BOX (opt_selkeys));
118
pho_candicate_col_N = (int) gtk_spin_button_get_value(GTK_SPIN_BUTTON(spinner_pho_candicate_col_N));
120
if (pho_candicate_col_N > strlen(selkeys[idx_selkeys].kstr))
121
pho_candicate_col_N = strlen(selkeys[idx_selkeys].kstr);
123
dbg("pho_candicate_col_N %d\n", pho_candicate_col_N);
126
sprintf(tt, "%s %s %d %d", kbm_sel[idx].kbm, selkeys[idx_selkeys].kstr, pho_candicate_col_N, selkeys[idx_selkeys].RL);
128
char phokbm_name[128];
129
get_hime_conf_fstr(PHONETIC_KEYBOARD, phokbm_name, "");
131
if (strcmp(phokbm_name, tt)) {
132
save_hime_conf_str(PHONETIC_KEYBOARD_BAK, phokbm_name);
134
save_hime_conf_str(PHONETIC_KEYBOARD, tt);
136
save_tsin_eng_pho_key();
138
save_hime_conf_int(TSIN_SPACE_OPT,
139
tsin_space_options[new_select_idx_tsin_space_opt].key);
141
save_hime_conf_int(TSIN_PHRASE_PRE_SELECT,
142
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_phrase_pre_select)));
144
save_hime_conf_int(PHONETIC_CHAR_DYNAMIC_SEQUENCE,
145
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_phonetic_char_dynamic_sequence)));
146
save_hime_conf_int(PHO_HIDE_ROW2,
147
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_pho_hide_row2)));
149
save_hime_conf_int(PHO_IN_ROW1,
150
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_pho_in_row1)));
152
save_hime_conf_int(PHONETIC_HUGE_TAB,
153
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_phonetic_huge_tab)));
155
save_hime_conf_int(TSIN_TONE_CHAR_INPUT,
156
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_tone_char_input)));
158
save_hime_conf_int(TSIN_USE_PHO_NEAR,
159
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_use_pho_near)));
162
save_hime_conf_int(TSIN_TAB_PHRASE_END,
163
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_tab_phrase_end)));
166
save_hime_conf_int(TSIN_TAIL_SELECT_KEY,
167
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_tail_select_key)));
169
save_hime_conf_int(TSIN_BUFFER_EDITING_MODE,
170
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_buffer_editing_mode)));
172
tsin_buffer_size = (int) gtk_spin_button_get_value(GTK_SPIN_BUTTON(spinner_tsin_buffer_size));
173
save_hime_conf_int(TSIN_BUFFER_SIZE, tsin_buffer_size);
177
cstr = gtk_color_selection_palette_to_string(&tsin_phrase_line_gcolor, 1);
178
dbg("color %s\n", cstr);
179
save_hime_conf_str(TSIN_PHRASE_LINE_COLOR, cstr);
184
cstr = gtk_color_selection_palette_to_string(&tsin_cursor_gcolor, 1);
185
dbg("color %s\n", cstr);
186
save_hime_conf_str(TSIN_CURSOR_COLOR, cstr);
189
/* caleb- does found where "reload kbm" is used.
190
* caleb- think the send_hime_message() here does nothing.
192
send_hime_message(GDK_DISPLAY(), "reload kbm");
194
gtk_widget_destroy(hime_kbm_window); hime_kbm_window = NULL;
201
static void callback_button_clicked_tsin_sw( GtkWidget *widget, gpointer data)
203
new_select_idx_tsin_sw = (int) data;
208
static void callback_button_clicked_tsin_space_opt( GtkWidget *widget, gpointer data)
210
new_select_idx_tsin_space_opt = (gsize) data;
214
static int get_current_kbm_idx()
217
for(i=0; kbm_sel[i].kbm; i++)
218
if (!strcmp(kbm_sel[i].kbm, pho_kbm_name)) {
222
p_err("phonetic-keyboard->%s is not valid", pho_kbm_name);
226
static int get_currnet_eng_ch_sw_idx()
229
for(i=0; i < tsin_eng_ch_swN; i++)
230
if (tsin_eng_ch_sw[i].key == tsin_chinese_english_toggle_key)
233
p_err("tsin-chinese-english-switch->%d is not valid", tsin_chinese_english_toggle_key);
238
static int get_currnet_tsin_space_option_idx()
241
for(i=0; i < tsin_space_optionsN; i++)
242
if (tsin_space_options[i].key == tsin_space_opt)
245
p_err("tsin-space-opt->%d is not valid", tsin_space_opt);
249
static gboolean close_kbm_window( GtkWidget *widget,
253
gtk_widget_destroy(hime_kbm_window); hime_kbm_window = NULL;
257
//static GtkWidget *da_phrase_line;
258
static GtkWidget *da_cursor;
261
static void cb_save_tsin_phrase_line_color(GtkWidget *widget, gpointer user_data)
263
GtkColorSelectionDialog *color_selector = (GtkColorSelectionDialog *)user_data;
264
gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(color_selector)), &tsin_phrase_line_gcolor);
266
#if !GTK_CHECK_VERSION(2,91,6)
267
gtk_widget_modify_bg(da_phrase_line, GTK_STATE_NORMAL, &tsin_phrase_line_gcolor);
270
gdk_rgba_parse(&rgbbg, gdk_color_to_string(&tsin_phrase_line_gcolor));
271
gtk_widget_override_background_color(da_phrase_line, GTK_STATE_FLAG_NORMAL, &rgbbg);
276
static void cb_save_tsin_cursor_color(GtkWidget *widget, gpointer user_data)
278
GtkColorSelectionDialog *color_selector = (GtkColorSelectionDialog *)user_data;
279
gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(color_selector)), &tsin_cursor_gcolor);
281
#if !GTK_CHECK_VERSION(2,91,6)
282
gtk_widget_modify_bg(da_cursor, GTK_STATE_NORMAL, &tsin_cursor_gcolor);
285
gdk_rgba_parse(&rgbbg, gdk_color_to_string(&tsin_cursor_gcolor));
286
gtk_widget_override_background_color(da_cursor, GTK_STATE_FLAG_NORMAL, &rgbbg);
291
static gboolean cb_tsin_cursor_color( GtkWidget *widget,
294
GtkWidget *color_selector = gtk_color_selection_dialog_new (_("詞音游標的顏色"));
296
gtk_color_selection_set_current_color(
297
GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_selector))),
298
&tsin_cursor_gcolor);
302
g_signal_connect (GTK_OBJECT (color_selector->ok_button),
304
G_CALLBACK (cb_save_tsin_cursor_color),
305
(gpointer) color_selector);
307
g_signal_connect_swapped (GTK_OBJECT (color_selector->ok_button),
309
G_CALLBACK (gtk_widget_destroy),
310
(gpointer) color_selector);
312
g_signal_connect_swapped (GTK_OBJECT (color_selector->cancel_button),
314
G_CALLBACK (gtk_widget_destroy),
315
(gpointer) color_selector);
318
gtk_widget_show((GtkWidget*)color_selector);
320
if (gtk_dialog_run(GTK_DIALOG(color_selector)) == GTK_RESPONSE_OK)
321
cb_save_tsin_cursor_color((GtkWidget *)color_selector, (gpointer) color_selector);
322
gtk_widget_destroy((GtkWidget *)color_selector);
327
static GtkWidget *create_kbm_opts()
330
GtkWidget *hbox = gtk_hbox_new (FALSE, 1);
332
opt_kbm_opts = gtk_combo_box_new_text ();
333
gtk_box_pack_start (GTK_BOX (hbox), opt_kbm_opts, FALSE, FALSE, 0);
336
int current_idx = get_current_kbm_idx();
338
for(i=0; kbm_sel[i].name; i++) {
339
gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (opt_kbm_opts), _(kbm_sel[i].name));
342
gtk_combo_box_set_active (GTK_COMBO_BOX (opt_kbm_opts), current_idx);
344
opt_selkeys = gtk_combo_box_new_text ();
345
gtk_box_pack_start (GTK_BOX (hbox), opt_selkeys, FALSE, FALSE, 0);
348
for(i=0; selkeys[i].kstr; i++) {
349
gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (opt_selkeys), selkeys[i].kstr);
350
if (!strcmp(selkeys[i].kstr, pho_selkey))
354
gtk_combo_box_set_active (GTK_COMBO_BOX (opt_selkeys), current_idx);
357
(GtkAdjustment *) gtk_adjustment_new (pho_candicate_col_N, 1, 10, 1.0, 1.0, 0.0);
358
spinner_pho_candicate_col_N = gtk_spin_button_new (adj, 0, 0);
359
gtk_box_pack_start (GTK_BOX (hbox), spinner_pho_candicate_col_N, FALSE, FALSE, 0);
366
static GtkWidget *create_eng_ch_opts()
369
GtkWidget *hbox = gtk_hbox_new (FALSE, 1);
371
opt_eng_ch_opts = gtk_combo_box_new_text ();
372
gtk_box_pack_start (GTK_BOX (hbox), opt_eng_ch_opts, FALSE, FALSE, 0);
375
int current_idx = get_currnet_eng_ch_sw_idx();
377
for(i=0; i < tsin_eng_ch_swN; i++) {
378
gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (opt_eng_ch_opts), _(tsin_eng_ch_sw[i].name));
381
dbg("current_idx:%d\n", current_idx);
383
gtk_combo_box_set_active (GTK_COMBO_BOX (opt_eng_ch_opts), current_idx);
388
GtkWidget *create_en_pho_key_sel(char *s)
390
GtkWidget *frame_tsin_sw = gtk_frame_new(s);
391
GtkWidget *vbox_tsin_sw = gtk_vbox_new(FALSE, 0);
392
gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_tsin_sw), GTK_ORIENTATION_VERTICAL);
393
gtk_container_add (GTK_CONTAINER (frame_tsin_sw), vbox_tsin_sw);
394
gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_sw), 1);
395
gtk_container_add (GTK_CONTAINER (vbox_tsin_sw), create_eng_ch_opts());
396
GtkWidget *hbox_hime_capslock_lower = gtk_hbox_new(FALSE, 0);
397
gtk_box_pack_start (GTK_BOX (vbox_tsin_sw), hbox_hime_capslock_lower, TRUE, TRUE, 0);
398
check_button_hime_capslock_lower = gtk_check_button_new_with_label(_("按下 Capslock 時輸出小寫英數字"));
399
gtk_box_pack_start (GTK_BOX (hbox_hime_capslock_lower), check_button_hime_capslock_lower, FALSE, FALSE, 0);
400
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_hime_capslock_lower), hime_capslock_lower);
402
return frame_tsin_sw;
406
void load_setttings();
408
void create_kbm_window()
410
if (hime_kbm_window) {
411
gtk_window_present(GTK_WINDOW(hime_kbm_window));
417
hime_kbm_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
418
gtk_window_set_position(GTK_WINDOW(hime_kbm_window), GTK_WIN_POS_MOUSE);
419
gtk_window_set_has_resize_grip(GTK_WINDOW(hime_kbm_window), FALSE);
421
g_signal_connect (G_OBJECT (hime_kbm_window), "delete_event",
422
G_CALLBACK (close_kbm_window),
425
gtk_window_set_title (GTK_WINDOW (hime_kbm_window), _("HIME 注音/詞音設定"));
426
gtk_container_set_border_width (GTK_CONTAINER (hime_kbm_window), 1);
428
GtkWidget *vbox_top = gtk_vbox_new (FALSE, 3);
429
gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_top), GTK_ORIENTATION_VERTICAL);
430
gtk_container_add (GTK_CONTAINER (hime_kbm_window), vbox_top);
433
GtkWidget *hbox_lr = gtk_hbox_new (FALSE, 3);
434
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_lr, TRUE, TRUE, 0);
437
GtkWidget *vbox_l = gtk_vbox_new (FALSE, 3);
438
gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_l), GTK_ORIENTATION_VERTICAL);
439
gtk_box_pack_start (GTK_BOX (hbox_lr), vbox_l, TRUE, TRUE, 10);
441
GtkWidget *vbox_r = gtk_vbox_new (FALSE, 3);
442
gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_r), GTK_ORIENTATION_VERTICAL);
443
gtk_grid_set_row_homogeneous(GTK_GRID(vbox_r), TRUE);
444
gtk_box_pack_start (GTK_BOX (hbox_lr), vbox_r, TRUE, TRUE, 10);
447
GtkWidget *frame_kbm = gtk_frame_new(_("鍵盤排列方式/選擇鍵/選單每列字數"));
448
gtk_box_pack_start (GTK_BOX (vbox_l), frame_kbm, TRUE, TRUE, 0);
449
gtk_container_set_border_width (GTK_CONTAINER (frame_kbm), 1);
450
gtk_container_add (GTK_CONTAINER (frame_kbm), create_kbm_opts());
452
gtk_box_pack_start (GTK_BOX (vbox_l), create_en_pho_key_sel(_("(詞音) 切換[中/英]輸入")), TRUE, TRUE, 0);
454
GtkWidget *frame_tsin_space_opt = gtk_frame_new(_("(詞音) 鍵入空白鍵"));
455
gtk_box_pack_start (GTK_BOX (vbox_l), frame_tsin_space_opt, TRUE, TRUE, 0);
456
gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_space_opt), 1);
458
GtkWidget *box_tsin_space_opt = gtk_vbox_new (FALSE, 0);
459
gtk_orientable_set_orientation(GTK_ORIENTABLE(box_tsin_space_opt), GTK_ORIENTATION_VERTICAL);
460
gtk_container_add (GTK_CONTAINER (frame_tsin_space_opt), box_tsin_space_opt);
461
gtk_container_set_border_width (GTK_CONTAINER (box_tsin_space_opt), 1);
463
GSList *group_tsin_space_opt = NULL;
464
int current_idx = get_currnet_tsin_space_option_idx();
465
new_select_idx_tsin_space_opt = current_idx;
468
for(i=0; i< tsin_space_optionsN; i++) {
469
GtkWidget *button = gtk_radio_button_new_with_label (group_tsin_space_opt, _(tsin_space_options[i].name));
470
gtk_box_pack_start (GTK_BOX (box_tsin_space_opt), button, TRUE, TRUE, 0);
472
group_tsin_space_opt = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
474
g_signal_connect (G_OBJECT (button), "clicked",
475
G_CALLBACK (callback_button_clicked_tsin_space_opt), (gpointer) i);
478
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
481
GtkWidget *hbox_tsin_phrase_pre_select = gtk_hbox_new(FALSE, 0);
482
gtk_box_pack_start (GTK_BOX (vbox_l), hbox_tsin_phrase_pre_select , TRUE, TRUE, 1);
483
check_button_tsin_phrase_pre_select = gtk_check_button_new_with_label(_("詞音輸入預選詞視窗"));
484
gtk_box_pack_start (GTK_BOX (hbox_tsin_phrase_pre_select), check_button_tsin_phrase_pre_select, FALSE, FALSE, 0);
485
gtk_toggle_button_set_active(
486
GTK_TOGGLE_BUTTON(check_button_tsin_phrase_pre_select), tsin_phrase_pre_select);
489
GtkWidget *hbox_phonetic_char_dynamic_sequence = gtk_hbox_new(FALSE, 0);
490
gtk_box_pack_start (GTK_BOX (vbox_l), hbox_phonetic_char_dynamic_sequence , TRUE, TRUE, 1);
491
check_button_phonetic_char_dynamic_sequence = gtk_check_button_new_with_label(_("依使用頻率調整字的順序"));
492
gtk_box_pack_start (GTK_BOX (hbox_phonetic_char_dynamic_sequence), check_button_phonetic_char_dynamic_sequence, FALSE, FALSE, 0);
493
gtk_toggle_button_set_active(
494
GTK_TOGGLE_BUTTON(check_button_phonetic_char_dynamic_sequence), phonetic_char_dynamic_sequence);
497
GtkWidget *hbox_pho_hide_row2 = gtk_hbox_new(FALSE, 0);
498
gtk_box_pack_start (GTK_BOX (vbox_l), hbox_pho_hide_row2 , TRUE, TRUE, 1);
499
check_button_pho_hide_row2 = gtk_check_button_new_with_label(_("注音隱藏第二列 (注音符號)"));
500
gtk_box_pack_start (GTK_BOX (hbox_pho_hide_row2), check_button_pho_hide_row2, FALSE, FALSE, 0);
501
gtk_toggle_button_set_active(
502
GTK_TOGGLE_BUTTON(check_button_pho_hide_row2), pho_hide_row2);
505
GtkWidget *hbox_pho_in_row1 = gtk_hbox_new(FALSE, 0);
506
gtk_box_pack_start (GTK_BOX (vbox_l), hbox_pho_in_row1 , TRUE, TRUE, 1);
507
check_button_pho_in_row1 = gtk_check_button_new_with_label(_("注音符號移至第一列"));
508
gtk_box_pack_start (GTK_BOX (hbox_pho_in_row1), check_button_pho_in_row1, FALSE, FALSE, 0);
509
gtk_toggle_button_set_active(
510
GTK_TOGGLE_BUTTON(check_button_pho_in_row1), pho_in_row1);
513
GtkWidget *hbox_phonetic_huge_tab = gtk_hbox_new(FALSE, 0);
514
gtk_box_pack_start (GTK_BOX (vbox_r), hbox_phonetic_huge_tab , TRUE, TRUE, 1);
515
check_button_phonetic_huge_tab = gtk_check_button_new_with_label(_("使用巨大 UTF-8 字集"));
516
gtk_box_pack_start (GTK_BOX (hbox_phonetic_huge_tab), check_button_phonetic_huge_tab, FALSE, FALSE, 0);
517
gtk_toggle_button_set_active(
518
GTK_TOGGLE_BUTTON(check_button_phonetic_huge_tab), phonetic_huge_tab);
521
GtkWidget *hbox_tsin_tone_char_input = gtk_hbox_new(FALSE, 0);
522
gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_tone_char_input , TRUE, TRUE, 1);
523
check_button_tsin_tone_char_input = gtk_check_button_new_with_label(_("(詞音) 輸入注音聲調符號"));
524
gtk_box_pack_start (GTK_BOX (hbox_tsin_tone_char_input), check_button_tsin_tone_char_input, FALSE, FALSE, 0);
525
gtk_toggle_button_set_active(
526
GTK_TOGGLE_BUTTON(check_button_tsin_tone_char_input), tsin_tone_char_input);
529
GtkWidget *hbox_tsin_tab_phrase_end = gtk_hbox_new(FALSE, 1);
530
gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_tab_phrase_end , TRUE, TRUE, 1);
531
check_button_tsin_tab_phrase_end = gtk_check_button_new_with_label(_("(詞音) 使用 Escape/Tab 斷詞"));
532
gtk_box_pack_start (GTK_BOX (hbox_tsin_tab_phrase_end), check_button_tsin_tab_phrase_end, FALSE, FALSE, 0);
533
gtk_toggle_button_set_active(
534
GTK_TOGGLE_BUTTON(check_button_tsin_tab_phrase_end), tsin_tab_phrase_end);
536
GtkWidget *hbox_tsin_tail_select_key = gtk_hbox_new(FALSE, 0);
537
gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_tail_select_key , TRUE, TRUE, 1);
538
check_button_tsin_tail_select_key = gtk_check_button_new_with_label(_("選擇鍵顯示於候選字(詞)後方"));
539
gtk_box_pack_start (GTK_BOX (hbox_tsin_tail_select_key), check_button_tsin_tail_select_key, FALSE, FALSE, 0);
540
gtk_toggle_button_set_active(
541
GTK_TOGGLE_BUTTON(check_button_tsin_tail_select_key), tsin_tail_select_key);
543
GtkWidget *hbox_tsin_buffer_editing_mode = gtk_hbox_new(FALSE, 0);
544
gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_buffer_editing_mode , TRUE, TRUE, 1);
545
check_button_tsin_buffer_editing_mode = gtk_check_button_new_with_label(_("\\ 鍵可切換 jkx 鍵編輯模式"));
546
gtk_box_pack_start (GTK_BOX (hbox_tsin_buffer_editing_mode), check_button_tsin_buffer_editing_mode, FALSE, FALSE, 0);
547
gtk_toggle_button_set_active(
548
GTK_TOGGLE_BUTTON(check_button_tsin_buffer_editing_mode), tsin_buffer_editing_mode);
550
GtkWidget *hbox_tsin_use_pho_near = gtk_hbox_new(FALSE, 0);
551
gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_use_pho_near , TRUE, TRUE, 1);
552
check_button_tsin_use_pho_near = gtk_check_button_new_with_label(_("按下 ↑ 鍵查詢近似音"));
553
gtk_box_pack_start (GTK_BOX (hbox_tsin_use_pho_near), check_button_tsin_use_pho_near, FALSE, FALSE, 0);
554
gtk_toggle_button_set_active(
555
GTK_TOGGLE_BUTTON(check_button_tsin_use_pho_near), tsin_use_pho_near);
557
GtkWidget *frame_tsin_buffer_size = gtk_frame_new(_("(詞音) 的編輯緩衝區大小"));
558
gtk_box_pack_start (GTK_BOX (vbox_r), frame_tsin_buffer_size, FALSE, FALSE, 0);
559
gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_buffer_size), 1);
560
GtkAdjustment *adj_gtab_in =
561
(GtkAdjustment *) gtk_adjustment_new (tsin_buffer_size, 10.0, MAX_PH_BF, 1.0, 1.0, 0.0);
562
spinner_tsin_buffer_size = gtk_spin_button_new (adj_gtab_in, 0, 0);
563
gtk_container_add (GTK_CONTAINER (frame_tsin_buffer_size), spinner_tsin_buffer_size);
565
GtkWidget *frame_tsin_cursor_color = gtk_frame_new(_("詞音游標的顏色"));
566
gtk_box_pack_start (GTK_BOX (vbox_r), frame_tsin_cursor_color, FALSE, FALSE, 0);
567
gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_cursor_color), 1);
568
GtkWidget *button_tsin_cursor_color = gtk_button_new();
569
g_signal_connect (G_OBJECT (button_tsin_cursor_color), "clicked",
570
G_CALLBACK (cb_tsin_cursor_color), G_OBJECT (hime_kbm_window));
571
da_cursor = gtk_drawing_area_new();
572
gtk_container_add (GTK_CONTAINER (button_tsin_cursor_color), da_cursor);
573
gdk_color_parse(tsin_cursor_color, &tsin_cursor_gcolor);
574
#if !GTK_CHECK_VERSION(2,91,6)
575
gtk_widget_modify_bg(da_cursor, GTK_STATE_NORMAL, &tsin_cursor_gcolor);
578
gdk_rgba_parse(&rgbbg, gdk_color_to_string(&tsin_cursor_gcolor));
579
gtk_widget_override_background_color(da_cursor, GTK_STATE_FLAG_NORMAL, &rgbbg);
581
gtk_widget_set_size_request(da_cursor, 16, 2);
582
gtk_container_add (GTK_CONTAINER (frame_tsin_cursor_color), button_tsin_cursor_color);
584
GtkWidget *hbox_cancel_ok = gtk_hbox_new (FALSE, 10);
585
gtk_grid_set_column_homogeneous(GTK_GRID(hbox_cancel_ok), TRUE);
586
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_cancel_ok , FALSE, FALSE, 5);
587
GtkWidget *button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
589
gtk_box_pack_end (GTK_BOX (hbox_cancel_ok), button_cancel, TRUE, TRUE, 0);
591
gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_cancel, TRUE, TRUE, 0);
592
GtkWidget *button_ok = gtk_button_new_from_stock (GTK_STOCK_OK);
593
#if !GTK_CHECK_VERSION(2,91,2)
595
gtk_box_pack_end (GTK_BOX (hbox_cancel_ok), button_ok, TRUE, TRUE, 5);
597
gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_ok, TRUE, TRUE, 5);
600
gtk_grid_attach_next_to (GTK_BOX (hbox_cancel_ok), button_ok, button_cancel, GTK_POS_LEFT, 1, 1);
602
gtk_grid_attach_next_to (GTK_BOX (hbox_cancel_ok), button_ok, button_cancel, GTK_POS_RIGHT, 1, 1);
605
g_signal_connect (G_OBJECT (button_cancel), "clicked",
606
G_CALLBACK (close_kbm_window),
607
G_OBJECT (hime_kbm_window));
609
g_signal_connect_swapped (G_OBJECT (button_ok), "clicked",
611
G_OBJECT (hime_kbm_window));
613
GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT);
614
gtk_widget_grab_default (button_cancel);
616
gtk_widget_show_all (hime_kbm_window);