2006-02-15 [wwp] 2.0.0cvs55
[claws.git] / src / compose.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2006 Hiroyuki Yamamoto
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef __COMPOSE_H__
21 #define __COMPOSE_H__
22
23 typedef struct _Compose         Compose;
24 typedef struct _AttachInfo      AttachInfo;
25
26 #include <glib.h>
27 #include <gtk/gtkwidget.h>
28 #include <gtk/gtkitemfactory.h>
29
30 #include "procmsg.h"
31 #include "procmime.h"
32 #include "addressbook.h"
33 #include "prefs_account.h"
34 #include "undo.h"
35 #include "toolbar.h"
36 #include "messageview.h"
37 #include "codeconv.h"
38 #include "template.h"
39 #include "textview.h"
40
41 #ifdef USE_ASPELL
42 #include "gtkaspell.h"
43 #endif
44
45 typedef enum
46 {
47         COMPOSE_TO,
48         COMPOSE_CC,
49         COMPOSE_BCC,
50         COMPOSE_REPLYTO,
51         COMPOSE_NEWSGROUPS,
52         COMPOSE_FOLLOWUPTO
53 } ComposeEntryType;
54
55 typedef enum
56 {
57         COMPOSE_REPLY,
58         COMPOSE_REPLY_WITH_QUOTE,
59         COMPOSE_REPLY_WITHOUT_QUOTE,
60         COMPOSE_REPLY_TO_SENDER,
61         COMPOSE_FOLLOWUP_AND_REPLY_TO,
62         COMPOSE_REPLY_TO_SENDER_WITH_QUOTE,
63         COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
64         COMPOSE_REPLY_TO_ALL,
65         COMPOSE_REPLY_TO_ALL_WITH_QUOTE,
66         COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
67         COMPOSE_REPLY_TO_LIST,
68         COMPOSE_REPLY_TO_LIST_WITH_QUOTE,
69         COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE,
70         COMPOSE_FORWARD,
71         COMPOSE_FORWARD_AS_ATTACH,
72         COMPOSE_FORWARD_INLINE,
73         COMPOSE_NEW,
74         COMPOSE_REDIRECT,
75         COMPOSE_REEDIT
76 } ComposeMode;
77
78 typedef struct {
79         guint headernum;
80         Compose *compose;
81         GtkWidget *combo;
82         GtkWidget *entry;
83 } ComposeHeaderEntry;
84
85 struct _Compose
86 {
87         /* start with window widget don`t change order */
88         GtkWidget *window;
89         GtkWidget *vbox;
90         GtkWidget *menubar;
91
92         /* Toolbar handlebox */
93         GtkWidget *handlebox;
94         Toolbar *toolbar;
95         
96         GtkWidget *vbox2;
97
98         /* Header */
99         GtkWidget *table_vbox;
100         GtkWidget *table;
101 /*
102         GtkWidget *to_hbox;
103         GtkWidget *to_entry;
104         GtkWidget *newsgroups_hbox;
105         GtkWidget *newsgroups_entry;
106 */
107         GtkWidget *subject_entry;
108 /*
109         GtkWidget *cc_hbox;
110         GtkWidget *cc_entry;
111         GtkWidget *bcc_hbox;
112         GtkWidget *bcc_entry;
113         GtkWidget *reply_hbox;
114         GtkWidget *reply_entry;
115         GtkWidget *followup_hbox;
116         GtkWidget *followup_entry;
117 */
118         GtkWidget *paned;
119
120         /* Attachments */
121         GtkWidget *attach_scrwin;
122         GtkWidget *attach_clist;
123
124         /* Others */
125         GtkWidget *savemsg_checkbtn;
126         GtkWidget *savemsg_entry;
127
128         /* Textedit */
129         GtkWidget *edit_vbox;
130         GtkWidget *ruler_hbox;
131         GtkWidget *ruler;
132         GtkWidget *scrolledwin;
133         GtkWidget *text;
134
135         GtkWidget *focused_editable;
136
137         GtkWidget *popupmenu;
138
139         GtkItemFactory *popupfactory;
140
141         GtkWidget *tmpl_menu;
142
143         ComposeMode mode;
144
145         MsgInfo *targetinfo;
146         MsgInfo *replyinfo;
147         MsgInfo *autosaved_draft;
148         MsgInfo *fwdinfo;
149
150         GtkWidget *header_table;
151         GSList    *header_list;
152         guint      header_nextrow;
153         ComposeHeaderEntry *header_last;
154
155         gchar   *replyto;
156         gchar   *cc;
157         gchar   *bcc;
158         gchar   *newsgroups;
159         gchar   *followup_to;
160
161         gchar   *ml_post;
162
163         gchar   *inreplyto;
164         gchar   *references;
165         gchar   *msgid;
166         gchar   *boundary;
167
168         gboolean autowrap;
169
170         gboolean use_to;
171         gboolean use_cc;
172         gboolean use_bcc;
173         gboolean use_replyto;
174         gboolean use_newsgroups;
175         gboolean use_followupto;
176         gboolean use_attach;
177
178         CharSet out_encoding;
179
180         /* privacy settings */
181         gboolean use_signing;
182         gboolean use_encryption;
183         gchar *privacy_system;
184
185         gboolean modified;
186
187         gboolean sending;
188         
189         gboolean return_receipt;
190
191         GSList *to_list;
192         GSList *newsgroup_list;
193
194         PrefsAccount *account;
195
196         UndoMain *undostruct;
197
198         gchar *sig_str;
199
200         /* external editor */
201         gchar      *exteditor_file;
202         pid_t       exteditor_pid;
203         GIOChannel *exteditor_ch;
204         gint        exteditor_tag;
205
206 #if USE_ASPELL
207         /* GNU/aspell spell checker */
208         GtkAspell *gtkaspell;
209 #endif
210
211         /* Priority */
212         gint priority;
213
214         gchar *redirect_filename;
215         
216         gboolean remove_references;
217
218         guint draft_timeout_tag;
219         
220         GtkTextTag *no_wrap_tag;
221         GtkTextTag *no_join_tag;
222         GMutex *mutex;
223         gchar *orig_charset;
224         gint set_cursor_pos;
225 };
226
227 struct _AttachInfo
228 {
229         gchar *file;
230         gchar *content_type;
231         EncodingType encoding;
232         gchar *name;
233         off_t size;
234 };
235
236 /*#warning FIXME_GTK2 */
237 /* attache_files will be locale encode */
238 Compose *compose_new                    (PrefsAccount   *account,
239                                          const gchar    *mailto,
240                                          GPtrArray      *attach_files);
241
242 Compose *compose_new_with_folderitem    (PrefsAccount   *account,
243                                          FolderItem     *item);
244
245 Compose *compose_new_with_list          (PrefsAccount   *account,
246                                          GList          *listAddress);
247
248 Compose *compose_reply_mode             (ComposeMode     mode, 
249                                          GSList         *msginfo_list, 
250                                          gchar          *body);
251 /* remove */
252 Compose *compose_followup_and_reply_to  (MsgInfo        *msginfo,
253                                          gboolean        quote,
254                                          gboolean        to_all,
255                                          gboolean        to_sender,
256                                          const gchar    *body);
257 Compose *compose_reply                  (MsgInfo        *msginfo,
258                                          gboolean        quote,
259                                          gboolean        to_all,
260                                          gboolean        to_ml,
261                                          gboolean        to_sender,
262                                          const gchar    *body);
263 Compose *compose_forward                (PrefsAccount *account,
264                                          MsgInfo        *msginfo,
265                                          gboolean        as_attach,
266                                          const gchar    *body,
267                                          gboolean        no_extedit);
268 Compose *compose_forward_multiple       (PrefsAccount   *account, 
269                                          GSList         *msginfo_list);
270 /* remove end */
271
272 Compose *compose_redirect               (PrefsAccount   *account,
273                                          MsgInfo        *msginfo);
274 void compose_reedit                     (MsgInfo        *msginfo);
275
276 GList *compose_get_compose_list         (void);
277
278 void compose_template_apply_fields(Compose *compose, Template *tmpl);
279
280 void compose_entry_append               (Compose          *compose,
281                                          const gchar      *address,
282                                          ComposeEntryType  type);
283
284 void compose_entry_mark_default_to      (Compose          *compose,
285                                          const gchar      *address);
286
287 gint compose_send                       (Compose          *compose);
288
289 void compose_update_actions_menu        (Compose        *compose);
290 void compose_update_privacy_systems_menu(Compose        *compose);
291 void compose_reflect_prefs_all                  (void);
292 void compose_reflect_prefs_pixmap_theme (void);
293
294 void compose_destroy_all                (void);
295 void compose_draft                      (gpointer data);
296 void compose_toolbar_cb                 (gint           action, 
297                                          gpointer       data);
298 void compose_reply_from_messageview     (MessageView    *msgview, 
299                                          GSList         *msginfo_list, 
300                                          guint           action);
301 void compose_action_cb                  (void           *data);
302
303 void compose_set_position                               (Compose        *compose,
304                                                  gint            pos);
305 gboolean compose_search_string                  (Compose        *compose,
306                                                  const gchar    *str,
307                                                  gboolean        case_sens);
308 gboolean compose_search_string_backward (Compose        *compose,
309                                                  const gchar    *str,
310                                                  gboolean        case_sens);
311
312 #endif /* __COMPOSE_H__ */