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