231d58c64bf2c13d1f932dba2737820c3a093350
[claws.git] / src / compose.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2005 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
39 #ifdef USE_ASPELL
40 #include "gtkaspell.h"
41 #endif
42
43 typedef enum
44 {
45         COMPOSE_TO,
46         COMPOSE_CC,
47         COMPOSE_BCC,
48         COMPOSE_REPLYTO,
49         COMPOSE_NEWSGROUPS,
50         COMPOSE_FOLLOWUPTO
51 } ComposeEntryType;
52
53 typedef enum
54 {
55         COMPOSE_REPLY,
56         COMPOSE_REPLY_WITH_QUOTE,
57         COMPOSE_REPLY_WITHOUT_QUOTE,
58         COMPOSE_REPLY_TO_SENDER,
59         COMPOSE_FOLLOWUP_AND_REPLY_TO,
60         COMPOSE_REPLY_TO_SENDER_WITH_QUOTE,
61         COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
62         COMPOSE_REPLY_TO_ALL,
63         COMPOSE_REPLY_TO_ALL_WITH_QUOTE,
64         COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
65         COMPOSE_REPLY_TO_LIST,
66         COMPOSE_REPLY_TO_LIST_WITH_QUOTE,
67         COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE,
68         COMPOSE_FORWARD,
69         COMPOSE_FORWARD_AS_ATTACH,
70         COMPOSE_FORWARD_INLINE,
71         COMPOSE_NEW,
72         COMPOSE_REDIRECT,
73         COMPOSE_REEDIT
74 } ComposeMode;
75
76 typedef struct {
77         guint headernum;
78         Compose *compose;
79         GtkWidget *combo;
80         GtkWidget *entry;
81 } ComposeHeaderEntry;
82
83 struct _Compose
84 {
85         /* start with window widget don`t change order */
86         GtkWidget *window;
87         GtkWidget *vbox;
88         GtkWidget *menubar;
89
90         /* Toolbar handlebox */
91         GtkWidget *handlebox;
92         Toolbar *toolbar;
93         
94         GtkWidget *vbox2;
95
96         /* Header */
97         GtkWidget *table_vbox;
98         GtkWidget *table;
99 /*
100         GtkWidget *to_hbox;
101         GtkWidget *to_entry;
102         GtkWidget *newsgroups_hbox;
103         GtkWidget *newsgroups_entry;
104 */
105         GtkWidget *subject_entry;
106 /*
107         GtkWidget *cc_hbox;
108         GtkWidget *cc_entry;
109         GtkWidget *bcc_hbox;
110         GtkWidget *bcc_entry;
111         GtkWidget *reply_hbox;
112         GtkWidget *reply_entry;
113         GtkWidget *followup_hbox;
114         GtkWidget *followup_entry;
115 */
116         GtkWidget *paned;
117
118         /* Attachments */
119         GtkWidget *attach_scrwin;
120         GtkWidget *attach_clist;
121
122         /* Others */
123         GtkWidget *savemsg_checkbtn;
124         GtkWidget *savemsg_entry;
125
126         /* Textedit */
127         GtkWidget *edit_vbox;
128         GtkWidget *ruler_hbox;
129         GtkWidget *ruler;
130         GtkWidget *scrolledwin;
131         GtkWidget *text;
132
133         GtkWidget *focused_editable;
134
135         GtkWidget *popupmenu;
136
137         GtkItemFactory *popupfactory;
138
139         GtkWidget *tmpl_menu;
140
141         ComposeMode mode;
142
143         MsgInfo *targetinfo;
144         MsgInfo *replyinfo;
145         MsgInfo *autosaved_draft;
146         MsgInfo *fwdinfo;
147
148         GtkWidget *header_table;
149         GSList    *header_list;
150         guint      header_nextrow;
151         ComposeHeaderEntry *header_last;
152
153         gchar   *replyto;
154         gchar   *cc;
155         gchar   *bcc;
156         gchar   *newsgroups;
157         gchar   *followup_to;
158
159         gchar   *ml_post;
160
161         gchar   *inreplyto;
162         gchar   *references;
163         gchar   *msgid;
164         gchar   *boundary;
165
166         gboolean autowrap;
167
168         gboolean use_to;
169         gboolean use_cc;
170         gboolean use_bcc;
171         gboolean use_replyto;
172         gboolean use_newsgroups;
173         gboolean use_followupto;
174         gboolean use_attach;
175
176         CharSet out_encoding;
177
178         /* privacy settings */
179         gboolean use_signing;
180         gboolean use_encryption;
181         gchar *privacy_system;
182
183         gboolean modified;
184
185         gboolean sending;
186         
187         gboolean return_receipt;
188
189         GSList *to_list;
190         GSList *newsgroup_list;
191
192         PrefsAccount *account;
193
194         UndoMain *undostruct;
195
196         gchar *sig_str;
197
198         /* external editor */
199         gchar      *exteditor_file;
200         pid_t       exteditor_pid;
201         GIOChannel *exteditor_ch;
202         gint        exteditor_tag;
203
204 #if USE_ASPELL
205         /* GNU/aspell spell checker */
206         GtkAspell *gtkaspell;
207 #endif
208
209         /* Priority */
210         gint priority;
211
212         gchar *redirect_filename;
213         
214         gboolean remove_references;
215
216         guint draft_timeout_tag;
217         
218         GtkTextTag *no_wrap_tag;
219         GMutex *mutex;
220         gchar *orig_charset;
221         gint set_cursor_pos;
222 };
223
224 struct _AttachInfo
225 {
226         gchar *file;
227         gchar *content_type;
228         EncodingType encoding;
229         gchar *name;
230         off_t size;
231 };
232
233 /*#warning FIXME_GTK2 */
234 /* attache_files will be locale encode */
235 Compose *compose_new                    (PrefsAccount   *account,
236                                          const gchar    *mailto,
237                                          GPtrArray      *attach_files);
238
239 Compose *compose_new_with_folderitem    (PrefsAccount   *account,
240                                          FolderItem     *item);
241
242 Compose *compose_new_with_list          (PrefsAccount   *account,
243                                          GList          *listAddress);
244
245 Compose *compose_reply_mode             (ComposeMode     mode, 
246                                          GSList         *msginfo_list, 
247                                          gchar          *body);
248 /* remove */
249 Compose *compose_followup_and_reply_to  (MsgInfo        *msginfo,
250                                          gboolean        quote,
251                                          gboolean        to_all,
252                                          gboolean        to_sender,
253                                          const gchar    *body);
254 Compose *compose_reply                  (MsgInfo        *msginfo,
255                                          gboolean        quote,
256                                          gboolean        to_all,
257                                          gboolean        to_ml,
258                                          gboolean        to_sender,
259                                          const gchar    *body);
260 Compose *compose_forward                (PrefsAccount *account,
261                                          MsgInfo        *msginfo,
262                                          gboolean        as_attach,
263                                          const gchar    *body,
264                                          gboolean        no_extedit);
265 Compose *compose_forward_multiple       (PrefsAccount   *account, 
266                                          GSList         *msginfo_list);
267 /* remove end */
268
269 Compose *compose_redirect               (PrefsAccount   *account,
270                                          MsgInfo        *msginfo);
271 void compose_reedit                     (MsgInfo        *msginfo);
272
273 GList *compose_get_compose_list         (void);
274
275 void compose_entry_append               (Compose          *compose,
276                                          const gchar      *address,
277                                          ComposeEntryType  type);
278
279 void compose_entry_mark_default_to      (Compose          *compose,
280                                          const gchar      *address);
281
282 gint compose_send                       (Compose          *compose);
283
284 void compose_update_actions_menu        (Compose        *compose);
285 void compose_update_privacy_systems_menu(Compose        *compose);
286 void compose_reflect_prefs_all                  (void);
287 void compose_reflect_prefs_pixmap_theme (void);
288
289 void compose_destroy_all                (void);
290 void compose_draft                      (gpointer data);
291 void compose_toolbar_cb                 (gint           action, 
292                                          gpointer       data);
293 void compose_reply_from_messageview     (MessageView    *msgview, 
294                                          GSList         *msginfo_list, 
295                                          guint           action);
296 void compose_action_cb                  (void           *data);
297
298 #endif /* __COMPOSE_H__ */