Mercurial > geeqie
annotate src/image-overlay.c @ 1811:f405ec9b696b default tip
Some small logic mistakes
Use boolean operators for booleans and bitwise otherwise only.
| author | mow |
|---|---|
| date | Mon, 10 May 2010 11:33:13 +0000 |
| parents | 956aab097ea7 |
| children |
| rev | line source |
|---|---|
| 9 | 1 /* |
| 196 | 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 |
| 1802 | 4 * Copyright (C) 2008 - 2010 The Geeqie Team |
| 9 | 5 * |
| 6 * Author: John Ellis | |
| 7 * | |
| 8 * This software is released under the GNU General Public License (GNU GPL). | |
| 9 * Please read the included file COPYING for more information. | |
| 10 * This software comes with no warranty of any kind, use at your own risk! | |
| 11 */ | |
| 12 | |
| 281 | 13 #include "main.h" |
| 9 | 14 #include "image-overlay.h" |
| 15 | |
| 16 #include "collect.h" | |
|
218
f4a0555794a9
Customizable info overlay in fullscreen, based on the patch posted to gqview-devel list by Timo on 2007-09-10.
zas_
parents:
216
diff
changeset
|
17 #include "exif.h" |
| 586 | 18 #include "filedata.h" |
| 622 | 19 #include "histogram.h" |
| 9 | 20 #include "image.h" |
| 21 #include "img-view.h" | |
| 22 #include "layout.h" | |
|
1178
f6449c17306b
Move comments/keywords read and write stuff to new metadata.{c,h}.
zas_
parents:
1177
diff
changeset
|
23 #include "metadata.h" |
|
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
24 #include "pixbuf-renderer.h" |
| 9 | 25 #include "pixbuf_util.h" |
| 622 | 26 #include "ui_fileops.h" |
| 1011 | 27 #include "image-load.h" |
| 9 | 28 |
| 29 /* | |
| 30 *---------------------------------------------------------------------------- | |
| 31 * image overlay | |
| 32 *---------------------------------------------------------------------------- | |
| 33 */ | |
| 34 | |
| 614 | 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 | 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; |
| 1439 | 40 NotifyType notify; |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
41 |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
42 Histogram *histogram; |
|
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
43 |
| 614 | 44 OsdShowFlags show; |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
45 |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
46 gint ovl_info; |
|
822
df541dc41707
Allow to set image overlay info position through options:
zas_
parents:
821
diff
changeset
|
47 |
|
df541dc41707
Allow to set image overlay info position through options:
zas_
parents:
821
diff
changeset
|
48 gint x; |
|
df541dc41707
Allow to set image overlay info position through options:
zas_
parents:
821
diff
changeset
|
49 gint y; |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
50 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
51 gint icon_time[IMAGE_OSD_COUNT]; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
52 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
|
53 |
| 1523 | 54 guint idle_id; /* event source id */ |
| 55 guint timer_id; /* event source id */ | |
| 9 | 56 gulong destroy_id; |
| 57 }; | |
| 58 | |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
59 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
60 typedef struct _OSDIcon OSDIcon; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
61 struct _OSDIcon { |
|
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1367
diff
changeset
|
62 gboolean reset; /* reset on new image */ |
|
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
63 gint x; /* x, y offset */ |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
64 gint y; |
|
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
65 gchar *key; /* inline pixbuf */ |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
66 }; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
67 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
68 static OSDIcon osd_icons[] = { |
|
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
69 { TRUE, 0, 0, NULL }, /* none */ |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
70 { TRUE, -10, -10, NULL }, /* auto rotated */ |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
71 { TRUE, -10, -10, NULL }, /* user rotated */ |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
72 { TRUE, -40, -10, NULL }, /* color embedded */ |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
73 { TRUE, -70, -10, NULL }, /* first image */ |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
74 { TRUE, -70, -10, NULL }, /* last image */ |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
75 { FALSE, -70, -10, NULL }, /* osd enabled */ |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
76 { FALSE, 0, 0, NULL } |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
77 }; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
78 |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
79 #define OSD_DATA "overlay-data" |
| 9 | 80 |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
81 #define IMAGE_OSD_DEFAULT_DURATION 30 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
82 |
| 290 | 83 #define HISTOGRAM_HEIGHT 140 |
| 620 | 84 #define HISTOGRAM_WIDTH 256 |
|
469
a05c72927e23
Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents:
468
diff
changeset
|
85 |
|
481
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
480
diff
changeset
|
86 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
|
87 |
|
733
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
88 void set_image_overlay_template_string(gchar **template_string, const gchar *value) |
|
469
a05c72927e23
Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents:
468
diff
changeset
|
89 { |
|
733
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
90 g_assert(template_string); |
|
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
91 |
|
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
92 g_free(*template_string); |
|
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
93 *template_string = g_strdup(value); |
|
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
94 } |
|
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
95 |
|
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
96 |
|
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
97 void set_default_image_overlay_template_string(gchar **template_string) |
|
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
98 { |
|
57f759d012c7
Modify set_default_image_overlay_template_string() to accept the pointer to
zas_
parents:
671
diff
changeset
|
99 set_image_overlay_template_string(template_string, DEFAULT_OVERLAY_INFO); |
|
469
a05c72927e23
Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents:
468
diff
changeset
|
100 } |
|
a05c72927e23
Rename few functions and replace fullscreen info with image overlay template string.
zas_
parents:
468
diff
changeset
|
101 |
|
615
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
102 static OverlayStateData *image_get_osd_data(ImageWindow *imd) |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
103 { |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
104 OverlayStateData *osd; |
|
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 if (!imd) return NULL; |
|
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->pr); |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
109 |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
110 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
|
111 return osd; |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
112 } |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
113 |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
114 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
|
115 { |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
116 g_assert(imd); |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
117 g_assert(imd->pr); |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
118 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
|
119 } |
|
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
120 |
|
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
121 /* |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
122 *---------------------------------------------------------------------------- |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
123 * image histogram |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
124 *---------------------------------------------------------------------------- |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
125 */ |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
126 |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
127 |
| 1665 | 128 void image_osd_histogram_toggle_channel(ImageWindow *imd) |
|
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
129 { |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
130 OverlayStateData *osd = image_get_osd_data(imd); |
|
613
d06f422a6673
image_osd_histogram_chan_toggle(), image_osd_histogram_log_toggle():
zas_
parents:
586
diff
changeset
|
131 |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
132 if (!osd || !osd->histogram) return; |
|
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
133 |
|
1312
fcf0e7a6143e
Introduce helpers histogram_toggle_channel() and histogram_toggle_mode().
zas_
parents:
1302
diff
changeset
|
134 histogram_toggle_channel(osd->histogram); |
|
613
d06f422a6673
image_osd_histogram_chan_toggle(), image_osd_histogram_log_toggle():
zas_
parents:
586
diff
changeset
|
135 image_osd_update(imd); |
|
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
136 } |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
137 |
| 1665 | 138 void image_osd_histogram_toggle_mode(ImageWindow *imd) |
|
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
139 { |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
140 OverlayStateData *osd = image_get_osd_data(imd); |
|
613
d06f422a6673
image_osd_histogram_chan_toggle(), image_osd_histogram_log_toggle():
zas_
parents:
586
diff
changeset
|
141 |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
142 if (!osd || !osd->histogram) return; |
|
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
143 |
|
1312
fcf0e7a6143e
Introduce helpers histogram_toggle_channel() and histogram_toggle_mode().
zas_
parents:
1302
diff
changeset
|
144 histogram_toggle_mode(osd->histogram); |
|
613
d06f422a6673
image_osd_histogram_chan_toggle(), image_osd_histogram_log_toggle():
zas_
parents:
586
diff
changeset
|
145 image_osd_update(imd); |
|
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
146 } |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
147 |
| 1665 | 148 void image_osd_histogram_set_channel(ImageWindow *imd, gint chan) |
| 149 { | |
| 150 OverlayStateData *osd = image_get_osd_data(imd); | |
| 151 | |
| 152 if (!osd || !osd->histogram) return; | |
| 153 | |
| 154 histogram_set_channel(osd->histogram, chan); | |
| 155 image_osd_update(imd); | |
| 156 } | |
| 157 | |
| 158 void image_osd_histogram_set_mode(ImageWindow *imd, gint mode) | |
| 159 { | |
| 160 OverlayStateData *osd = image_get_osd_data(imd); | |
| 161 | |
| 162 if (!osd || !osd->histogram) return; | |
| 163 | |
| 164 histogram_set_mode(osd->histogram, mode); | |
| 165 image_osd_update(imd); | |
| 166 } | |
| 167 | |
| 168 gint image_osd_histogram_get_channel(ImageWindow *imd) | |
| 169 { | |
| 170 OverlayStateData *osd = image_get_osd_data(imd); | |
| 171 | |
| 172 if (!osd || !osd->histogram) return HCHAN_DEFAULT; | |
| 173 | |
| 174 return histogram_get_channel(osd->histogram); | |
| 175 } | |
| 176 | |
| 177 gint image_osd_histogram_get_mode(ImageWindow *imd) | |
| 178 { | |
| 179 OverlayStateData *osd = image_get_osd_data(imd); | |
| 180 | |
| 181 if (!osd || !osd->histogram) return 0; | |
| 182 | |
| 183 return histogram_get_mode(osd->histogram); | |
| 184 } | |
| 185 | |
|
481
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
480
diff
changeset
|
186 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
|
187 { |
| 1447 | 188 OsdShowFlags show; |
|
503
e5023cced4e5
Fix image overlay displayed only on second "I" press in layout view.
zas_
parents:
483
diff
changeset
|
189 |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
190 if (!imd) return; |
|
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
191 |
| 1447 | 192 show = image_osd_get(imd); |
| 193 if (show == OSD_SHOW_NOTHING) | |
|
481
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
480
diff
changeset
|
194 { |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
195 image_osd_set(imd, OSD_SHOW_INFO | OSD_SHOW_STATUS); |
|
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
196 return; |
|
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
197 } |
| 1336 | 198 else |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
199 { |
| 1447 | 200 if (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
|
201 { |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
202 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
|
203 } |
|
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
480
diff
changeset
|
204 else |
|
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
480
diff
changeset
|
205 { |
| 1447 | 206 image_osd_set(imd, 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
|
207 } |
|
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
480
diff
changeset
|
208 } |
|
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
480
diff
changeset
|
209 } |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
210 |
|
650
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
211 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
|
212 { |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
213 GList *keywords; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
214 GString *kwstr = NULL; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
215 gchar *ret = NULL; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
216 |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
217 g_assert(fd); |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
218 |
| 1288 | 219 keywords = metadata_read_list(fd, KEYWORD_KEY, METADATA_PLAIN); |
|
1238
947e603a52c6
simplified metadata interface, dropped metadata_read,
nadvornik
parents:
1191
diff
changeset
|
220 |
|
947e603a52c6
simplified metadata interface, dropped metadata_read,
nadvornik
parents:
1191
diff
changeset
|
221 if (keywords) |
|
650
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
222 { |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
223 GList *work = keywords; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
224 |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
225 while (work) |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
226 { |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
227 gchar *kw = work->data; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
228 work = work->next; |
| 995 | 229 |
|
650
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
230 if (!kw) continue; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
231 if (!kwstr) |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
232 kwstr = g_string_new(""); |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
233 else |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
234 g_string_append(kwstr, ", "); |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
235 |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
236 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
|
237 } |
|
1238
947e603a52c6
simplified metadata interface, dropped metadata_read,
nadvornik
parents:
1191
diff
changeset
|
238 string_list_free(keywords); |
|
650
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
239 } |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
240 |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
241 if (kwstr) |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
242 { |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
243 ret = kwstr->str; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
244 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
|
245 } |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
246 |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
247 return ret; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
248 } |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
249 |
|
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
|
250 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
|
251 { |
|
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
|
252 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
|
253 gchar *start, *end; |
| 736 | 254 guint pos, prev; |
|
866
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
255 gboolean want_separator = FALSE; |
|
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
|
256 gchar *name, *data; |
| 410 | 257 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
|
258 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
|
259 |
| 410 | 260 if (!str || !*str) return g_strdup(""); |
| 442 | 261 |
| 410 | 262 new = g_string_new(str); |
| 263 | |
|
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
|
264 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
|
265 |
|
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
|
266 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
|
267 { |
| 736 | 268 guint limit = 0; |
|
298
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
269 gchar *trunc = NULL; |
| 622 | 270 gchar *limpos = NULL; |
| 271 gchar *extra = NULL; | |
| 272 gchar *extrapos = NULL; | |
|
298
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
273 gchar *p; |
|
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
274 |
|
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
|
275 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
|
276 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
|
277 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
|
278 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
|
279 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
|
280 break; |
| 442 | 281 |
| 622 | 282 /* Search for optionnal modifiers |
| 283 * %name:99:extra% -> name = "name", limit=99, extra = "extra" | |
| 284 */ | |
| 285 for (p = start + 1; p < end; p++) | |
|
298
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
286 { |
| 622 | 287 if (p[0] == ':') |
|
298
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
288 { |
| 622 | 289 if (g_ascii_isdigit(p[1]) && !limpos) |
| 290 { | |
| 291 limpos = p + 1; | |
| 292 if (!trunc) trunc = p; | |
| 293 } | |
| 294 else | |
| 295 { | |
| 296 extrapos = p + 1; | |
| 297 if (!trunc) trunc = p; | |
| 298 break; | |
| 299 } | |
|
298
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
300 } |
|
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
301 } |
|
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
|
302 |
| 622 | 303 if (limpos) |
| 736 | 304 limit = (guint) atoi(limpos); |
|
298
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
305 |
| 622 | 306 if (extrapos) |
| 307 extra = g_strndup(extrapos, end - extrapos); | |
| 308 | |
| 309 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
|
310 pos = start - new->str; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
311 data = NULL; |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
312 |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
313 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
|
314 { |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
315 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
|
316 } |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
317 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
|
318 { |
| 1288 | 319 data = metadata_read_string(imd->image_fd, COMMENT_KEY, METADATA_PLAIN); |
|
650
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
320 } |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
321 else |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
322 { |
|
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
323 data = g_strdup(g_hash_table_lookup(vars, name)); |
| 1288 | 324 if (!data) |
| 325 data = metadata_read_string(imd->image_fd, name, METADATA_FORMATTED); | |
|
650
02e2c135ee0c
Keywords and comment can now be displayed in OSD info using %keywords% and %comment%.
zas_
parents:
622
diff
changeset
|
326 } |
|
866
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
327 |
| 299 | 328 if (data && *data && limit > 0 && strlen(data) > limit + 3) |
|
298
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
329 { |
|
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
330 gchar *new_data = g_strdup_printf("%-*.*s...", limit, limit, data); |
|
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
331 g_free(data); |
|
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
332 data = new_data; |
|
cb93a982fcdd
Add the possibility to truncate overlay infos displayed:
zas_
parents:
290
diff
changeset
|
333 } |
| 622 | 334 |
|
483
c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
zas_
parents:
482
diff
changeset
|
335 if (data) |
|
c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
zas_
parents:
482
diff
changeset
|
336 { |
|
c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
zas_
parents:
482
diff
changeset
|
337 /* 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
|
338 gchar *escaped = g_markup_escape_text(data, -1); |
|
c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
zas_
parents:
482
diff
changeset
|
339 g_free(data); |
|
c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
zas_
parents:
482
diff
changeset
|
340 data = escaped; |
|
c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
zas_
parents:
482
diff
changeset
|
341 } |
| 622 | 342 |
| 343 if (extra) | |
| 344 { | |
| 345 if (data && *data) | |
| 346 { | |
| 347 /* Display data between left and right parts of extra string | |
|
752
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
348 * the data is expressed by a '*' character. A '*' may be escaped |
| 995 | 349 * by a \. You should escape all '*' characters, do not rely on the |
|
752
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
350 * current implementation which only replaces the first unescaped '*'. |
| 622 | 351 * If no "*" is present, the extra string is just appended to data string. |
| 352 * Pango mark up is accepted in left and right parts. | |
| 353 * Any \n is replaced by a newline | |
| 354 * Examples: | |
| 355 * "<i>*</i>\n" -> data is displayed in italics ended with a newline | |
| 356 * "\n" -> ended with newline | |
| 357 * "ISO *" -> prefix data with "ISO " (ie. "ISO 100") | |
|
752
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
358 * "\**\*" -> prefix data with a star, and append a star (ie. "*100*") |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
359 * "\\*" -> prefix data with an anti slash (ie "\100") |
| 622 | 360 * "Collection <b>*</b>\n" -> display data in bold prefixed by "Collection " and a newline is appended |
| 361 * | |
| 362 * FIXME: using background / foreground colors lead to weird results. | |
| 363 */ | |
| 364 gchar *new_data; | |
| 365 gchar *left = NULL; | |
| 366 gchar *right = extra; | |
| 367 gchar *p; | |
| 736 | 368 guint len = strlen(extra); |
| 622 | 369 |
|
752
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
370 /* Search for left and right parts and unescape characters */ |
| 622 | 371 for (p = extra; *p; p++, len--) |
|
752
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
372 if (p[0] == '\\') |
| 622 | 373 { |
|
752
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
374 if (p[1] == 'n') |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
375 { |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
376 memmove(p+1, p+2, --len); |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
377 p[0] = '\n'; |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
378 } |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
379 else if (p[1] != '\0') |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
380 memmove(p, p+1, len--); // includes \0 |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
381 } |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
382 else if (p[0] == '*' && !left) |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
383 { |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
384 right = p + 1; |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
385 left = extra; |
| 622 | 386 } |
| 387 | |
|
752
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
388 if (left) right[-1] = '\0'; |
|
85c9412d77d2
Allow to escape star characters in the template string with a \.
zas_
parents:
736
diff
changeset
|
389 |
| 622 | 390 new_data = g_strdup_printf("%s%s%s", left ? left : "", data, right); |
| 391 g_free(data); | |
| 392 data = new_data; | |
| 393 } | |
| 394 g_free(extra); | |
| 995 | 395 } |
| 622 | 396 |
|
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
|
397 g_string_erase(new, pos, end-start+1); |
|
866
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
398 if (data && *data) |
|
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
|
399 { |
|
866
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
400 if (want_separator) |
|
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
|
401 { |
|
866
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
402 /* insert separator */ |
|
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 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
|
404 pos += strlen(sep); |
|
986
533694a9675c
Fix another missing separator bug in image overlay. This one was occuring with default string when no ISO data was available from exif.
zas_
parents:
963
diff
changeset
|
405 want_separator = FALSE; |
|
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
|
406 } |
|
866
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
407 |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
408 g_string_insert(new, pos, data); |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
409 pos += strlen(data); |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
410 } |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
411 |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
412 if (pos-prev >= 1 && new->str[pos] == imp) |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
413 { |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
414 /* pipe character is replaced by a separator, delete it |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
415 * and raise a flag if needed */ |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
416 g_string_erase(new, pos--, 1); |
|
986
533694a9675c
Fix another missing separator bug in image overlay. This one was occuring with default string when no ISO data was available from exif.
zas_
parents:
963
diff
changeset
|
417 want_separator |= (data && *data); |
|
866
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
418 } |
|
986
533694a9675c
Fix another missing separator bug in image overlay. This one was occuring with default string when no ISO data was available from exif.
zas_
parents:
963
diff
changeset
|
419 |
|
533694a9675c
Fix another missing separator bug in image overlay. This one was occuring with default string when no ISO data was available from exif.
zas_
parents:
963
diff
changeset
|
420 if (new->str[pos] == '\n') want_separator = FALSE; |
|
533694a9675c
Fix another missing separator bug in image overlay. This one was occuring with default string when no ISO data was available from exif.
zas_
parents:
963
diff
changeset
|
421 |
|
866
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
422 prev = pos - 1; |
|
c879a9a4f186
image_osd_mkinfo(): pipe replacement by " - " separator was fixed to work correctly with
zas_
parents:
865
diff
changeset
|
423 |
|
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
|
424 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
|
425 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
|
426 } |
| 442 | 427 |
|
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
|
428 /* 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
|
429 end = new->str; |
|
245
62f2f8f7cb2d
Add parenthesis around affection to clear a gcc warning.
zas_
parents:
218
diff
changeset
|
430 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
|
431 { |
|
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
|
432 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
|
433 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
|
434 ; |
|
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
|
435 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
|
436 } |
|
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
|
437 |
|
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
|
438 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
|
439 |
|
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
|
440 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
|
441 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
|
442 |
|
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
|
443 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
|
444 } |
| 9 | 445 |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
446 typedef enum { |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
447 OSDT_NONE = 0, |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
448 OSDT_FREE = 1 << 0, |
| 963 | 449 OSDT_NO_DUP = 1 << 1 |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
450 } OsdTemplateFlags; |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
451 |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
452 static void osd_template_insert(GHashTable *vars, gchar *keyword, gchar *value, OsdTemplateFlags flags) |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
453 { |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
454 if (!value) |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
455 { |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
456 g_hash_table_insert(vars, keyword, g_strdup("")); |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
457 return; |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
458 } |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
459 |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
460 if (flags & OSDT_NO_DUP) |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
461 { |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
462 g_hash_table_insert(vars, keyword, value); |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
463 return; |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
464 } |
| 963 | 465 else |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
466 { |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
467 g_hash_table_insert(vars, keyword, g_strdup(value)); |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
468 } |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
469 |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
470 if (flags & OSDT_FREE) g_free((gpointer) value); |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
471 } |
|
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
472 |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
473 static GdkPixbuf *image_osd_info_render(OverlayStateData *osd) |
| 9 | 474 { |
| 410 | 475 GdkPixbuf *pixbuf = NULL; |
| 9 | 476 gint width, height; |
| 477 PangoLayout *layout; | |
| 478 const gchar *name; | |
| 275 | 479 gchar *text; |
|
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
480 GdkPixbuf *imgpixbuf = NULL; |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
481 gboolean with_hist; |
| 1298 | 482 const HistMap *histmap; |
| 995 | 483 ImageWindow *imd = osd->imd; |
|
617
aa883b6d2ef6
image_osd_info_render(): if there's no fd, just return.
zas_
parents:
616
diff
changeset
|
484 FileData *fd = image_get_fd(imd); |
|
aa883b6d2ef6
image_osd_info_render(): if there's no fd, just return.
zas_
parents:
616
diff
changeset
|
485 |
|
aa883b6d2ef6
image_osd_info_render(): if there's no fd, just return.
zas_
parents:
616
diff
changeset
|
486 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
|
487 |
| 9 | 488 name = image_get_name(imd); |
| 489 if (name) | |
| 490 { | |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
491 gint n, t; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
492 CollectionData *cd; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
493 CollectInfo *info; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
494 GHashTable *vars; |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
495 |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
496 vars = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
| 9 | 497 |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
498 cd = image_get_collection(imd, &info); |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
499 if (cd) |
| 622 | 500 { |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
501 t = g_list_length(cd->list); |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
502 n = g_list_index(cd->list, info) + 1; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
503 if (cd->name) |
| 9 | 504 { |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
505 if (file_extension_match(cd->name, GQ_COLLECTION_EXT)) |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
506 osd_template_insert(vars, "collection", remove_extension_from_path(cd->name), OSDT_FREE); |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
507 else |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
508 osd_template_insert(vars, "collection", cd->name, OSDT_NONE); |
| 9 | 509 } |
| 510 else | |
| 511 { | |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
512 osd_template_insert(vars, "collection", _("Untitled"), OSDT_NONE); |
| 9 | 513 } |
| 514 } | |
| 515 else | |
| 516 { | |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
517 LayoutWindow *lw = layout_find_by_image(imd); |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
518 if (lw) |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
519 { |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
520 if (lw->slideshow) |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
521 { |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
522 n = g_list_length(lw->slideshow->list_done); |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
523 t = n + g_list_length(lw->slideshow->list); |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
524 if (n == 0) n = t; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
525 } |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
526 else |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
527 { |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
528 t = layout_list_count(lw, NULL); |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
529 n = layout_list_get_index(lw, image_get_fd(lw->image)) + 1; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
530 } |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
531 } |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
532 else if (view_window_find_image(imd, &n, &t)) |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
533 { |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
534 n++; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
535 } |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
536 else |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
537 { |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
538 t = 1; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
539 n = 1; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
540 } |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
541 |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
542 if (n < 1) n = 1; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
543 if (t < 1) t = 1; |
|
480
805c3258d228
Make histogram depends on image window not layout window.
zas_
parents:
475
diff
changeset
|
544 |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
545 osd_template_insert(vars, "collection", NULL, OSDT_NONE); |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
546 } |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
547 |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
548 osd_template_insert(vars, "number", g_strdup_printf("%d", n), OSDT_NO_DUP); |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
549 osd_template_insert(vars, "total", g_strdup_printf("%d", t), OSDT_NO_DUP); |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
550 osd_template_insert(vars, "name", (gchar *) name, OSDT_NONE); |
| 995 | 551 osd_template_insert(vars, "date", imd->image_fd ? ((gchar *) text_from_time(imd->image_fd->date)) : "", OSDT_NONE); |
| 888 | 552 osd_template_insert(vars, "size", imd->image_fd ? (text_from_size_abrev(imd->image_fd->size)) : g_strdup(""), OSDT_FREE); |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
553 osd_template_insert(vars, "zoom", image_zoom_get_as_text(imd), OSDT_FREE); |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
554 |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
555 if (!imd->unknown) |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
556 { |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
557 gint w, h; |
| 1011 | 558 GdkPixbuf *load_pixbuf = image_loader_get_pixbuf(imd->il); |
| 442 | 559 |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
560 if (imd->delay_flip && |
| 1011 | 561 imd->il && load_pixbuf && |
| 562 image_get_pixbuf(imd) != load_pixbuf) | |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
563 { |
| 1011 | 564 w = gdk_pixbuf_get_width(load_pixbuf); |
| 565 h = gdk_pixbuf_get_height(load_pixbuf); | |
| 566 imgpixbuf = load_pixbuf; | |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
567 } |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
568 else |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
569 { |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
570 image_get_image_size(imd, &w, &h); |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
571 imgpixbuf = (PIXBUF_RENDERER(imd->pr))->pixbuf; |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
572 } |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
573 |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
574 |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
575 osd_template_insert(vars, "width", g_strdup_printf("%d", w), OSDT_NO_DUP); |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
576 osd_template_insert(vars, "height", g_strdup_printf("%d", h), OSDT_NO_DUP); |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
577 osd_template_insert(vars, "res", g_strdup_printf("%d × %d", w, h), OSDT_FREE); |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
578 } |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
579 else |
|
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
580 { |
|
862
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
581 osd_template_insert(vars, "width", NULL, OSDT_NONE); |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
582 osd_template_insert(vars, "height", NULL, OSDT_NONE); |
|
30e1f4370215
osd_template_insert(): optimize and simplify using flags.
zas_
parents:
861
diff
changeset
|
583 osd_template_insert(vars, "res", NULL, OSDT_NONE); |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
584 } |
|
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
585 |
| 1336 | 586 text = image_osd_mkinfo(options->image_overlay.template_string, imd, vars); |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
587 g_hash_table_destroy(vars); |
| 415 | 588 |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
589 } else { |
|
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
590 /* When does this occur ?? */ |
|
861
3df5220fbc23
image_osd_info_render(): ensure values are always escaped before using pango_layout_set_markup().
zas_
parents:
860
diff
changeset
|
591 text = g_markup_escape_text(_("Untitled"), -1); |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
592 } |
| 132 | 593 |
| 1294 | 594 with_hist = ((osd->show & OSD_SHOW_HISTOGRAM) && osd->histogram); |
| 595 if (with_hist) | |
| 596 { | |
| 597 histmap = histmap_get(imd->image_fd); | |
| 1439 | 598 if (!histmap) |
| 599 { | |
| 600 histmap_start_idle(imd->image_fd); | |
| 601 with_hist = FALSE; | |
| 602 } | |
| 1294 | 603 } |
| 604 | |
|
860
1e85eabf4952
image_osd_info_render(): code cleanup and simplification, drop some useless memory allocations.
zas_
parents:
857
diff
changeset
|
605 |
| 133 | 606 { |
|
265
3f14da3c3b9a
Fix a segfault on fullscreen file deletion reported by Fr?d?ric Mantegazza.
zas_
parents:
263
diff
changeset
|
607 gint active_marks = 0; |
|
3f14da3c3b9a
Fix a segfault on fullscreen file deletion reported by Fr?d?ric Mantegazza.
zas_
parents:
263
diff
changeset
|
608 gint mark; |
| 275 | 609 gchar *text2; |
|
263
c7fefb0a4b78
Display marks in overlay info only if at least one is set.
zas_
parents:
245
diff
changeset
|
610 |
| 442 | 611 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
|
612 { |
| 800 | 613 active_marks += file_data_get_mark(fd, mark); |
|
265
3f14da3c3b9a
Fix a segfault on fullscreen file deletion reported by Fr?d?ric Mantegazza.
zas_
parents:
263
diff
changeset
|
614 } |
|
263
c7fefb0a4b78
Display marks in overlay info only if at least one is set.
zas_
parents:
245
diff
changeset
|
615 |
|
265
3f14da3c3b9a
Fix a segfault on fullscreen file deletion reported by Fr?d?ric Mantegazza.
zas_
parents:
263
diff
changeset
|
616 if (active_marks > 0) |
|
3f14da3c3b9a
Fix a segfault on fullscreen file deletion reported by Fr?d?ric Mantegazza.
zas_
parents:
263
diff
changeset
|
617 { |
|
3f14da3c3b9a
Fix a segfault on fullscreen file deletion reported by Fr?d?ric Mantegazza.
zas_
parents:
263
diff
changeset
|
618 GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2); |
| 442 | 619 |
| 620 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
|
621 { |
| 800 | 622 g_string_append_printf(buf, file_data_get_mark(fd, mark) ? " <span background='#FF00FF'>%c</span>" : " %c", '1' + mark); |
| 995 | 623 } |
|
265
3f14da3c3b9a
Fix a segfault on fullscreen file deletion reported by Fr?d?ric Mantegazza.
zas_
parents:
263
diff
changeset
|
624 |
| 410 | 625 if (*text) |
| 626 text2 = g_strdup_printf("%s\n%s", text, buf->str); | |
| 627 else | |
| 628 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
|
629 g_string_free(buf, TRUE); |
|
3f14da3c3b9a
Fix a segfault on fullscreen file deletion reported by Fr?d?ric Mantegazza.
zas_
parents:
263
diff
changeset
|
630 g_free(text); |
| 275 | 631 text = text2; |
|
265
3f14da3c3b9a
Fix a segfault on fullscreen file deletion reported by Fr?d?ric Mantegazza.
zas_
parents:
263
diff
changeset
|
632 } |
| 275 | 633 |
| 995 | 634 if (with_hist) |
| 290 | 635 { |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
636 gchar *escaped_histogram_label = g_markup_escape_text(histogram_label(osd->histogram), -1); |
| 410 | 637 if (*text) |
|
483
c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
zas_
parents:
482
diff
changeset
|
638 text2 = g_strdup_printf("%s\n%s", text, escaped_histogram_label); |
| 410 | 639 else |
|
483
c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
zas_
parents:
482
diff
changeset
|
640 text2 = g_strdup(escaped_histogram_label); |
|
c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
zas_
parents:
482
diff
changeset
|
641 g_free(escaped_histogram_label); |
| 290 | 642 g_free(text); |
| 643 text = text2; | |
| 644 } | |
| 155 | 645 } |
| 410 | 646 |
|
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
647 layout = gtk_widget_create_pango_layout(imd->pr, NULL); |
| 275 | 648 pango_layout_set_markup(layout, text, -1); |
| 649 g_free(text); | |
| 442 | 650 |
| 9 | 651 pango_layout_get_pixel_size(layout, &width, &height); |
| 410 | 652 /* with empty text width is set to 0, but not height) */ |
| 653 if (width == 0) | |
| 654 height = 0; | |
| 655 else if (height == 0) | |
| 656 width = 0; | |
| 657 if (width > 0) width += 10; | |
| 658 if (height > 0) height += 10; | |
| 9 | 659 |
|
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
660 if (with_hist) |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
661 { |
| 620 | 662 if (width < HISTOGRAM_WIDTH + 10) width = HISTOGRAM_WIDTH + 10; |
| 290 | 663 height += HISTOGRAM_HEIGHT + 5; |
|
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
664 } |
|
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
265
diff
changeset
|
665 |
| 410 | 666 if (width > 0 && height > 0) |
| 667 { | |
| 668 /* TODO: make osd color configurable --Zas */ | |
| 669 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); | |
| 670 pixbuf_set_rect_fill(pixbuf, 3, 3, width-6, height-6, 240, 240, 240, 210); | |
| 671 pixbuf_set_rect(pixbuf, 0, 0, width, height, 240, 240, 240, 80, 1, 1, 1, 1); | |
| 672 pixbuf_set_rect(pixbuf, 1, 1, width-2, height-2, 240, 240, 240, 130, 1, 1, 1, 1); | |
| 673 pixbuf_set_rect(pixbuf, 2, 2, width-4, height-4, 240, 240, 240, 180, 1, 1, 1, 1); | |
| 674 pixbuf_pixel_set(pixbuf, 0, 0, 0, 0, 0, 0); | |
| 675 pixbuf_pixel_set(pixbuf, width - 1, 0, 0, 0, 0, 0); | |
| 676 pixbuf_pixel_set(pixbuf, 0, height - 1, 0, 0, 0, 0); | |
| 677 pixbuf_pixel_set(pixbuf, width - 1, height - 1, 0, 0, 0, 0); | |
| 442 | 678 |
| 410 | 679 if (with_hist) |
| 620 | 680 { |
| 681 gint x = 5; | |
| 682 gint y = height - HISTOGRAM_HEIGHT - 5; | |
| 683 gint w = width - 10; | |
| 442 | 684 |
|
1302
8d1f9739c06a
Add grid to bar histogram, simplify the code and draw horizontal lines too.
zas_
parents:
1298
diff
changeset
|
685 pixbuf_set_rect_fill(pixbuf, x, y, w, HISTOGRAM_HEIGHT, 220, 220, 220, 210); |
| 1294 | 686 histogram_draw(osd->histogram, histmap, pixbuf, x, y, w, HISTOGRAM_HEIGHT); |
| 620 | 687 } |
| 410 | 688 pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, 0, 0, 0, 255); |
| 689 } | |
| 9 | 690 |
| 691 g_object_unref(G_OBJECT(layout)); | |
| 692 | |
| 693 return pixbuf; | |
| 694 } | |
| 695 | |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
696 static GdkPixbuf *image_osd_icon_pixbuf(ImageOSDFlag flag) |
| 9 | 697 { |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
698 static GdkPixbuf **icons = NULL; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
699 GdkPixbuf *icon = NULL; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
700 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
701 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
|
702 if (icons[flag]) return icons[flag]; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
703 |
|
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
704 if (osd_icons[flag].key) |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
705 { |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
706 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
|
707 } |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
708 |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
709 if (!icon) |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
710 { |
|
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
711 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
|
712 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
|
713 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
|
714 switch (flag) |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
715 { |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
716 case IMAGE_OSD_ROTATE_AUTO: |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
717 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
|
718 0, 0, 0, 255, |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
719 3, 0, 3, 0); |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
720 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
|
721 20, 9, 14, 15, 14, 3, |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
722 0, 0, 0, 255); |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
723 break; |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
724 case IMAGE_OSD_ROTATE_USER: |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
725 break; |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
726 case IMAGE_OSD_COLOR: |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
727 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
|
728 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
|
729 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
|
730 break; |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
731 case IMAGE_OSD_FIRST: |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
732 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
|
733 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
|
734 12, 5, 18, 11, 6, 11, |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
735 0, 0, 0, 255); |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
736 break; |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
737 case IMAGE_OSD_LAST: |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
738 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
|
739 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
|
740 12, 18, 6, 12, 18, 12, |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
741 0, 0, 0, 255); |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
742 break; |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
743 case IMAGE_OSD_ICON: |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
744 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
|
745 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
|
746 break; |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
747 default: |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
748 break; |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
749 } |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
750 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
751 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
752 icons[flag] = icon; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
753 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
754 return icon; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
755 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
756 |
|
821
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
757 static gint image_overlay_add(ImageWindow *imd, GdkPixbuf *pixbuf, gint x, gint y, |
|
857
7d387a25b1ec
Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents:
844
diff
changeset
|
758 OverlayRendererFlags flags) |
|
821
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
759 { |
|
857
7d387a25b1ec
Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents:
844
diff
changeset
|
760 return pixbuf_renderer_overlay_add((PixbufRenderer *)imd->pr, pixbuf, x, y, flags); |
|
821
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
761 } |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
762 |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
763 static void image_overlay_set(ImageWindow *imd, gint id, GdkPixbuf *pixbuf, gint x, gint y) |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
764 { |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
765 pixbuf_renderer_overlay_set((PixbufRenderer *)imd->pr, id, pixbuf, x, y); |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
766 } |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
767 |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
768 #if 0 /* unused for now */ |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
769 static gint image_overlay_get(ImageWindow *imd, gint id, GdkPixbuf **pixbuf, gint *x, gint *y) |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
770 { |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
771 return pixbuf_renderer_overlay_get((PixbufRenderer *)imd->pr, id, pixbuf, x, y); |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
772 } |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
773 #endif |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
774 |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
775 static void image_overlay_remove(ImageWindow *imd, gint id) |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
776 { |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
777 pixbuf_renderer_overlay_remove((PixbufRenderer *)imd->pr, id); |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
778 } |
|
fb249b8e63e4
Move some functions from image.[ch] to image-overlay.c and make them static:
zas_
parents:
800
diff
changeset
|
779 |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
780 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
|
781 { |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
782 GdkPixbuf *pixbuf; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
783 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
784 if (osd->icon_id[flag]) return; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
785 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
786 pixbuf = image_osd_icon_pixbuf(flag); |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
787 if (!pixbuf) return; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
788 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
789 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
|
790 osd_icons[flag].x, osd_icons[flag].y, |
|
857
7d387a25b1ec
Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents:
844
diff
changeset
|
791 OVL_RELATIVE); |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
792 } |
|
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 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
|
795 { |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
796 if (osd->icon_id[flag]) |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
797 { |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
798 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
|
799 osd->icon_id[flag] = 0; |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
800 } |
| 9 | 801 } |
| 802 | |
| 886 | 803 static void image_osd_icons_reset_time(OverlayStateData *osd) |
| 804 { | |
| 805 gint i; | |
| 806 | |
| 807 for (i = 0; i < IMAGE_OSD_COUNT; i++) | |
| 808 { | |
| 809 if (osd_icons[i].reset) | |
| 810 { | |
| 811 osd->icon_time[i] = 0; | |
| 812 } | |
| 813 } | |
| 814 } | |
| 815 | |
| 816 static void image_osd_icons_update(OverlayStateData *osd) | |
| 817 { | |
| 818 gint i; | |
| 819 | |
| 820 for (i = 0; i < IMAGE_OSD_COUNT; i++) | |
| 821 { | |
| 822 if (osd->icon_time[i] > 0) | |
| 823 { | |
| 824 image_osd_icon_show(osd, i); | |
| 825 } | |
| 826 else | |
| 827 { | |
| 828 image_osd_icon_hide(osd, i); | |
| 829 } | |
| 830 } | |
| 831 } | |
| 832 | |
| 833 static void image_osd_icons_hide(OverlayStateData *osd) | |
| 834 { | |
| 835 gint i; | |
| 836 | |
| 837 for (i = 0; i < IMAGE_OSD_COUNT; i++) | |
| 838 { | |
| 839 image_osd_icon_hide(osd, i); | |
| 840 } | |
| 841 } | |
| 842 | |
|
887
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
843 static void image_osd_info_show(OverlayStateData *osd, GdkPixbuf *pixbuf) |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
844 { |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
845 if (osd->ovl_info == 0) |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
846 { |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
847 osd->ovl_info = image_overlay_add(osd->imd, pixbuf, osd->x, osd->y, OVL_RELATIVE); |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
848 } |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
849 else |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
850 { |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
851 image_overlay_set(osd->imd, osd->ovl_info, pixbuf, osd->x, osd->y); |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
852 } |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
853 } |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
854 |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
855 static void image_osd_info_hide(OverlayStateData *osd) |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
856 { |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
857 if (osd->ovl_info == 0) return; |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
858 |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
859 image_overlay_remove(osd->imd, osd->ovl_info); |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
860 osd->ovl_info = 0; |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
861 } |
|
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
862 |
|
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1367
diff
changeset
|
863 static gboolean image_osd_update_cb(gpointer data) |
| 9 | 864 { |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
865 OverlayStateData *osd = data; |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
866 |
| 614 | 867 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
|
868 { |
| 1297 | 869 /* redraw when the image was changed, |
| 870 with histogram we have to redraw also when loading is finished */ | |
| 871 if (osd->changed_states & IMAGE_STATE_IMAGE || | |
| 1439 | 872 (osd->changed_states & IMAGE_STATE_LOADING && osd->show & OSD_SHOW_HISTOGRAM) || |
| 873 osd->notify & NOTIFY_HISTMAP) | |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
874 { |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
875 GdkPixbuf *pixbuf; |
| 9 | 876 |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
877 pixbuf = image_osd_info_render(osd); |
| 410 | 878 if (pixbuf) |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
879 { |
|
887
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
880 image_osd_info_show(osd, pixbuf); |
| 410 | 881 g_object_unref(pixbuf); |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
882 } |
|
887
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
883 else |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
884 { |
|
887
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
885 image_osd_info_hide(osd); |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
886 } |
|
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 } |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
889 else |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
890 { |
|
887
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
891 image_osd_info_hide(osd); |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
892 } |
| 9 | 893 |
| 614 | 894 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
|
895 { |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
896 if (osd->changed_states & IMAGE_STATE_IMAGE) |
| 886 | 897 image_osd_icons_reset_time(osd); |
| 898 | |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
899 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
|
900 { |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
901 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
|
902 image_osd_timer_schedule(osd); |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
903 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
904 |
|
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
905 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
|
906 { |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
907 gint n = 0; |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
908 |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
909 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
|
910 { |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
911 n = 1; |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
912 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
|
913 } |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
914 |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
915 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
|
916 image_osd_timer_schedule(osd); |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
917 } |
|
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
118
diff
changeset
|
918 |
| 886 | 919 image_osd_icons_update(osd); |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
920 } |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
921 else |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
922 { |
| 886 | 923 image_osd_icons_hide(osd); |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
924 } |
| 9 | 925 |
|
1440
3265830658cd
fixed a bug in osd updating, it seems that the osd icons work again
nadvornik
parents:
1439
diff
changeset
|
926 osd->changed_states = IMAGE_STATE_NONE; |
| 1439 | 927 osd->notify = 0; |
| 1523 | 928 osd->idle_id = 0; |
| 9 | 929 return FALSE; |
| 930 } | |
| 931 | |
|
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1367
diff
changeset
|
932 static void image_osd_update_schedule(OverlayStateData *osd, gboolean force) |
| 9 | 933 { |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
934 if (force) osd->changed_states |= IMAGE_STATE_IMAGE; |
| 9 | 935 |
| 1523 | 936 if (!osd->idle_id) |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
937 { |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
938 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
|
939 } |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
940 } |
| 9 | 941 |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
942 void image_osd_update(ImageWindow *imd) |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
943 { |
|
615
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
944 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
|
945 |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
946 if (!osd) return; |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
947 |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
948 image_osd_update_schedule(osd, TRUE); |
| 9 | 949 } |
| 950 | |
|
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1367
diff
changeset
|
951 static gboolean image_osd_timer_cb(gpointer data) |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
952 { |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
953 OverlayStateData *osd = data; |
|
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1367
diff
changeset
|
954 gboolean done = TRUE; |
|
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1367
diff
changeset
|
955 gboolean changed = FALSE; |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
956 gint i; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
957 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
958 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
|
959 { |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
960 if (osd->icon_time[i] > 1) |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
961 { |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
962 osd->icon_time[i]--; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
963 if (osd->icon_time[i] < 2) |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
964 { |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
965 osd->icon_time[i] = 0; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
966 changed = TRUE; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
967 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
968 else |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
969 { |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
970 done = FALSE; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
971 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
972 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
973 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
974 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
975 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
|
976 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
977 if (done) |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
978 { |
| 1523 | 979 osd->timer_id = 0; |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
980 return FALSE; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
981 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
982 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
983 return TRUE; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
984 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
985 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
986 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
|
987 { |
| 1523 | 988 if (!osd->timer_id) |
|
118
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 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
|
991 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
992 } |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
993 |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
994 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
|
995 { |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
996 OverlayStateData *osd = data; |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
997 |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
998 osd->changed_states |= state; |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
999 image_osd_update_schedule(osd, FALSE); |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1000 } |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1001 |
| 1439 | 1002 static void image_osd_notify_cb(FileData *fd, NotifyType type, gpointer data) |
| 1003 { | |
| 1004 OverlayStateData *osd = data; | |
| 1005 | |
| 1006 if ((type & (NOTIFY_HISTMAP)) && osd->imd && fd == osd->imd->image_fd) | |
| 1007 { | |
| 1498 | 1008 DEBUG_1("Notify osd: %s %04x", fd->path, type); |
| 1439 | 1009 osd->notify |= type; |
| 1010 image_osd_update_schedule(osd, FALSE); | |
| 1011 } | |
| 1012 } | |
| 1013 | |
| 1014 | |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1015 static void image_osd_free(OverlayStateData *osd) |
| 9 | 1016 { |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1017 if (!osd) return; |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1018 |
| 1523 | 1019 if (osd->idle_id) g_source_remove(osd->idle_id); |
| 1020 if (osd->timer_id) 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
|
1021 |
| 1439 | 1022 file_data_unregister_notify_func(image_osd_notify_cb, osd); |
| 1023 | |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1024 if (osd->imd) |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1025 { |
|
615
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
1026 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
|
1027 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
|
1028 |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1029 image_set_state_func(osd->imd, NULL, NULL); |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1030 |
|
887
e418c33a49c8
Move code from image_osd_update_cb() to separate functions.
zas_
parents:
886
diff
changeset
|
1031 image_osd_info_hide(osd); |
| 886 | 1032 image_osd_icons_hide(osd); |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1033 } |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1034 |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
1035 if (osd->histogram) histogram_free(osd->histogram); |
|
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
1036 |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1037 g_free(osd); |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1038 } |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1039 |
|
1740
6146ec0c9ab9
Comment out unused functions, silenting related compilation warnings.
zas_
parents:
1665
diff
changeset
|
1040 #if 0 |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1041 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
|
1042 { |
|
615
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
1043 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
|
1044 |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
1045 if (osd) image_osd_free(osd); |
| 9 | 1046 } |
|
1740
6146ec0c9ab9
Comment out unused functions, silenting related compilation warnings.
zas_
parents:
1665
diff
changeset
|
1047 #endif |
| 9 | 1048 |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1049 static void image_osd_destroy_cb(GtkWidget *widget, gpointer data) |
| 9 | 1050 { |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1051 OverlayStateData *osd = data; |
| 9 | 1052 |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1053 osd->imd = NULL; |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1054 image_osd_free(osd); |
| 9 | 1055 } |
| 1056 | |
| 614 | 1057 static void image_osd_enable(ImageWindow *imd, OsdShowFlags show) |
| 9 | 1058 { |
|
615
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
1059 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
|
1060 |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1061 if (!osd) |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1062 { |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1063 osd = g_new0(OverlayStateData, 1); |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1064 osd->imd = imd; |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
1065 osd->show = OSD_SHOW_NOTHING; |
| 1336 | 1066 osd->x = options->image_overlay.x; |
| 1067 osd->y = options->image_overlay.y; | |
|
822
df541dc41707
Allow to set image overlay info position through options:
zas_
parents:
821
diff
changeset
|
1068 |
| 1336 | 1069 osd->histogram = histogram_new(); |
| 1070 | |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1071 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
|
1072 G_CALLBACK(image_osd_destroy_cb), osd); |
|
615
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
1073 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
|
1074 |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1075 image_set_state_func(osd->imd, image_osd_state_cb, osd); |
| 1439 | 1076 file_data_register_notify_func(image_osd_notify_cb, osd, NOTIFY_PRIORITY_LOW); |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1077 } |
| 9 | 1078 |
|
616
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
1079 if (show & OSD_SHOW_STATUS) |
|
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
1080 image_osd_icon(imd, IMAGE_OSD_ICON, -1); |
|
d9c9d05c9d4d
Move overlay histogram stuff from ImageWindow to OverlayStateData.
zas_
parents:
615
diff
changeset
|
1081 |
| 614 | 1082 if (show != osd->show) |
| 1083 image_osd_update_schedule(osd, TRUE); | |
| 9 | 1084 |
| 614 | 1085 osd->show = show; |
| 9 | 1086 } |
| 1087 | |
| 614 | 1088 void image_osd_set(ImageWindow *imd, OsdShowFlags show) |
| 9 | 1089 { |
|
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1090 if (!imd) return; |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1091 |
| 614 | 1092 image_osd_enable(imd, show); |
| 9 | 1093 } |
| 1094 | |
| 621 | 1095 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
|
1096 { |
|
615
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
1097 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
|
1098 |
| 621 | 1099 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
|
1100 } |
|
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1101 |
| 1336 | 1102 Histogram *image_osd_get_histogram(ImageWindow *imd) |
| 1103 { | |
| 1104 OverlayStateData *osd = image_get_osd_data(imd); | |
| 1105 | |
| 1106 return osd ? osd->histogram : NULL; | |
| 1107 } | |
| 1108 | |
| 1109 void image_osd_copy_status(ImageWindow *src, ImageWindow *dest) | |
| 1110 { | |
| 1111 Histogram *h_src, *h_dest; | |
| 1112 image_osd_set(dest, image_osd_get(src)); | |
| 1113 | |
| 1114 h_src = image_osd_get_histogram(src); | |
| 1115 h_dest = image_osd_get_histogram(dest); | |
| 1116 | |
| 1117 h_dest->histogram_mode = h_src->histogram_mode; | |
| 1118 h_dest->histogram_channel = h_src->histogram_channel; | |
| 1119 | |
| 1120 } | |
| 1121 | |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1122 /* duration: |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1123 0 = hide |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1124 1 = show |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1125 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
|
1126 -1 = use default duration |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1127 */ |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1128 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
|
1129 { |
|
615
cddccc89d93b
Introduce image_get_osd_data() and image_set_osd_data().
zas_
parents:
614
diff
changeset
|
1130 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
|
1131 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1132 if (!osd) return; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1133 |
|
1177
5a20c47e7a14
Fix up unsigned expression always true/false warnings.
zas_
parents:
1055
diff
changeset
|
1134 if (flag >= IMAGE_OSD_COUNT) return; |
|
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1135 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
|
1136 if (duration > 1) duration += 1; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1137 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1138 osd->icon_time[flag] = duration; |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1139 |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1140 image_osd_update_schedule(osd, FALSE); |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1141 image_osd_timer_schedule(osd); |
|
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1142 } |
|
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
1011
diff
changeset
|
1143 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |
