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