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