2009-04-26 [paul] 3.7.1cvs48
[claws.git] / src / gtk / gtkaspell.h
index 20dce2607e3f2b65133a7d75d669ca422eab9c7f..397d62f3b6c2c8fec19d1a716bc4d2568e4f4e21 100644 (file)
  *
  */
 
-#ifndef __GTKASPELL_H__
-#define __GTKASPELL_H__
+#ifndef __GTKENCHANT_H__
+#define __GTKENCHANT_H__
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
 #endif
 
-#ifdef USE_ASPELL
+#ifdef USE_ENCHANT
 
 #include <gtk/gtk.h>
+#include <enchant.h>
+
+#define GTKASPELLWORDSIZE 1024
+
+typedef struct _Dictionary {
+       gchar *fullname;
+       gchar *dictname;
+} Dictionary;
+
+typedef struct _GtkAspeller {
+       Dictionary      *dictionary;
+       EnchantBroker   *broker;
+       EnchantDict     *speller;
+} GtkAspeller;
+
+typedef void (*ContCheckFunc) (gpointer *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
+{
+       GtkAspeller     *gtkaspeller;
+       GtkAspeller     *alternate_speller;
+       gchar            theword[GTKASPELLWORDSIZE];
+       gint             start_pos;
+       gint             end_pos;
+        gint            orig_pos;
+       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       *replace_entry;
+       GtkWidget       *parent_window;
+
+       gint             max_sug;
+       GList           *suggestions_list;
+
+       GtkTextView     *gtktext;
+       GdkColor         highlight;
+       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 struct _GtkAspell GtkAspell; /* Defined in gtkaspell.c */
 
 void           gtkaspell_checkers_init         (void);
 
@@ -49,8 +112,7 @@ const char *         gtkaspell_checkers_strerror     (void);
 
 void           gtkaspell_checkers_reset_error  (void);
 
-GtkAspell*     gtkaspell_new                   (const gchar *dictionary_path,
-                                                const gchar *dictionary, 
+GtkAspell*     gtkaspell_new                   (const gchar *dictionary, 
                                                 const gchar *alt_dictionary, 
                                                 const gchar *encoding,
                                                 gint  misspelled_color,
@@ -60,6 +122,7 @@ GtkAspell*   gtkaspell_new                   (const gchar *dictionary_path,
                                                 gboolean use_both_dicts,  
                                                 GtkTextView *gtktext,
                                                 GtkWindow *parent_win,
+                                                void (*dict_changed_cd)(void *data), 
                                                 void (*spell_menu_cb)(void *data),
                                                 void *data);
 
@@ -72,24 +135,21 @@ gboolean   gtkaspell_change_dict           (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);
 
 void           gtkaspell_check_all             (GtkAspell *gtkaspell);
 void           gtkaspell_highlight_all         (GtkAspell *gtkaspell);
 
-GtkWidget*     gtkaspell_dictionary_combo_new  (const gchar *aspell_path,
-                                                const gboolean refresh);
+GtkWidget*     gtkaspell_dictionary_combo_new  (const gboolean refresh);
 
-GtkTreeModel*  gtkaspell_dictionary_store_new  (const gchar *aspell_path);
+GtkTreeModel*  gtkaspell_dictionary_store_new  (void);
 GtkTreeModel*  gtkaspell_dictionary_store_new_with_refresh
-                                                       (const gchar *aspell_path,
-                                                        gboolean     refresh);
+                                                       (gboolean     refresh);
 
 gchar*         gtkaspell_get_dictionary_menu_active_item
                                                        (GtkComboBox *combo);
@@ -97,11 +157,19 @@ gint               gtkaspell_set_dictionary_menu_active_item
                                                        (GtkComboBox *combo, 
                                                         const gchar *dictionary);
 
-GtkWidget*     gtkaspell_sugmode_combo_new     (gint sugmode);
-
 GSList*                gtkaspell_make_config_menu              (GtkAspell      *gtkaspell);
 
-gchar *gtkaspell_get_default_dictionary(GtkAspell *gtkaspell);
+gchar*         gtkaspell_get_default_dictionary        (GtkAspell *gtkaspell);
+
+void           gtkaspell_make_context_menu             (GtkMenu        *menu,
+                                                        GtkAspell      *gtkaspell);
+
+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);
+
 
-#endif /* USE_ASPELL */
-#endif /* __GTKASPELL_H__ */
+#endif /* USE_ENCHANT */
+#endif /* __GTKENCHANT_H__ */