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