186979dee8260d3c78de11a3024d6c4b03370e8f
[claws.git] / src / compose.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __COMPOSE_H__
21 #define __COMPOSE_H__
22
23 #include <glib.h>
24 #include <gtk/gtkwidget.h>
25 #include <gtk/gtkitemfactory.h>
26
27 typedef struct _Compose         Compose;
28 typedef struct _AttachInfo      AttachInfo;
29
30 #include "procmsg.h"
31 #include "procmime.h"
32 #include "addressbook.h"
33 #include "prefs_account.h"
34 #include "undo.h"
35
36 #ifdef USE_PSPELL
37 #include "gtkspell.h"
38 #endif
39
40 typedef enum
41 {
42         COMPOSE_TO,
43         COMPOSE_CC,
44         COMPOSE_BCC,
45         COMPOSE_REPLYTO,
46         COMPOSE_NEWSGROUPS,
47         COMPOSE_FOLLOWUPTO
48 } ComposeEntryType;
49
50 typedef enum
51 {
52         COMPOSE_REPLY,
53         COMPOSE_REPLY_WITH_QUOTE,
54         COMPOSE_REPLY_WITHOUT_QUOTE,
55         COMPOSE_REPLY_TO_SENDER,
56         COMPOSE_FOLLOWUP_AND_REPLY_TO,
57         COMPOSE_REPLY_TO_SENDER_WITH_QUOTE,
58         COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
59         COMPOSE_REPLY_TO_ALL,
60         COMPOSE_REPLY_TO_ALL_WITH_QUOTE,
61         COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
62         COMPOSE_FORWARD,
63         COMPOSE_FORWARD_AS_ATTACH,
64         COMPOSE_FORWARD_INLINE,
65         COMPOSE_BOUNCE,
66         COMPOSE_NEW,
67         COMPOSE_REEDIT
68 } ComposeMode;
69
70 typedef struct {
71         guint headernum;
72         Compose *compose;
73         GtkWidget *combo;
74         GtkWidget *entry;
75 } ComposeHeaderEntry;
76
77 struct _Compose
78 {
79         GtkWidget *window;
80         GtkWidget *vbox;
81         GtkWidget *menubar;
82
83         GtkWidget *handlebox;
84         GtkWidget *toolbar;
85         GtkWidget *send_btn;
86         GtkWidget *sendl_btn;
87         GtkWidget *draft_btn;
88         GtkWidget *insert_btn;
89         GtkWidget *attach_btn;
90         GtkWidget *sig_btn;
91         GtkWidget *exteditor_btn;
92         GtkWidget *linewrap_btn;
93         GtkWidget *addrbook_btn;
94
95         GtkWidget *vbox2;
96
97         /* Header */
98         GtkWidget *table_vbox;
99         GtkWidget *table;
100 /*
101         GtkWidget *to_hbox;
102         GtkWidget *to_entry;
103         GtkWidget *newsgroups_hbox;
104         GtkWidget *newsgroups_entry;
105 */
106         GtkWidget *subject_entry;
107 /*
108         GtkWidget *cc_hbox;
109         GtkWidget *cc_entry;
110         GtkWidget *bcc_hbox;
111         GtkWidget *bcc_entry;
112         GtkWidget *reply_hbox;
113         GtkWidget *reply_entry;
114         GtkWidget *followup_hbox;
115         GtkWidget *followup_entry;
116 */
117         GtkWidget *paned;
118
119         /* Attachments */
120         GtkWidget *attach_scrwin;
121         GtkWidget *attach_clist;
122
123         /* Others */
124         GtkWidget *savemsg_checkbtn;
125         GtkWidget *savemsg_entry;
126
127         /* Textedit */
128         GtkWidget *edit_vbox;
129         GtkWidget *ruler_hbox;
130         GtkWidget *ruler;
131         GtkWidget *scrolledwin;
132         GtkWidget *text;
133
134         GtkWidget *focused_editable;
135
136         GtkWidget *popupmenu;
137
138         GtkItemFactory *popupfactory;
139
140         GtkWidget *tmpl_menu;
141
142         ComposeMode mode;
143
144         MsgInfo *targetinfo;
145         MsgInfo *replyinfo;
146
147         GtkWidget *header_table;
148         GSList    *header_list;
149         guint      header_nextrow;
150         ComposeHeaderEntry *header_last;
151
152         gchar   *replyto;
153         gchar   *cc;
154         gchar   *bcc;
155         gchar   *newsgroups;
156         gchar   *followup_to;
157         gchar   *mailinglist;
158
159         gchar   *inreplyto;
160         gchar   *references;
161         gchar   *msgid;
162         gchar   *boundary;
163
164         gboolean use_to;
165         gboolean use_cc;
166         gboolean use_bcc;
167         gboolean use_replyto;
168         gboolean use_followupto;
169         gboolean use_mailinglist;
170         gboolean use_attach;
171
172         /* privacy settings */
173         gboolean use_signing;
174         gboolean use_encryption;
175
176         gboolean modified;
177
178         gboolean return_receipt;
179
180         GSList *to_list;
181         GSList *newsgroup_list;
182
183         PrefsAccount *account;
184         PrefsAccount *orig_account;
185
186         UndoMain *undostruct;
187
188         /* external editor */
189         gchar *exteditor_file;
190         pid_t  exteditor_pid;
191         gint   exteditor_readdes;
192         gint   exteditor_tag;
193
194 #if USE_PSPELL
195         /* Pspell spell checker */
196         GtkPspell *gtkpspell;
197 #endif
198
199         gchar *bounce_filename;
200 };
201
202 struct _AttachInfo
203 {
204         gchar *file;
205         gchar *content_type;
206         EncodingType encoding;
207         gchar *name;
208         off_t size;
209 };
210
211 Compose *compose_new                    (PrefsAccount   *account);
212
213 Compose *compose_new_with_recipient     (PrefsAccount   *account,
214                                          const gchar    *to);
215
216 Compose *compose_new_with_folderitem    (PrefsAccount   *account,
217                                          FolderItem     *item);
218
219 void compose_followup_and_reply_to      (MsgInfo        *msginfo,
220                                          gboolean        quote,
221                                          gboolean        to_all,
222                                          gboolean        ignore_replyto,
223                                          const gchar    *body);
224 void compose_reply                      (MsgInfo        *msginfo,
225                                          gboolean        quote,
226                                          gboolean        to_all,
227                                          gboolean        ignore_replyto,
228                                          const gchar    *body);
229 Compose *compose_forward                (PrefsAccount *account,
230                                          MsgInfo        *msginfo,
231                                          gboolean        as_attach,
232                                          const gchar    *body);
233 Compose *compose_forward_multiple       (PrefsAccount   *account, 
234                                          GSList         *msginfo_list);
235 Compose *compose_bounce                 (PrefsAccount   *account,
236                                          MsgInfo        *msginfo);
237 void compose_reedit                     (MsgInfo        *msginfo);
238
239 GList *compose_get_compose_list         (void);
240
241 void compose_entry_append               (Compose          *compose,
242                                          const gchar      *address,
243                                          ComposeEntryType  type);
244
245 gint compose_send                       (Compose          *compose);
246
247 void compose_reflect_prefs_all                  (void);
248 void compose_reflect_prefs_pixmap_theme (void);
249
250 #endif /* __COMPOSE_H__ */