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