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