switched to pspell and dropped ispell support
[claws.git] / src / gtkspell.h
index 5b3577966a058f05bc7e06f217a1deb83ec06c0f..abf03e4e1a109ea6071f13d62fe4a4f64cd09378 100644 (file)
@@ -1,7 +1,7 @@
 /*
     Stuphead: (C) 2000,2001 Grigroy Bakunov, Sergey Pinaev
  */
-/* gtkspell - a spell-checking addon for GtkText
+/* gtkpspell - a spell-checking addon for GtkText
  * Copyright (c) 2000 Evan Martin.
  *
  * This library is free software; you can redistribute it and/or
  * Adapted by the Sylpheed Claws Team.
  */
 
-#ifndef __gtkspell_h__
-#define __gtkspell_h__
+/*
+ *  Adapted for pspell (c) 2001 Melvin Hadasht
+ *
+ */
+
+ /* first a pspell config must be created (at the beginning of the app)
+ with 
+ GtkPspellConfig gtkpspellconfig = gtkpspell_init();
+ then for each document use this to create a manager
+ GtkPspell = gtkpspell_new(GtkPspellConfig *gtkpspellconfig);
+ Now, path and dict can be set
+ gtkpspell_set_path_and_dict(GtkPspell *gtkpspell, guchar * path, guchar * dict);
+ then attach this to a gtktext widget :
+ gtkpspell_attach(GtkPspell *gtkpspell, GtkXText *gtkxtext);
+ and we can also detach :
+ gtkpspell_deattach(GtkPspell *gtkpspell, GtkXText *gtkxtext);
+ When finished, GtkPspell can be deleted with
+ gtkpspell_delete(GtkPspell * gtkpspell);
+ At the end of the app, GtkPspellConfig should be deleted with :
+ gtkpspell_finished(GtkPspellConfig * gtkpspellconfig);
+*/ 
+
+#ifndef __gtkpspell_h__
+#define __gtkpspell_h__
 
 #include "gtkxtext.h"
+#include <pspell/pspell.h>
+
+#define PSPELL_FASTMODE       1
+#define PSPELL_NORMALMODE     2
+#define PSPELL_BADSPELLERMODE 3
+
+typedef struct _Dictionary {
+       gchar *name;
+} Dictionary;
+
+typedef struct _GtkPspell 
+{
+     PspellConfig * config;
+     PspellCanHaveError * possible_err ;
+     PspellManager * checker;
+     gchar theword[1111];
+     gchar *path;
+     gchar *dict;
+     guint mode;
+     
+     GSList * dictionary_list;
+     GtkXText * gtktext;
+
+} GtkPspell;
+
+typedef PspellConfig GtkPspellConfig;
+/* Create a new gtkspell instance to manage one text widget */
+
+/* These one create and delete a pspell config */
+GtkPspellConfig * gtkpspell_init();
+void gtkpspell_finished(GtkPspellConfig * gtkpspellconfig);
+
+/* These ones create and delete a manager*/
+GtkPspell * gtkpspell_new(GtkPspellConfig * config);
+
+GtkPspell *gtkpspell_new_with_config(GtkPspellConfig *gtkpspellconfig, 
+                                     guchar *path, 
+                                     guchar *dict, 
+                                     guint mode, 
+                                     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);
+
+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);
+
+void gtkpspell_attach(GtkPspell *gtkpspell, GtkXText *text_ccc);
+
+void gtkpspell_detach(GtkPspell *gtkpspell);
+
+void gtkpspell_check_all(GtkPspell *gtkpspell);
 
-extern void gtkspell_attach(GtkXText *text_ccc);
+void gtkpspell_uncheck_all(GtkPspell *gtkpspell);
 
-int gtkspell_start(unsigned char *path, char * args[]); 
+GSList *gtkpspell_get_dictionary_list(const char *pspell_path);
 
-void gtkspell_detach(GtkXText *gtktext);
+void gtkpspell_free_dictionary_list(GSList *list);
 
-void gtkspell_check_all(GtkXText *gtktext);
+GtkWidget *gtkpspell_dictionary_option_menu_new(const gchar *pspell_path);
+gchar *gtkpspell_get_dictionary_menu_active_item(GtkWidget *menu);
 
-void gtkspell_uncheck_all(GtkXText *gtktext);
+extern GtkPspellConfig * gtkpspellconfig;
 
-#endif /* __gtkspell_h__ */
+#endif /* __gtkpspell_h__ */