Fix #626: Animated GIFS lead to high CPU load
[geeqie.git] / src / typedefs.h
1 /*
2  * Copyright (C) 2006 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef TYPEDEFS_H
23 #define TYPEDEFS_H
24
25 typedef enum {
26         ZOOM_RESET_ORIGINAL     = 0,
27         ZOOM_RESET_FIT_WINDOW   = 1,
28         ZOOM_RESET_NONE         = 2
29 } ZoomMode;
30
31 typedef enum {
32         PRIMARY = 0,
33         CLIPBOARD = 1,
34 } ClipboardSelection;
35
36 typedef enum {
37         MOUSE_BUTTON_LEFT       = 1,
38         MOUSE_BUTTON_MIDDLE     = 2,
39         MOUSE_BUTTON_RIGHT      = 3,
40         MOUSE_BUTTON_WHEEL_UP   = 4,
41         MOUSE_BUTTON_WHEEL_DOWN = 5,
42         MOUSE_BUTTON_BACK       = 8,
43         MOUSE_BUTTON_FORWARD    = 9
44 } MouseButton;
45
46 typedef enum {
47         DIRVIEW_LIST,
48         DIRVIEW_TREE,
49
50         // Keep this up to date!
51         DIRVIEW_LAST = DIRVIEW_TREE
52 } DirViewType;
53
54 typedef enum {
55         FILEVIEW_LIST,
56         FILEVIEW_ICON,
57
58         // Keep this up to date!
59         FILEVIEW_LAST = FILEVIEW_ICON
60 } FileViewType;
61
62 #define CMD_COPY     "geeqie-copy-command.desktop"
63 #define CMD_MOVE     "geeqie-move-command.desktop"
64 #define CMD_RENAME   "geeqie-rename-command.desktop"
65 #define CMD_DELETE   "geeqie-delete-command.desktop"
66 #define CMD_FOLDER   "geeqie-folder-command.desktop"
67
68 typedef enum {
69         SORT_NONE,
70         SORT_NAME,
71         SORT_SIZE,
72         SORT_TIME,
73         SORT_CTIME,
74         SORT_PATH,
75         SORT_NUMBER,
76         SORT_EXIFTIME,
77         SORT_EXIFTIMEDIGITIZED,
78         SORT_RATING,
79         SORT_CLASS
80 } SortType;
81
82 typedef enum {
83         ALTER_NONE,             /* do nothing */
84         ALTER_ROTATE_90,
85         ALTER_ROTATE_90_CC,     /* counterclockwise */
86         ALTER_ROTATE_180,
87         ALTER_MIRROR,
88         ALTER_FLIP,
89 } AlterType;
90
91 typedef enum {
92         LAYOUT_HIDE   = 0,
93         LAYOUT_LEFT   = 1 << 0,
94         LAYOUT_RIGHT  = 1 << 1,
95         LAYOUT_TOP    = 1 << 2,
96         LAYOUT_BOTTOM = 1 << 3
97 } LayoutLocation;
98
99
100 typedef enum {
101         IMAGE_STATE_NONE        = 0,
102         IMAGE_STATE_IMAGE       = 1 << 0,
103         IMAGE_STATE_LOADING     = 1 << 1,
104         IMAGE_STATE_ERROR       = 1 << 2,
105         IMAGE_STATE_COLOR_ADJ   = 1 << 3,
106         IMAGE_STATE_ROTATE_AUTO = 1 << 4,
107         IMAGE_STATE_ROTATE_USER = 1 << 5,
108         IMAGE_STATE_DELAY_FLIP  = 1 << 6
109 } ImageState;
110
111 typedef enum {
112         SPLIT_NONE = 0,
113         SPLIT_VERT,
114         SPLIT_HOR,
115         SPLIT_QUAD,
116 } ImageSplitMode;
117
118 typedef enum {
119         FILEDATA_CHANGE_DELETE,
120         FILEDATA_CHANGE_MOVE,
121         FILEDATA_CHANGE_RENAME,
122         FILEDATA_CHANGE_COPY,
123         FILEDATA_CHANGE_UNSPECIFIED,
124         FILEDATA_CHANGE_WRITE_METADATA
125 } FileDataChangeType;
126
127 typedef enum {
128         MTS_MODE_MINUS,
129         MTS_MODE_SET,
130         MTS_MODE_OR,
131         MTS_MODE_AND
132 } MarkToSelectionMode;
133
134 typedef enum {
135         STM_MODE_RESET,
136         STM_MODE_SET,
137         STM_MODE_TOGGLE
138 } SelectionToMarkMode;
139
140 typedef enum {
141         FORMAT_CLASS_UNKNOWN,
142         FORMAT_CLASS_IMAGE,
143         FORMAT_CLASS_RAWIMAGE,
144         FORMAT_CLASS_META,
145         FORMAT_CLASS_VIDEO,
146         FORMAT_CLASS_COLLECTION,
147         FORMAT_CLASS_PDF,
148         FILE_FORMAT_CLASSES
149 } FileFormatClass;
150
151 extern gchar *format_class_list[];
152
153 typedef enum {
154         SS_ERR_NONE = 0,
155         SS_ERR_DISABLED, /**< secsave is disabled. */
156         SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
157
158         /* see err field in SecureSaveInfo */
159         SS_ERR_OPEN_READ,
160         SS_ERR_OPEN_WRITE,
161         SS_ERR_STAT,
162         SS_ERR_ACCESS,
163         SS_ERR_MKSTEMP,
164         SS_ERR_RENAME,
165         SS_ERR_OTHER,
166 } SecureSaveErrno;
167
168 typedef enum {
169         NOTIFY_PRIORITY_HIGH = 0,
170         NOTIFY_PRIORITY_MEDIUM,
171         NOTIFY_PRIORITY_LOW
172 } NotifyPriority;
173
174 typedef enum {
175         NOTIFY_MARKS            = 1 << 1, /* changed marks */
176         NOTIFY_PIXBUF           = 1 << 2, /* image was read into fd->pixbuf */
177         NOTIFY_HISTMAP          = 1 << 3, /* histmap was read into fd->histmap */
178         NOTIFY_ORIENTATION      = 1 << 4, /* image was rotated */
179         NOTIFY_METADATA         = 1 << 5, /* changed image metadata, not yet written */
180         NOTIFY_GROUPING         = 1 << 6, /* change in fd->sidecar_files or fd->parent */
181         NOTIFY_REREAD           = 1 << 7, /* changed file size, date, etc., file name remains unchanged */
182         NOTIFY_CHANGE           = 1 << 8  /* generic change described by fd->change */
183 } NotifyType;
184
185 typedef enum {
186         CHANGE_OK                      = 0,
187         CHANGE_WARN_DEST_EXISTS        = 1 << 0,
188         CHANGE_WARN_NO_WRITE_PERM      = 1 << 1,
189         CHANGE_WARN_SAME               = 1 << 2,
190         CHANGE_WARN_CHANGED_EXT        = 1 << 3,
191         CHANGE_WARN_UNSAVED_META       = 1 << 4,
192         CHANGE_WARN_NO_WRITE_PERM_DEST_DIR  = 1 << 5,
193         CHANGE_ERROR_MASK              = (~0U) << 8, /* the values below are fatal errors */
194         CHANGE_NO_READ_PERM            = 1 << 8,
195         CHANGE_NO_WRITE_PERM_DIR       = 1 << 9,
196         CHANGE_NO_DEST_DIR             = 1 << 10,
197         CHANGE_DUPLICATE_DEST          = 1 << 11,
198         CHANGE_NO_WRITE_PERM_DEST      = 1 << 12,
199         CHANGE_DEST_EXISTS             = 1 << 13,
200         CHANGE_NO_SRC                  = 1 << 14,
201         CHANGE_GENERIC_ERROR           = 1 << 16
202 } ChangeError;
203
204 typedef enum {
205         METADATA_PLAIN          = 0, /* format that can be edited and written back */
206         METADATA_FORMATTED      = 1  /* for display only */
207 } MetadataFormat;
208
209 typedef enum {
210         STARTUP_PATH_CURRENT    = 0,
211         STARTUP_PATH_LAST,
212         STARTUP_PATH_HOME,
213 } StartUpPath;
214
215 typedef enum {
216         TOOLBAR_MAIN,
217         TOOLBAR_STATUS,
218         TOOLBAR_COUNT
219 } ToolbarType;
220
221 typedef enum {
222         PR_STEREO_NONE             = 0,   /* do nothing */
223         PR_STEREO_DUAL             = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
224         PR_STEREO_FIXED            = 1 << 1,  /* custom position */
225         PR_STEREO_HORIZ            = 1 << 2,  /* side by side */
226         PR_STEREO_VERT             = 1 << 3,  /* above below */
227         PR_STEREO_RIGHT            = 1 << 4,  /* render right buffer */
228         PR_STEREO_ANAGLYPH_RC      = 1 << 5,  /* anaglyph red-cyan */
229         PR_STEREO_ANAGLYPH_GM      = 1 << 6,  /* anaglyph green-magenta */
230         PR_STEREO_ANAGLYPH_YB      = 1 << 7,  /* anaglyph yellow-blue */
231         PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8,  /* anaglyph gray red-cyan*/
232         PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9,  /* anaglyph gray green-magenta */
233         PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /* anaglyph gray yellow-blue */
234         PR_STEREO_ANAGLYPH_DB_RC   = 1 << 11, /* anaglyph dubois red-cyan */
235         PR_STEREO_ANAGLYPH_DB_GM   = 1 << 12, /* anaglyph dubois green-magenta */
236         PR_STEREO_ANAGLYPH_DB_YB   = 1 << 13, /* anaglyph dubois yellow-blue */
237         PR_STEREO_ANAGLYPH         = PR_STEREO_ANAGLYPH_RC |
238                                      PR_STEREO_ANAGLYPH_GM |
239                                      PR_STEREO_ANAGLYPH_YB |
240                                      PR_STEREO_ANAGLYPH_GRAY_RC |
241                                      PR_STEREO_ANAGLYPH_GRAY_GM |
242                                      PR_STEREO_ANAGLYPH_GRAY_YB |
243                                      PR_STEREO_ANAGLYPH_DB_RC |
244                                      PR_STEREO_ANAGLYPH_DB_GM |
245                                      PR_STEREO_ANAGLYPH_DB_YB, /* anaglyph mask */
246
247         PR_STEREO_MIRROR_LEFT      = 1 << 14, /* mirror */
248         PR_STEREO_FLIP_LEFT        = 1 << 15, /* flip */
249
250         PR_STEREO_MIRROR_RIGHT     = 1 << 16, /* mirror */
251         PR_STEREO_FLIP_RIGHT       = 1 << 17, /* flip */
252
253         PR_STEREO_MIRROR           = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/
254         PR_STEREO_FLIP             = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
255         PR_STEREO_SWAP             = 1 << 18,  /* swap left and right buffers */
256         PR_STEREO_TEMP_DISABLE     = 1 << 19,  /* temporarily disable stereo mode if source image is not stereo */
257         PR_STEREO_HALF             = 1 << 20
258 } PixbufRendererStereoMode;
259
260 typedef enum {
261         STEREO_PIXBUF_DEFAULT  = 0,
262         STEREO_PIXBUF_SBS      = 1,
263         STEREO_PIXBUF_CROSS    = 2,
264         STEREO_PIXBUF_NONE     = 3
265 } StereoPixbufData;
266
267 #define MAX_SPLIT_IMAGES 4
268
269 typedef enum {
270         SELECTION_NONE          = 0,
271         SELECTION_SELECTED      = 1 << 0,
272         SELECTION_PRELIGHT      = 1 << 1,
273         SELECTION_FOCUS         = 1 << 2
274 } SelectionType;
275
276 typedef struct _ImageLoader ImageLoader;
277 typedef struct _ThumbLoader ThumbLoader;
278
279 typedef struct _AnimationData AnimationData;
280
281 typedef struct _CollectInfo CollectInfo;
282 typedef struct _CollectionData CollectionData;
283 typedef struct _CollectTable CollectTable;
284 typedef struct _CollectWindow CollectWindow;
285
286 typedef struct _ImageWindow ImageWindow;
287
288 typedef struct _FileData FileData;
289 typedef struct _FileDataChangeInfo FileDataChangeInfo;
290
291 typedef struct _LayoutWindow LayoutWindow;
292 typedef struct _LayoutOptions LayoutOptions;
293
294 typedef struct _ViewDir ViewDir;
295 typedef struct _ViewDirInfoList ViewDirInfoList;
296 typedef struct _ViewDirInfoTree ViewDirInfoTree;
297
298 typedef struct _ViewFile ViewFile;
299 typedef struct _ViewFileInfoList ViewFileInfoList;
300 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
301
302 typedef struct _SlideShowData SlideShowData;
303 typedef struct _FullScreenData FullScreenData;
304
305 typedef struct _PixmapFolders PixmapFolders;
306 typedef struct _Histogram Histogram;
307 typedef struct _HistMap HistMap;
308
309 typedef struct _SecureSaveInfo SecureSaveInfo;
310
311 typedef struct _ExifData ExifData;
312
313 typedef struct _EditorDescription EditorDescription;
314
315 typedef struct _CommandLine CommandLine;
316
317 struct _Histogram {
318         gint histogram_channel; /* drawing mode for histogram */
319         gint histogram_mode;     /* logarithmical or not */
320         guint vgrid; /* number of vertical divisions, 0 for none */
321         guint hgrid; /* number of horizontal divisions, 0 for none */
322         struct {
323                 int R; /* red */
324                 int G; /* green */
325                 int B; /* blue */
326                 int A; /* alpha */
327         } grid_color;  /* grid color */
328
329 };
330
331
332
333 struct _ImageLoader;
334
335 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
336
337 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
338
339 struct _ThumbLoader
340 {
341         gboolean standard_loader;
342
343         ImageLoader *il;
344         FileData *fd;           /* fd->pixbuf contains final (scaled) image when done */
345
346         gboolean cache_enable;
347         gboolean cache_hit;
348         gdouble percent_done;
349
350         gint max_w;
351         gint max_h;
352
353         ThumbLoaderFunc func_done;
354         ThumbLoaderFunc func_error;
355         ThumbLoaderFunc func_progress;
356
357         gpointer data;
358
359         guint idle_done_id; /* event source id */
360 };
361
362 struct _AnimationData
363 {
364         ImageWindow *iw;
365         LayoutWindow *lw;
366         GdkPixbufAnimation *gpa;
367         GdkPixbufAnimationIter *iter;
368         GdkPixbuf *gpb;
369         FileData *data_adr;
370         guint delay;
371         gboolean valid;
372         GCancellable *cancellable;
373         GFile *in_file;
374         GFileInputStream *gfstream;
375 };
376
377 struct _CollectInfo
378 {
379         FileData *fd;
380         GdkPixbuf *pixbuf;
381         guint flag_mask;
382 };
383
384 struct _CollectionData
385 {
386         gchar *path;
387         gchar *name;
388         GList *list;
389         SortType sort_method;
390
391         ThumbLoader *thumb_loader;
392         CollectInfo *thumb_info;
393
394         void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
395         gpointer info_updated_data;
396
397         gint ref;
398
399         /* geometry */
400         gint window_read;
401         gint window_x;
402         gint window_y;
403         gint window_w;
404         gint window_h;
405
406         /* contents changed since save flag */
407         gboolean changed;
408
409         GHashTable *existence;
410 };
411
412 struct _CollectTable
413 {
414         GtkWidget *scrolled;
415         GtkWidget *listview;
416         gint columns;
417         gint rows;
418
419         CollectionData *cd;
420
421         GList *selection;
422         CollectInfo *prev_selection;
423
424         CollectInfo *click_info;
425
426         GtkWidget *tip_window;
427         guint tip_delay_id; /* event source id */
428         CollectInfo *tip_info;
429
430         GdkWindow *marker_window;
431         CollectInfo *marker_info;
432
433         GtkWidget *status_label;
434         GtkWidget *extra_label;
435
436         gint focus_row;
437         gint focus_column;
438         CollectInfo *focus_info;
439
440         GtkWidget *popup;
441         CollectInfo *drop_info;
442         GList *drop_list;
443
444         guint sync_idle_id; /* event source id */
445         guint drop_idle_id; /* event source id */
446
447         gboolean show_text;
448         gboolean show_stars;
449
450         /* file list for edit menu */
451         GList *editmenu_fd_list;
452 };
453
454 struct _CollectWindow
455 {
456         GtkWidget *window;
457         CollectTable *table;
458         GtkWidget *status_box;
459
460         GtkWidget *close_dialog;
461
462         CollectionData *cd;
463 };
464
465 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
466                                       gint width, gint height, GdkPixbuf *pixbuf, gpointer);
467 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
468                                       gint width, gint height, GdkPixbuf *pixbuf, gpointer);
469
470 struct _ImageWindow
471 {
472         GtkWidget *widget;      /* use this to add it and show it */
473         GtkWidget *pr;
474         GtkWidget *frame;
475
476         FileData *image_fd;
477
478         gboolean unknown;               /* failed to load image */
479
480         ImageLoader *il;        /* FIXME - image loader should probably go to FileData, but it must first support
481                                    sending callbacks to multiple ImageWindows in parallel */
482
483         gint has_frame;  /* not boolean, see image_new() */
484
485         /* top level (not necessarily parent) window */
486         gboolean top_window_sync;       /* resize top_window when image dimensions change */
487         GtkWidget *top_window;  /* window that gets title, and window to resize when 'fitting' */
488         gchar *title;           /* window title to display left of file name */
489         gchar *title_right;     /* window title to display right of file name */
490         gboolean title_show_zoom;       /* option to include zoom in window title */
491
492         gboolean completed;
493         ImageState state;       /* mask of IMAGE_STATE_* flags about current image */
494
495         void (*func_update)(ImageWindow *imd, gpointer data);
496         void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
497         void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
498         ImageTileRequestFunc func_tile_request;
499         ImageTileDisposeFunc func_tile_dispose;
500
501         gpointer data_update;
502         gpointer data_complete;
503         gpointer data_state;
504         gpointer data_tile;
505
506         /* button, scroll functions */
507         void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
508         void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
509         void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
510         void (*func_focus_in)(ImageWindow *, gpointer);
511
512         gpointer data_button;
513         gpointer data_drag;
514         gpointer data_scroll;
515         gpointer data_focus_in;
516
517         /* scroll notification (for scroll bar implementation) */
518         void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
519
520         gpointer data_scroll_notify;
521
522         /* collection info */
523         CollectionData *collection;
524         CollectInfo *collection_info;
525
526         /* color profiles */
527         gboolean color_profile_enable;
528         gint color_profile_input;
529         gboolean color_profile_use_image;
530         gint color_profile_from_image;
531         gpointer cm;
532
533         AlterType delay_alter_type;
534
535         FileData *read_ahead_fd;
536         ImageLoader *read_ahead_il;
537
538         gint prev_color_row;
539
540         gboolean auto_refresh;
541
542         gboolean delay_flip;
543         gint orientation;
544         gboolean desaturate;
545         gint user_stereo;
546
547         gboolean mouse_wheel_mode;
548 };
549
550 #define FILEDATA_MARKS_SIZE 10
551
552 struct _FileDataChangeInfo {
553         FileDataChangeType type;
554         gchar *source;
555         gchar *dest;
556         gint error;
557         gboolean regroup_when_finished;
558 };
559
560 struct _FileData {
561         guint magick;
562         gint type;
563         gchar *original_path; /* key to file_data_pool hash table */
564         gchar *path;
565         const gchar *name;
566         const gchar *extension;
567         gchar *extended_extension;
568         FileFormatClass format_class;
569         gchar *collate_key_name;
570         gchar *collate_key_name_nocase;
571         gint64 size;
572         time_t date;
573         time_t cdate;
574         mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
575         gint sidecar_priority;
576
577         guint marks; /* each bit represents one mark */
578         guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
579
580
581         GList *sidecar_files;
582         FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
583         FileDataChangeInfo *change; /* for rename, move ... */
584         GdkPixbuf *thumb_pixbuf;
585
586         GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
587                               all FileData with non-NULL pixbuf are referenced by image_cache */
588
589         HistMap *histmap;
590
591         gboolean locked;
592         gint ref;
593         gint version; /* increased when any field in this structure is changed */
594         gboolean disable_grouping;
595
596         gint user_orientation;
597         gint exif_orientation;
598
599         ExifData *exif;
600         time_t exifdate;
601         time_t exifdate_digitized;
602         GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
603         GList *cached_metadata;
604         gint rating;
605         gboolean metadata_in_idle_loaded;
606
607         gchar *owner;
608         gchar *group;
609         gchar *sym_link;
610
611         SelectionType selected;  // Used by view_file_icon.
612 };
613
614 struct _LayoutOptions
615 {
616         gchar *id;
617
618         gchar *order;
619         gint style;
620
621         DirViewType dir_view_type;
622         FileViewType file_view_type;
623
624         gboolean show_thumbnails;
625         gboolean show_marks;
626         gboolean show_file_filter;
627         gboolean show_directory_date;
628         gboolean show_info_pixel;
629
630         struct {
631                 gint w;
632                 gint h;
633                 gint x;
634                 gint y;
635                 gboolean maximized;
636                 gint hdivider_pos;
637                 gint vdivider_pos;
638         } main_window;
639
640         struct {
641                 gint w;
642                 gint h;
643                 gint x;
644                 gint y;
645                 gint vdivider_pos;
646         } float_window;
647
648         struct {
649                 gint vdivider_pos;
650         } folder_window;
651
652         struct {
653                 gint w;
654                 gint h;
655         } properties_window;
656
657         struct {
658                 guint state;
659                 gint histogram_channel;
660                 gint histogram_mode;
661         } image_overlay;
662
663         struct {
664                 gint w;
665                 gint h;
666                 gint x;
667                 gint y;
668         } log_window;
669
670         gboolean tools_float;
671         gboolean tools_hidden;
672         gboolean toolbar_hidden;
673
674         struct {
675                 gboolean info;
676                 gboolean sort;
677                 gboolean tools_float;
678                 gboolean tools_hidden;
679                 gboolean hidden;
680         } bars_state;
681
682         gchar *home_path;
683         gchar *last_path;
684
685         StartUpPath startup_path;
686
687         gboolean exit_on_close;
688
689         gboolean animate;
690 };
691
692 struct _LayoutWindow
693 {
694         LayoutOptions options;
695
696         FileData *dir_fd;
697
698         /* base */
699
700         GtkWidget *window;
701
702         GtkWidget *main_box;
703
704         GtkWidget *group_box;
705         GtkWidget *h_pane;
706         GtkWidget *v_pane;
707
708         /* menus, path selector */
709
710         GtkActionGroup *action_group;
711         GtkActionGroup *action_group_editors;
712         guint ui_editors_id;
713         GtkUIManager *ui_manager;
714         guint toolbar_merge_id[TOOLBAR_COUNT];
715         GList *toolbar_actions[TOOLBAR_COUNT];
716
717         GtkWidget *path_entry;
718
719         /* image */
720
721         LayoutLocation image_location;
722
723         ImageWindow *image;
724
725         ImageWindow *split_images[MAX_SPLIT_IMAGES];
726         ImageSplitMode split_mode;
727         gint active_split_image;
728
729         GtkWidget *split_image_widget;
730         GtkSizeGroup *split_image_sizegroup;
731
732         /* tools window (float) */
733
734         GtkWidget *tools;
735         GtkWidget *tools_pane;
736
737 //      gint tools_float;
738 //      gint tools_hidden;
739         GtkWidget *menu_tool_bar; /*Combined menu and toolbar box */
740         GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
741         /* toolbar */
742
743         GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
744 //      gint toolbar_hidden;
745
746 //      GtkWidget *thumb_button;
747 //      gint thumbs_enabled;
748 //      gint marks_enabled;
749
750         GtkWidget *back_button;
751
752         /* dir view */
753
754         LayoutLocation dir_location;
755
756         ViewDir *vd;
757         GtkWidget *dir_view;
758
759 //      DirViewType dir_view_type;
760
761         /* file view */
762
763         LayoutLocation file_location;
764
765         ViewFile *vf;
766 //      FileViewType file_view_type;
767
768         GtkWidget *file_view;
769
770         SortType sort_method;
771         gboolean sort_ascend;
772
773         /* status bar */
774
775         GtkWidget *info_box;
776         GtkWidget *info_progress_bar;
777         GtkWidget *info_sort;
778         GtkWidget *info_status;
779         GtkWidget *info_details;
780         GtkWidget *info_zoom;
781         GtkWidget *info_pixel;
782
783         /* slide show */
784
785         SlideShowData *slideshow;
786
787         /* full screen */
788
789         FullScreenData *full_screen;
790
791         /* dividers */
792
793 //      gint div_h;
794 //      gint div_v;
795 //      gint div_float;
796
797         /* misc */
798
799         GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
800         GtkWidget *utility_paned; /* between image and bar */
801         GtkWidget *bar_sort;
802         GtkWidget *bar;
803
804         gboolean bar_sort_enabled; /* Set during start-up, and checked when the editors have loaded */
805 //      gint bar_enabled;
806
807 //      gint bar_width;
808
809         GtkWidget *exif_window;
810
811         AnimationData *animation;
812
813         GtkWidget *log_window;
814 };
815
816 struct _ViewDir
817 {
818         DirViewType type;
819         gpointer info;
820
821         GtkWidget *widget;
822         GtkWidget *view;
823
824         FileData *dir_fd;
825
826         FileData *click_fd;
827
828         FileData *drop_fd;
829         GList *drop_list;
830         guint drop_scroll_id; /* event source id */
831
832         /* func list */
833         void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
834         gpointer select_data;
835
836         void (*dnd_drop_update_func)(ViewDir *vd);
837         void (*dnd_drop_leave_func)(ViewDir *vd);
838
839         LayoutWindow *layout;
840
841         GtkWidget *popup;
842
843         PixmapFolders *pf;
844 };
845
846 struct _ViewDirInfoList
847 {
848         GList *list;
849 };
850
851 struct _ViewDirInfoTree
852 {
853         guint drop_expand_id; /* event source id */
854         gint busy_ref;
855 };
856
857
858 struct _ViewFile
859 {
860         FileViewType type;
861         // TODO(xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h).
862         gpointer info;
863
864         GtkWidget *widget;
865         GtkWidget *listview;
866         GtkWidget *scrolled;
867         GtkWidget *filter;
868         GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
869
870         struct {
871                 GtkWidget *combo;
872                 GtkWidget *frame;
873                 gint count;
874                 gint last_selected;
875         } file_filter;
876
877         FileData *dir_fd;
878         GList *list;
879
880         SortType sort_method;
881         gboolean sort_ascend;
882
883         /* func list */
884         void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
885         gpointer data_thumb_status;
886
887         void (*func_status)(ViewFile *vf, gpointer data);
888         gpointer data_status;
889
890         LayoutWindow *layout;
891
892         GtkWidget *popup;
893
894         /* thumbs updates*/
895         gboolean thumbs_running;
896         ThumbLoader *thumbs_loader;
897         FileData *thumbs_filedata;
898
899         /* marks */
900         gboolean marks_enabled;
901         gint active_mark;
902         gint clicked_mark;
903
904         /* refresh */
905         guint refresh_idle_id; /* event source id */
906         time_t time_refresh_set; /* time when refresh_idle_id was set */
907
908         /* file list for edit menu */
909         GList *editmenu_fd_list;
910
911         guint read_metadata_in_idle_id;
912 };
913
914 struct _ViewFileInfoList
915 {
916         FileData *click_fd;
917         FileData *select_fd;
918
919         gboolean thumbs_enabled;
920
921         guint select_idle_id; /* event source id */
922 };
923
924 struct _ViewFileInfoIcon
925 {
926         /* table stuff */
927         gint columns;
928         gint rows;
929
930         GList *selection;
931         FileData *prev_selection;
932
933         GtkWidget *tip_window;
934         guint tip_delay_id; /* event source id */
935         FileData *tip_fd;
936
937         FileData *click_fd;
938
939         FileData *focus_fd;
940         gint focus_row;
941         gint focus_column;
942
943         gboolean show_text;
944 };
945
946 struct _SlideShowData
947 {
948         LayoutWindow *lw;        /* use this window to display the slideshow */
949         ImageWindow *imd;        /* use this window only if lw is not available,
950                                     FIXME: it is probably required only by img-view.c and should be dropped with it */
951
952         GList *filelist;
953         CollectionData *cd;
954         FileData *dir_fd;
955
956         GList *list;
957         GList *list_done;
958
959         FileData *slide_fd;
960
961         guint slide_count;
962         guint timeout_id; /* event source id */
963
964         gboolean from_selection;
965
966         void (*stop_func)(SlideShowData *, gpointer);
967         gpointer stop_data;
968
969         gboolean paused;
970 };
971
972 struct _FullScreenData
973 {
974         GtkWidget *window;
975         ImageWindow *imd;
976
977         GtkWidget *normal_window;
978         ImageWindow *normal_imd;
979
980         guint hide_mouse_id; /* event source id */
981         guint busy_mouse_id; /* event source id */
982
983         gint cursor_state;
984
985         guint saver_block_id; /* event source id */
986
987         void (*stop_func)(FullScreenData *, gpointer);
988         gpointer stop_data;
989
990         gboolean same_region; /* the returned region will overlap the current location of widget. */
991 };
992
993 struct _PixmapFolders
994 {
995         GdkPixbuf *close;
996         GdkPixbuf *open;
997         GdkPixbuf *deny;
998         GdkPixbuf *parent;
999         GdkPixbuf *link;
1000 };
1001
1002 struct _SecureSaveInfo {
1003         FILE *fp; /**< file stream pointer */
1004         gchar *file_name; /**< final file name */
1005         gchar *tmp_file_name; /**< temporary file name */
1006         gint err; /**< set to non-zero value in case of error */
1007         gboolean secure_save; /**< use secure save for this file, internal use only */
1008         gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1009         gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1010         gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1011 };
1012
1013 struct _CommandLine
1014 {
1015         int argc;
1016         gchar **argv;
1017         gboolean startup_blank;
1018         gboolean startup_full_screen;
1019         gboolean startup_in_slideshow;
1020         gboolean startup_command_line_collection;
1021         gboolean tools_hide;
1022         gboolean tools_show;
1023         gboolean log_window_show;
1024         gchar *path;
1025         gchar *file;
1026         GList *cmd_list;
1027         GList *collection_list;
1028         gchar *geometry;
1029         gchar *regexp;
1030         gchar *log_file;
1031         SecureSaveInfo *ssi;
1032 };
1033
1034 #endif
1035 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */