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