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