~ubuntu-branches/ubuntu/natty/bluefish/natty-proposed

« back to all changes in this revision

Viewing changes to src/bluefish.h

  • Committer: Bazaar Package Importer
  • Author(s): Davide Puricelli (evo)
  • Date: 2005-04-23 17:05:18 UTC
  • mto: (1.1.5 upstream) (5.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20050423170518-izh2k25xve7ui1jx
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Bluefish HTML Editor
2
 
 * bluefish.h - global prototypes live here
 
2
 * bluefish.h - global prototypes
3
3
 *
4
4
 * Copyright (C) 1998 Olivier Sessink and Chris Mazuc
5
 
 * Copyright (C) 1999-2001 Olivier Sessink
 
5
 * Copyright (C) 1999-2004 Olivier Sessink
6
6
 *
7
7
 * This program is free software; you can redistribute it and/or modify
8
8
 * it under the terms of the GNU General Public License as published by
18
18
 * along with this program; if not, write to the Free Software
19
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
20
 */
21
 
#define UNDO2
22
 
/* #define DEVELOPMENT */
23
 
/* #define IMAGEMAP_EDITOR_TEST */
24
 
 
 
21
/* if you define DEBUG here you will get debug output from all Bluefish parts */
 
22
/* #define DEBUG */
25
23
 
26
24
#ifndef __BLUEFISH_H_
27
25
#define __BLUEFISH_H_
28
26
 
29
 
#include <glib.h>
30
 
#include <gtk/gtkwidget.h>
31
 
#include <sys/types.h> /* time_t */
32
 
 
33
 
#ifdef USE_GDK_PIXBUF
34
 
#include <gdk-pixbuf/gdk-pixbuf.h>
35
 
#endif
36
 
 
37
 
/* needed to see if WITH_SPC is defined */
38
27
#include "config.h"
39
 
 
40
 
#if defined(AUTOCOMPLET) || defined(ATTRPAGE)
41
 
#define PARSEDTD
42
 
#endif
43
 
 
44
 
 
 
28
#define BLUEFISH_SPLASH_FILENAME PKGDATADIR"bluefish_splash.png"
 
29
 
 
30
#ifdef HAVE_SYS_MSG_H
45
31
#define WITH_MSG_QUEUE
46
 
 
47
 
#ifdef WITH_MSG_QUEUE
48
 
#define BLUEFISH_MSG_QUEUE 9723475
49
 
#define MSQ_QUEUE_SIZE 1024
50
 
#define MSQ_QUEUE_SMALL_SIZE 7
51
 
#define MSQ_QUEUE_CHECK_TIME 300
52
 
#define MSG_QUEUE_SEND_ALIVE 46064
53
 
#define MSG_QUEUE_OPENFILE 46063
54
 
#define MSG_QUEUE_ASK_ALIVE 46062
55
 
#define MSG_QUEUE_PER_DOCUMENT_TIMEOUT 150
56
 
#endif
57
 
 
58
 
 
59
 
 
60
 
#ifdef UNDO2
 
32
#endif
 
33
 
 
34
#ifdef DEBUG
 
35
#define DEBUG_MSG g_print
 
36
#else /* not DEBUG */
 
37
#ifdef __GNUC__
 
38
#define DEBUG_MSG(args...)
 
39
 /**/
 
40
#else/* notdef __GNUC__ */
 
41
extern void g_none(gchar *first, ...);
 
42
#define DEBUG_MSG g_none
 
43
#endif /* __GNUC__ */
 
44
#endif /* DEBUG */
 
45
 
 
46
#ifdef ENABLE_NLS
 
47
 
 
48
#include <libintl.h>
 
49
#define _(String) gettext (String)
 
50
#define N_(String) (String)
 
51
 
 
52
#else                                                                           
 
53
 
 
54
#define _(String)(String)
 
55
#define N_(String)(String)
 
56
 
 
57
#endif    
 
58
 
 
59
 
 
60
#define DIRSTR "/"
 
61
#define DIRCHR '/'
 
62
 
 
63
#include <sys/types.h>
 
64
#include <regex.h>
 
65
#include <sys/types.h>
 
66
#include <sys/stat.h>
 
67
#include <unistd.h>
 
68
#include <pcre.h>
 
69
 
 
70
#ifdef HAVE_GNOME_VFS
 
71
#include <libgnomevfs/gnome-vfs.h>
 
72
#endif
 
73
 
 
74
 
 
75
/*********************/
 
76
/* undo/redo structs */
 
77
/*********************/
61
78
typedef enum {
62
79
        UndoDelete = 1, UndoInsert
63
80
} undo_op_t;
74
91
        gint num_groups;
75
92
        GList *redofirst;
76
93
} unre_t;
77
 
