Ref #820: Problem with window in the current build
[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         gboolean split_pane_sync;
666         gboolean ignore_alpha;
667
668         struct {
669                 gint w;
670                 gint h;
671                 gint x;
672                 gint y;
673                 gboolean maximized;
674                 gint hdivider_pos;
675                 gint vdivider_pos;
676         } main_window;
677
678         struct {
679                 gint w;
680                 gint h;
681                 gint x;
682                 gint y;
683                 gint vdivider_pos;
684         } float_window;
685
686         struct {
687                 gint vdivider_pos;
688         } folder_window;
689
690         struct {
691                 gint w;
692                 gint h;
693         } properties_window;
694
695         struct {
696                 guint state;
697                 gint histogram_channel;
698                 gint histogram_mode;
699         } image_overlay;
700
701         struct {
702                 gint w;
703                 gint h;
704                 gint x;
705                 gint y;
706         } log_window;
707
708         struct {
709                 gint w;
710                 gint h;
711                 gint x;
712                 gint y;
713         } search_window;
714
715         struct {
716                 gint w;
717                 gint h;
718                 gint x;
719                 gint y;
720         } dupe_window;
721
722         gboolean tools_float;
723         gboolean tools_hidden;
724         gboolean toolbar_hidden;
725
726         struct {
727                 gboolean info;
728                 gboolean sort;
729                 gboolean tools_float;
730                 gboolean tools_hidden;
731                 gboolean hidden;
732         } bars_state;
733
734         gchar *home_path;
735         gchar *last_path;
736
737         StartUpPath startup_path;
738
739         gboolean animate;
740         gint workspace;
741
742         SortActionType action;
743         SortModeType mode;
744         SortSelectionType selection;
745         gchar *filter_key;
746 };
747
748 struct _LayoutWindow
749 {
750         LayoutOptions options;
751
752         FileData *dir_fd;
753
754         /* base */
755
756         GtkWidget *window;
757
758         GtkWidget *main_box;
759
760         GtkWidget *group_box;
761         GtkWidget *h_pane;
762         GtkWidget *v_pane;
763
764         /* menus, path selector */
765
766         GtkActionGroup *action_group;
767         GtkActionGroup *action_group_editors;
768         guint ui_editors_id;
769         GtkUIManager *ui_manager;
770         guint toolbar_merge_id[TOOLBAR_COUNT];
771         GList *toolbar_actions[TOOLBAR_COUNT];
772
773         GtkWidget *path_entry;
774
775         /* image */
776
777         LayoutLocation image_location;
778
779         ImageWindow *image;
780
781         ImageWindow *split_images[MAX_SPLIT_IMAGES];
782         ImageSplitMode split_mode;
783         gint active_split_image;
784
785         GtkWidget *split_image_widget;
786         GtkSizeGroup *split_image_sizegroup;
787
788         /* tools window (float) */
789
790         GtkWidget *tools;
791         GtkWidget *tools_pane;
792
793 //      gint tools_float;
794 //      gint tools_hidden;
795         GtkWidget *menu_tool_bar; /*Combined menu and toolbar box */
796         GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
797         /* toolbar */
798
799         GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
800 //      gint toolbar_hidden;
801
802 //      GtkWidget *thumb_button;
803 //      gint thumbs_enabled;
804 //      gint marks_enabled;
805
806         GtkWidget *back_button;
807
808         /* dir view */
809
810         LayoutLocation dir_location;
811
812         ViewDir *vd;
813         GtkWidget *dir_view;
814
815 //      DirViewType dir_view_type;
816
817         /* file view */
818
819         LayoutLocation file_location;
820
821         ViewFile *vf;
822 //      FileViewType file_view_type;
823
824         GtkWidget *file_view;
825
826         SortType sort_method;
827         gboolean sort_ascend;
828
829         /* status bar */
830
831         GtkWidget *info_box;
832         GtkWidget *info_progress_bar;
833         GtkWidget *info_sort;
834         GtkWidget *info_status;
835         GtkWidget *info_details;
836         GtkWidget *info_zoom;
837         GtkWidget *info_pixel;
838
839         /* slide show */
840
841         SlideShowData *slideshow;
842
843         /* full screen */
844
845         FullScreenData *full_screen;
846
847         /* dividers */
848
849 //      gint div_h;
850 //      gint div_v;
851 //      gint div_float;
852
853         /* misc */
854
855         GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
856         GtkWidget *utility_paned; /* between image and bar */
857         GtkWidget *bar_sort;
858         GtkWidget *bar;
859
860         gboolean bar_sort_enabled; /* Set during start-up, and checked when the editors have loaded */
861 //      gint bar_enabled;
862
863 //      gint bar_width;
864
865         GtkWidget *exif_window;
866         GtkWidget *sar_window; /* Search and Run window */
867
868         AnimationData *animation;
869
870         GtkWidget *log_window;
871 };
872
873 struct _ViewDir
874 {
875         DirViewType type;
876         gpointer info;
877
878         GtkWidget *widget;
879         GtkWidget *view;
880
881         FileData *dir_fd;
882
883         FileData *click_fd;
884
885         FileData *drop_fd;
886         GList *drop_list;
887         guint drop_scroll_id; /* event source id */
888
889         /* func list */
890         void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
891         gpointer select_data;
892
893         void (*dnd_drop_update_func)(ViewDir *vd);
894         void (*dnd_drop_leave_func)(ViewDir *vd);
895
896         LayoutWindow *layout;
897
898         GtkWidget *popup;
899
900         PixmapFolders *pf;
901 };
902
903 struct _ViewDirInfoList
904 {
905         GList *list;
906 };
907
908 struct _ViewDirInfoTree
909 {
910         guint drop_expand_id; /* event source id */
911         gint busy_ref;
912 };
913
914
915 struct _ViewFile
916 {
917         FileViewType type;
918         // TODO(xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h).
919         gpointer info;
920
921         GtkWidget *widget;
922         GtkWidget *listview;
923         GtkWidget *scrolled;
924         GtkWidget *filter;
925         GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
926
927         struct {
928                 GtkWidget *combo;
929                 GtkWidget *frame;
930                 gint count;
931                 gint last_selected;
932                 gboolean case_sensitive;
933         } file_filter;
934
935         FileData *dir_fd;
936         GList *list;
937
938         SortType sort_method;
939         gboolean sort_ascend;
940
941         /* func list */
942         void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
943         gpointer data_thumb_status;
944
945         void (*func_status)(ViewFile *vf, gpointer data);
946         gpointer data_status;
947
948         LayoutWindow *layout;
949
950         GtkWidget *popup;
951
952         /* thumbs updates*/
953         gboolean thumbs_running;
954         ThumbLoader *thumbs_loader;
955         FileData *thumbs_filedata;
956
957         /* marks */
958         gboolean marks_enabled;
959         gint active_mark;
960         gint clicked_mark;
961
962         /* stars */
963         FileData *stars_filedata;
964         guint stars_id;
965
966         /* refresh */
967         guint refresh_idle_id; /* event source id */
968         time_t time_refresh_set; /* time when refresh_idle_id was set */
969
970         /* file list for edit menu */
971         GList *editmenu_fd_list;
972
973         guint read_metadata_in_idle_id;
974 };
975
976 struct _ViewFileInfoList
977 {
978         FileData *click_fd;
979         FileData *select_fd;
980
981         gboolean thumbs_enabled;
982
983         guint select_idle_id; /* event source id */
984 };
985
986 struct _ViewFileInfoIcon
987 {
988         /* table stuff */
989         gint columns;
990         gint rows;
991
992         GList *selection;
993         FileData *prev_selection;
994
995         GtkWidget *tip_window;
996         guint tip_delay_id; /* event source id */
997         FileData *tip_fd;
998
999         FileData *click_fd;
1000
1001         FileData *focus_fd;
1002         gint focus_row;
1003         gint focus_column;
1004
1005         gboolean show_text;
1006 };
1007
1008 struct _SlideShowData
1009 {
1010         LayoutWindow *lw;        /* use this window to display the slideshow */
1011         ImageWindow *imd;        /* use this window only if lw is not available,
1012                                     FIXME: it is probably required only by img-view.c and should be dropped with it */
1013
1014         GList *filelist;
1015         CollectionData *cd;
1016         FileData *dir_fd;
1017
1018         GList *list;
1019         GList *list_done;
1020
1021         FileData *slide_fd;
1022
1023         guint slide_count;
1024         guint timeout_id; /* event source id */
1025
1026         gboolean from_selection;
1027
1028         void (*stop_func)(SlideShowData *, gpointer);
1029         gpointer stop_data;
1030
1031         gboolean paused;
1032 };
1033
1034 struct _FullScreenData
1035 {
1036         GtkWidget *window;
1037         ImageWindow *imd;
1038
1039         GtkWidget *normal_window;
1040         ImageWindow *normal_imd;
1041
1042         guint hide_mouse_id; /* event source id */
1043         guint busy_mouse_id; /* event source id */
1044
1045         gint cursor_state;
1046
1047         guint saver_block_id; /* event source id */
1048
1049         void (*stop_func)(FullScreenData *, gpointer);
1050         gpointer stop_data;
1051
1052         gboolean same_region; /* the returned region will overlap the current location of widget. */
1053 };
1054
1055 struct _PixmapFolders
1056 {
1057         GdkPixbuf *close;
1058         GdkPixbuf *open;
1059         GdkPixbuf *deny;
1060         GdkPixbuf *parent;
1061         GdkPixbuf *link;
1062 };
1063
1064 struct _SecureSaveInfo {
1065         FILE *fp; /**< file stream pointer */
1066         gchar *file_name; /**< final file name */
1067         gchar *tmp_file_name; /**< temporary file name */
1068         gint err; /**< set to non-zero value in case of error */
1069         gboolean secure_save; /**< use secure save for this file, internal use only */
1070         gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1071         gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1072         gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1073 };
1074
1075 struct _CommandLine
1076 {
1077         int argc;
1078         gchar **argv;
1079         gboolean startup_blank;
1080         gboolean startup_full_screen;
1081         gboolean startup_in_slideshow;
1082         gboolean startup_command_line_collection;
1083         gboolean tools_hide;
1084         gboolean tools_show;
1085         gboolean log_window_show;
1086         gchar *path;
1087         gchar *file;
1088         GList *cmd_list;
1089         GList *collection_list;
1090         gchar *geometry;
1091         gchar *regexp;
1092         gchar *log_file;
1093         SecureSaveInfo *ssi;
1094         gboolean new_instance;
1095 };
1096
1097 #endif
1098 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */