annotate src/image-overlay.c @ 650:02e2c135ee0c

Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
author zas_
date Tue, 13 May 2008 11:58:47 +0000
parents 54e20abb5c6d
children 8268cbe682f1
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
650
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
16 #include "bar_info.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "collect.h"
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
18 #include "debug.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
19 #include "exif.h"
586
905688aa2317 split filelist.c to filefilter.c and filedata.c
nadvornik
parents: 532
diff changeset
20 #include "filedata.h"
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
21 #include "histogram.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "img-view.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "layout.h"
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
25 #include "pixbuf-renderer.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "pixbuf_util.h"
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
27 #include "ui_fileops.h"
9
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 /*
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 * image overlay
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 *----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
35
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
36 typedef struct _OverlayStateData OverlayStateData;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
37 struct _OverlayStateData {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 ImageWindow *imd;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
39 ImageState changed_states;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
40
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
41 Histogram *histogram;
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
42
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
43 OsdShowFlags show;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
44
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
45 gint ovl_info;
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
46
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
47 gint icon_time[IMAGE_OSD_COUNT];
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
48 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
49
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 gint idle_id;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
51 gint timer_id;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 gulong destroy_id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
55
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
56 typedef struct _OSDIcon OSDIcon;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
57 struct _OSDIcon {
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
58 gint reset; /* reset on new image */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
59 gint x; /* x, y offset */
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
60 gint y;
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
61 gchar *key; /* inline pixbuf */
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
62 };
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
63
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
64 static OSDIcon osd_icons[] = {
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
65 { TRUE, 0, 0, NULL }, /* none */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
66 { TRUE, -10, -10, NULL }, /* auto rotated */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
67 { TRUE, -10, -10, NULL }, /* user rotated */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
68 { TRUE, -40, -10, NULL }, /* color embedded */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
69 { TRUE, -70, -10, NULL }, /* first image */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
70 { TRUE, -70, -10, NULL }, /* last image */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
71 { FALSE, -70, -10, NULL }, /* osd enabled */
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
72 { FALSE, 0, 0, NULL }
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
73 };
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
74
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
75 #define OSD_DATA "overlay-data"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
77 #define OSD_INFO_X 10
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
78 #define OSD_INFO_Y -10
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
80 #define IMAGE_OSD_DEFAULT_DURATION 30
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
81
290
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
82 #define HISTOGRAM_HEIGHT 140
620
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
83 #define HISTOGRAM_WIDTH 256
469
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
84
481
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
85 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
86
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
87
469
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
88 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
89 {
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
90 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
91 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
92 }
a05c72927e23 Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents: 468
diff changeset
93
615
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
94 static OverlayStateData *image_get_osd_data(ImageWindow *imd)
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
95 {
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
96 OverlayStateData *osd;
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
97
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
98 if (!imd) return NULL;
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
99
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
100 g_assert(imd->pr);
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
101
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
102 osd = g_object_get_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA");
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
103 return osd;
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
104 }
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
105
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
106 static void image_set_osd_data(ImageWindow *imd, OverlayStateData *osd)
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
107 {
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
108 g_assert(imd);
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
109 g_assert(imd->pr);
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
110 g_object_set_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA", osd);
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
111 }
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
112
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
113 /*
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
114 *----------------------------------------------------------------------------
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
115 * image histogram
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 */
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
118
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
119
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
120 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
121 {
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
122 OverlayStateData *osd = image_get_osd_data(imd);
613
d06f422a6673 image_osd_histogram_chan_toggle(), image_osd_histogram_log_toggle():
zas_
parents: 586
diff changeset
123
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
124 if (!osd || !osd->histogram) return;
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
125
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
126 histogram_set_channel(osd->histogram, (histogram_get_channel(osd->histogram) +1)%HCHAN_COUNT);
613
d06f422a6673 image_osd_histogram_chan_toggle(), image_osd_histogram_log_toggle():
zas_
parents: 586
diff changeset
127 image_osd_update(imd);
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
128 }
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
129
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
130 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
131 {
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
132 OverlayStateData *osd = image_get_osd_data(imd);
613
d06f422a6673 image_osd_histogram_chan_toggle(), image_osd_histogram_log_toggle():
zas_
parents: 586
diff changeset
133
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
134 if (!osd || !osd->histogram) return;
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
135
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
136 histogram_set_mode(osd->histogram, !histogram_get_mode(osd->histogram));
613
d06f422a6673 image_osd_histogram_chan_toggle(), image_osd_histogram_log_toggle():
zas_
parents: 586
diff changeset
137 image_osd_update(imd);
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
138 }
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
139
481
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
140 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
141 {
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
142 OverlayStateData *osd;
503
e5023cced4e5 Fix image overlay displayed only on second "I" press in layout view.
zas_
parents: 483
diff changeset
143
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
144 if (!imd) return;
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
145
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
146 osd = image_get_osd_data(imd);
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
147 if (!osd)
481
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
148 {
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
149 image_osd_set(imd, OSD_SHOW_INFO | OSD_SHOW_STATUS);
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
150 return;
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
151 }
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
152
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
153 if (osd->show != OSD_SHOW_NOTHING)
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
154 {
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
155 if (osd->show & OSD_SHOW_HISTOGRAM)
481
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
156 {
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
157 image_osd_set(imd, OSD_SHOW_NOTHING);
481
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
158 }
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
159 else
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
160 {
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
161 image_osd_set(imd, osd->show | OSD_SHOW_HISTOGRAM);
481
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
162 }
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
163 }
67a612985686 Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents: 480
diff changeset
164 }
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
165
650
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
166 static gchar *keywords_to_string(FileData *fd)
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
167 {
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
168 GList *keywords;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
169 GString *kwstr = NULL;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
170 gchar *ret = NULL;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
171
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
172 g_assert(fd);
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
173
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
174 if (comment_read(fd, &keywords, NULL))
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
175 {
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
176 GList *work = keywords;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
177
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
178 while (work)
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
179 {
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
180 gchar *kw = work->data;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
181 work = work->next;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
182
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
183 if (!kw) continue;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
184 if (!kwstr)
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
185 kwstr = g_string_new("");
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
186 else
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
187 g_string_append(kwstr, ", ");
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
188
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
189 g_string_append(kwstr, kw);
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
190 }
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
191 }
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
192
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
193 if (kwstr)
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
194 {
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
195 ret = kwstr->str;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
196 g_string_free(kwstr, FALSE);
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
197 }
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
198
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
199 return ret;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
200 }
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
201
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
202 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
203 {
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
204 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
205 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
206 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
207 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
208 gchar *name, *data;
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
209 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
210 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
211 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
212
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
213 if (!str || !*str) return g_strdup("");
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
214
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
215 new = g_string_new(str);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
216
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
217 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
218 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
219 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
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 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
222 {
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
223 gint limit = 0;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
224 gchar *trunc = NULL;
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
225 gchar *limpos = NULL;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
226 gchar *extra = NULL;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
227 gchar *extrapos = NULL;
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
228 gchar *p;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
229
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 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
231 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
232 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
233 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
234 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
235 break;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
236
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
237 /* Search for optionnal modifiers
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
238 * %name:99:extra% -> name = "name", limit=99, extra = "extra"
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
239 */
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
240 for (p = start + 1; p < end; p++)
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
241 {
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
242 if (p[0] == ':')
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
243 {
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
244 if (g_ascii_isdigit(p[1]) && !limpos)
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
245 {
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
246 limpos = p + 1;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
247 if (!trunc) trunc = p;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
248 }
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
249 else
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
250 {
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
251 extrapos = p + 1;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
252 if (!trunc) trunc = p;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
253 break;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
254 }
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
255 }
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
256 }
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
257
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
258 if (limpos)
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
259 limit = atoi(limpos);
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
260
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
261 if (extrapos)
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
262 extra = g_strndup(extrapos, end - extrapos);
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
263
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
264 name = g_strndup(start+1, (trunc ? trunc : end)-start-1);
650
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
265 pos = start - new->str;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
266 data = NULL;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
267
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
268 if (strcmp(name, "keywords") == 0)
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
269 {
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
270 data = keywords_to_string(imd->image_fd);
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
271 }
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
272 else if (strcmp(name, "comment") == 0)
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
273 {
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
274 comment_read(imd->image_fd, NULL, &data);
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
275 }
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
276 else
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
277 {
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
278 data = g_strdup(g_hash_table_lookup(vars, name));
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
279 if (data && strcmp(name, "zoom") == 0) imd->overlay_show_zoom = TRUE;
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
280 if (!data && exif)
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
281 data = exif_get_data_as_text(exif, name);
02e2c135ee0c Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents: 622
diff changeset
282 }
299
49eaa6463492 Do not display ... if not truncated.
zas_
parents: 298
diff changeset
283 if (data && *data && limit > 0 && strlen(data) > limit + 3)
298
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
284 {
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
285 gchar *new_data = g_strdup_printf("%-*.*s...", limit, limit, data);
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
286 g_free(data);
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
287 data = new_data;
cb93a982fcdd Add the possibility to truncate overlay infos displayed:
zas_
parents: 290
diff changeset
288 }
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
289
483
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
290 if (data)
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
291 {
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
292 /* Since we use pango markup to display, we need to escape here */
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
293 gchar *escaped = g_markup_escape_text(data, -1);
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
294 g_free(data);
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
295 data = escaped;
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
296 }
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
297
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
298 if (extra)
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
299 {
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
300 if (data && *data)
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
301 {
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
302 /* Display data between left and right parts of extra string
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
303 * the data is expressed by a '*' character.
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
304 * If no "*" is present, the extra string is just appended to data string.
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
305 * Pango mark up is accepted in left and right parts.
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
306 * Any \n is replaced by a newline
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
307 * Examples:
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
308 * "<i>*</i>\n" -> data is displayed in italics ended with a newline
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
309 * "\n" -> ended with newline
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
310 * "ISO *" -> prefix data with "ISO " (ie. "ISO 100")
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
311 * "Collection <b>*</b>\n" -> display data in bold prefixed by "Collection " and a newline is appended
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
312 *
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
313 * FIXME: using background / foreground colors lead to weird results.
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
314 */
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
315 gchar *new_data;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
316 gchar *left = NULL;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
317 gchar *right = extra;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
318 gchar *p;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
319 gint len = strlen(extra);
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
320
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
321 /* Search and replace "\n" by a newline character */
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
322 for (p = extra; *p; p++, len--)
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
323 if (p[0] == '\\' && p[1] == 'n')
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
324 {
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
325 memmove(p+1, p+2, --len);
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
326 *p = '\n';
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
327 }
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
328
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
329 /* Search for left and right parts */
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
330 for (p = extra; *p; p++)
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
331 if (*p == '*')
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
332 {
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
333 *p = '\0';
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
334 p++;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
335 right = p;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
336 left = extra;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
337 break;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
338 }
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
339
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
340 new_data = g_strdup_printf("%s%s%s", left ? left : "", data, right);
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
341 g_free(data);
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
342 data = new_data;
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
343 }
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
344 g_free(extra);
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
345 }
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
346
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
347 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
348 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
349 g_string_insert(new, pos, data);
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
350
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
351 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
352 {
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
353 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
354 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
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 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
357 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
358 }
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 }
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
360
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 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
362 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
363 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
364 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
365 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
366
532
ea226ad80fc4 fixed a memory leak
nadvornik
parents: 531
diff changeset
367 exif_free(exif);
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
368 /* 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
369 end = new->str;
245
62f2f8f7cb2d Add parenthesis around affection to clear a gcc warning.
zas_
parents: 218
diff changeset
370 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
371 {
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
372 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
373 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
374 ;
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
375 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
376 }
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
377
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
378 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
379
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
380 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
381 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
382
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
383 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
384 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
386 static GdkPixbuf *image_osd_info_render(OverlayStateData *osd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 {
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
388 GdkPixbuf *pixbuf = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 gint width, height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 PangoLayout *layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 const gchar *name;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 gchar *name_escaped;
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
393 gchar *text;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 gchar *size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 gint n, t;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 CollectionData *cd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 CollectInfo *info;
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
398 GdkPixbuf *imgpixbuf = NULL;
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
399 LayoutWindow *lw = NULL;
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
400 gint with_hist = 0;
216
a57b153e7fa4 Indentation and white lines minor fixes.
zas_
parents: 196
diff changeset
401 gchar *ct;
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
402 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
403 GHashTable *vars;
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
404 ImageWindow *imd = osd->imd;
617
aa883b6d2ef6 image_osd_info_render(): if there's no fd, just return.
zas_
parents: 616
diff changeset
405 FileData *fd = image_get_fd(imd);
aa883b6d2ef6 image_osd_info_render(): if there's no fd, just return.
zas_
parents: 616
diff changeset
406
aa883b6d2ef6 image_osd_info_render(): if there's no fd, just return.
zas_
parents: 616
diff changeset
407 if (!fd) return NULL;
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
408
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
409 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
410
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 name = image_get_name(imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 if (name)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 name_escaped = g_markup_escape_text(name, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 name_escaped = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
421 cd = image_get_collection(imd, &info);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
422 if (cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
423 {
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
424 gchar *collection_name;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 t = g_list_length(cd->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 n = g_list_index(cd->list, info) + 1;
622
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
428 if (cd->name)
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
429 {
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
430 if (file_extension_match(cd->name, ".gqv"))
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
431 collection_name = remove_extension_from_path(cd->name);
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
432 else
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
433 collection_name = g_strdup(cd->name);
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
434 }
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
435 else
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
436 {
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
437 collection_name = g_strdup(_("Untitled"));
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
438 }
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
439
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
440 ct = g_markup_escape_text(collection_name, -1);
54e20abb5c6d Fix display of collection in overlay info.
zas_
parents: 621
diff changeset
441 g_free(collection_name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 lw = layout_find_by_image(imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446 if (lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 if (lw->slideshow)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 n = g_list_length(lw->slideshow->list_done);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 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
452 if (n == 0) n = t;
9
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 else
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 t = layout_list_count(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457 n = layout_list_get_index(lw, image_get_path(lw->image)) + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 else if (view_window_find_image(imd, &n, &t))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 n++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
466 t = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
467 n = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
468 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
469
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
470 if (n < 1) n = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
471 if (t < 1) t = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
472
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
473 ct = g_strdup("");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
474 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
476 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
477 if (!imd->unknown)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
479 if (imd->delay_flip &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 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
481 image_get_pixbuf(imd) != imd->il->pixbuf)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483 w = gdk_pixbuf_get_width(imd->il->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484 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
485 imgpixbuf = imd->il->pixbuf;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
487 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
488 {
531
1149a7b0a3d7 cleanup: use image_get_image_size
nadvornik
parents: 504
diff changeset
489 image_get_image_size(imd, &w, &h);
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
490 imgpixbuf = (PIXBUF_RENDERER(imd->pr))->pixbuf;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 }
480
805c3258d228 Make histogram depends on image window not layout window.
zas_
parents: 475
diff changeset
492
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
493 if (imgpixbuf && (osd->show & OSD_SHOW_HISTOGRAM) && osd->histogram
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
494 && (!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
495 with_hist=1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
496
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
497 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
498 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
499 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
500 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
501
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
502 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
503 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
504 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
505 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
506 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
507 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
508 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
509
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
510 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
511 {
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
512 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
513 }
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
514 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
515 {
468
2df505c60459 Replace fullscreen.info and fullscreen.show_info options by:
zas_
parents: 464
diff changeset
516 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
517 }
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 122
diff changeset
518
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 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
520 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
521 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
522 g_hash_table_destroy(vars);
133
532c42d5ed4d compilation fix
bruclik
parents: 132
diff changeset
523
532c42d5ed4d compilation fix
bruclik
parents: 132
diff changeset
524 {
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
525 gint active_marks = 0;
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
526 gint mark;
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
527 gchar *text2;
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
528
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
529 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
530 {
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
531 active_marks += fd->marks[mark];
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
532 }
263
c7fefb0a4b78 Display marks in overlay info only if at least one is set.
zas_
parents: 245
diff changeset
533
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
534 if (active_marks > 0)
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
535 {
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
536 GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
537
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
538 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
539 {
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
540 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
541 }
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
542
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
543 if (*text)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
544 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
545 else
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
546 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
547 g_string_free(buf, TRUE);
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
548 g_free(text);
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
549 text = text2;
265
3f14da3c3b9a Fix a segfault on fullscreen file deletion reported by Fr«±d«±ric Mantegazza.
zas_
parents: 263
diff changeset
550 }
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
551
290
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
552 if (with_hist)
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
553 {
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
554 gchar *escaped_histogram_label = g_markup_escape_text(histogram_label(osd->histogram), -1);
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
555 if (*text)
483
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
556 text2 = g_strdup_printf("%s\n%s", text, escaped_histogram_label);
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
557 else
483
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
558 text2 = g_strdup(escaped_histogram_label);
c9e3baeda1b1 Correctly escape data before using pango_layout_set_markup().
zas_
parents: 482
diff changeset
559 g_free(escaped_histogram_label);
290
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
560 g_free(text);
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
561 text = text2;
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
562 }
155
d06bccc7551e show active marks in image overlay
nadvornik
parents: 133
diff changeset
563 }
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
564
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
565 layout = gtk_widget_create_pango_layout(imd->pr, NULL);
275
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
566 pango_layout_set_markup(layout, text, -1);
dc69ea2dcf76 fixed histogram label
nadvornik
parents: 273
diff changeset
567 g_free(text);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
568
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569 pango_layout_get_pixel_size(layout, &width, &height);
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
570 /* 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
571 if (width == 0)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
572 height = 0;
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
573 else if (height == 0)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
574 width = 0;
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
575 if (width > 0) width += 10;
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
576 if (height > 0) height += 10;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
578 if (with_hist)
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
579 {
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
580 histogram_read(osd->histogram, imgpixbuf);
620
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
581 if (width < HISTOGRAM_WIDTH + 10) width = HISTOGRAM_WIDTH + 10;
290
4bbde8a38ad4 improved histogram drawing
nadvornik
parents: 281
diff changeset
582 height += HISTOGRAM_HEIGHT + 5;
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
583 }
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
584
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
585 if (width > 0 && height > 0)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
586 {
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
587 /* TODO: make osd color configurable --Zas */
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
588 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
589 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
590 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
591 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
592 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
593 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
594 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
595 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
596 pixbuf_pixel_set(pixbuf, width - 1, height - 1, 0, 0, 0, 0);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
597
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
598 if (with_hist)
620
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
599 {
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
600 gint x = 5;
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
601 gint y = height - HISTOGRAM_HEIGHT - 5;
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
602 gint w = width - 10;
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
603 gint xoffset = 0;
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
604 gint subdiv = 5;
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
605 gint c = 160;
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
606 gint alpha = 250;
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
607 gint i;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 415
diff changeset
608
620
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
609 for (i = 0; i < subdiv; i++)
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
610 {
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
611 gint d = (i > 0 ? 0 : 1);
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
612 gint div_width = d + w / subdiv;
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
613
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
614 pixbuf_set_rect(pixbuf, x + xoffset, y, div_width, HISTOGRAM_HEIGHT, c, c, c, alpha, d, 1, 1, 1);
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
615 xoffset += div_width;
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
616 }
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
617
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
618 histogram_draw(osd->histogram, pixbuf, x, y, w, HISTOGRAM_HEIGHT);
f335373f44e5 Display a simple grid with histogram.
zas_
parents: 618
diff changeset
619 }
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
620 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
621 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 g_object_unref(G_OBJECT(layout));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 return pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
628 static GdkPixbuf *image_osd_icon_pixbuf(ImageOSDFlag flag)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
630 static GdkPixbuf **icons = NULL;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
631 GdkPixbuf *icon = NULL;
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 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
634 if (icons[flag]) return icons[flag];
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
635
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
636 if (osd_icons[flag].key)
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
637 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
638 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
639 }
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
640
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
641 if (!icon)
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
642 {
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
643 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
644 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
645 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
646 switch (flag)
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
647 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
648 case IMAGE_OSD_ROTATE_AUTO:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
649 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
650 0, 0, 0, 255,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
651 3, 0, 3, 0);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
652 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
653 20, 9, 14, 15, 14, 3,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
654 0, 0, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
655 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
656 case IMAGE_OSD_ROTATE_USER:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
657 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
658 case IMAGE_OSD_COLOR:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
659 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
660 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
661 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
662 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
663 case IMAGE_OSD_FIRST:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
664 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
665 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
666 12, 5, 18, 11, 6, 11,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
667 0, 0, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
668 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
669 case IMAGE_OSD_LAST:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
670 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
671 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
672 12, 18, 6, 12, 18, 12,
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
673 0, 0, 0, 255);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
674 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
675 case IMAGE_OSD_ICON:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
676 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
677 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
678 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
679 default:
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
680 break;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
681 }
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
682 }
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 icons[flag] = icon;
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 return icon;
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 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
690 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
691 GdkPixbuf *pixbuf;
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 if (osd->icon_id[flag]) return;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
694
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
695 pixbuf = image_osd_icon_pixbuf(flag);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
696 if (!pixbuf) return;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
697
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
698 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
699 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
700 TRUE, FALSE);
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
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
703 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
704 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
705 if (osd->icon_id[flag])
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 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
708 osd->icon_id[flag] = 0;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
709 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
711
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
712 static gint image_osd_update_cb(gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
714 OverlayStateData *osd = data;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
715
415
4f7362028062 Add zoom ratio display to OSD in fullscreen mode.
zas_
parents: 411
diff changeset
716 osd->imd->overlay_show_zoom = FALSE;
4f7362028062 Add zoom ratio display to OSD in fullscreen mode.
zas_
parents: 411
diff changeset
717
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
718 if (osd->show & OSD_SHOW_INFO)
117
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->changed_states & IMAGE_STATE_IMAGE)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
721 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
722 GdkPixbuf *pixbuf;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
724 pixbuf = image_osd_info_render(osd);
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
725 if (pixbuf)
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
726 {
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
727 if (osd->ovl_info == 0)
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
728 {
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
729 osd->ovl_info = image_overlay_add(osd->imd, pixbuf,
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
730 OSD_INFO_X, OSD_INFO_Y, TRUE, FALSE);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
731 }
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
732 else
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
733 {
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
734 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
735 }
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
736 g_object_unref(pixbuf);
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
737 }
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
738 else if (osd->ovl_info)
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
739 {
410
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
740 image_overlay_remove(osd->imd, osd->ovl_info);
603206ffa644 Fix OSD display when fullscreen info string is empty.
zas_
parents: 322
diff changeset
741 osd->ovl_info = 0;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
742 }
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 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
745 else
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
746 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
747 if (osd->ovl_info)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
748 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
749 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
750 osd->ovl_info = 0;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
751 }
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
752 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
754 if (osd->show & OSD_SHOW_STATUS)
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
755 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
756 gint i;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
757
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
758 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
759 {
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
760 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
761 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
762 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
763 }
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
764 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
765
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
766 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
767 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
768 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
769 image_osd_timer_schedule(osd);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
770 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
771
122
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
772 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
773 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
774 gint n = 0;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
775
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
776 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
777 {
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
778 n = 1;
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
779 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
780 }
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
781
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
782 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
783 image_osd_timer_schedule(osd);
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
784 }
e2a8b7f2165b Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 118
diff changeset
785
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
786 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
787 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
788 if (osd->icon_time[i] > 0)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
789 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
790 image_osd_icon_show(osd, i);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
791 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
792 else
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
793 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
794 image_osd_icon_hide(osd, i);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
795 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
796 }
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
797 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
798 else
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
799 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
800 gint i;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
801
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
802 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
803 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
804 image_osd_icon_hide(osd, i);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
805 }
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
806 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807
273
e0e2c2b72c5a reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents: 265
diff changeset
808 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
809 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
810 osd->idle_id = -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
814 static void image_osd_update_schedule(OverlayStateData *osd, gint force)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
816 if (force) osd->changed_states |= IMAGE_STATE_IMAGE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
818 if (osd->idle_id == -1)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
819 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
820 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
821 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
822 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
824 void image_osd_update(ImageWindow *imd)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
825 {
615
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
826 OverlayStateData *osd = image_get_osd_data(imd);
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
827
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
828 if (!osd) return;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
829
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
830 image_osd_update_schedule(osd, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
833 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
834 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
835 OverlayStateData *osd = data;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
836 gint done = TRUE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
837 gint changed = FALSE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
838 gint i;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
839
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
840 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
841 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
842 if (osd->icon_time[i] > 1)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
843 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
844 osd->icon_time[i]--;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
845 if (osd->icon_time[i] < 2)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
846 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
847 osd->icon_time[i] = 0;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
848 changed = TRUE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
849 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
850 else
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
851 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
852 done = FALSE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
853 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
854 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
855 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
856
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
857 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
858
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
859 if (done)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
860 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
861 osd->timer_id = -1;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
862 return FALSE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
863 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
864
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
865 return TRUE;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
866 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
867
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
868 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
869 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
870 if (osd->timer_id == -1)
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
871 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
872 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
873 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
874 }
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
875
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
876 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
877 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
878 OverlayStateData *osd = data;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
879
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
880 osd->changed_states |= state;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
881 image_osd_update_schedule(osd, FALSE);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
882 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
883
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
884 static void image_osd_free(OverlayStateData *osd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
886 if (!osd) return;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
887
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
888 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
889 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
890
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
891 if (osd->imd)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
892 {
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
893 gint i;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
894
615
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
895 image_set_osd_data(osd->imd, NULL);
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
896 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
897
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
898 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
899 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
900
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
901 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
902 {
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
903 image_osd_icon_hide(osd, i);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
904 }
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
905 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
906
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
907 if (osd->histogram) histogram_free(osd->histogram);
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
908
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
909 g_free(osd);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
910 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
911
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
912 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
913 {
615
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
914 OverlayStateData *osd = image_get_osd_data(imd);
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
915
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
916 if (osd) image_osd_free(osd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
917 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
919 static void image_osd_destroy_cb(GtkWidget *widget, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
920 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
921 OverlayStateData *osd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
922
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
923 osd->imd = NULL;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
924 image_osd_free(osd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
925 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
926
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
927 static void image_osd_enable(ImageWindow *imd, OsdShowFlags show)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
928 {
615
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
929 OverlayStateData *osd = image_get_osd_data(imd);
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
930
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
931 if (!osd)
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
932 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
933 osd = g_new0(OverlayStateData, 1);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
934 osd->imd = imd;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
935 osd->idle_id = -1;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
936 osd->timer_id = -1;
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
937 osd->show = OSD_SHOW_NOTHING;
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
938 osd->histogram = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
939
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
940 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
941 G_CALLBACK(image_osd_destroy_cb), osd);
615
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
942 image_set_osd_data(imd, osd);
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
943
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
944 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
945 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
946
616
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
947 if (show & OSD_SHOW_HISTOGRAM)
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
948 osd->histogram = histogram_new();
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
949 else if (osd->histogram)
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
950 {
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
951 histogram_free(osd->histogram);
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
952 osd->histogram = NULL;
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
953 }
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
954
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
955 if (show & OSD_SHOW_STATUS)
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
956 image_osd_icon(imd, IMAGE_OSD_ICON, -1);
d9c9d05c9d4d Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents: 615
diff changeset
957
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
958 if (show != osd->show)
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
959 image_osd_update_schedule(osd, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
960
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
961 osd->show = show;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
962 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
963
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
964 void image_osd_set(ImageWindow *imd, OsdShowFlags show)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
965 {
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
966 if (!imd) return;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
967
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
968 if (show == OSD_SHOW_NOTHING)
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
969 {
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
970 image_osd_remove(imd);
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
971 return;
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
972 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
973
614
b2898f04c82e image_osd_get() and image_osd_set() now uses flags.
zas_
parents: 613
diff changeset
974 image_osd_enable(imd, show);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
975 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
976
621
734b6b0a3356 image_osd_get() now returns OsdShowFlags.
zas_
parents: 620
diff changeset
977 OsdShowFlags image_osd_get(ImageWindow *imd)
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
978 {
615
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
979 OverlayStateData *osd = image_get_osd_data(imd);
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
980
621
734b6b0a3356 image_osd_get() now returns OsdShowFlags.
zas_
parents: 620
diff changeset
981 return osd ? osd->show : OSD_SHOW_NOTHING;
117
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
982 }
0c2e1f0a001b Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
983
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
984 /* duration:
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
985 0 = hide
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
986 1 = show
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
987 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
988 -1 = use default duration
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
989 */
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
990 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
991 {
615
cddccc89d93b Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents: 614
diff changeset
992 OverlayStateData *osd = image_get_osd_data(imd);
118
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
993
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
994 if (!osd) return;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
995
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
996 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
997 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
998 if (duration > 1) duration += 1;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
999
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
1000 osd->icon_time[flag] = duration;
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
1001
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
1002 image_osd_update_schedule(osd, FALSE);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
1003 image_osd_timer_schedule(osd);
ac0f7f942c4d Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents: 117
diff changeset
1004 }