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