#endif /* UNDO2 */
78
 
 
79
 
/* the saved selection in a document */
80
 
typedef struct {
81
 
        gboolean saved;
82
 
        guint start_pos;
83
 
        guint end_pos;
84
 
        guint has_selection : 1;
85
 
} TSelection;
86
 
 
87
 
/* This is the type of each document */
88
 
typedef struct {
89
 
        gchar *filename;
 
94
 
 
95
/************************/
 
96
/* filetype struct      */
 
97
/************************/
 
98
 
 
99
typedef struct {
 
100
        gchar *type;
 
101
        gchar **extensions;
 
102
        GdkPixbuf *icon;
 
103
        gchar *update_chars;
 
104
        GList *highlightlist;
 
105
        gboolean editable; /* this a type that can be edited by Bluefish */
 
106
        gint autoclosingtag; /* 0=off, 1=xml mode, 2=html mode */
 
107
        gchar *content_regex; /* a regex pattern to test the filetype using the content */
 
108
} Tfiletype;
 
109
 
 
110
/*******************/
 
111
/* document struct */
 
112
/*******************/
 
113
#define BFWIN(var) ((Tbfwin *)(var))
 
114
#define DOCUMENT(var) ((Tdocument *)(var))
 
115
 
 
116
typedef struct {
 
117
        gchar *filename; /* this is the UTF-8 encoded filename, before you use it on disk you need convert to disk-encoding! */
 
118
        gchar *encoding;
90
119
        gint modified;
91
 
        time_t mtime; /* from stat() */
92
 
        uid_t owner_uid; /* user ID of owner */
93
 
        gid_t owner_gid; /* group ID of owner */
94
 
        mode_t mode; /* mode field in stat() format so any stat macro's will work*/
 
120
/*      time_t mtime; */ /* from stat() */
 
121
#ifdef HAVE_GNOME_VFS
 
122
        GnomeVFSFileInfo *fileinfo;
 
123
#else /* HAVE_GNOME_VFS */
 
124
        struct stat statbuf;
 
125
#endif /* HAVE_GNOME_VFS */
95
126
        gint is_symlink; /* file is a symbolic link */
96
 
        unsigned del_txt_id;
97
 
        unsigned ins_txt_id;
98
 
#ifdef UNDO2
 
127
        gulong del_txt_id; /* text delete signal */
 
128
        gulong ins_txt_id; /* text insert signal */
 
129
        gulong ins_aft_txt_id; /* text insert-after signal, for auto-indenting */
99
130
        unre_t unre;
100
 
#else
101
 
        GList *undolist; /* Copyright (C) 1998 Andy C. Kahn <kahn@zk3.dec.com> */
102
 
        GList *undotail; /* undo/redo part is copied from gnotepad code */
103
 
        GList *redolist;
104
 
        GList *redotail;
105
 
#endif /* UNDO2 */
106
 
        GtkWidget *textbox;
 
131
        GtkWidget *view;
107
132
        GtkWidget *tab_label;
108
 
        gint highlightstate;
109
 
        gint need_highlighting;         /* +1 means a '"' is added, +2 means a '<' is added, 4 means a '>' is added */
110
 
        TSelection saved_sel;
111
 
#ifdef PARSEDTD
112
 
        int dtd_doctype; /* index of the doc's doctype in the array HTML_doctypes */
113
 
        int dtd_loaded;  /* loaded doctype (may not be the same as above) */
114
 
#endif
 
133
        GtkWidget *tab_eventbox;
 
134
        GtkWidget *tab_menu;
 
135
        GtkTextBuffer *buffer;
 
136
        gpointer paste_operation;
 
137
        gint last_rbutton_event; /* index of last 3rd button click */
 
138
        Tfiletype *hl; /* filetype & highlighting set to use for this document */
 
139
        gint need_highlighting; /* if you open 10+ documents you don't need immediate highlighting, just set this var, and notebook_switch() will trigger the actual highlighting when needed */
 
140
        gboolean highlightstate; /* does this document use highlighting ? */
 
141
        gboolean wrapstate; /* does this document use wrap?*/
 
142
        gboolean linenumberstate; /* does this document use linenumbers? */
 
143
        gboolean overwrite_mode; /* is document in overwrite mode */
 
144
        gboolean autoclosingtag; /* does the document use autoclosing of tags */
 
145
        gpointer floatingview; /* a 2nd textview widget that has its own window */
 
146
        gpointer bfwin;
 
147
        GtkTreeIter *bmark_parent; /* if NULL this document doesn't have bookmarks, if 
 
148
                                                                        it does have bookmarks they are children of this GtkTreeIter */
115
149
} Tdocument;
116
150
 
117
 
/* This is the current project */
118
 
typedef struct {
119
 
        gint modified;
120
 
        gchar *filename;
121
 
        gchar *basedir;
122
 
        gchar *webdir;
123
 
        gchar *template;
124
 
        GList *fontlist;
125
 
        GList *urllist;
126
 
        GList *targetlist;
127
 
        GList *colorlist;
128
 
        GList *dtd_cblist;
129
 
        GList *classlist;
130
 
        GList *headerlist;
131
 
        GList *filenames;
132
 
} Tproject;
133
 
 
134
 
typedef struct {
135
 
        gint v_html_tb;                         /* view html toolbar */
136
 
        gint v_custom_tb;                       /* view custom menubar */
137
 
        gint v_main_tb;                         /* view main toolbar */
138
 
        gint v_filebrowser;     /* view filebrowser */
 
151
typedef struct {
 
152
        gint view_html_toolbar;                         /* view html toolbar */
 
153
        gint view_custom_menu;                  /* view custom menubar */
 
154
        gint view_main_toolbar;                         /* view main toolbar */
 
155
        gint view_left_panel;   /* view filebrowser/functionbrowser etc. */
 
156
        gint view_line_numbers; /* view line numbers on the left side by default */
 
157
        gint filebrowser_show_hidden_files;
 
158
        gint filebrowser_show_backup_files;
 
159
        gint filebrowser_two_pane_view; /* have one or two panes in the filebrowser */
 
160
        gint filebrowser_focus_follow; /* have the directory of the current document in focus */
 
161
        gchar *filebrowser_unknown_icon;
 
162
        gchar *filebrowser_dir_icon;
 
163
        gchar *editor_font_string;              /* editor font */
 
164
        gint editor_tab_width;  /* editor tabwidth */
 
165
        gint editor_indent_wspaces; /* indent with spaces, not tabs */
 
166
        gchar *tab_font_string;         /* notebook tabs font */
 
167
        GList *browsers; /* browsers array */
 
168
        GList *external_commands;       /* external commands array */
 
169
        GList *cust_menu;               /* DEPRECATED entries in the custom menu */
 
170
        GList *cmenu_insert; /* custom menu inserts */
 
171
        GList *cmenu_replace; /* custom menu replaces */
 
172
        gint highlight_num_lines_count; /* number of lines to highlight in continous highlighting */    
 
173
        gint defaulthighlight;          /* highlight documents by default */
 
174
        GList *filetypes; /* filetypes for highlighting and filtering */
 
175
        gint numcharsforfiletype; /* maximum number of characters in the file to use to find the filetype */
 
176
        GList *filefilters; /* filebrowser.c filtering */
 
177
        gchar *last_filefilter; /* last filelist filter type */
 
178
        GList *highlight_patterns; /* the highlight patterns */
139
179
        gint transient_htdialogs;  /* set html dialogs transient ro the main window */
140
 
        gint main_window_h;                     /* main window height */
141
 
        gint main_window_w;                     /* main window width */
142
 
        gint main_filelist_size;        /* width of filelist */
 
180
        gint restore_dimensions; /* use the dimensions as used the previous run */
 
181
        gint left_panel_width;  /* width of filelist */
 
182
        gint left_panel_left; /* 1 = left, 0 = right */
143
183
        gint max_recent_files;  /* length of Open Recent list */
144
184
        gint max_dir_history;   /* length of directory history */
145
 
        gchar *filelist_filter; /* filelist filter type */
146
 
        gchar *filebrowser_filter_image; /* the image type */
147
 
        gchar *filebrowser_filter_php; /* the php type */
148
 
        gchar *filebrowser_filter_html; /* the html type */
149
 
        gchar *filebrowser_filter_jscript; /* the jscript type */
150
 
        gchar *filebrowser_filter_css; /* the css type */
151
 
        gchar *filebrowser_filter_other; /* the other type */
152
 
        gchar *cfg_browser_cline;       /* browser commandline */
 
185
        gint backup_file;                       /* wheather to use a backup file */
 
186
        gchar *backup_filestring;  /* the string to append to the backup file */
 
187
        gint backup_abort_action; /* if the backup fails, continue save, abort save, or ask the user */
 
188
        gint backup_cleanuponclose; /* remove the backupfile after close ? */
 
189
        gchar *image_thumbnailstring;   /* string to append to thumbnail filenames */
 
190
        gchar *image_thumbnailtype;     /* fileformat to use for thumbnails, "jpeg" or "png" can be handled by gdkpixbuf*/
 
191
        gint image_thumbnail_refresh_quality; /* 1=GDK_INTERP_BILINEAR, 0=GDK_INTERP_NEAREST*/
 
192
        gint image_thumbnailsizing_type;        /* scaling ratio=0, fixed width=1, height=2, width+height (discard aspect ratio)=3 */
 
193
        gint image_thumbnailsizing_val1;        /* the width, height or ratio, depending on the value above */
 
194
        gint image_thumbnailsizing_val2; /* height if the type=3 */
 
195
        gchar *image_thumnailformatstring; /* like <a href="%r"><img src="%t"></a> or more advanced */
 
196
        gint allow_multi_instances; /* allow multiple instances of the same file */
 
197
        gint modified_check_type; /* 0=no check, 1=by mtime and size, 2=by mtime, 3=by size, 4,5,...not implemented (md5sum?) */
 
198
        gint num_undo_levels;   /* number of undo levels per document */
 
199
        gint clear_undo_on_save;        /* clear all undo information on file save */
 
200
        gchar *newfile_default_encoding; /* if you open a new file, what encoding will it use */
 
201
        GList *encodings; /* all encodings you can choose from */
 
202
        gint auto_set_encoding_meta; /* auto set metatag for the encoding */
 
203
        gint auto_update_meta; /* auto update author and generator meta tags on save */
 
204
        gint encoding_search_Nbytes; /* number of bytes to look for the encoding meta tag */
 
205
        GList *outputbox; /* all outputbox commands */
 
206
        gint ext_browsers_in_submenu;
 
207
        gint ext_commands_in_submenu;
 
208
        gint ext_outputbox_in_submenu;
 
209
        GList *reference_files; /* all reference files */
 
210
        gint bookmarks_default_store; /* 0= temporary by default, 1= permanent by default */
 
211
        gint bookmarks_filename_mode; /* 0=FULLPATH, 1=DIR FROM BASE 2=BASENAME */
 
212
        gint document_tabposition;
 
213
        gint leftpanel_tabposition;
 
214
        gchar *default_basedir;
 
215
        gchar *project_suffix;
 
216
#ifdef HAVE_LIBASPELL
 
217
        gchar *spell_default_lang;
 
218
#endif /* HAVE_LIBASPELL */
 
219
        /* not yet in use */
153
220
        gchar *image_editor_cline;      /* image editor commandline */
154
 
        gchar *cfg_weblint_cline;       /* weblint command line */
155
 
        gchar *cfg_editor_font;         /* editor font */
156
 
        gint cfg_editor_tabwidth;       /* editor tabwidth */
157
 
        gchar *cfg_tab_pos;                     /* notebook tabs positioning */
158
 
        gchar *cfg_tab_font;            /* notebook tabs font */
159
 
        gchar *cfg_thumbnailstring;     /* string to append to thumbnail filenames */
160
 
        gchar *cfg_thumbnailtype;       /* fileformat to use for thumbnails */
161
 
        gint full_p;                            /* use </p> */
162
 
        gint full_li;                           /* use </li> */
163
 
        gint allow_css;                         /* CSS allowed */
164
221
        gint allow_dep;                         /* allow <FONT>... */
165
222
        gint format_by_context;         /* use <strong> instead of <b>, <emphasis instead of <i> etc. (W3C reccomendation) */
166
223
        gint xhtml;                                     /* write <br /> */
167
224
        gint allow_ruby;                        /* allow <ruby> */
168
 
        gint allow_h4;                          /* allow <Q>... */
169
 
        gint allow_frames;                      /* allow <FRAME> */
170
225
        gint force_dtd;                         /* write <!DOCTYPE...> */
171
226
        gint dtd_url;                           /* URL in DTD */
172
227
        gint xml_start;                         /* <?XML...> */
173
228
        gint lowercase_tags;            /* use lowercase tags */
174
229
        gint word_wrap;                         /* use wordwrap */
175
230
        gint autoindent;                        /* autoindent code */
176
 
        gint line_wrap;                         /* use line wrap */
177
 
        gint fontset;                           /* load fontset (0 = load font) */
178
 
        gint force_def_style;  /* force white editor background */
179
231
        gint drop_at_drop_pos;  /* drop at drop position instead of cursor position */
180
232
        gint link_management;   /* perform link management */
181
 
        gint defaulthighlight;          /* highlight documents by default */
182
 
        gint cont_highlight_full;       /* if you want to highlight the full text or just the line */
183
233
        gint cont_highlight_update;     /* update the syntax highlighting continuous */
184
 
        gchar *html_ver;
185
 
        GList *external_filters;        /* external filter in list */
186
 
        GList *external_commands;       /* external filter in list */
187
 
        GList *cust_menu;               /* entries in the custom menu */
188
 
        GList *syntax_configstrings;    /* the strings containing the colors and patters */
189
 
 
190
 
#ifdef WITH_SPC
191
 
        /* spell checker options */
192
 
        gchar *cfg_spc_cline      ;  /* spell checker command line */
193
 
        gchar *cfg_spc_lang       ;  /* language */
194
 
        gint  spc_accept_compound ;  /* accept compound words ? */
195
 
        gint  spc_use_esc_chars   ;  /* specify aditional characters that
196
 
                                     may be part of a word ? */
197
 
        gchar* spc_esc_chars      ;  /* which ones ? */
198
 
        gint   spc_use_pers_dict  ;  /* use a personal dictionary */
199
 
        gchar* spc_pers_dict      ;  /* which one ? */
200
 
   gint   spc_use_input_encoding ;  /* use input encoding */
201
 
   gchar* spc_input_encoding     ;  /* wich one ? */
202
 
   gint   spc_output_html_chars  ; /* output html chars ? (like &aacute;)*/
203
 
#endif
204
 
        gchar *backup_filestring;  /* the string to append to the backup file */
205
 
        gint backup_file;                       /* wheather to use a backup file */
206
 
        gint backup_by_copy;    /* make a copy instead of renaming the file */
207
 
        gchar *backup_abort_style; /* if the backup fails, continue 'save', 'abort' save, or 'ask' user */
208
 
        gint auto_convert_CR; /* auto remove carriage returns from input files */
209
 
        gint allow_multi_instances; /* allow multiple instances of the same file */
210
 
        gint num_undo_levels;   /* number of undo levels per document */
211
 
        gint clear_undo_on_save;        /* clear all undo information on file save */
212
234
        /* key conversion */
213
 
        gint conv_ctrl_enter;           /* convert control-enter key press */
214
 
        gchar *ctrl_enter_text;         /* inserted text */
215
 
        gint conv_shift_enter;          /* convert shift-enter key press */
216
 
        gchar *shift_enter_text;        /* inserted text */
217
 
        gint conv_special_char;         /* convert ctrl-'<','>','&' */
218
 
#ifdef WITH_MSG_QUEUE
219
235
        gint open_in_running_bluefish; /* open commandline documents in already running session*/
220
 
#endif /* WITH_MSG_QUEUE */
221
 
#ifdef AUTOCOMPLET
222
 
        gint autocomplet_html;   /* Shows autocompletion window when editing HTML */
223
 
        gint autocomplet_delay;  /* Delay to show the autocompletion window */
 
236
#ifdef HAVE_GNOME_VFS
 
237
        gint server_zope_compat;        /* add 'document_src' to uri when reading remote files */
224
238
#endif
225
239
} Tproperties;
226
240
 
227
 
typedef struct {
228
 
        gchar *before;
229
 
        gchar *after;
230
 
} Tlast_insert;
231
 
 
232
 
#ifdef WITH_INTERNAL_PREVIEW
233
 
typedef struct {
234
 
        GtkWidget *win;
235
 
        GtkWidget *html;
236
 
} Tpreview;
237
 
#endif
238
 
 
239
 
typedef enum {
240
 
FILTER_ALL,
241
 
FILTER_WEB,
242
 
FILTER_IMAGES,
243
 
FILTER_DOCUMENTS
244
 
} Tfilebrowser_filter;
245
 
 
246
 
 
247
 
typedef struct {
248
 
        GtkWidget *hpane; /* it needs to be in here so it can be destroyed when the filebrowser is removed */
249
 
        gchar *curdir;
250
 
        GtkWidget *dir_history;
251
 
        GtkWidget *dir_list;
252
 
        gint dir_list_lastrow;
253
 
        GtkWidget *file_list;
254
 
        gint file_list_lastrow;
255
 
        gint file_list_selectedrow;
256
 
        GList *dir_history_menu;
257
 
        Tfilebrowser_filter filter_type;
258
 
        GList *directory_history;
259
 
} Tfilebrowser;
260
 
 
261
 
typedef struct {
262
 
     GtkWidget *w_img_preview_win;
263
 
     GtkWidget *w_image;
264
 
     gint max_width; /* make this configurable */
265
 
     gint max_height; 
266
 
     GtkWidget *w_scrolledwin;
267
 
     char *current_img_filename;
268
 
} Timage_preview;
269
 
 
270
 
typedef struct {
271
 
        GtkWidget *undo;
272
 
        GtkWidget *redo;
273
 
} Ttoolbar_buttons;
274
 
 
275
 
/* identifying files */
276
 
#define TYPE_UNKNOWN 0
277
 
#define TYPE_IMAGE 1
278
 
#define TYPE_PHP 2
279
 
#define TYPE_HTML 3
280
 
#define TYPE_DIR 4
281
 
#define TYPE_JSCRIPT 5
282
 
#define TYPE_CSS 6
283
 
#define TYPE_OTHER 7
284
 
#define TYPES_COUNT 8
285
 
 
286
 
typedef struct {
287
 
     Tproject current_project;
288
 
     Tproperties props;
289
 
     Tdocument *current_document;       /* This is always the current visible one */
290
 
     GList *documentlist;               /* The documents are now placed in a Glist */
291
 
     GtkWidget *notebook;
292
 
     gint last_notebook_page;   /* this is the last used, this can be used to track down if the notebook page really changed */
293
 
     GtkWidget *statusbar;
294
 
     GtkWidget *menubar;
295
 
     Tfilebrowser filebrowser;
296
 
     gchar **identify_filters[TYPES_COUNT];
297
 
     GtkWidget *main_window;
298
 
          GtkWidget *middlebox; /* the hbox which contains the notebook or the notebook and the filebrowser */
299
 
     GtkWidget *cmenu;
300
 
     GList *cmenu_arrays; /* custom menu strctures */
301
 
#ifdef WITH_INTERNAL_PREVIEW
302
 
     Tpreview *preview;
303
 
#endif
304
 
     void *syntax_structs;              /* pointer to an array of struct : the props.syntax_configstrings parsed into structs with GdkColor and regex pattern */
305
 
     gint syntax_structs_n;             /* number of structs pointed by syntax_structs */
306
 
     GList *command_strings;
307
 
     GList *filter_strings;
308
 
     GList *recent_files;
309
 
     GdkColormap *colormap;
310
 
#ifdef WITH_MSG_QUEUE
311
 
     gint msgid;
312
 
#endif /* WITH_MSG_QUEUE */
313
 
     Tlast_insert last_insert;
314
 
     Timage_preview *img_preview;
315
 
          Ttoolbar_buttons toolb;
316
 
#ifdef ATTRPAGE
317
 
     GtkWidget *attrpage_window;
318
 
#endif
 
241
/* the Tglobalsession contains all settings that can change 
 
242
over every time you run Bluefish, so things that *need* to be
 
243
saved after every run! */
 
244
typedef struct {
 
245
        GList *quickbar_items; /* items in the quickbar toolbar */      
 
246
        gint main_window_h;                     /* main window height */
 
247
        gint main_window_w;                     /* main window width */
 
248
        gint two_pane_filebrowser_height; /* position of the pane separater on the two paned file browser */
 
249
        gint fref_ldoubleclick_action; /* left doubleclick in the function reference */
 
250
        gint fref_info_type; /* type of info shown in a small function reference window */
 
251
        gint lasttime_cust_menu; /* the last time the defaultfile was checked for new entries */
 
252
        gint lasttime_highlighting; /* see above */
 
253
        gint lasttime_filetypes; /* see above */
 
254
        gint lasttime_encodings; /* see above */
 
255
        GList *recent_projects;
 
256
} Tglobalsession;
 
257
 
 
258
typedef struct {
 
259
        GList *classlist;
 
260
        GList *colorlist;
 
261
        GList *targetlist;
 
262
        GList *urllist;
 
263
        GList *fontlist;
 
264
        GList *dtd_cblist; /* is this used ?? */
 
265
        GList *headerlist; /* is this used ?? */
 
266
        GList *positionlist; /* is this used ?? */
 
267
        GList *searchlist; /* used in snr2 */
 
268
        GList *replacelist; /* used in snr2 */
 
269
        GList *bmarks;
 
270
        GList *recent_files;
 
271
        GList *recent_dirs;
 
272
        gchar *opendir;
 
273
        gchar *savedir;
 
274
} Tsessionvars;
 
275
 
 
276
typedef struct {
 
277
        gchar *filename;
 
278
        gchar *name;
 
279
        GList *files;
 
280
        gchar *basedir;
 
281
        gchar *webdir;
 
282
        gchar *template;
 
283
        gpointer editor;
 
284
        gint view_main_toolbar;
 
285
        gint view_left_panel;
 
286
        gint view_custom_menu;
 
287
        gint view_html_toolbar;
 
288
        gint word_wrap;
 
289
        Tsessionvars *session;
 
290
        GtkTreeStore *bookmarkstore; /* project bookmarks */
 
291
} Tproject;
 
292
 
 
293
typedef struct {
 
294
        Tsessionvars *session; /* points to the global session, or to the project session */
 
295
        Tdocument *current_document; /* one object out of the documentlist, the current visible document */
 
296
        GList *documentlist; /* document.c and others: all Tdocument objects */
 
297
        Tdocument *last_activated_doc;
 
298
        Tproject *project; /* might be NULL for a default project */
 
299
        GtkWidget *main_window;
 
300
        GtkWidget *menubar;
 
301
        gint last_notebook_page; /* a check to see if the notebook changed to a new page */
 
302
        gulong notebook_switch_signal;
 
303
        GtkWidget *notebook;
 
304
        GtkWidget *notebook_fake;
 
305
        GtkWidget *notebook_box; /* Container for notebook and notebook_fake */
 
306
        GtkWidget *middlebox; /* we need this to show/hide the filebrowser */
 
307
        GtkWidget *hpane; /* we need this to show/hide the filebrowser */
 
308
        GtkWidget *statusbar;
 
309
        GtkWidget *statusbar_lncol; /* where we have the line number */
 
310
        GtkWidget *statusbar_insovr; /* insert/overwrite indicator */
 
311
        GtkWidget *statusbar_editmode; /* editor mode and doc encoding */
 
312
        /* the following list contains toolbar widgets we like to reference later on */
 
313
        GtkWidget *toolbar_undo;
 
314
        GtkWidget *toolbar_redo;
 
315
        GtkWidget *toolbar_quickbar; /* the quickbar widget */
 
316
        GList *toolbar_quickbar_children; /* this list is needed to remove widgets from the quickbar */
 
317
        /* following widgets are used to show/hide stuff */
 
318
        GtkWidget *main_toolbar_hb;
 
319
        GtkWidget *html_toolbar_hb;
 
320
        GtkWidget *custom_menu_hb; /* handle box for custom menu */
 
321
        GtkWidget *output_box;
 
322
        GtkWidget *leftpanel_notebook;
 
323
        /* following are lists with dynamic menu entries */
 
324
        GList *menu_recent_files;
 
325
        GList *menu_recent_projects;
 
326
        GList *menu_external;
 
327
        GList *menu_encodings;
 
328
        GList *menu_outputbox;
 
329
        GList *menu_windows;
 
330
        GtkWidget *menu_cmenu;
 
331
        GList *menu_cmenu_entries;
 
332
        GList *menu_filetypes;
 
333
        /* following is a new approach, that we have only a gpointer here, whioh is typecasted 
 
334
        in the file where it is needed */
 
335
        gpointer outputbox;
 
336
        gpointer bfspell;
 
337
        gpointer filebrowser;
 
338
        gpointer snr2;
 
339
        gpointer fref;
 
340
        gpointer bmark;
 
341
        GtkTreeStore *bookmarkstore; /* this is a link to project->bookmarkstore OR main_v->bookmarkstore
 
342
                                                                                          and it is only here for convenience !!!! */
 
343
        GHashTable *bmark_files;     /* no way, I have to have list of file iters. Other way I 
 
344
                                        cannot properly load bmarks for closed files */
 
345
} Tbfwin;
 
346
 
 
347
typedef struct {
 
348
        Tproperties props; /* preferences */
 
349
        Tglobalsession globses; /* global session */
 
350
        GList *filetypelist; /* highlighting.c: a list of all filetypes with their icons and highlighting sets */
 
351
        GList *bfwinlist;
 
352
        GList *recent_directories; /* a stringlist with the most recently used directories */
 
353
        Tsessionvars *session; /* holds all session variables for non-project windows */
 
354
        gpointer filebrowserconfig;
 
355
        gpointer frefdata;
 
356
        gpointer bmarkdata;
 
357
        GtkTreeStore *bookmarkstore; /* the global bookmarks from the global session */
 
358
        gint num_untitled_documents;
 
359
        GtkTooltips *tooltips;
 
360
        guint16 lastkp_hardware_keycode; /* for the autoclosing, we need to know the last pressed key, in the key release callback, */
 
361
        guint lastkp_keyval;             /* this is different if the modifier key is not pressed anymore during the key-release */
 
362
        pcre *autoclosingtag_regc; /* the regular expression to check for a valid tag in tag autoclosing*/
319
363
} Tmain;
320
364
 
321
365
extern Tmain *main_v;
322
366
 
323
 
/* for exiting bluefish */
324
 
void cya_later(GtkWidget * widget, gpointer data);
325
 
 
326
 
void load_identify_filters();
327
 
gint identify_by_filename(gchar *filename);
328
 
 
329
 
/* runs through all the events in the gtk and gdk queue */
330
 
void flush_queue(void);
331
 
 
332
 
#endif                                                  /* __BLUEFISH_H_ */
 
367
/* public functions from bluefish.c */
 
368
void bluefish_exit_request(void);
 
369
#endif /* __BLUEFISH_H_ */