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