Additional debug features
[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         struct {
629                 gint w;
630                 gint h;
631                 gint x;
632                 gint y;
633                 gboolean paused;
634         } log_window;
635
636         gboolean tools_float;
637         gboolean tools_hidden;
638         gboolean toolbar_hidden;
639
640         struct {
641                 gboolean info;
642                 gboolean sort;
643                 gboolean tools_float;
644                 gboolean tools_hidden;
645                 gboolean hidden;
646         } bars_state;
647
648         gchar *home_path;
649         gchar *last_path;
650
651         StartUpPath startup_path;
652
653         gboolean exit_on_close;
654
655         gboolean animate;
656 };
657
658 struct _LayoutWindow
659 {
660         LayoutOptions options;
661
662         FileData *dir_fd;
663
664         /* base */
665
666         GtkWidget *window;
667
668         GtkWidget *main_box;
669
670         GtkWidget *group_box;
671         GtkWidget *h_pane;
672         GtkWidget *v_pane;
673
674         /* menus, path selector */
675
676         GtkActionGroup *action_group;
677         GtkActionGroup *action_group_editors;
678         guint ui_editors_id;
679         GtkUIManager *ui_manager;
680         GList *toolbar_actions[TOOLBAR_COUNT];
681
682         GtkWidget *path_entry;
683
684         /* image */
685
686         LayoutLocation image_location;
687
688         ImageWindow *image;
689
690         ImageWindow *split_images[MAX_SPLIT_IMAGES];
691         ImageSplitMode split_mode;
692         gint active_split_image;
693
694         GtkWidget *split_image_widget;
695         GtkSizeGroup *split_image_sizegroup;
696
697         /* tools window (float) */
698
699         GtkWidget *tools;
700         GtkWidget *tools_pane;
701
702 //      gint tools_float;
703 //      gint tools_hidden;
704
705         GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
706         /* toolbar */
707
708         GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
709 //      gint toolbar_hidden;
710
711 //      GtkWidget *thumb_button;
712 //      gint thumbs_enabled;
713 //      gint marks_enabled;
714
715         GtkWidget *back_button;
716
717         /* dir view */
718
719         LayoutLocation dir_location;
720
721         ViewDir *vd;
722         GtkWidget *dir_view;
723
724 //      DirViewType dir_view_type;
725
726         /* file view */
727
728         LayoutLocation file_location;
729
730         ViewFile *vf;
731 //      FileViewType file_view_type;
732
733         GtkWidget *file_view;
734
735         SortType sort_method;
736         gboolean sort_ascend;
737
738         /* status bar */
739
740         GtkWidget *info_box;
741         GtkWidget *info_progress_bar;
742         GtkWidget *info_sort;
743         GtkWidget *info_status;
744         GtkWidget *info_details;
745         GtkWidget *info_zoom;
746         GtkWidget *info_pixel;
747
748         /* slide show */
749
750         SlideShowData *slideshow;
751
752         /* full screen */
753
754         FullScreenData *full_screen;
755
756         /* dividers */
757
758 //      gint div_h;
759 //      gint div_v;
760 //      gint div_float;
761
762         /* misc */
763
764         GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
765         GtkWidget *utility_paned; /* between image and bar */
766         GtkWidget *bar_sort;
767         GtkWidget *bar;
768
769 //      gint bar_sort_enabled;
770 //      gint bar_enabled;
771
772 //      gint bar_width;
773
774         GtkWidget *exif_window;
775
776         AnimationData *animation;
777
778         GtkWidget *log_window;
779 };
780
781 struct _ViewDir
782 {
783         DirViewType type;
784         gpointer info;
785
786         GtkWidget *widget;
787         GtkWidget *view;
788
789         FileData *dir_fd;
790
791         FileData *click_fd;
792
793         FileData *drop_fd;
794         GList *drop_list;
795         guint drop_scroll_id; /* event source id */
796
797         /* func list */
798         void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
799         gpointer select_data;
800
801         void (*dnd_drop_update_func)(ViewDir *vd);
802         void (*dnd_drop_leave_func)(ViewDir *vd);
803
804         LayoutWindow *layout;
805
806         GtkWidget *popup;
807
808         PixmapFolders *pf;
809 };
810
811 struct _ViewDirInfoList
812 {
813         GList *list;
814 };
815
816 struct _ViewDirInfoTree
817 {
818         guint drop_expand_id; /* event source id */
819         gint busy_ref;
820 };
821
822
823 struct _ViewFile
824 {
825         FileViewType type;
826         gpointer info;
827
828         GtkWidget *widget;
829         GtkWidget *listview;
830         GtkWidget *scrolled;
831         GtkWidget *filter;
832         GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
833
834         FileData *dir_fd;
835         GList *list;
836
837         SortType sort_method;
838         gboolean sort_ascend;
839
840         /* func list */
841         void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
842         gpointer data_thumb_status;
843
844         void (*func_status)(ViewFile *vf, gpointer data);
845         gpointer data_status;
846
847         LayoutWindow *layout;
848
849         GtkWidget *popup;
850
851         /* thumbs updates*/
852         gboolean thumbs_running;
853         ThumbLoader *thumbs_loader;
854         FileData *thumbs_filedata;
855
856         /* marks */
857         gboolean marks_enabled;
858         gint active_mark;
859         gint clicked_mark;
860
861         /* refresh */
862         guint refresh_idle_id; /* event source id */
863         time_t time_refresh_set; /* time when refresh_idle_id was set */
864
865         /* file list for edit menu */
866         GList *editmenu_fd_list;
867 };
868
869 struct _ViewFileInfoList
870 {
871         FileData *click_fd;
872         FileData *select_fd;
873
874         gboolean thumbs_enabled;
875
876         guint select_idle_id; /* event source id */
877 };
878
879 typedef enum {
880         SELECTION_NONE          = 0,
881         SELECTION_SELECTED      = 1 << 0,
882         SELECTION_PRELIGHT      = 1 << 1,
883         SELECTION_FOCUS         = 1 << 2
884 } SelectionType;
885
886 typedef struct _IconData IconData;
887 struct _IconData
888 {
889         SelectionType selected;
890         FileData *fd;
891 };
892
893 struct _ViewFileInfoIcon
894 {
895         /* table stuff */
896         gint columns;
897         gint rows;
898
899         GList *selection;
900         struct _IconData *prev_selection;
901
902         GtkWidget *tip_window;
903         guint tip_delay_id; /* event source id */
904         struct _IconData *tip_id;
905
906         struct _IconData *click_id;
907
908         struct _IconData *focus_id;
909         gint focus_row;
910         gint focus_column;
911
912         gboolean show_text;
913 };
914
915 struct _SlideShowData
916 {
917         LayoutWindow *lw;        /* use this window to display the slideshow */
918         ImageWindow *imd;        /* use this window only if lw is not available,
919                                     FIXME: it is probably required only by img-view.c and should be dropped with it */
920
921         GList *filelist;
922         CollectionData *cd;
923         FileData *dir_fd;
924
925         GList *list;
926         GList *list_done;
927
928         FileData *slide_fd;
929
930         guint slide_count;
931         guint timeout_id; /* event source id */
932
933         gboolean from_selection;
934
935         void (*stop_func)(SlideShowData *, gpointer);
936         gpointer stop_data;
937
938         gboolean paused;
939 };
940
941 struct _FullScreenData
942 {
943         GtkWidget *window;
944         ImageWindow *imd;
945
946         GtkWidget *normal_window;
947         ImageWindow *normal_imd;
948
949         guint hide_mouse_id; /* event source id */
950         guint busy_mouse_id; /* event source id */
951
952         gint cursor_state;
953
954         guint saver_block_id; /* event source id */
955
956         void (*stop_func)(FullScreenData *, gpointer);
957         gpointer stop_data;
958
959         gboolean same_region; /* the returned region will overlap the current location of widget. */
960 };
961
962 struct _PixmapFolders
963 {
964         GdkPixbuf *close;
965         GdkPixbuf *open;
966         GdkPixbuf *deny;
967         GdkPixbuf *parent;
968 };
969
970 struct _SecureSaveInfo {
971         FILE *fp; /**< file stream pointer */
972         gchar *file_name; /**< final file name */
973         gchar *tmp_file_name; /**< temporary file name */
974         gint err; /**< set to non-zero value in case of error */
975         gboolean secure_save; /**< use secure save for this file, internal use only */
976         gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
977         gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
978         gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
979 };
980
981 struct _CommandLine
982 {
983         int argc;
984         gchar **argv;
985         gboolean startup_blank;
986         gboolean startup_full_screen;
987         gboolean startup_in_slideshow;
988         gboolean startup_command_line_collection;
989         gboolean tools_hide;
990         gboolean tools_show;
991         gboolean log_window_show;
992         gchar *path;
993         gchar *file;
994         GList *cmd_list;
995         GList *collection_list;
996         gchar *geometry;
997         gchar *regexp;
998         gchar *log_file;
999         SecureSaveInfo *ssi;
1000 };
1001
1002 #endif
1003 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */