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