comparison src/image-overlay.c @ 23:17acca639a86

##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. ##### Fri Mar 18 19:52:38 2005 John Ellis <johne@verizon.net> * pixbuf-renderer.c: Fix broken 2pass queueing so it merges a single queue item for each tile, and now that a tile holds a queue pointer there is no need to walk the tile list to find a possible merge victim. Thu Mar 17 19:23:56 2005 John Ellis <johne@verizon.net> * image.c, pixbuf-renderer.[ch]: More progress, and 2 pass zoom now works again (mostly). Tue Mar 15 23:17:41 2005 John Ellis <johne@verizon.net> * image.[ch]: Start conversion to use of PixbufRenderer. * pixbuf-renderer.[ch]: Additions and fixes for use by ImageWindow. * fullscreen.c, image-overlay.c, img-view.c, info.c, layout.c, layout_image.c, print.c: Changes for above ImageWindow conversion. * typedefs.h: Remove unused ImageWindow variables. Mon Mar 14 20:45:50 2005 John Ellis <johne@verizon.net> * pan-view.c: Convert to using new PixbufRenderer. * pixbuf-renderer.[ch]: Clean up and fixes. Sun Mar 13 10:21:35 2005 John Ellis <johne@verizon.net> * image.c (image_scroller_start): Unref scroller pixbuf after adding it as an overlay to avoid leaking it. * pixbuf-renderer.[ch]: All functions defined in header file are now implemented. Fri Mar 11 17:05:36 2005 John Ellis <johne@verizon.net> * pixbuf-renderer.[ch]: Set up object properties and additional. Mar 10 19:22:18 2005 John Ellis <johne@verizon.net> * pixbuf-renderer.[ch]: FIx scrolling to use old method of gdk_draw and not gdk_scroll, as scroll often invalidates the entire window (!). Also merged in source tiles code from image.c. * pan-view.c: Change picked up when testing PixbufRender zoom. Tue Mar 8 23:26:00 2005 John Ellis <johne@verizon.net> * pixbuf-renderer.[ch]: Start of turning image drawing portion of ImageWindow into an actual GtkWidget. * src/Makefile.am: Add pixbuf-renderer.[ch]. * pan-view.c: Added temporary hack button and callback for testing PixbufRenderer widget.
author gqview
date Sat, 19 Mar 2005 01:15:17 +0000
parents d907d608745f
children 0c2e1f0a001b
comparison
equal deleted inserted replaced
22:e9625635e162 23:17acca639a86
15 #include "collect.h" 15 #include "collect.h"
16 #include "filelist.h" 16 #include "filelist.h"
17 #include "image.h" 17 #include "image.h"
18 #include "img-view.h" 18 #include "img-view.h"
19 #include "layout.h" 19 #include "layout.h"
20 #include "pixbuf-renderer.h"
20 #include "pixbuf_util.h" 21 #include "pixbuf_util.h"
21 22
22 23
23 /* 24 /*
24 *---------------------------------------------------------------------------- 25 *----------------------------------------------------------------------------
124 { 125 {
125 gint w, h; 126 gint w, h;
126 127
127 if (imd->delay_flip && 128 if (imd->delay_flip &&
128 imd->il && imd->il->pixbuf && 129 imd->il && imd->il->pixbuf &&
129 imd->pixbuf != imd->il->pixbuf) 130 image_get_pixbuf(imd) != imd->il->pixbuf)
130 { 131 {
131 w = gdk_pixbuf_get_width(imd->il->pixbuf); 132 w = gdk_pixbuf_get_width(imd->il->pixbuf);
132 h = gdk_pixbuf_get_height(imd->il->pixbuf); 133 h = gdk_pixbuf_get_height(imd->il->pixbuf);
133 } 134 }
134 else 135 else
135 { 136 {
136 w = imd->image_width; 137 pixbuf_renderer_get_image_size(PIXBUF_RENDERER(imd->pr), &w, &h);
137 h = imd->image_height;
138 } 138 }
139 139
140 text = g_strdup_printf("%s(%d/%d) <b>%s</b>\n%d x %d - %s - %s", ct, 140 text = g_strdup_printf("%s(%d/%d) <b>%s</b>\n%d x %d - %s - %s", ct,
141 n, t, name_escaped, 141 n, t, name_escaped,
142 w, h, 142 w, h,
144 } 144 }
145 g_free(size); 145 g_free(size);
146 g_free(ct); 146 g_free(ct);
147 g_free(name_escaped); 147 g_free(name_escaped);
148 148
149 layout = gtk_widget_create_pango_layout(imd->image, NULL); 149 layout = gtk_widget_create_pango_layout(imd->pr, NULL);
150 pango_layout_set_markup(layout, text, -1); 150 pango_layout_set_markup(layout, text, -1);
151 g_free(text); 151 g_free(text);
152 152
153 pango_layout_get_pixel_size(layout, &width, &height); 153 pango_layout_get_pixel_size(layout, &width, &height);
154 154
163 pixbuf_pixel_set(pixbuf, 0, 0, 0, 0, 0, 0); 163 pixbuf_pixel_set(pixbuf, 0, 0, 0, 0, 0, 0);
164 pixbuf_pixel_set(pixbuf, width - 1, 0, 0, 0, 0, 0); 164 pixbuf_pixel_set(pixbuf, width - 1, 0, 0, 0, 0, 0);
165 pixbuf_pixel_set(pixbuf, 0, height - 1, 0, 0, 0, 0); 165 pixbuf_pixel_set(pixbuf, 0, height - 1, 0, 0, 0, 0);
166 pixbuf_pixel_set(pixbuf, width - 1, height - 1, 0, 0, 0, 0); 166 pixbuf_pixel_set(pixbuf, width - 1, height - 1, 0, 0, 0, 0);
167 167
168 pixbuf_draw_layout(pixbuf, layout, imd->image, 5, 5, 0, 0, 0, 255); 168 pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, 0, 0, 0, 255);
169 169
170 g_object_unref(G_OBJECT(layout)); 170 g_object_unref(G_OBJECT(layout));
171 171
172 return pixbuf; 172 return pixbuf;
173 } 173 }
187 187
188 pixbuf = image_overlay_info_render(ou->imd); 188 pixbuf = image_overlay_info_render(ou->imd);
189 image_overlay_set(ou->imd, ou->id, pixbuf, IMAGE_OVERLAY_X, IMAGE_OVERLAY_Y); 189 image_overlay_set(ou->imd, ou->id, pixbuf, IMAGE_OVERLAY_X, IMAGE_OVERLAY_Y);
190 g_object_unref(pixbuf); 190 g_object_unref(pixbuf);
191 191
192 g_object_set_data(G_OBJECT(ou->imd->image), IMAGE_OVERLAY_UPDATE_KEY, NULL); 192 g_object_set_data(G_OBJECT(ou->imd->pr), IMAGE_OVERLAY_UPDATE_KEY, NULL);
193 g_signal_handler_disconnect(ou->imd->image, ou->destroy_id); 193 g_signal_handler_disconnect(ou->imd->pr, ou->destroy_id);
194 g_free(ou); 194 g_free(ou);
195 195
196 return FALSE; 196 return FALSE;
197 } 197 }
198 198
199 static void image_overlay_update_schedule(ImageWindow *imd, gint id) 199 static void image_overlay_update_schedule(ImageWindow *imd, gint id)
200 { 200 {
201 OverlayUpdate *ou; 201 OverlayUpdate *ou;
202 202
203 ou = g_object_get_data(G_OBJECT(imd->image), IMAGE_OVERLAY_UPDATE_KEY); 203 ou = g_object_get_data(G_OBJECT(imd->pr), IMAGE_OVERLAY_UPDATE_KEY);
204 if (ou) return; 204 if (ou) return;
205 205
206 ou = g_new0(OverlayUpdate, 1); 206 ou = g_new0(OverlayUpdate, 1);
207 ou->imd = imd; 207 ou->imd = imd;
208 ou->id = id; 208 ou->id = id;
209 ou->idle_id = g_idle_add_full(G_PRIORITY_HIGH, image_overlay_update_cb, ou, NULL); 209 ou->idle_id = g_idle_add_full(G_PRIORITY_HIGH, image_overlay_update_cb, ou, NULL);
210 ou->destroy_id = g_signal_connect(G_OBJECT(imd->image), "destroy", 210 ou->destroy_id = g_signal_connect(G_OBJECT(imd->pr), "destroy",
211 G_CALLBACK(image_overlay_update_destroy_cb), ou); 211 G_CALLBACK(image_overlay_update_destroy_cb), ou);
212 g_object_set_data(G_OBJECT(imd->image), IMAGE_OVERLAY_UPDATE_KEY, ou); 212 g_object_set_data(G_OBJECT(imd->pr), IMAGE_OVERLAY_UPDATE_KEY, ou);
213 } 213 }
214 214
215 void image_overlay_update(ImageWindow *imd, gint id) 215 void image_overlay_update(ImageWindow *imd, gint id)
216 { 216 {
217 if (id < 0) return; 217 if (id < 0) return;