+2002-01-02 [melvin] 0.6.6claws35
+
+ * src/gtkspell.[ch]
+ Made spelling code compatible with undo/redo feature.
+ Added creation of suggestion mode menu for the general
+ preferences.
+
+ * src/prefs_common.[ch]
+ Added option menu for the speller's suggestion mode.
+ Added missing spaces in "..." buttons and made a "..."
+ button non translatable!
+
+ * src/compose.c
+ Made speller use the default suggestion mode.
+ Hack to make it possible to choose 'CTRL-Enter' as a
+ shortcut for sending (and only for sending).
+
+ * src/prefs_folder_item.c
+ Changing subject simplification does not update cache
+ anymore (because it is unnecessary).
+ Fixed bug where changing subject simplification updated the
+ summaryview even when the viewed folder is not the
+ folder which properties are being changed. (E.g.
+ viewing folder A and changing
+ the subject simplification of
+ folder B -not being viewed- updated the
+ summaryview of folder A with data of
+ folder B). (Hope this is clear... )
+
+
2001-12-31 [alfons] 0.6.6claws34
* src/ldif.c
MICRO_VERSION=6
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws34
+EXTRA_VERSION=claws35
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl
GdkEventKey *event,
ComposeHeaderEntry *headerentry);
-static void compose_show_first_last_header(Compose *compose, gboolean show_first);
+static void compose_show_first_last_header (Compose *compose, gboolean show_first);
+
+static void compose_ctl_enter_send_shortcut_cb(GtkWidget *w, Compose *compose);
static GtkItemFactoryEntry compose_popup_entries[] =
{
gtk_signal_connect(GTK_OBJECT(entry), "key-press-event", GTK_SIGNAL_FUNC(compose_headerentry_key_press_event_cb), headerentry);
gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(compose_headerentry_changed_cb), headerentry);
+ gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(compose_ctl_enter_send_shortcut_cb), compose);
address_completion_register_entry(GTK_ENTRY(entry));
subject_entry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(subject), subject_entry, TRUE, TRUE, 2);
+ gtk_signal_connect(GTK_OBJECT(subject_entry), "activate", GTK_SIGNAL_FUNC(compose_ctl_enter_send_shortcut_cb), compose);
gtk_widget_show(subject_entry);
compose->subject_entry = subject_entry;
gtk_container_add(GTK_CONTAINER(subject_frame), subject);
GTK_SIGNAL_FUNC(compose_changed_cb), compose);
gtk_signal_connect(GTK_OBJECT(text), "grab_focus",
GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
+ gtk_signal_connect(GTK_OBJECT(text), "activate",
+ GTK_SIGNAL_FUNC(compose_ctl_enter_send_shortcut_cb), compose);
gtk_signal_connect_after(GTK_OBJECT(text), "button_press_event",
GTK_SIGNAL_FUNC(compose_button_press_cb),
edit_vbox);
gtkpspell = gtkpspell_new_with_config(gtkpspellconfig,
prefs_common.pspell_path,
prefs_common.dictionary,
- PSPELL_FASTMODE,
+ prefs_common.pspell_sugmode,
conv_get_current_charset_str());
if (gtkpspell == NULL)
prefs_common.enable_pspell = FALSE;
vadj = gtk_viewport_get_vadjustment(GTK_VIEWPORT(compose->header_table->parent));
gtk_adjustment_set_value(vadj, (show_first ? vadj->lower : vadj->upper));
}
+
+static void compose_ctl_enter_send_shortcut_cb(GtkWidget *w, Compose *compose)
+{
+ GtkItemFactory *ifactory;
+ GtkAccelEntry *accel;
+ GtkWidget *send_button;
+ GSList *list;
+
+ ifactory = gtk_item_factory_from_widget(compose->menubar);
+ send_button = gtk_item_factory_get_widget(ifactory, "/Message/Send");
+ list = gtk_accel_group_entries_from_object(GTK_OBJECT(send_button));
+ accel = (GtkAccelEntry *) list->data;
+ if (accel->accelerator_key == GDK_Return && accel->accelerator_mods == GDK_CONTROL_MASK)
+ compose_send_cb(compose, 0, NULL);
+
+}
static void entry_insert_cb (GtkXText *gtktext, gchar *newtext,
guint len, guint *ppos,
GtkPspell *gtkpspell);
+static void entry_delete_cb (GtkXText *gtktext, gint start, gint end,
+ GtkPspell *gtkpspell);
static gint compare_dict (Dictionary *a, Dictionary *b);
guchar *convert_to_pspell_encoding (const guchar *encoding);
gtkpspell->gtktext = NULL;
gtkpspell->config = pspell_config_clone(gtkpspellconfig);
- gtkpspell->mode = PSPELL_FASTMODE;
+ gtkpspell->mode = mode;
gtkpspell->learn = TRUE;
if (!set_path_and_dict(gtkpspell, gtkpspell->config, path, dict)) {
gtk_xtext_freeze(gtktext);
newtext = gtk_editable_get_chars(GTK_EDITABLE(gtktext), start, end);
if (newtext) {
- gtk_signal_handler_block_by_func(GTK_OBJECT(gtktext),
- GTK_SIGNAL_FUNC(entry_insert_cb),
- gtkpspell);
gtk_xtext_set_point(gtktext, start);
gtk_xtext_forward_delete(gtktext, end - start);
gtk_xtext_insert(gtktext, NULL, color, NULL, newtext, end - start);
- gtk_signal_handler_unblock_by_func(GTK_OBJECT(gtktext),
- GTK_SIGNAL_FUNC(entry_insert_cb),
- gtkpspell);
g_free(newtext);
}
gtk_xtext_thaw(gtktext);
oldlen = end - start;
gtk_xtext_set_point(GTK_XTEXT(gtktext), end);
- gtk_xtext_backward_delete(GTK_XTEXT(gtktext), end - start);
- gtk_xtext_insert(GTK_XTEXT(gtktext), NULL, NULL, NULL, newword, strlen(newword));
+ gtk_signal_handler_block_by_func(GTK_OBJECT(gtktext),
+ GTK_SIGNAL_FUNC(entry_insert_cb),
+ gtkpspell);
+ gtk_signal_handler_block_by_func(GTK_OBJECT(gtktext),
+ GTK_SIGNAL_FUNC(entry_delete_cb),
+ gtkpspell);
+ gtk_xtext_set_point(gtktext, start);
+ gtk_signal_emit_by_name(GTK_OBJECT(gtktext), "delete-text", start, end);
+ gtk_signal_emit_by_name(GTK_OBJECT(gtktext), "insert-text", newword, strlen(newword), &start);
+ gtk_signal_handler_unblock_by_func(GTK_OBJECT(gtktext),
+ GTK_SIGNAL_FUNC(entry_insert_cb),
+ gtkpspell);
+ gtk_signal_handler_unblock_by_func(GTK_OBJECT(gtktext),
+ GTK_SIGNAL_FUNC(entry_delete_cb),
+ gtkpspell);
if (end-start > 0 && gtkpspell->learn) {
/* Just be sure the buffer ends somewhere... */
buf[end-start] = 0;
}
+GtkWidget *gtkpspell_sugmode_option_menu_new(gint sugmode)
+{
+ GtkWidget *menu;
+ GtkWidget *item;
+
+
+ menu = gtk_menu_new();
+ gtk_widget_show(menu);
+
+ item = gtk_menu_item_new_with_label(_("Fast Mode"));
+ gtk_widget_show(item);
+ gtk_menu_append(GTK_MENU(menu), item);
+ gtk_object_set_data(GTK_OBJECT(item), "sugmode", GINT_TO_POINTER(PSPELL_FASTMODE));
+
+ item = gtk_menu_item_new_with_label(_("Normal Mode"));
+ gtk_widget_show(item);
+ gtk_menu_append(GTK_MENU(menu), item);
+ gtk_object_set_data(GTK_OBJECT(item), "sugmode", GINT_TO_POINTER(PSPELL_NORMALMODE));
+
+ item = gtk_menu_item_new_with_label(_("Bad Spellers Mode"));
+ gtk_widget_show(item);
+ gtk_menu_append(GTK_MENU(menu), item);
+ gtk_object_set_data(GTK_OBJECT(item), "sugmode", GINT_TO_POINTER(PSPELL_BADSPELLERMODE));
+
+ return menu;
+}
+
+void gtkpspell_sugmode_option_menu_set(GtkOptionMenu *optmenu, gint sugmode)
+{
+ g_return_if_fail(GTK_IS_OPTION_MENU(optmenu));
+
+ g_return_if_fail(sugmode == PSPELL_FASTMODE ||
+ sugmode == PSPELL_NORMALMODE ||
+ sugmode == PSPELL_BADSPELLERMODE);
+
+ gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), sugmode - 1);
+}
+
+gint gtkpspell_get_sugmode_from_option_menu(GtkOptionMenu *optmenu)
+{
+ gint sugmode;
+ GtkWidget *item;
+
+ g_return_val_if_fail(GTK_IS_OPTION_MENU(optmenu), -1);
+
+ item = gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(optmenu)));
+
+ sugmode = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(item), "sugmode"));
+
+ return sugmode;
+
+}
+
/* convert_to_pspell_encoding () - converts ISO-8859-* strings to iso8859-*
* as needed by pspell. Returns an allocated string.
*/
#define __gtkpspell_h__
#include "gtkxtext.h"
+
+#include <gtk/gtkoptionmenu.h>
#include <pspell/pspell.h>
#define PSPELL_FASTMODE 1
typedef PspellConfig GtkPspellConfig;
-/* Create a new gtkspell instance to manage one text widget */
-
-/* These one create and delete a pspell config */
+/* These ones create and delete a pspell config */
GtkPspellConfig *gtkpspell_init();
-void gtkpspell_finished(GtkPspellConfig * gtkpspellconfig);
+void gtkpspell_finished (GtkPspellConfig *gtkpspellconfig);
/* These ones create and delete a manager*/
-GtkPspell *gtkpspell_new(GtkPspellConfig * config);
+GtkPspell *gtkpspell_new (GtkPspellConfig *config);
-GtkPspell *gtkpspell_new_with_config(GtkPspellConfig *gtkpspellconfig,
- guchar *path,
- guchar *dict,
- guint mode,
- const guchar *encoding);
-GtkPspell *gtkpspell_delete(GtkPspell *gtkpspell);
+GtkPspell *gtkpspell_new_with_config (GtkPspellConfig *gtkpspellconfig,
+ guchar *path,
+ guchar *dict,
+ guint mode,
+ const guchar *encoding);
+GtkPspell *gtkpspell_delete (GtkPspell *gtkpspell);
-int gtkpspell_set_path_and_dict(GtkPspell *gtkpspell, guchar * path,
- guchar * dict);
-guchar *gtkpspell_get_dict(GtkPspell *gtkpspell);
+int gtkpspell_set_path_and_dict (GtkPspell *gtkpspell,
+ guchar * path,
+ guchar * dict);
+guchar *gtkpspell_get_dict (GtkPspell *gtkpspell);
-guchar *gtkpspell_get_path(GtkPspell *gtkpspell);
+guchar *gtkpspell_get_path (GtkPspell *gtkpspell);
/* This sets suggestion mode "fast" "normal" "bad-spellers" */
/* and resets the dict & path (which should be set first) */
/* return 0 on failure and -1 on success */
-int gtkpspell_set_sug_mode(GtkPspell * gtkpspell, gchar * themode);
+int gtkpspell_set_sug_mode (GtkPspell * gtkpspell,
+ gchar * themode);
+
+void gtkpspell_attach (GtkPspell *gtkpspell,
+ GtkXText *text_ccc);
-void gtkpspell_attach(GtkPspell *gtkpspell, GtkXText *text_ccc);
+void gtkpspell_detach (GtkPspell *gtkpspell);
-void gtkpspell_detach(GtkPspell *gtkpspell);
+void gtkpspell_check_all (GtkPspell *gtkpspell);
-void gtkpspell_check_all(GtkPspell *gtkpspell);
+void gtkpspell_uncheck_all (GtkPspell *gtkpspell);
-void gtkpspell_uncheck_all(GtkPspell *gtkpspell);
+GSList *gtkpspell_get_dictionary_list (const char *pspell_path);
-GSList *gtkpspell_get_dictionary_list(const char *pspell_path);
+void gtkpspell_free_dictionary_list (GSList *list);
-void gtkpspell_free_dictionary_list(GSList *list);
+GtkWidget *gtkpspell_dictionary_option_menu_new (const gchar *pspell_path);
-GtkWidget *gtkpspell_dictionary_option_menu_new(const gchar *pspell_path);
gchar *gtkpspell_get_dictionary_menu_active_item(GtkWidget *menu);
+GtkWidget *gtkpspell_sugmode_option_menu_new (gint sugmode);
+
+void gtkpspell_sugmode_option_menu_set (GtkOptionMenu *optmenu,
+ gint sugmode);
+
+gint gtkpspell_get_sugmode_from_option_menu (GtkOptionMenu *optmenu);
+
extern GtkPspellConfig * gtkpspellconfig;
#endif /* __gtkpspell_h__ */
GtkWidget *entry_pspell_path;
GtkWidget *btn_pspell_path;
GtkWidget *optmenu_dictionary;
+ GtkWidget *optmenu_sugmode;
} spelling;
#endif
static void prefs_nextunreadmsgdialog_set_optmenu(PrefParam *pparam);
#if USE_PSPELL
-static void prefs_dictionary_set_data_from_optmenu(PrefParam *param);
-static void prefs_dictionary_set_optmenu(PrefParam *pparam);
+static void prefs_dictionary_set_data_from_optmenu (PrefParam *param);
+static void prefs_dictionary_set_optmenu (PrefParam *pparam);
+static void prefs_speller_sugmode_set_data_from_optmenu (PrefParam *pparam);
+static void prefs_speller_sugmode_set_optmenu (PrefParam *pparam);
#endif
{"dictionary", "", &prefs_common.dictionary,
P_STRING, &spelling.optmenu_dictionary,
prefs_dictionary_set_data_from_optmenu, prefs_dictionary_set_optmenu },
+ {"pspell_sugmode", "1", &prefs_common.pspell_sugmode,
+ P_INT, &spelling.optmenu_sugmode,
+ prefs_speller_sugmode_set_data_from_optmenu, prefs_speller_sugmode_set_optmenu },
{"misspelled_color", "16711680", &prefs_common.misspelled_col, P_INT,
NULL, NULL, NULL},
#endif
prefs_dictionary_set_data_from_optmenu(pparam);
}
+static void prefs_speller_sugmode_set_data_from_optmenu(PrefParam *param)
+{
+ gint sugmode;
+ g_return_if_fail(param);
+ g_return_if_fail(param->data);
+ g_return_if_fail(param->widget);
+ g_return_if_fail(*(param->widget));
+
+ sugmode = gtkpspell_get_sugmode_from_option_menu
+ (GTK_OPTION_MENU(*(param->widget)));
+ *((gint *) param->data) = sugmode;
+}
+
+static void prefs_speller_sugmode_set_optmenu(PrefParam *pparam)
+{
+ GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
+ GtkWidget *menu;
+ GtkWidget *menuitem;
+ gint sugmode;
+
+ g_return_if_fail(optmenu != NULL);
+ g_return_if_fail(pparam->data != NULL);
+
+ sugmode = *(gint *) pparam->data;
+ gtkpspell_sugmode_option_menu_set(optmenu, sugmode);
+}
+
+
static void prefs_spelling_checkbtn_enable_pspell_toggle_cb
(GtkWidget *widget,
gpointer data)
gboolean toggled;
toggled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- gtk_widget_set_sensitive(spelling.entry_pspell_path, toggled);
- gtk_widget_set_sensitive(spelling.optmenu_dictionary, toggled);
- gtk_widget_set_sensitive(spelling.btn_pspell_path, toggled);
+
+ gtk_widget_set_sensitive(spelling.entry_pspell_path, toggled);
+ gtk_widget_set_sensitive(spelling.optmenu_dictionary, toggled);
+ gtk_widget_set_sensitive(spelling.optmenu_sugmode, toggled);
+ gtk_widget_set_sensitive(spelling.btn_pspell_path, toggled);
+ gtk_widget_set_sensitive(color_buttons.misspelled_btn, toggled);
}
static void prefs_spelling_btn_pspell_path_clicked_cb(GtkWidget *widget,
GtkWidget *spell_table;
GtkWidget *label_dictionary;
GtkWidget *optmenu_dictionary;
+ GtkWidget *sugmode_label;
+ GtkWidget *sugmode_optmenu;
GtkWidget *color_label;
GtkWidget *hbox_col;
GtkWidget *col_align;
GTK_SIGNAL_FUNC(prefs_spelling_checkbtn_enable_pspell_toggle_cb),
NULL);
- spell_table = gtk_table_new(3, 3, FALSE);
+ spell_table = gtk_table_new(4, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (spell_table), 0);
gtk_table_set_row_spacings(GTK_TABLE(spell_table), 8);
gtk_table_set_col_spacings(GTK_TABLE(spell_table), 8);
gtk_widget_set_sensitive(entry_pspell_path, prefs_common.enable_pspell);
- btn_pspell_path = gtk_button_new_with_label(_("..."));
+ btn_pspell_path = gtk_button_new_with_label(" ... ");
gtk_widget_show(btn_pspell_path);
gtk_box_pack_start(GTK_BOX(hbox_pspell_path), btn_pspell_path, FALSE, FALSE, 0);
gtk_widget_set_sensitive(btn_pspell_path, prefs_common.enable_pspell);
GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
gtk_widget_set_sensitive(optmenu_dictionary, prefs_common.enable_pspell);
+ /* Suggestion mode */
+ sugmode_label = gtk_label_new(_("Default suggestion mode"));
+ gtk_misc_set_alignment(GTK_MISC(sugmode_label), 1.0, 0.5);
+ gtk_widget_show(sugmode_label);
+ gtk_table_attach(GTK_TABLE (spell_table), sugmode_label, 0, 1, 2, 3,
+ GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
+
+ sugmode_optmenu = gtk_option_menu_new();
+ gtk_widget_show(sugmode_optmenu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(sugmode_optmenu),
+ gtkpspell_sugmode_option_menu_new(prefs_common.pspell_sugmode));
+ gtk_table_attach(GTK_TABLE(spell_table), sugmode_optmenu, 1, 2, 2, 3,
+ GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
+ gtk_widget_set_sensitive(sugmode_optmenu, prefs_common.enable_pspell);
+
/* Color */
color_label = gtk_label_new(_("Misspelled word color:"));
gtk_misc_set_alignment(GTK_MISC(color_label), 1.0, 0.5);
- gtk_table_attach (GTK_TABLE (spell_table), color_label, 0, 1, 2, 3,
+ gtk_table_attach (GTK_TABLE (spell_table), color_label, 0, 1, 3, 4,
GTK_FILL, GTK_SHRINK, 0, 0);
gtk_widget_show(color_label);
col_align = gtk_alignment_new(0.0, 0.5, 0, 0);
gtk_widget_show(col_align);
- gtk_table_attach (GTK_TABLE (spell_table), col_align, 1, 2, 2, 3,
+ gtk_table_attach (GTK_TABLE (spell_table), col_align, 1, 2, 3, 4,
GTK_FILL, GTK_SHRINK, 0, 0);
color_buttons.misspelled_btn = gtk_button_new_with_label ("");
spelling.entry_pspell_path = entry_pspell_path;
spelling.btn_pspell_path = btn_pspell_path;
spelling.optmenu_dictionary = optmenu_dictionary;
+ spelling.optmenu_sugmode = sugmode_optmenu;
}
#endif
gtk_table_attach (GTK_TABLE (table1), entry_textfont, 1, 2, 0, 1,
(GTK_EXPAND | GTK_FILL), 0, 0, 0);
- button_textfont = gtk_button_new_with_label ("... ");
+ button_textfont = gtk_button_new_with_label (" ... ");
gtk_widget_show (button_textfont);
gtk_table_attach (GTK_TABLE (table1), button_textfont, 2, 3, 0, 1,
gtk_widget_show (entry_datefmt);
gtk_box_pack_start (GTK_BOX (hbox1), entry_datefmt, TRUE, TRUE, 0);
- button_datefmt = gtk_button_new_with_label ("... ");
+ button_datefmt = gtk_button_new_with_label (" ... ");
gtk_widget_show (button_datefmt);
gtk_box_pack_start (GTK_BOX (hbox1), button_datefmt, FALSE, FALSE, 0);
gchar *pspell_path;
gchar *dictionary;
gint misspelled_col;
+ gint pspell_sugmode;
#endif
/* Display */
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_simplify_subject));
prefs->simplify_subject_regexp =
gtk_editable_get_chars(GTK_EDITABLE(dialog->entry_simplify_subject), 0, -1);
-
- if (prefs->enable_simplify_subject != old_simplify_val ||
- 0 != strcmp2(prefs->simplify_subject_regexp, old_simplify_str))
- summary_show(dialog->folderview->summaryview, dialog->item, TRUE);
+
+ if (dialog->item == dialog->folderview->summaryview->folder_item &&
+ (prefs->enable_simplify_subject != old_simplify_val ||
+ 0 != strcmp2(prefs->simplify_subject_regexp, old_simplify_str)))
+ summary_show(dialog->folderview->summaryview, dialog->item, FALSE);
if (old_simplify_str) g_free(old_simplify_str);