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