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