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