Various bug fixes and enhancements, see ChangeLog.claws 2002-02-03
[claws.git] / src / gtkspell.h
index 5b3577966a058f05bc7e06f217a1deb83ec06c0f..5f98d81eb943d21dbbfe7b43e0d1c356bef5e0fd 100644 (file)
@@ -1,8 +1,8 @@
 /*
     Stuphead: (C) 2000,2001 Grigroy Bakunov, Sergey Pinaev
  */
-/* gtkspell - a spell-checking addon for GtkText
- * Copyright (c) 2000 Evan Martin.
+/* gtkpspell - a spell-checking addon for GtkText
+ * Copyright (c) 2001-2002 Melvin Hadasht
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * Adapted by the Sylpheed Claws Team.
  */
 
-#ifndef __gtkspell_h__
-#define __gtkspell_h__
+/*
+ *  Adapted for pspell (c) 2001-2002 Melvin Hadasht
+ *
+ */
+
+#ifndef __gtkpspell_h__
+#define __gtkpspell_h__
+
+#include "gtkstext.h"
+
+#include <gtk/gtkoptionmenu.h>
+#include <pspell/pspell.h>
+
+#define PSPELL_FASTMODE       1
+#define PSPELL_NORMALMODE     2
+#define PSPELL_BADSPELLERMODE 3
+
+typedef struct _GtkPspellCheckers {
+       GSList          *checkers;
+       GSList          *dictionary_list;
+       gchar           *error_message;
+} GtkPspellCheckers;
+
+typedef struct _Dictionary {
+       gchar           *fullname;
+       gchar           *dictname; /* dictname points into fullname */
+       gchar           *encoding;
+} Dictionary;
+
+typedef struct _GtkPspeller {
+       Dictionary *    dictionary;
+       gint            sug_mode;
+       gint            ispell;
+       PspellConfig  * config;
+       PspellManager * checker;
+} GtkPspeller;
+
+typedef void (*ContCheckFunc)  (gpointer *gtkpspell);
+
+#define GTKPSPELLWORDSIZE 1024
+typedef struct _GtkPspell {
+       GtkPspeller     *gtkpspeller;
+       gchar            theword[GTKPSPELLWORDSIZE];
+       gint             start_pos;
+       gint             end_pos;
+        gint            orig_pos;
+       gint             end_check_pos;
+       gboolean         misspelled;
+       gboolean         check_while_typing;
+
+       ContCheckFunc    continue_check; 
+#if 0
+       Dictionary      *dict1;
+       Dictionary      *dict2;
+
+       GtkWidget       *gui;
+       gpointer        *compose;
+#endif
+       GtkWidget       *config_menu;
+       GtkWidget       *popup_config_menu;
+       GtkWidget       *sug_menu;
+       GtkWidget       *replace_entry;
+
+       gint             default_sug_mode;
+       gint             max_sug;
+       GList           *suggestions_list;
+
+       GtkSText        *gtktext;
+       GdkColor         highlight;
+} GtkPspell;
+
+typedef PspellConfig GtkPspellConfig;
+
+extern GtkPspellCheckers *gtkpspellcheckers;
+
+GtkPspellCheckers*     gtkpspell_checkers_new          ();
+
+GtkPspellCheckers*     gtkpspell_checkers_delete       ();
+
+void                   gtkpspell_checkers_reset_error  ();
+
+GtkPspell*             gtkpspell_new                   (const gchar *dictionary, 
+                                                        const gchar *encoding,
+                                                        gint  misspelled_color,
+                                                        gboolean check_while_typing,  
+                                                        GtkSText *gtktext);
+
+void                   gtkpspell_delete                (GtkPspell *gtkpspell); 
+
+guchar*                        gtkpspell_get_dict              (GtkPspell *gtkpspell);
+
+guchar*                        gtkpspell_get_path              (GtkPspell *gtkpspell);
+
+gboolean               gtkpspell_set_sug_mode          (GtkPspell *gtkpspell, 
+                                                        gint  themode);
+
+GSList*                        gtkpspell_get_dictionary_list   (const char *pspell_path,
+                                                        gint refresh);
+
+void                   gtkpspell_free_dictionary_list  (GSList *list);
+
+void                   gtkpspell_check_forwards_go     (GtkPspell *gtkpspell);
+void                   gtkpspell_check_backwards       (GtkPspell *gtkpspell);
 
-#include "gtkxtext.h"
+void                   gtkpspell_check_all             (GtkPspell *gtkpspell);
+void                   gtkpspell_uncheck_all           (GtkPspell *gtkpspell);
+void                   gtkpspell_highlight_all         (GtkPspell *gtkpspell);
 
-extern void gtkspell_attach(GtkXText *text_ccc);
+void                   gtkpspell_populate_submenu      (GtkPspell *gtkpspell, 
+                                                        GtkWidget *menuitem);
 
-int gtkspell_start(unsigned char *path, char * args[]); 
+GtkWidget*             gtkpspell_dictionary_option_menu_new
+                                                       (const gchar *pspell_path);
+gchar*                 gtkpspell_get_dictionary_menu_active_item
+                                                       (GtkWidget *menu);
 
-void gtkspell_detach(GtkXText *gtktext);
+GtkWidget*             gtkpspell_sugmode_option_menu_new
+                                                       (gint sugmode);
 
-void gtkspell_check_all(GtkXText *gtktext);
+void                   gtkpspell_sugmode_option_menu_set
+                                                       (GtkOptionMenu *optmenu, 
+                                                        gint sugmode);
 
-void gtkspell_uncheck_all(GtkXText *gtktext);
+gint                   gtkpspell_get_sugmode_from_option_menu  
+                                                       (GtkOptionMenu *optmenu);
 
-#endif /* __gtkspell_h__ */
+#endif /* __gtkpspell_h__ */