From: Tristan Chabredier Date: Thu, 21 Dec 2006 10:52:39 +0000 (+0000) Subject: 2006-12-21 [wwp] 2.6.1cvs63 X-Git-Tag: rel_2_7_0~59 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=6fc676bcb121bed4e8d3b9188d01b2c27fc417ea 2006-12-21 [wwp] 2.6.1cvs63 * src/compose.c * src/prefs_common.c * src/prefs_common.h * src/prefs_spelling.c * src/gtk/gtkaspell.c * src/gtk/gtkaspell.h Allow spell-checking using both current and alternate dictionaries (thanks to Colin). --- diff --git a/ChangeLog b/ChangeLog index d1c62139b..ba5eecf0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-12-21 [wwp] 2.6.1cvs63 + + * src/compose.c + * src/prefs_common.c + * src/prefs_common.h + * src/prefs_spelling.c + * src/gtk/gtkaspell.c + * src/gtk/gtkaspell.h + Allow spell-checking using both current and alternate dictionaries + (thanks to Colin). + 2006-12-21 [wwp] 2.6.1cvs62 * src/gtk/gtkaspell.c diff --git a/PATCHSETS b/PATCHSETS index 9586174d3..ca5ffa481 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -2170,3 +2170,4 @@ ( cvs diff -u -r 1.213.2.125 -r 1.213.2.126 src/folder.c; cvs diff -u -r 1.12.2.15 -r 1.12.2.16 src/html.c; ) > 2.6.1cvs60.patchset ( cvs diff -u -r 1.382.2.342 -r 1.382.2.343 src/compose.c; cvs diff -u -r 1.2.2.5 -r 1.2.2.6 src/folder_item_prefs.h; cvs diff -u -r 1.204.2.113 -r 1.204.2.114 src/prefs_common.c; cvs diff -u -r 1.103.2.70 -r 1.103.2.71 src/prefs_common.h; cvs diff -u -r 1.52.2.29 -r 1.52.2.30 src/prefs_folder_item.c; cvs diff -u -r 1.5.2.27 -r 1.5.2.28 src/prefs_spelling.c; cvs diff -u -r 1.9.2.44 -r 1.9.2.45 src/gtk/gtkaspell.c; cvs diff -u -r 1.5.2.7 -r 1.5.2.8 src/gtk/gtkaspell.h; ) > 2.6.1cvs61.patchset ( cvs diff -u -r 1.9.2.45 -r 1.9.2.46 src/gtk/gtkaspell.c; ) > 2.6.1cvs62.patchset +( cvs diff -u -r 1.382.2.343 -r 1.382.2.344 src/compose.c; cvs diff -u -r 1.204.2.114 -r 1.204.2.115 src/prefs_common.c; cvs diff -u -r 1.103.2.71 -r 1.103.2.72 src/prefs_common.h; cvs diff -u -r 1.5.2.28 -r 1.5.2.29 src/prefs_spelling.c; cvs diff -u -r 1.9.2.46 -r 1.9.2.47 src/gtk/gtkaspell.c; cvs diff -u -r 1.5.2.8 -r 1.5.2.9 src/gtk/gtkaspell.h; ) > 2.6.1cvs63.patchset diff --git a/configure.ac b/configure.ac index 45e116488..070b13000 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=6 MICRO_VERSION=1 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=62 +EXTRA_VERSION=63 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/compose.c b/src/compose.c index 1357b42aa..e5a90199c 100644 --- a/src/compose.c +++ b/src/compose.c @@ -6386,6 +6386,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode, prefs_common.check_while_typing, prefs_common.recheck_when_changing_dict, prefs_common.use_alternate, + prefs_common.use_both_dicts, GTK_TEXT_VIEW(text), GTK_WINDOW(compose->window), compose_spell_menu_changed, diff --git a/src/gtk/gtkaspell.c b/src/gtk/gtkaspell.c index ba1696c05..1bbb15b07 100644 --- a/src/gtk/gtkaspell.c +++ b/src/gtk/gtkaspell.c @@ -123,6 +123,7 @@ struct _GtkAspell gboolean check_while_typing; gboolean recheck_when_changing_dict; gboolean use_alternate; + gboolean use_both_dicts; ContCheckFunc continue_check; @@ -177,6 +178,8 @@ static gint set_dictionary (AspellConfig *config, Dictionary *dict); static void set_sug_mode_cb (GtkMenuItem *w, GtkAspell *gtkaspell); +static void set_use_both_cb (GtkMenuItem *w, + GtkAspell *gtkaspell); static void set_real_sug_mode (GtkAspell *gtkaspell, const char *themode); @@ -379,6 +382,7 @@ GtkAspell *gtkaspell_new(const gchar *dictionary_path, gboolean check_while_typing, gboolean recheck_when_changing_dict, gboolean use_alternate, + gboolean use_both_dicts, GtkTextView *gtktext, GtkWindow *parent_win, void (*spell_menu_cb)(void *data), @@ -451,6 +455,7 @@ GtkAspell *gtkaspell_new(const gchar *dictionary_path, gtkaspell->max_sug = -1; gtkaspell->suggestions_list = NULL; gtkaspell->use_alternate = use_alternate; + gtkaspell->use_both_dicts = use_both_dicts; gtkaspell->parent_window = GTK_WIDGET(parent_win); gtkaspell->menu_changed_cb = spell_menu_cb; gtkaspell->menu_changed_data = data; @@ -842,6 +847,19 @@ static void set_sug_mode_cb(GtkMenuItem *w, GtkAspell *gtkaspell) gtkaspell->menu_changed_cb(gtkaspell->menu_changed_data); } +/* set_sug_mode_cb() - Menu callback: Set the suggestion mode */ +static void set_use_both_cb(GtkMenuItem *w, GtkAspell *gtkaspell) +{ + gtkaspell->use_both_dicts = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); + + if (gtkaspell->recheck_when_changing_dict) { + gtkaspell_highlight_all(gtkaspell); + } + + if (gtkaspell->menu_changed_cb) + gtkaspell->menu_changed_cb(gtkaspell->menu_changed_data); +} + static void set_real_sug_mode(GtkAspell *gtkaspell, const char *themode) { gint result; @@ -937,8 +955,15 @@ static GList *misspelled_suggest(GtkAspell *gtkaspell, gchar *word) /* misspelled_test() - Just test if word is correctly spelled */ static int misspelled_test(GtkAspell *gtkaspell, unsigned char *word) { - return aspell_speller_check(gtkaspell->gtkaspeller->checker, (char *)word, -1) + gint result = aspell_speller_check(gtkaspell->gtkaspeller->checker, (char *)word, -1) + ? 0 : 1; + if (result && gtkaspell->use_both_dicts && gtkaspell->alternate_speller) { + use_alternate_dict(gtkaspell); + result = aspell_speller_check(gtkaspell->gtkaspeller->checker, (char *)word, -1) ? 0 : 1; + use_alternate_dict(gtkaspell); + } + return result; } @@ -2113,7 +2138,22 @@ static GSList *populate_submenu(GtkAspell *gtkaspell) list = g_slist_append(list, item); } + item = gtk_check_menu_item_new_with_label(_("Use both dictionaries")); + if (gtkaspell->use_both_dicts) { + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); + } + g_signal_connect(G_OBJECT(item), "activate", + G_CALLBACK(set_use_both_cb), + gtkaspell); + gtk_widget_show(item); + list = g_slist_append(list, item); + + item = gtk_menu_item_new(); + gtk_widget_show(item); + list = g_slist_append(list, item); + item = gtk_check_menu_item_new_with_label(_("Fast Mode")); + gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(item), TRUE); if (gtkaspell->gtkaspeller->sug_mode == ASPELL_FASTMODE) { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),TRUE); gtk_widget_set_sensitive(GTK_WIDGET(item),FALSE); @@ -2125,6 +2165,7 @@ static GSList *populate_submenu(GtkAspell *gtkaspell) list = g_slist_append(list, item); item = gtk_check_menu_item_new_with_label(_("Normal Mode")); + gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(item), TRUE); if (gtkaspell->gtkaspeller->sug_mode == ASPELL_NORMALMODE) { gtk_widget_set_sensitive(GTK_WIDGET(item), FALSE); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); @@ -2136,6 +2177,7 @@ static GSList *populate_submenu(GtkAspell *gtkaspell) list = g_slist_append(list, item); item = gtk_check_menu_item_new_with_label(_("Bad Spellers Mode")); + gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(item), TRUE); if (gtkaspell->gtkaspeller->sug_mode == ASPELL_BADSPELLERMODE) { gtk_widget_set_sensitive(GTK_WIDGET(item), FALSE); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); diff --git a/src/gtk/gtkaspell.h b/src/gtk/gtkaspell.h index b3278c017..cbcb24447 100644 --- a/src/gtk/gtkaspell.h +++ b/src/gtk/gtkaspell.h @@ -58,6 +58,7 @@ GtkAspell* gtkaspell_new (const gchar *dictionary_path, gboolean check_while_typing, gboolean recheck_when_changing_dict, gboolean use_alternate, + gboolean use_both_dicts, GtkTextView *gtktext, GtkWindow *parent_win, void (*spell_menu_cb)(void *data), diff --git a/src/prefs_common.c b/src/prefs_common.c index b272fea77..1e1408ac9 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -241,6 +241,8 @@ static PrefParam param[] = { P_BOOL, NULL, NULL, NULL}, {"misspelled_color", "16711680", &prefs_common.misspelled_col, P_COLOR, NULL, NULL, NULL}, + {"use_both_dicts", "FALSE", &prefs_common.use_both_dicts, P_BOOL, + NULL, NULL, NULL}, #endif {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL, NULL, NULL, NULL}, diff --git a/src/prefs_common.h b/src/prefs_common.h index 6f91b9aa1..7931ab4f2 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -151,6 +151,7 @@ struct _PrefsCommon gboolean check_while_typing; gboolean recheck_when_changing_dict; gboolean use_alternate; + gboolean use_both_dicts; #endif /* Display */ diff --git a/src/prefs_spelling.c b/src/prefs_spelling.c index 73c686fad..81cebb98d 100644 --- a/src/prefs_spelling.c +++ b/src/prefs_spelling.c @@ -67,6 +67,8 @@ typedef struct _SpellingPage GtkWidget *default_alt_dict_optmenu; GtkWidget *default_alt_dict_optmenu_menu; + GtkWidget *both_dict_check; + GtkWidget *sugmode_label; GtkWidget *sugmode_optmenu; GtkWidget *sugmode_optmenu_menu; @@ -162,7 +164,8 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer GtkWidget *sugmode_label; GtkWidget *sugmode_optmenu; GtkWidget *sugmode_optmenu_menu; - + + GtkWidget *both_dict_check; GtkWidget *misspelled_label; GtkWidget *misspelled_hbox; GtkWidget *misspelled_colorbtn; @@ -226,7 +229,7 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer gtk_widget_show(vbox2); gtk_container_add(GTK_CONTAINER(dictionary_frame), vbox2); - table = gtk_table_new(6, 3, FALSE); + table = gtk_table_new(6, 4, FALSE); gtk_widget_show(table); gtk_container_set_border_width(GTK_CONTAINER(table), 8); gtk_table_set_row_spacings(GTK_TABLE(table), 4); @@ -270,9 +273,16 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer gtk_option_menu_set_menu(GTK_OPTION_MENU(default_alt_dict_optmenu), default_alt_dict_optmenu_menu); + both_dict_check = gtk_check_button_new_with_label( + _("Check with both dictionaries")); + gtk_widget_show(both_dict_check); + gtk_table_attach (GTK_TABLE (table), both_dict_check, 1, 2, 2, 3, + GTK_SHRINK, 0, 0, 0); + + sugmode_label = gtk_label_new(_("Default suggestion mode")); gtk_widget_show(sugmode_label); - gtk_table_attach(GTK_TABLE (table), sugmode_label, 0, 1, 2, 3, + gtk_table_attach(GTK_TABLE (table), sugmode_label, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 2); gtk_label_set_justify(GTK_LABEL(sugmode_label), GTK_JUSTIFY_RIGHT); @@ -281,7 +291,7 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer sugmode_optmenu = gtk_option_menu_new(); gtk_widget_show(sugmode_optmenu); gtk_widget_set_size_request(sugmode_optmenu, 180, -1); - gtk_table_attach (GTK_TABLE (table), sugmode_optmenu, 1, 2, 2, 3, + gtk_table_attach (GTK_TABLE (table), sugmode_optmenu, 1, 2, 3, 4, GTK_SHRINK, 0, 0, 0); sugmode_optmenu_menu = gtk_menu_new(); @@ -317,9 +327,12 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, use_alternate_checkbtn); SET_TOGGLE_SENSITIVITY(use_alternate_checkbtn, default_alt_dict_label); SET_TOGGLE_SENSITIVITY(use_alternate_checkbtn, default_alt_dict_optmenu); + SET_TOGGLE_SENSITIVITY(use_alternate_checkbtn, both_dict_check); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_aspell_checkbtn), prefs_common.enable_aspell); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(both_dict_check), + prefs_common.use_both_dicts); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_while_typing_checkbtn), prefs_common.check_while_typing); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(recheck_when_changing_dict_checkbtn), @@ -373,6 +386,7 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer prefs_spelling->sugmode_optmenu_menu = sugmode_optmenu_menu; prefs_spelling->misspelled_label = misspelled_label; prefs_spelling->misspelled_colorbtn = misspelled_colorbtn; + prefs_spelling->both_dict_check = both_dict_check; prefs_spelling->page.widget = vbox1; } @@ -389,6 +403,8 @@ void prefs_spelling_save(PrefsPage *_page) gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(spelling->recheck_when_changing_dict_checkbtn)); prefs_common.use_alternate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(spelling->use_alternate_checkbtn)); + prefs_common.use_both_dicts = + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(spelling->both_dict_check)); g_free(prefs_common.aspell_path); prefs_common.aspell_path =