update Spanish translation
[claws.git] / src / gtkaspell.h
1 /*
2     Stuphead: (C) 2000,2001 Grigroy Bakunov, Sergey Pinaev
3  */
4 /* gtkaspell - a spell-checking addon for GtkText
5  * Copyright (c) 2001-2002 Melvin Hadasht
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  * 
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
20  */
21
22 /*
23  * Adapted by the Sylpheed Claws Team.
24  */
25
26 /*
27  *  Adapted for pspell (c) 2001-2002 Melvin Hadasht
28  *  Adapted for GNU/aspell (c) 2002 Melvin Hadasht
29  *
30  */
31
32 #ifndef __GTKASPELL_H__
33 #define __GTKASPELL_H__
34
35 #include <gtk/gtkoptionmenu.h>
36 #include <aspell.h>
37
38 #include "gtkstext.h"
39
40 #define ASPELL_FASTMODE       1
41 #define ASPELL_NORMALMODE     2
42 #define ASPELL_BADSPELLERMODE 3
43
44 #define GTKASPELLWORDSIZE 1024
45
46 typedef struct _GtkAspellCheckers
47 {
48         GSList          *checkers;
49         GSList          *dictionary_list;
50         gchar           *error_message;
51 } GtkAspellCheckers;
52
53 typedef struct _Dictionary {
54         gchar *fullname;
55         gchar *dictname;
56         gchar *encoding;
57 } Dictionary;
58
59 typedef struct _GtkAspeller {
60         Dictionary      *dictionary;
61         gint             sug_mode;
62         AspellConfig    *config;
63         AspellSpeller   *checker;
64 } GtkAspeller;
65
66 typedef void (*ContCheckFunc) (gpointer *gtkaspell);
67
68 typedef struct _GtkAspell
69 {
70         GtkAspeller     *gtkaspeller;
71         GtkAspeller     *alternate_speller;
72         gchar            theword[GTKASPELLWORDSIZE];
73         gint             start_pos;
74         gint             end_pos;
75         gint             orig_pos;
76         gint             end_check_pos;
77         gboolean         misspelled;
78         gboolean         check_while_typing;
79         gboolean         use_alternate;
80
81         ContCheckFunc    continue_check; 
82
83         GtkWidget       *config_menu;
84         GtkWidget       *popup_config_menu;
85         GtkWidget       *sug_menu;
86         GtkWidget       *replace_entry;
87
88         gint             default_sug_mode;
89         gint             max_sug;
90         GList           *suggestions_list;
91
92         GtkSText        *gtktext;
93         GdkColor         highlight;
94 } GtkAspell;
95
96 typedef AspellConfig GtkAspellConfig;
97
98 extern GtkAspellCheckers *gtkaspellcheckers;
99
100 GtkAspellCheckers*      gtkaspell_checkers_new          ();
101
102 GtkAspellCheckers*      gtkaspell_checkers_delete       ();
103
104 void                    gtkaspell_checkers_reset_error  ();
105
106 GtkAspell*              gtkaspell_new                   (const gchar *dictionary, 
107                                                          const gchar *encoding,
108                                                          gint  misspelled_color,
109                                                          gboolean check_while_typing,  
110                                                          gboolean use_alternate,  
111                                                          GtkSText *gtktext);
112
113 void                    gtkaspell_delete                (GtkAspell *gtkaspell); 
114
115 guchar*                 gtkaspell_get_dict              (GtkAspell *gtkaspell);
116
117 guchar*                 gtkaspell_get_path              (GtkAspell *gtkaspell);
118
119 gboolean                gtkaspell_set_sug_mode          (GtkAspell *gtkaspell, 
120                                                          gint  themode);
121
122 GSList*                 gtkaspell_get_dictionary_list   (const char *aspell_path,
123                                                          gint refresh);
124
125 void                    gtkaspell_free_dictionary_list  (GSList *list);
126
127 void                    gtkaspell_check_forwards_go     (GtkAspell *gtkaspell);
128 void                    gtkaspell_check_backwards       (GtkAspell *gtkaspell);
129
130 void                    gtkaspell_check_all             (GtkAspell *gtkaspell);
131 void                    gtkaspell_uncheck_all           (GtkAspell *gtkaspell);
132 void                    gtkaspell_highlight_all         (GtkAspell *gtkaspell);
133
134 void                    gtkaspell_populate_submenu      (GtkAspell *gtkaspell, 
135                                                          GtkWidget *menuitem);
136
137 GtkWidget*              gtkaspell_dictionary_option_menu_new
138                                                         (const gchar *aspell_path);
139 gchar*                  gtkaspell_get_dictionary_menu_active_item
140                                                         (GtkWidget *menu);
141
142 GtkWidget*              gtkaspell_sugmode_option_menu_new
143                                                         (gint sugmode);
144
145 void                    gtkaspell_sugmode_option_menu_set
146                                                         (GtkOptionMenu *optmenu, 
147                                                          gint sugmode);
148
149 gint                    gtkaspell_get_sugmode_from_option_menu  
150                                                         (GtkOptionMenu *optmenu);
151
152 #endif /* __GTKASPELL_H__ */