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