##### Note: GQview CVS on sourceforge is not always up to date, please use #####
[geeqie.git] / src / typedefs.h
1 /*
2  * GQview
3  * (C) 2004 John Ellis
4  *
5  * Author: John Ellis
6  *
7  * This software is released under the GNU General Public License (GNU GPL).
8  * Please read the included file COPYING for more information.
9  * This software comes with no warranty of any kind, use at your own risk!
10  */
11
12
13 #ifndef TYPEDEFS_H
14 #define TYPEDEFS_H
15
16
17 typedef enum {
18         SORT_NONE,
19         SORT_NAME,
20         SORT_SIZE,
21         SORT_TIME,
22         SORT_PATH,
23         SORT_NUMBER
24 } SortType;
25
26 typedef enum {
27         ALTER_NONE,             /* do nothing */
28         ALTER_ROTATE_90,
29         ALTER_ROTATE_90_CC,     /* counterclockwise */
30         ALTER_ROTATE_180,
31         ALTER_MIRROR,
32         ALTER_FLIP
33 } AlterType;
34
35 typedef enum {
36         LAYOUT_HIDE   = 0,
37         LAYOUT_LEFT   = 1 << 0,
38         LAYOUT_RIGHT  = 1 << 1,
39         LAYOUT_TOP    = 1 << 2,
40         LAYOUT_BOTTOM = 1 << 3
41 } LayoutLocation;
42
43
44 typedef struct _ImageLoader ImageLoader;
45 typedef struct _ThumbLoader ThumbLoader;
46
47 typedef struct _CollectInfo CollectInfo;
48 typedef struct _CollectionData CollectionData;
49 typedef struct _CollectTable CollectTable;
50 typedef struct _CollectWindow CollectWindow;
51
52 typedef struct _ImageWindow ImageWindow;
53
54 typedef struct _FileData FileData;
55
56 typedef struct _LayoutWindow LayoutWindow;
57 typedef struct _ViewDirList ViewDirList;
58 typedef struct _ViewDirTree ViewDirTree;
59 typedef struct _ViewFileList ViewFileList;
60 typedef struct _ViewFileIcon ViewFileIcon;
61
62 typedef struct _SlideShowData SlideShowData;
63 typedef struct _FullScreenData FullScreenData;
64
65 typedef struct _PixmapFolders PixmapFolders;
66
67
68 struct _ImageLoader
69 {
70         GdkPixbuf *pixbuf;
71         gchar *path;
72
73         gint bytes_read;
74         gint bytes_total;
75
76         guint buffer_size;
77
78         gint requested_width;
79         gint requested_height;
80         gint shrunk;
81
82         gint done;
83         gint idle_id;
84         gint idle_priority;
85
86         GdkPixbufLoader *loader;
87         gint load_fd;
88
89         void (*func_area_ready)(ImageLoader *, guint x, guint y, guint w, guint h, gpointer);
90         void (*func_error)(ImageLoader *, gpointer);
91         void (*func_done)(ImageLoader *, gpointer);
92         void (*func_percent)(ImageLoader *, gdouble, gpointer);
93
94         gpointer data_area_ready;
95         gpointer data_error;
96         gpointer data_done;
97         gpointer data_percent;
98
99         gint idle_done_id;
100 };
101
102 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
103
104 struct _ThumbLoader
105 {
106         gint standard_loader;
107
108         GdkPixbuf *pixbuf;      /* contains final (scaled) image when done */
109         ImageLoader *il;
110         gchar *path;
111
112         gint cache_enable;
113         gint cache_hit;
114         gdouble percent_done;
115
116         gint max_w;
117         gint max_h;
118
119         ThumbLoaderFunc func_done;
120         ThumbLoaderFunc func_error;
121         ThumbLoaderFunc func_progress;
122
123         gpointer data;
124
125         gint idle_done_id;
126 };
127
128 struct _CollectInfo
129 {
130         gchar *path;
131         gint64 size;
132         time_t date;
133
134         GdkPixbuf *pixbuf;
135         gint flag_mask;
136 };
137
138 struct _CollectionData
139 {
140         gchar *path;
141         gchar *name;
142         GList *list;
143         SortType sort_method;
144
145         ThumbLoader *thumb_loader;
146         CollectInfo *thumb_info;
147
148         void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
149         gpointer info_updated_data;
150
151         gint ref;
152
153         /* geometry */
154         gint window_read;
155         gint window_x;
156         gint window_y;
157         gint window_w;
158         gint window_h;
159
160         /* contents changed since save flag */
161         gint changed;
162 };
163
164 struct _CollectTable
165 {
166         GtkWidget *scrolled;
167         GtkWidget *listview;
168         gint columns;
169         gint rows;
170
171         CollectionData *cd;
172
173         GList *selection;
174         CollectInfo *prev_selection;
175
176         CollectInfo *click_info;
177
178         GtkWidget *tip_window;
179         gint tip_delay_id;
180         CollectInfo *tip_info;
181
182         GdkWindow *marker_window;
183         CollectInfo *marker_info;
184
185         GtkWidget *status_label;
186         GtkWidget *extra_label;
187
188         gint focus_row;
189         gint focus_column;
190         CollectInfo *focus_info;
191
192         GtkWidget *popup;
193         CollectInfo *drop_info;
194         GList *drop_list;
195
196         gint sync_idle_id;
197         gint drop_idle_id;
198
199         gint show_text;
200 };
201
202 struct _CollectWindow
203 {
204         GtkWidget *window;
205         CollectTable *table;
206         GtkWidget *status_box;
207         GList *list;
208
209         GtkWidget *close_dialog;
210
211         CollectionData *cd;
212 };
213
214 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
215                                       gint width, gint height, GdkPixbuf *pixbuf, gpointer);
216 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
217                                       gint width, gint height, GdkPixbuf *pixbuf, gpointer);
218
219 struct _ImageWindow
220 {
221         GtkWidget *widget;      /* use this to add it and show it */
222         GtkWidget *pr;
223         GtkWidget *frame;
224
225         gchar *image_path;
226         const gchar *image_name;
227
228         gint64 size;            /* file size (bytes) */
229         time_t mtime;           /* file modified time stamp */
230         gint unknown;           /* failed to load image */
231
232         ImageLoader *il;
233
234         gint has_frame;
235
236         /* top level (not necessarily parent) window */
237         gint top_window_sync;   /* resize top_window when image dimensions change */
238         GtkWidget *top_window;  /* window that gets title, and window to resize when 'fitting' */
239         gchar *title;           /* window title to display left of file name */
240         gchar *title_right;     /* window title to display right of file name */
241         gint title_show_zoom;   /* option to include zoom in window title */
242
243         gint completed;
244
245         void (*func_update)(ImageWindow *, gpointer);
246         void (*func_complete)(ImageWindow *, gint preload, gpointer);
247         void (*func_new)(ImageWindow *, gpointer);
248         ImageTileRequestFunc func_tile_request;
249         ImageTileDisposeFunc func_tile_dispose;
250
251         gpointer data_update;
252         gpointer data_complete;
253         gpointer data_new;
254         gpointer data_tile;
255
256         /* button, scroll functions */
257         void (*func_button)(ImageWindow *, gint button,
258                             guint32 time, gdouble x, gdouble y, guint state, gpointer);
259         void (*func_scroll)(ImageWindow *, GdkScrollDirection direction,
260                             guint32 time, gdouble x, gdouble y, guint state, gpointer);
261
262         gpointer data_button;
263         gpointer data_scroll;
264
265         /* scroll notification (for scroll bar implementation) */
266         void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
267
268         gpointer data_scroll_notify;
269
270         /* collection info */
271         CollectionData *collection;
272         CollectInfo *collection_info;
273
274         AlterType delay_alter_type;
275
276         ImageLoader *read_ahead_il;
277         GdkPixbuf *read_ahead_pixbuf;
278         gchar *read_ahead_path;
279
280         GdkPixbuf *prev_pixbuf;
281         gchar *prev_path;
282
283         gint auto_refresh_id;
284         gint auto_refresh_interval;
285
286         gint delay_flip;
287 };
288
289 struct _FileData {
290         gchar *path;
291         const gchar *name;
292         gint64 size;
293         time_t date;
294
295         GdkPixbuf *pixbuf;
296 };
297
298 struct _LayoutWindow
299 {
300         gchar *path;
301
302         /* base */
303
304         GtkWidget *window;
305
306         GtkWidget *main_box;
307
308         GtkWidget *group_box;
309         GtkWidget *h_pane;
310         GtkWidget *v_pane;
311
312         GtkTooltips *tooltips;
313
314         /* menus, path selector */
315
316         GtkActionGroup *action_group;
317         GtkUIManager *ui_manager;
318
319         GtkWidget *path_entry;
320
321         /* image */
322
323         LayoutLocation image_location;
324
325         ImageWindow *image;
326
327         /* tools window (float) */
328
329         GtkWidget *tools;
330         GtkWidget *tools_pane;
331
332         gint tools_float;
333         gint tools_hidden;
334
335         /* toolbar */
336
337         GtkWidget *toolbar;
338         gint toolbar_hidden;
339
340         GtkWidget *thumb_button;
341         gint thumbs_enabled;
342
343         /* dir view */
344
345         LayoutLocation dir_location;
346
347         ViewDirList *vdl;
348         ViewDirTree *vdt;
349         GtkWidget *dir_view;
350
351         gint tree_view;
352
353         /* file view */
354
355         LayoutLocation file_location;
356
357         ViewFileList *vfl;
358         ViewFileIcon *vfi;
359         GtkWidget *file_view;
360
361         gint icon_view;
362         SortType sort_method;
363         gint sort_ascend;
364
365         /* status bar */
366
367         GtkWidget *info_box;
368         GtkWidget *info_progress_bar;
369         GtkWidget *info_sort;
370         GtkWidget *info_status;
371         GtkWidget *info_details;
372         GtkWidget *info_zoom;
373
374         /* slide show */
375
376         SlideShowData *slideshow;
377
378         /* full screen */
379
380         FullScreenData *full_screen;
381         gint full_screen_overlay_id;
382         gint full_screen_overlay_on;
383
384         /* dividers */
385
386         gint div_h;
387         gint div_v;
388         gint div_float;
389
390         /* directory update check */
391
392         gint last_time_id;
393         time_t last_time;
394
395         /* misc */
396
397         GtkWidget *utility_box;
398         GtkWidget *bar_sort;
399         GtkWidget *bar_exif;
400         GtkWidget *bar_info;
401
402         gint bar_sort_enabled;
403         gint bar_exif_enabled;
404         gint bar_info_enabled;
405
406         gint bar_exif_size;
407         gint bar_exif_advanced;
408 };
409
410 struct _ViewDirList
411 {
412         GtkWidget *widget;
413         GtkWidget *listview;
414
415         gchar *path;
416         GList *list;
417
418         FileData *click_fd;
419
420         FileData *drop_fd;
421         GList *drop_list;
422
423         gint drop_scroll_id;
424
425         /* func list */
426         void (*select_func)(ViewDirList *vdl, const gchar *path, gpointer data);
427         gpointer select_data;
428
429         LayoutWindow *layout;
430
431         GtkWidget *popup;
432
433         PixmapFolders *pf;
434 };
435
436 struct _ViewDirTree
437 {
438         GtkWidget *widget;
439         GtkWidget *treeview;
440
441         gchar *path;
442
443         FileData *click_fd;
444
445         FileData *drop_fd;
446         GList *drop_list;
447
448         gint drop_scroll_id;
449         gint drop_expand_id;
450
451         /* func list */
452         void (*select_func)(ViewDirTree *vdt, const gchar *path, gpointer data);
453         gpointer select_data;
454
455         LayoutWindow *layout;
456
457         GtkWidget *popup;
458
459         PixmapFolders *pf;
460
461         gint busy_ref;
462 };
463
464 struct _ViewFileList
465 {
466         GtkWidget *widget;
467         GtkWidget *listview;
468
469         gchar *path;
470         GList *list;
471
472         SortType sort_method;
473         gint sort_ascend;
474
475         FileData *click_fd;
476         FileData *select_fd;
477
478         gint thumbs_enabled;
479
480         /* thumb updates */
481         gint thumbs_running;
482         gint thumbs_count;
483         ThumbLoader *thumbs_loader;
484         FileData *thumbs_filedata;
485
486         /* func list */
487         void (*func_thumb_status)(ViewFileList *vfl, gdouble val, const gchar *text, gpointer data);
488         gpointer data_thumb_status;
489
490         void (*func_status)(ViewFileList *vfl, gpointer data);
491         gpointer data_status;
492
493         gint select_idle_id;
494         LayoutWindow *layout;
495
496         GtkWidget *popup;
497 };
498
499 struct _ViewFileIcon
500 {
501         GtkWidget *widget;
502         GtkWidget *listview;
503
504         gchar *path;
505         GList *list;
506
507         /* table stuff */
508
509         gint columns;
510         gint rows;
511
512         GList *selection;
513         FileData *prev_selection;
514
515         GtkWidget *tip_window;
516         gint tip_delay_id;
517         FileData *tip_fd;
518
519         FileData *click_fd;
520
521         FileData *focus_fd;
522         gint focus_row;
523         gint focus_column;
524
525         SortType sort_method;
526         gint sort_ascend;
527
528         gint show_text;
529
530         gint sync_idle_id;
531
532         /* thumbs */
533         
534         gint thumbs_running;
535         GList *thumbs_list;
536         gint thumbs_count;
537         ThumbLoader *thumbs_loader;
538         FileData *thumbs_fd;
539
540         /* func list */
541         void (*func_thumb_status)(ViewFileIcon *vfi, gdouble val, const gchar *text, gpointer data);
542         gpointer data_thumb_status;
543
544         void (*func_status)(ViewFileIcon *vfi, gpointer data);
545         gpointer data_status;
546
547         LayoutWindow *layout;
548
549         GtkWidget *popup;
550 };
551
552 struct _SlideShowData
553 {
554         ImageWindow *imd;
555
556         GList *path_list;
557         CollectionData *cd;
558         gchar *layout_path;
559         LayoutWindow *layout;
560
561         GList *list;
562         GList *list_done;
563
564         gchar *slide_path;
565
566         gint slide_count;
567         gint timeout_id;
568
569         gint from_selection;
570
571         void (*stop_func)(SlideShowData *, gpointer);
572         gpointer stop_data;
573
574         gint paused;
575 };
576
577 struct _FullScreenData
578 {
579         GtkWidget *window;
580         ImageWindow *imd;
581
582         GtkWidget *normal_window;
583         ImageWindow *normal_imd;
584
585         gint hide_mouse_id;
586         gint busy_mouse_id;
587         gint cursor_state;
588
589         gint saver_block_id;
590
591         void (*stop_func)(FullScreenData *, gpointer);
592         gpointer stop_data;
593 };
594
595 struct _PixmapFolders
596 {
597         GdkPixbuf *close;
598         GdkPixbuf *open;
599         GdkPixbuf *deny;
600         GdkPixbuf *parent;
601 };
602
603
604 #endif
605
606