* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
- * Adapted by the Sylpheed Claws Team.
+ * Adapted by the Claws Mail Team.
*/
/*
*
*/
-#ifndef __GTKASPELL_H__
-#define __GTKASPELL_H__
+#ifndef __GTKENCHANT_H__
+#define __GTKENCHANT_H__
-#include <gtk/gtkoptionmenu.h>
-#include <aspell.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
-#include "gtkstext.h"
+#ifdef USE_ENCHANT
-#define ASPELL_FASTMODE 1
-#define ASPELL_NORMALMODE 2
-#define ASPELL_BADSPELLERMODE 3
+#include <gtk/gtk.h>
+#include <enchant/enchant.h>
#define GTKASPELLWORDSIZE 1024
-typedef struct _GtkAspellCheckers
-{
- GSList *checkers;
- GSList *dictionary_list;
- gchar *error_message;
-} GtkAspellCheckers;
-
typedef struct _Dictionary {
gchar *fullname;
gchar *dictname;
- gchar *encoding;
} Dictionary;
typedef struct _GtkAspeller {
Dictionary *dictionary;
- gint sug_mode;
- AspellConfig *config;
- AspellSpeller *checker;
+ EnchantBroker *broker;
+ EnchantDict *speller;
} GtkAspeller;
typedef void (*ContCheckFunc) (gpointer *gtkaspell);
-typedef struct _GtkAspell
+struct _WidgetContext
+{
+ void (*set_position)(gpointer data, gint pos);
+ void (*set_menu_pos)(GtkMenu *menu, gint *x, gint *y,
+ gboolean *push_in, gpointer user_data);
+ gboolean (*find_misspelled)(gpointer data, gboolean forward);
+ gboolean (*check_word)(gpointer data);
+ void (*replace_word)(gpointer data, const gchar *newword);
+ gpointer *data;
+};
+
+typedef struct _WidgetContext WidgetContext;
+
+struct _GtkAspell
{
- const gchar *dictionary_path;
-
GtkAspeller *gtkaspeller;
GtkAspeller *alternate_speller;
gchar theword[GTKASPELLWORDSIZE];
gint end_check_pos;
gboolean misspelled;
gboolean check_while_typing;
+ gboolean recheck_when_changing_dict;
gboolean use_alternate;
+ gboolean use_both_dicts;
ContCheckFunc continue_check;
- GtkWidget *config_menu;
- GtkWidget *popup_config_menu;
- GtkWidget *sug_menu;
GtkWidget *replace_entry;
+ GtkWidget *parent_window;
- gint default_sug_mode;
gint max_sug;
GList *suggestions_list;
- GtkSText *gtktext;
+ GtkTextView *gtktext;
GdkColor highlight;
-} GtkAspell;
+ GtkAccelGroup *accel_group;
+ void (*dict_changed_cb)(void *data);
+ void (*menu_changed_cb)(void *data);
+ void *menu_changed_data;
+
+ WidgetContext ctx;
+};
+
+typedef struct _GtkAspell GtkAspell;
+
-typedef AspellConfig GtkAspellConfig;
+void gtkaspell_checkers_init (void);
-extern GtkAspellCheckers *gtkaspellcheckers;
+void gtkaspell_checkers_quit (void);
-GtkAspellCheckers* gtkaspell_checkers_new (void);
+const char * gtkaspell_checkers_strerror (void);
-GtkAspellCheckers* gtkaspell_checkers_delete (void);
+void gtkaspell_checkers_reset_error (void);
-void gtkaspell_checkers_reset_error (void);
+GtkAspell* gtkaspell_new (const gchar *dictionary,
+ const gchar *alt_dictionary,
+ const gchar *encoding,
+ gint misspelled_color,
+ gboolean check_while_typing,
+ gboolean recheck_when_changing_dict,
+ gboolean use_alternate,
+ gboolean use_both_dicts,
+ GtkTextView *gtktext,
+ GtkWindow *parent_win,
+ void (*dict_changed_cd)(void *data),
+ void (*spell_menu_cb)(void *data),
+ void *data);
-GtkAspell* gtkaspell_new (const gchar *dictionary_path,
- const gchar *dictionary,
- const gchar *encoding,
- gint misspelled_color,
- gboolean check_while_typing,
- gboolean use_alternate,
- GtkSText *gtktext);
+void gtkaspell_delete (GtkAspell *gtkaspell);
-void gtkaspell_delete (GtkAspell *gtkaspell);
-guchar* gtkaspell_get_dict (GtkAspell *gtkaspell);
+gboolean gtkaspell_change_dict (GtkAspell *gtkaspell,
+ const gchar* dictionary,
+ gboolean always_set_alt_dict);
-guchar* gtkaspell_get_path (GtkAspell *gtkaspell);
+gboolean gtkaspell_change_alt_dict (GtkAspell *gtkaspell,
+ const gchar* alt_dictionary);
+void gtkaspell_use_alternate_dict (GtkAspell *gtkaspell);
-gboolean gtkaspell_set_sug_mode (GtkAspell *gtkaspell,
- gint themode);
+gboolean gtkaspell_check_next_prev (GtkAspell *gtkaspell,
+ gboolean forward);
+void gtkaspell_check_forwards_go (GtkAspell *gtkaspell);
+void gtkaspell_check_backwards (GtkAspell *gtkaspell);
-GSList* gtkaspell_get_dictionary_list (const char *aspell_path,
- gint refresh);
+void gtkaspell_check_all (GtkAspell *gtkaspell);
+void gtkaspell_highlight_all (GtkAspell *gtkaspell);
-void gtkaspell_free_dictionary_list (GSList *list);
+GtkWidget* gtkaspell_dictionary_combo_new (const gboolean refresh);
-void gtkaspell_check_forwards_go (GtkAspell *gtkaspell);
-void gtkaspell_check_backwards (GtkAspell *gtkaspell);
+GtkTreeModel* gtkaspell_dictionary_store_new (void);
+GtkTreeModel* gtkaspell_dictionary_store_new_with_refresh
+ (gboolean refresh);
-void gtkaspell_check_all (GtkAspell *gtkaspell);
-void gtkaspell_uncheck_all (GtkAspell *gtkaspell);
-void gtkaspell_highlight_all (GtkAspell *gtkaspell);
+gchar* gtkaspell_get_dictionary_menu_active_item
+ (GtkComboBox *combo);
+gint gtkaspell_set_dictionary_menu_active_item
+ (GtkComboBox *combo,
+ const gchar *dictionary);
-void gtkaspell_populate_submenu (GtkAspell *gtkaspell,
- GtkWidget *menuitem);
+GSList* gtkaspell_make_config_menu (GtkAspell *gtkaspell);
-GtkWidget* gtkaspell_dictionary_option_menu_new
- (const gchar *aspell_path);
-gchar* gtkaspell_get_dictionary_menu_active_item
- (GtkWidget *menu);
+gchar* gtkaspell_get_default_dictionary (GtkAspell *gtkaspell);
-GtkWidget* gtkaspell_sugmode_option_menu_new
- (gint sugmode);
+void gtkaspell_make_context_menu (GtkMenu *menu,
+ GtkAspell *gtkaspell);
-void gtkaspell_sugmode_option_menu_set
- (GtkOptionMenu *optmenu,
- gint sugmode);
+int gtkaspell_misspelled_test (GtkAspell *gtkaspell,
+ char *word);
+void gtkaspell_dict_changed (GtkAspell *gtkaspell);
+void gtkaspell_context_set (GtkAspell *gtkaspell);
+void gtkaspell_free_suggestions_list (GtkAspell *gtkaspell);
-gint gtkaspell_get_sugmode_from_option_menu
- (GtkOptionMenu *optmenu);
-#endif /* __GTKASPELL_H__ */
+#endif /* USE_ENCHANT */
+#endif /* __GTKENCHANT_H__ */