annotate src/image-overlay.c @ 482:75b7154e6435

Use image_osd_toggle() in layout_menu_overlay_cb(). Drop layout_image_overlay_update().
author zas_
date Tue, 22 Apr 2008 09:01:29 +0000
parents 67a612985686
children c9e3baeda1b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 155
diff changeset
2 * Geeqie
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3 * (C) 2006 John Ellis
475
48c8e49b571c updated copyright in source files
nadvornik
parents: 469
diff changeset
4 * Copyright (C) 2008 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 275
diff changeset
13 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #include "image-overlay.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "collect.h"
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
17 #include "exif.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "filelist.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "img-view.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "layout.h"
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
22 #include "pixbuf-renderer.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "pixbuf_util.h"
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
24 #include "histogram.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 *----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 * image overlay
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 *----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
33 typedef struct _OverlayStateData OverlayStateData;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
34 struct _OverlayStateData {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 ImageWindow *imd;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
36 ImageState changed_states;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
37
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
38 gint show_info;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
39 gint show_status;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
40
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
41 gint ovl_info;
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
42
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
43 gint icon_time[IMAGE_OSD_COUNT];
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
44 gint icon_id[IMAGE_OSD_COUNT];
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
45
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 gint idle_id;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
47 gint timer_id;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 gulong destroy_id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
51
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
52 typedef struct _OSDIcon OSDIcon;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
53 struct _OSDIcon {
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
54 gint reset; /* reset on new image */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
55 gint x; /* x, y offset */
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
56 gint y;
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
57 gchar *key; /* inline pixbuf */
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
58 };
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
59
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
60 static OSDIcon osd_icons[] = {
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
61 { TRUE, 0, 0, NULL }, /* none */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
62 { TRUE, -10, -10, NULL }, /* auto rotated */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
63 { TRUE, -10, -10, NULL }, /* user rotated */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
64 { TRUE, -40, -10, NULL }, /* color embedded */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
65 { TRUE, -70, -10, NULL }, /* first image */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
66 { TRUE, -70, -10, NULL }, /* last image */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
67 { FALSE, -70, -10, NULL }, /* osd enabled */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
68 { FALSE, 0, 0, NULL }
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
69 };
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
70
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
71 #define OSD_DATA "overlay-data"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
73 #define OSD_INFO_X 10
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
74 #define OSD_INFO_Y -10
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
76 #define IMAGE_OSD_DEFAULT_DURATION 30
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
77
290
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
78 #define HISTOGRAM_HEIGHT 140
469
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
79
481
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
80 static void image_osd_timer_schedule(OverlayStateData *osd);
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
81
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
82
469
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
83 void set_default_image_overlay_template_string(ConfOptions *options)
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
84 {
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
85 if (options->image_overlay.common.template_string) g_free(options->image_overlay.common.template_string);
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
86 options->image_overlay.common.template_string = g_strdup(DEFAULT_OVERLAY_INFO);
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
87 }
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
88
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
89 /*
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
90 *----------------------------------------------------------------------------
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
91 * image histogram
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
92 *----------------------------------------------------------------------------
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
93 */
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
94
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
95
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
96 void image_osd_histogram_onoff_toggle(ImageWindow *imd, gint x)
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
97 {
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
98 imd->histogram_enabled = !!(x);
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
99 if (imd->histogram_enabled && !imd->histogram)
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
100 imd->histogram = histogram_new();
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
101 }
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
102
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
103 gint image_osd_histogram_onoff_status(ImageWindow *imd)
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
104 {
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
105 return imd->histogram_enabled;
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
106 }
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
107
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
108 void image_osd_histogram_chan_toggle(ImageWindow *imd)
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
109 {
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
110 if (imd->histogram)
482
75b7154e6435 Use image_osd_toggle() in layout_menu_overlay_cb().
zas_
parents: 481
diff changeset
111 {
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
112 histogram_set_channel(imd->histogram, (histogram_get_channel(imd->histogram) +1)%HCHAN_COUNT);
482
75b7154e6435 Use image_osd_toggle() in layout_menu_overlay_cb().
zas_
parents: 481
diff changeset
113 image_osd_update(imd);
75b7154e6435 Use image_osd_toggle() in layout_menu_overlay_cb().
zas_
parents: 481
diff changeset
114 }
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
115 }
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
116
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
117 void image_osd_histogram_log_toggle(ImageWindow *imd)
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
118 {
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
119 if (imd->histogram)
482
75b7154e6435 Use image_osd_toggle() in layout_menu_overlay_cb().
zas_
parents: 481
diff changeset
120 {
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
121 histogram_set_mode(imd->histogram, !histogram_get_mode(imd->histogram));
482
75b7154e6435 Use image_osd_toggle() in layout_menu_overlay_cb().
zas_
parents: 481
diff changeset
122 image_osd_update(imd);
75b7154e6435 Use image_osd_toggle() in layout_menu_overlay_cb().
zas_
parents: 481
diff changeset
123 }
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
124 }
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
125
481
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
126 void image_osd_toggle(ImageWindow *imd)
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
127 {
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
128 if (image_osd_get(imd, NULL, NULL))
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
129 {
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
130 if (image_osd_histogram_onoff_status(imd))
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
131 {
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
132 image_osd_histogram_onoff_toggle(imd, 0);
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
133 image_osd_update(imd);
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
134 }
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
135 else
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
136 {
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
137 image_osd_set(imd, FALSE, FALSE);
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
138 }
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
139 }
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
140 else
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
141 {
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
142 image_osd_set(imd, TRUE, TRUE);
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
143 image_osd_icon(imd, IMAGE_OSD_ICON, -1);
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
144 image_osd_histogram_onoff_toggle(imd, 1);
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
145 image_osd_update(imd);
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
146 }
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
147 }
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
148
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
149 static gchar *image_osd_mkinfo(const gchar *str, ImageWindow *imd, GHashTable *vars)
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
150 {
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
151 gchar delim = '%', imp = '|', sep[] = " - ";
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
152 gchar *start, *end;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
153 gint pos, prev;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
154 gint last;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
155 gchar *name, *data;
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
156 GString *new;
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
157 gchar *ret;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
158 ExifData *exif;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
159
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
160 if (!str || !*str) return g_strdup("");
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
161
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
162 new = g_string_new(str);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
163
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
164 exif = exif_read_fd(imd->image_fd);
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
165 prev = 0;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
166 last = FALSE;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
167
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
168 while (TRUE)
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
169 {
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
170 gint was_digit = 0;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
171 gint limit = 0;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
172 gchar *trunc = NULL;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
173 gchar *p;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
174
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
175 start = strchr(new->str, delim);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
176 if (!start)
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
177 break;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
178 end = strchr(start+1, delim);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
179 if (!end)
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
180 break;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
181
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
182 for (p = end; p > start; p--)
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
183 {
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
184 if (*p == ':' && was_digit)
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
185 {
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
186 trunc = p;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
187 break;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
188 }
299
49eaa6463492 Do not display ... if not truncated.
zas_
parents: 298
diff changeset
189 was_digit = g_ascii_isdigit(*p);
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
190 }
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
191
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
192 if (trunc) limit = atoi(trunc+1);
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
193
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
194 name = g_strndup(start+1, ((limit > 0) ? trunc : end)-start-1);
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
195
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
196 pos = start-new->str;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
197 data = g_strdup(g_hash_table_lookup(vars, name));
415
4f7362028062 Add zoom ratio display to OSD in fullscreen mode.
zas_
parents: 411
diff changeset
198 if (data && strcmp(name, "zoom") == 0) imd->overlay_show_zoom = TRUE;
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
199 if (!data && exif)
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
200 data = exif_get_data_as_text(exif, name);
299
49eaa6463492 Do not display ... if not truncated.
zas_
parents: 298
diff changeset
201 if (data && *data && limit > 0 && strlen(data) > limit + 3)
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
202 {
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
203 gchar *new_data = g_strdup_printf("%-*.*s...", limit, limit, data);
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
204 g_free(data);
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
205 data = new_data;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
206 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
207
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
208 g_string_erase(new, pos, end-start+1);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
209 if (data)
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
210 g_string_insert(new, pos, data);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
211 if (pos-prev == 2 && new->str[pos-1] == imp)
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
212 {
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
213 g_string_erase(new, --pos, 1);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
214 if (last && data)
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
215 {
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
216 g_string_insert(new, pos, sep);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
217 pos += strlen(sep);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
218 }
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
219 }
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
220
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
221 prev = data ? pos+strlen(data)-1 : pos-1;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
222 last = data ? TRUE : last;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
223 g_free(name);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
224 g_free(data);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
225 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
226
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
227 /* search and destroy empty lines */
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
228 end = new->str;
245
62f2f8f7cb2d Add parenthesis around affection to clear a gcc warning.
zas_
parents: 218
diff changeset
229 while ((start = strchr(end, '\n')))
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
230 {
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
231 end = start;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
232 while (*++(end) == '\n')
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
233 ;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
234 g_string_erase(new, start-new->str, end-start-1);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
235 }
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
236
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
237 g_strchomp(new->str);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
238
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
239 ret = new->str;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
240 g_string_free(new, FALSE);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
241
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
242 return ret;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
243 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
245 static GdkPixbuf *image_osd_info_render(ImageWindow *imd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 {
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
247 GdkPixbuf *pixbuf = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 gint width, height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 PangoLayout *layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 const gchar *name;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 gchar *name_escaped;
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
252 gchar *text;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 gchar *size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 gint n, t;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 CollectionData *cd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 CollectInfo *info;
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
257 GdkPixbuf *imgpixbuf = NULL;
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
258 LayoutWindow *lw = NULL;
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
259 gint with_hist = 0;
216
a57b153e7fa4 Indentation and white lines minor fixes.
zas_
parents: 196
diff changeset
260 gchar *ct;
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
261 gint w, h;
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
262 GHashTable *vars;
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
263
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
264 vars = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
265
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 name = image_get_name(imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 if (name)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 name_escaped = g_markup_escape_text(name, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 name_escaped = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 cd = image_get_collection(imd, &info);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 if (cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 t = g_list_length(cd->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 n = g_list_index(cd->list, info) + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 buf = g_markup_escape_text((cd->name) ? cd->name : _("Untitled"), -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 ct = g_strdup_printf("<i>%s</i>\n", buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 lw = layout_find_by_image(imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 if (lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 if (lw->slideshow)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 n = g_list_length(lw->slideshow->list_done);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295 t = n + g_list_length(lw->slideshow->list);
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
296 if (n == 0) n = t;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 t = layout_list_count(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 n = layout_list_get_index(lw, image_get_path(lw->image)) + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 else if (view_window_find_image(imd, &n, &t))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 n++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 t = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 n = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 if (n < 1) n = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 if (t < 1) t = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 ct = g_strdup("");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 size = text_from_size_abrev(imd->size);
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
321 if (!imd->unknown)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 if (imd->delay_flip &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 imd->il && imd->il->pixbuf &&
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
325 image_get_pixbuf(imd) != imd->il->pixbuf)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 w = gdk_pixbuf_get_width(imd->il->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 h = gdk_pixbuf_get_height(imd->il->pixbuf);
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
329 imgpixbuf = imd->il->pixbuf;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 {
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
333 pixbuf_renderer_get_image_size(PIXBUF_RENDERER(imd->pr), &w, &h);
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
334 imgpixbuf = (PIXBUF_RENDERER(imd->pr))->pixbuf;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 }
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
336
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
337 if (imgpixbuf && imd->histogram_enabled && imd->histogram
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
338 && (!imd->il || imd->il->done))
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
339 with_hist=1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
341 g_hash_table_insert(vars, "width", g_strdup_printf("%d", w));
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
342 g_hash_table_insert(vars, "height", g_strdup_printf("%d", h));
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
343 g_hash_table_insert(vars, "res", g_strdup_printf("%d × %d", w, h));
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
344 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
345
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
346 g_hash_table_insert(vars, "collection", g_strdup(ct));
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
347 g_hash_table_insert(vars, "number", g_strdup_printf("%d", n));
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
348 g_hash_table_insert(vars, "total", g_strdup_printf("%d", t));
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
349 g_hash_table_insert(vars, "name", g_strdup(name_escaped));
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
350 g_hash_table_insert(vars, "date", g_strdup(text_from_time(imd->mtime)));
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
351 g_hash_table_insert(vars, "size", g_strdup(size));
415
4f7362028062 Add zoom ratio display to OSD in fullscreen mode.
zas_
parents: 411
diff changeset
352 g_hash_table_insert(vars, "zoom", image_zoom_get_as_text(imd));
4f7362028062 Add zoom ratio display to OSD in fullscreen mode.
zas_
parents: 411
diff changeset
353
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
354 if (!name_escaped)
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
355 {
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
356 text = g_strdup_printf(_("Untitled"));
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
357 }
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
358 else
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
359 {
468
2df505c60459 Replace fullscreen.info and fullscreen.show_info options by:
zas_
parents: 464
diff changeset
360 text = image_osd_mkinfo(options->image_overlay.common.template_string, imd, vars);
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
361 }
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 122
diff changeset
362
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 g_free(size);
218
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
364 g_free(ct);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
365 g_free(name_escaped);
f4a0555794a9 Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents: 216
diff changeset
366 g_hash_table_destroy(vars);
133
532c42d5ed4d compilation fix
bruclik
parents: 132
diff changeset
367
532c42d5ed4d compilation fix
bruclik
parents: 132
diff changeset
368 {
216
a57b153e7fa4 Indentation and white lines minor fixes.
zas_
parents: 196
diff changeset
369 FileData *fd = image_get_fd(imd);
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
370
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
371 if (fd) /* fd may be null after file deletion */
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
372 {
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
373 gint active_marks = 0;
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
374 gint mark;
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
375 gchar *text2;
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
376
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
377 for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++)
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
378 {
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
379 active_marks += fd->marks[mark];
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
380 }
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
381
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
382
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
383 if (active_marks > 0)
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
384 {
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
385 GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
386
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
387 for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++)
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
388 {
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
389 g_string_append_printf(buf, fd->marks[mark] ? " <span background='#FF00FF'>%c</span>" : " %c", '1' + mark);
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
390 }
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
391
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
392 if (*text)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
393 text2 = g_strdup_printf("%s\n%s", text, buf->str);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
394 else
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
395 text2 = g_strdup(buf->str);
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
396 g_string_free(buf, TRUE);
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
397 g_free(text);
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
398 text = text2;
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
399 }
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
400
290
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
401 if (with_hist)
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
402 {
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
403 if (*text)
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
404 text2 = g_strdup_printf("%s\n%s", text, histogram_label(imd->histogram));
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
405 else
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
406 text2 = g_strdup(histogram_label(imd->histogram));
290
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
407 g_free(text);
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
408 text = text2;
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
409 }
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
410 }
155
d06bccc7551e show active marks in image overlay
nadvornik
parents: 133
diff changeset
411 }
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
412
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
413 layout = gtk_widget_create_pango_layout(imd->pr, NULL);
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
414 pango_layout_set_markup(layout, text, -1);
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
415 g_free(text);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
416
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 pango_layout_get_pixel_size(layout, &width, &height);
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
418 /* with empty text width is set to 0, but not height) */
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
419 if (width == 0)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
420 height = 0;
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
421 else if (height == 0)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
422 width = 0;
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
423 if (width > 0) width += 10;
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
424 if (height > 0) height += 10;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
426 if (with_hist)
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
427 {
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
428 histogram_read(imd->histogram, imgpixbuf);
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
429 if (width < 266) width = 266;
290
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
430 height += HISTOGRAM_HEIGHT + 5;
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
431 }
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
432
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
433 if (width > 0 && height > 0)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
434 {
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
435 /* TODO: make osd color configurable --Zas */
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
436 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
437 pixbuf_set_rect_fill(pixbuf, 3, 3, width-6, height-6, 240, 240, 240, 210);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
438 pixbuf_set_rect(pixbuf, 0, 0, width, height, 240, 240, 240, 80, 1, 1, 1, 1);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
439 pixbuf_set_rect(pixbuf, 1, 1, width-2, height-2, 240, 240, 240, 130, 1, 1, 1, 1);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
440 pixbuf_set_rect(pixbuf, 2, 2, width-4, height-4, 240, 240, 240, 180, 1, 1, 1, 1);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
441 pixbuf_pixel_set(pixbuf, 0, 0, 0, 0, 0, 0);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
442 pixbuf_pixel_set(pixbuf, width - 1, 0, 0, 0, 0, 0);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
443 pixbuf_pixel_set(pixbuf, 0, height - 1, 0, 0, 0, 0);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
444 pixbuf_pixel_set(pixbuf, width - 1, height - 1, 0, 0, 0, 0);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
445
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
446 if (with_hist)
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
447 histogram_draw(imd->histogram, pixbuf, 5, height - HISTOGRAM_HEIGHT - 5 , width - 10, HISTOGRAM_HEIGHT);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
448
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
449 pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, 0, 0, 0, 255);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
450 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 g_object_unref(G_OBJECT(layout));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 return pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
457 static GdkPixbuf *image_osd_icon_pixbuf(ImageOSDFlag flag)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
459 static GdkPixbuf **icons = NULL;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
460 GdkPixbuf *icon = NULL;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
461
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
462 if (!icons) icons = g_new0(GdkPixbuf *, IMAGE_OSD_COUNT);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
463 if (icons[flag]) return icons[flag];
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
464
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
465 if (osd_icons[flag].key)
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
466 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
467 icon = pixbuf_inline(osd_icons[flag].key);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
468 }
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
469
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
470 if (!icon)
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
471 {
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
472 icon = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 24, 24);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
473 pixbuf_set_rect_fill(icon, 1, 1, 22, 22, 255, 255, 255, 200);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
474 pixbuf_set_rect(icon, 0, 0, 24, 24, 0, 0, 0, 128, 1, 1, 1, 1);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
475 switch (flag)
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
476 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
477 case IMAGE_OSD_ROTATE_AUTO:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
478 pixbuf_set_rect(icon, 3, 8, 11, 12,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
479 0, 0, 0, 255,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
480 3, 0, 3, 0);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
481 pixbuf_draw_triangle(icon, 14, 3, 6, 12,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
482 20, 9, 14, 15, 14, 3,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
483 0, 0, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
484 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
485 case IMAGE_OSD_ROTATE_USER:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
486 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
487 case IMAGE_OSD_COLOR:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
488 pixbuf_set_rect_fill(icon, 3, 3, 18, 6, 200, 0, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
489 pixbuf_set_rect_fill(icon, 3, 9, 18, 6, 0, 200, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
490 pixbuf_set_rect_fill(icon, 3, 15, 18, 6, 0, 0, 200, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
491 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
492 case IMAGE_OSD_FIRST:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
493 pixbuf_set_rect(icon, 3, 3, 18, 18, 0, 0, 0, 200, 3, 3, 3, 0);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
494 pixbuf_draw_triangle(icon, 6, 5, 12, 6,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
495 12, 5, 18, 11, 6, 11,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
496 0, 0, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
497 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
498 case IMAGE_OSD_LAST:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
499 pixbuf_set_rect(icon, 3, 3, 18, 18, 0, 0, 0, 200, 3, 3, 0, 3);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
500 pixbuf_draw_triangle(icon, 6, 12, 12, 6,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
501 12, 18, 6, 12, 18, 12,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
502 0, 0, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
503 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
504 case IMAGE_OSD_ICON:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
505 pixbuf_set_rect_fill(icon, 11, 3, 3, 12, 0, 0, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
506 pixbuf_set_rect_fill(icon, 11, 17, 3, 3, 0, 0, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
507 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
508 default:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
509 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
510 }
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
511 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
512
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
513 icons[flag] = icon;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
514
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
515 return icon;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
516 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
517
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
518 static void image_osd_icon_show(OverlayStateData *osd, ImageOSDFlag flag)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
519 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
520 GdkPixbuf *pixbuf;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
521
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
522 if (osd->icon_id[flag]) return;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
523
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
524 pixbuf = image_osd_icon_pixbuf(flag);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
525 if (!pixbuf) return;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
526
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
527 osd->icon_id[flag] = image_overlay_add(osd->imd, pixbuf,
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
528 osd_icons[flag].x, osd_icons[flag].y,
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
529 TRUE, FALSE);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
530 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
531
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
532 static void image_osd_icon_hide(OverlayStateData *osd, ImageOSDFlag flag)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
533 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
534 if (osd->icon_id[flag])
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
535 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
536 image_overlay_remove(osd->imd, osd->icon_id[flag]);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
537 osd->icon_id[flag] = 0;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
538 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
540
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
541 static gint image_osd_update_cb(gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
543 OverlayStateData *osd = data;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
544
415
4f7362028062 Add zoom ratio display to OSD in fullscreen mode.
zas_
parents: 411
diff changeset
545 osd->imd->overlay_show_zoom = FALSE;
4f7362028062 Add zoom ratio display to OSD in fullscreen mode.
zas_
parents: 411
diff changeset
546
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
547 if (osd->show_info)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
548 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
549 if (osd->changed_states & IMAGE_STATE_IMAGE)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
550 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
551 GdkPixbuf *pixbuf;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
553 pixbuf = image_osd_info_render(osd->imd);
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
554 if (pixbuf)
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
555 {
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
556 if (osd->ovl_info == 0)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
557 {
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
558 osd->ovl_info = image_overlay_add(osd->imd, pixbuf,
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
559 OSD_INFO_X, OSD_INFO_Y, TRUE, FALSE);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
560 }
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
561 else
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
562 {
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
563 image_overlay_set(osd->imd, osd->ovl_info, pixbuf, OSD_INFO_X, OSD_INFO_Y);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
564 }
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
565 g_object_unref(pixbuf);
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
566 }
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
567 else if (osd->ovl_info)
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
568 {
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
569 image_overlay_remove(osd->imd, osd->ovl_info);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
570 osd->ovl_info = 0;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
571 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
572 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
573 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
574 else
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
575 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
576 if (osd->ovl_info)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
577 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
578 image_overlay_remove(osd->imd, osd->ovl_info);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
579 osd->ovl_info = 0;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
580 }
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
581 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
583 if (osd->show_status)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
584 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
585 gint i;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
586
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
587 if (osd->changed_states & IMAGE_STATE_IMAGE)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
588 {
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
589 for (i = 0; i < IMAGE_OSD_COUNT; i++)
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
590 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
591 if (osd_icons[i].reset) osd->icon_time[i] = 0;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
592 }
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
593 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
594
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
595 if (osd->changed_states & IMAGE_STATE_COLOR_ADJ)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
596 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
597 osd->icon_time[IMAGE_OSD_COLOR] = IMAGE_OSD_DEFAULT_DURATION + 1;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
598 image_osd_timer_schedule(osd);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
599 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
600
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
601 if (osd->changed_states & IMAGE_STATE_ROTATE_AUTO)
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
602 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
603 gint n = 0;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
604
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
605 if (osd->imd->state & IMAGE_STATE_ROTATE_AUTO)
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
606 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
607 n = 1;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
608 if (!osd->imd->cm) n += IMAGE_OSD_DEFAULT_DURATION;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
609 }
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
610
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
611 osd->icon_time[IMAGE_OSD_ROTATE_AUTO] = n;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
612 image_osd_timer_schedule(osd);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
613 }
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
614
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
615 for (i = 0; i < IMAGE_OSD_COUNT; i++)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
616 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
617 if (osd->icon_time[i] > 0)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
618 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
619 image_osd_icon_show(osd, i);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
620 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
621 else
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
622 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
623 image_osd_icon_hide(osd, i);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
624 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
625 }
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
626 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
627 else
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
628 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
629 gint i;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
630
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
631 for (i = 0; i < IMAGE_OSD_COUNT; i++)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
632 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
633 image_osd_icon_hide(osd, i);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
634 }
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
635 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
637 if (osd->imd->il && osd->imd->il->done)
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
638 osd->changed_states = IMAGE_STATE_NONE;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
639 osd->idle_id = -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
642
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
643 static void image_osd_update_schedule(OverlayStateData *osd, gint force)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
645 if (force) osd->changed_states |= IMAGE_STATE_IMAGE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
647 if (osd->idle_id == -1)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
648 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
649 osd->idle_id = g_idle_add_full(G_PRIORITY_HIGH, image_osd_update_cb, osd, NULL);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
650 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
651 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
653 void image_osd_update(ImageWindow *imd)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
654 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
655 OverlayStateData *osd;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
656
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
657 if (!imd) return;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
658
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
659 osd = g_object_get_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA");
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
660 if (!osd) return;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
661
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
662 image_osd_update_schedule(osd, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
665 static gint image_osd_timer_cb(gpointer data)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
666 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
667 OverlayStateData *osd = data;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
668 gint done = TRUE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
669 gint changed = FALSE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
670 gint i;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
671
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
672 for (i = 0; i < IMAGE_OSD_COUNT; i++)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
673 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
674 if (osd->icon_time[i] > 1)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
675 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
676 osd->icon_time[i]--;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
677 if (osd->icon_time[i] < 2)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
678 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
679 osd->icon_time[i] = 0;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
680 changed = TRUE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
681 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
682 else
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
683 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
684 done = FALSE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
685 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
686 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
687 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
688
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
689 if (changed) image_osd_update_schedule(osd, FALSE);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
690
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
691 if (done)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
692 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
693 osd->timer_id = -1;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
694 return FALSE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
695 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
696
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
697 return TRUE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
698 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
699
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
700 static void image_osd_timer_schedule(OverlayStateData *osd)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
701 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
702 if (osd->timer_id == -1)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
703 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
704 osd->timer_id = g_timeout_add(100, image_osd_timer_cb, osd);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
705 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
706 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
707
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
708 static void image_osd_state_cb(ImageWindow *imd, ImageState state, gpointer data)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
709 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
710 OverlayStateData *osd = data;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
711
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
712 osd->changed_states |= state;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
713 image_osd_update_schedule(osd, FALSE);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
714 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
715
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
716 static void image_osd_free(OverlayStateData *osd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
717 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
718 if (!osd) return;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
719
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
720 if (osd->idle_id != -1) g_source_remove(osd->idle_id);
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
721 if (osd->timer_id != -1) g_source_remove(osd->timer_id);
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
722
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
723 if (osd->imd)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
724 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
725 gint i;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
726
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
727 g_object_set_data(G_OBJECT(osd->imd->pr), "IMAGE_OVERLAY_DATA", NULL);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
728 g_signal_handler_disconnect(osd->imd->pr, osd->destroy_id);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
729
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
730 image_set_state_func(osd->imd, NULL, NULL);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
731 image_overlay_remove(osd->imd, osd->ovl_info);
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
732
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
733 for (i = 0; i < IMAGE_OSD_COUNT; i++)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
734 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
735 image_osd_icon_hide(osd, i);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
736 }
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
737 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
738
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
739 g_free(osd);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
740 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
741
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
742 static void image_osd_remove(ImageWindow *imd)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
743 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
744 OverlayStateData *osd;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
745
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
746 osd = g_object_get_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA");
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
747 image_osd_free(osd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
750 static void image_osd_destroy_cb(GtkWidget *widget, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
752 OverlayStateData *osd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
754 osd->imd = NULL;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
755 image_osd_free(osd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
758 static void image_osd_enable(ImageWindow *imd, gint info, gint status)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
760 OverlayStateData *osd;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
761
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
762 osd = g_object_get_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA");
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
763 if (!osd)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
764 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
765 osd = g_new0(OverlayStateData, 1);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
766 osd->imd = imd;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
767 osd->idle_id = -1;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
768 osd->timer_id = -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
770 osd->destroy_id = g_signal_connect(G_OBJECT(imd->pr), "destroy",
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
771 G_CALLBACK(image_osd_destroy_cb), osd);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
772 g_object_set_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA", osd);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
773
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
774 image_set_state_func(osd->imd, image_osd_state_cb, osd);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
775 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
776
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
777 if (osd->show_info != info ||
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
778 osd->show_status != status)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
779 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
780 osd->show_info = info;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
781 osd->show_status = status;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
783 image_osd_update_schedule(osd, TRUE);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
784 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
786
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
787 void image_osd_set(ImageWindow *imd, gint info, gint status)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
789 if (!imd) return;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
790
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
791 if (!info && !status)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
792 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
793 image_osd_remove(imd);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
794 return;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
795 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
796
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
797 image_osd_enable(imd, info, status);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
800 gint image_osd_get(ImageWindow *imd, gint *info, gint *status)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
801 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
802 OverlayStateData *osd;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
803
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
804 if (!imd) return FALSE;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
805
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
806 osd = g_object_get_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA");
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
807 if (!osd) return FALSE;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
808
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
809 if (info) *info = osd->show_info;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
810 if (status) *status = osd->show_status;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
811
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
812 return TRUE;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
813 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
814
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
815 /* duration:
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
816 0 = hide
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
817 1 = show
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
818 2+ = show for duration tenths of a second
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
819 -1 = use default duration
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
820 */
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
821 void image_osd_icon(ImageWindow *imd, ImageOSDFlag flag, gint duration)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
822 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
823 OverlayStateData *osd;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
824
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
825 if (!imd) return;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
826
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
827 osd = g_object_get_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA");
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
828 if (!osd) return;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
829
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
830 if (flag < IMAGE_OSD_NONE || flag >= IMAGE_OSD_COUNT) return;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
831 if (duration < 0) duration = IMAGE_OSD_DEFAULT_DURATION;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
832 if (duration > 1) duration += 1;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
833
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
834 osd->icon_time[flag] = duration;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
835
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
836 image_osd_update_schedule(osd, FALSE);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
837 image_osd_timer_schedule(osd);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
838 }