CVS: sylpheedclaws/sylpheed-claws/src/gtk gtkaspell.c,1.9.2.46,1.9.2.47 gtkaspell.h,1.5.2.8,1.5.2.9
[email protected] Thu, 21 Dec 2006 10:52:37 +0000
| Newsgroups | gmane.mail.sylpheed.claws.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk
In directory sunsite.dk:/tmp/cvs-serv26162/src/gtk
Modified Files:
Tag: gtk2
gtkaspell.c gtkaspell.h
Log Message:
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).
Index: gtkaspell.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk/gtkaspell.c,v
retrieving revision 1.9.2.46
retrieving revision 1.9.2.47
diff -u -d -r1.9.2.46 -r1.9.2.47
--- gtkaspell.c 2006/12/21 08:29:58 1.9.2.46
+++ gtkaspell.c 2006/12/21 10:52:33 1.9.2.47
@@ -123,6 +123,7 @@
gboolean check_while_typing;
gboolean recheck_when_changing_dict;
gboolean use_alternate;
+ gboolean use_both_dicts;
ContCheckFunc continue_check;
@@ -177,6 +178,8 @@
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 @@
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->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 @@
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 @@
/* 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 @@
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 @@
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 @@
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: gtkaspell.h
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk/gtkaspell.h,v
retrieving revision 1.5.2.8
retrieving revision 1.5.2.9
diff -u -d -r1.5.2.8 -r1.5.2.9
--- gtkaspell.h 2006/12/21 08:15:41 1.5.2.8
+++ gtkaspell.h 2006/12/21 10:52:33 1.5.2.9
@@ -58,6 +58,7 @@
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),