diff --git a/scim-wnn/src/scim_wnn_def.h b/scim-wnn/src/scim_wnn_def.h index 5f97145..7baaca2 100644 --- a/scim-wnn/src/scim_wnn_def.h +++ b/scim-wnn/src/scim_wnn_def.h @@ -71,6 +71,8 @@ #define SCIM_DEFAULT_WNN_SERVER "localhost" #define SCIM_CONFIG_WNN_RC "/IMEngine/Wnn/Rc" #define SCIM_DEFAULT_WNN_RC "/usr/lib/wnn7/ja_JP/wnnenvrc" +#define SCIM_CONFIG_WNN_NUMKEY_SELECT "/IMEngine/Wnn/NumkeySelection" +#define SCIM_DEFAULT_WNN_NUMKEY_SELECT true #define SCIM_CONFIG_WNN_SERVERTYPE "/IMEngine/Wnn/ServerType" #ifdef HAVE_LIBWNN7 #define SCIM_DEFAULT_WNN_SERVERTYPE "Wnn7" diff --git a/scim-wnn/src/scim_wnn_imengine_setup.cpp b/scim-wnn/src/scim_wnn_imengine_setup.cpp index 56d0886..62bdd61 100644 --- a/scim-wnn/src/scim_wnn_imengine_setup.cpp +++ b/scim-wnn/src/scim_wnn_imengine_setup.cpp @@ -142,6 +142,8 @@ static String __config_wnn_rc = SCIM_DEFAULT_WNN_RC; static String __config_servertype = SCIM_DEFAULT_WNN_SERVERTYPE; static bool __config_yosoku = SCIM_DEFAULT_WNN_YOSOKU; +static bool __config_numkeyselect = SCIM_DEFAULT_WNN_NUMKEY_SELECT; +static int __config_alp = SCIM_DEFAULT_WNN_ALP; static bool __have_changed = true; @@ -150,6 +152,8 @@ static GtkWidget * __widget_servertype = 0; static GtkWidget * __widget_wnn_rc = 0; static GtkWidget * __widget_yosoku = 0; +static GtkWidget * __widget_alp = 0; +static GtkWidget * __widget_numkeyselect = 0; static GtkTooltips * __widget_tooltips = 0; static KeyboardConfigData __config_keyboards_common [] = @@ -417,6 +421,8 @@ static void on_default_editable_changed (GtkEditable *editable, gpointer user_data); +static void on_default_number_changed (GtkEditable *editable, + gpointer user_data); static void on_default_toggle_button_toggled (GtkToggleButton *togglebutton, gpointer user_data); static void on_default_key_selection_clicked (GtkButton *button, @@ -444,7 +450,7 @@ // G_CALLBACK (on_default_toggle_button_toggled), // &__config_use_kana); - table = gtk_table_new (3, 3, FALSE); + table = gtk_table_new (3, 6, FALSE); gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); @@ -495,7 +501,7 @@ _("input the path of wnnenvrc."), NULL); /* servertype */ - label = gtk_label_new_with_mnemonic (_("_Servertype: ")); + label = gtk_label_new_with_mnemonic (_("Server_type: ")); gtk_widget_show (label); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 4, 0); @@ -512,8 +518,9 @@ gtk_tooltips_set_tip (__widget_tooltips, __widget_servertype, _("select the server type from Wnn4 / Wnn6 / Wnn7."), NULL); - /* completion */ - label = gtk_label_new_with_mnemonic (_("_YOSOKU-input: ")); + + /* ALP */ + label = gtk_label_new_with_mnemonic (_("_Auto candidates popup: ")); gtk_widget_show (label); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 4, 0); @@ -521,15 +528,55 @@ (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 4, 4); - __widget_yosoku = gtk_toggle_button_new (); + GtkAdjustment* aj; + aj = (GtkAdjustment *) gtk_adjustment_new(0,-1,10,1,1,1); + __widget_alp = gtk_spin_button_new(aj,1,0); + gtk_widget_show (__widget_alp); + gtk_table_attach (GTK_TABLE (table), __widget_alp, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_alp); + gtk_tooltips_set_tip (__widget_tooltips, __widget_alp, + _("set the count of conversion until displaying the list of lookup result automatically."), NULL); + + /* numkeyselection */ + label = gtk_label_new_with_mnemonic (_("_NumKey selection: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + __widget_numkeyselect = gtk_check_button_new(); + gtk_widget_show (__widget_numkeyselect); + gtk_table_attach (GTK_TABLE (table), __widget_numkeyselect, 1, 2, 4, 5, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_numkeyselect); + gtk_tooltips_set_tip (__widget_tooltips, __widget_numkeyselect, + _("If you use the candidate selection by numkey, check this."), NULL); + + + /* completion */ + label = gtk_label_new_with_mnemonic (_("_YOSOKU-input: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + __widget_yosoku = gtk_check_button_new(); gtk_widget_show (__widget_yosoku); - gtk_table_attach (GTK_TABLE (table), __widget_yosoku, 1, 2, 3, 4, - (GtkAttachOptions) (GTK_SHRINK), - (GtkAttachOptions) (GTK_SHRINK), 4, 4); + gtk_table_attach (GTK_TABLE (table), __widget_yosoku, 1, 2, 5, 6, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_yosoku); gtk_tooltips_set_tip (__widget_tooltips, __widget_yosoku, _("if you use YOSOKU-input , check this."), NULL); + /* connect all signals */ g_signal_connect ((gpointer) __widget_server, "changed", G_CALLBACK (on_default_editable_changed), @@ -543,6 +590,12 @@ g_signal_connect ((gpointer) __widget_servertype, "changed", G_CALLBACK (on_default_editable_changed), &__config_servertype); + g_signal_connect ((gpointer) __widget_alp, "changed", + G_CALLBACK (on_default_number_changed), + &__config_alp); + g_signal_connect ((gpointer) __widget_numkeyselect, "toggled", + G_CALLBACK (on_default_toggle_button_toggled), + &__config_numkeyselect); g_signal_connect ((gpointer) __widget_yosoku, "toggled", G_CALLBACK (on_default_toggle_button_toggled), &__config_yosoku); @@ -668,6 +721,18 @@ __config_servertype.c_str ()); } + if (__widget_alp) { + gtk_spin_button_set_value ( + GTK_SPIN_BUTTON (__widget_alp), + __config_alp); + } + + if (__widget_numkeyselect) { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (__widget_numkeyselect), + __config_numkeyselect); + } + if (__widget_yosoku) { gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (__widget_yosoku), @@ -701,6 +766,12 @@ __config_servertype = config->read (String (SCIM_CONFIG_WNN_SERVERTYPE), __config_servertype); + __config_alp = + config->read (String (SCIM_CONFIG_WNN_ALP), + __config_alp); + __config_numkeyselect = + config->read (String (SCIM_CONFIG_WNN_NUMKEY_SELECT), + __config_numkeyselect); __config_yosoku = config->read (String (SCIM_CONFIG_WNN_YOSOKU), __config_yosoku); @@ -731,6 +802,10 @@ __config_wnn_rc); config->write (String (SCIM_CONFIG_WNN_SERVERTYPE), __config_servertype); + config->write (String (SCIM_CONFIG_WNN_ALP), + __config_alp); + config->write (String (SCIM_CONFIG_WNN_NUMKEY_SELECT), + __config_numkeyselect); config->write (String (SCIM_CONFIG_WNN_YOSOKU), __config_yosoku); @@ -777,6 +852,18 @@ } static void +on_default_number_changed (GtkEditable *editable, + gpointer user_data) +{ + int *num = static_cast (user_data); + + if (num) { + *num = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editable)); + __have_changed = true; + } +} + +static void on_default_key_selection_clicked (GtkButton *button, gpointer user_data) {