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