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