2006-12-21 [wwp] 2.6.1cvs63
authorTristan Chabredier <wwp@claws-mail.org>
Thu, 21 Dec 2006 10:52:39 +0000 (10:52 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Thu, 21 Dec 2006 10:52:39 +0000 (10:52 +0000)
* 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).

ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/gtk/gtkaspell.c
src/gtk/gtkaspell.h
src/prefs_common.c
src/prefs_common.h
src/prefs_spelling.c

index d1c62139b9599699cfc5fcf17200950f72067b89..ba5eecf0d0113f13ad95202e63784ef727cd0241 100644 (file)
--- 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
index 9586174d3d3a3a44fbddde914b05f4bf3031f6ca..ca5ffa481fef0d174212f1ff9580a850c05ac052 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 45e11648861bcf0ce5ffff3dc6b432fd77f8ce37..070b13000126d9a8771d463288ac443c0366111d 100644 (file)
@@ -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=
 
index 1357b42aa6fd5fc066b19b6e9cde4627438385a2..e5a90199ce7c7dd6e16d59484c75633d828f69e2 100644 (file)
@@ -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,
index ba1696c05c4d0a31d736cf73ae0de6c1709dde2f..1bbb15b075a733cfd7cb6b72f74a4dd55da2cc4a 100644 (file)
@@ -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);
index b3278c0172c9dc9f40718f867108c38fa5a473e1..cbcb24447e52db97520b950afdd10e80af1a703d 100644 (file)
@@ -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),
index b272fea77ed29f90ae8e3b2de128810d41e15463..1e1408ac9dc928dcfc63c495d63f2e8699c8f1a9 100644 (file)
@@ -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},
index 6f91b9aa18a7588fab783db11136ca64dce1f34d..7931ab4f2600045f205d1962582b91a766a5ce64 100644 (file)
@@ -151,6 +151,7 @@ struct _PrefsCommon
        gboolean check_while_typing;
        gboolean recheck_when_changing_dict;
        gboolean use_alternate;
+       gboolean use_both_dicts;
 #endif
         
        /* Display */
index 73c686fad55bd8e7d552c57d93157a9e86cf9cae..81cebb98d5c646c5a9b988dc8354927105bf3f66 100644 (file)
@@ -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 =