2006-02-24 [wwp] 2.0.0cvs81
[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         gboolean batch;
192         
193         GSList *to_list;
194         GSList *newsgroup_list;
195
196         PrefsAccount *account;
197
198         UndoMain *undostruct;
199
200         gchar *sig_str;
201
202         /* external editor */
203         gchar      *exteditor_file;
204         pid_t       exteditor_pid;
205         GIOChannel *exteditor_ch;
206         gint        exteditor_tag;
207
208 #if USE_ASPELL
209         /* GNU/aspell spell checker */
210         GtkAspell *gtkaspell;
211 #endif
212
213         /* Priority */
214         gint priority;
215
216         gchar *redirect_filename;
217         
218         gboolean remove_references;
219
220         guint draft_timeout_tag;
221         
222         GtkTextTag *no_wrap_tag;
223         GtkTextTag *no_join_tag;
224         GMutex *mutex;
225         gchar *orig_charset;
226         gint set_cursor_pos;
227 };
228
229 struct _AttachInfo
230 {
231         gchar *file;
232         gchar *content_type;
233         EncodingType encoding;
234         gchar *name;
235         off_t size;
236 };
237
238 /*#warning FIXME_GTK2 */
239 /* attache_files will be locale encode */
240 Compose *compose_new                    (PrefsAccount   *account,
241                                          const gchar    *mailto,
242                                          GPtrArray      *attach_files);
243
244 Compose *compose_new_with_folderitem    (PrefsAccount   *account,
245                                          FolderItem     *item);
246
247 Compose *compose_new_with_list          (PrefsAccount   *account,
248                                          GList          *listAddress);
249
250 Compose *compose_reply_mode             (ComposeMode     mode, 
251                                          GSList         *msginfo_list, 
252                                          gchar          *body);
253 /* remove */
254 Compose *compose_followup_and_reply_to  (MsgInfo        *msginfo,
255                                          gboolean        quote,
256                                          gboolean        to_all,
257                                          gboolean        to_sender,
258                                          const gchar    *body);
259 Compose *compose_reply                  (MsgInfo        *msginfo,
260                                          gboolean        quote,
261                                          gboolean        to_all,
262                                          gboolean        to_ml,
263                                          gboolean        to_sender,
264                                          const gchar    *body);
265 Compose *compose_forward                (PrefsAccount *account,
266                                          MsgInfo        *msginfo,
267                                          gboolean        as_attach,
268                                          const gchar    *body,
269                                          gboolean        no_extedit,
270                                          gboolean        batch);
271 Compose *compose_forward_multiple       (PrefsAccount   *account, 
272                                          GSList         *msginfo_list);
273 /* remove end */
274
275 Compose *compose_redirect               (PrefsAccount   *account,
276                                          MsgInfo        *msginfo,
277                                          gboolean        batch);
278 void compose_reedit                     (MsgInfo        *msginfo);
279
280 GList *compose_get_compose_list         (void);
281
282 void compose_template_apply_fields(Compose *compose, Template *tmpl);
283
284 void compose_entry_append               (Compose          *compose,
285                                          const gchar      *address,
286                                          ComposeEntryType  type);
287
288 void compose_entry_mark_default_to      (Compose          *compose,
289                                          const gchar      *address);
290
291 gint compose_send                       (Compose          *compose);
292
293 void compose_update_actions_menu        (Compose        *compose);
294 void compose_update_privacy_systems_menu(Compose        *compose);
295 void compose_reflect_prefs_all                  (void);
296 void compose_reflect_prefs_pixmap_theme (void);
297
298 void compose_destroy_all                (void);
299 void compose_draft                      (gpointer data);
300 void compose_toolbar_cb                 (gint           action, 
301                                          gpointer       data);
302 void compose_reply_from_messageview     (MessageView    *msgview, 
303                                          GSList         *msginfo_list, 
304                                          guint           action);
305 void compose_action_cb                  (void           *data);
306
307 void compose_set_position                               (Compose        *compose,
308                                                  gint            pos);
309 gboolean compose_search_string                  (Compose        *compose,
310                                                  const gchar    *str,
311                                                  gboolean        case_sens);
312 gboolean compose_search_string_backward (Compose        *compose,
313                                                  const gchar    *str,
314                                                  gboolean        case_sens);
315
316 #endif /* __COMPOSE_H__ */