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