@@ -93,13 +93,18 @@ static const int infobar_label_width[] = {
9393 10 , /* double complex */
9494};
9595
96- /* Tilesource has a new image. We need a new number of band elements and
97- * dimensions.
96+ /* We have a new image to display -- rebuild widgets.
9897 */
9998static void
100- infobar_tilesource_changed ( Tilesource * tilesource , Infobar * infobar )
99+ infobar_new_image ( Infobar * infobar )
101100{
102- VipsImage * image = tilesource -> image ;
101+ Tilesource * tilesource ;
102+ if (!(tilesource = imagewindow_get_tilesource (infobar -> win )))
103+ return ;
104+
105+ VipsImage * image ;
106+ if (!(image = tilesource_get_base_image (tilesource )))
107+ return ;
103108
104109 GSList * p ;
105110 VipsBandFormat format ;
@@ -110,7 +115,7 @@ infobar_tilesource_changed(Tilesource *tilesource, Infobar *infobar)
110115 int i ;
111116
112117#ifdef DEBUG
113- printf ("infobar_tilesource_changed :\n" );
118+ printf ("infobar_new_image :\n" );
114119#endif /*DEBUG*/
115120
116121 /* Remove all existing children of infobar->values.
@@ -251,7 +256,7 @@ infobar_update_pixel(Infobar *infobar,
251256
252257 PixelUpdate * update = g_new0 (PixelUpdate , 1 );
253258 update -> infobar = infobar ;
254- update -> image = tilesource -> image ;
259+ update -> image = tilesource_get_base_image ( tilesource ) ;
255260
256261 /* Currently in level0 image coordinates ... we will fetch from
257262 * tilesource->image, the current pyr layer.
@@ -305,32 +310,27 @@ infobar_status_update(Infobar *infobar)
305310}
306311
307312static void
308- infobar_status_changed (Imagewindow * win , Infobar * infobar )
313+ infobar_imagewindow_status_changed (Imagewindow * win , Infobar * infobar )
309314{
310315 if (!gtk_action_bar_get_revealed (GTK_ACTION_BAR (infobar -> action_bar )) ||
311316 !imagewindow_get_tilesource (infobar -> win ))
312317 return ;
313318
314319#ifdef DEBUG
315- printf ("infobar_status_changed :\n" );
320+ printf ("infobar_imagewindow_status_changed :\n" );
316321#endif /*DEBUG*/
317322
318323 infobar_status_update (infobar );
319324}
320325
321- /* Imagewindow has a new tilesource.
322- */
323326static void
324- infobar_imagewindow_changed (Imagewindow * win , Infobar * infobar )
327+ infobar_imagewindow_new_image (Imagewindow * win , Infobar * infobar )
325328{
326- Tilesource * tilesource ;
329+ #ifdef DEBUG
330+ printf ("infobar_imagewindow_new_image:\n" );
331+ #endif /*DEBUG*/
327332
328- if ((tilesource = imagewindow_get_tilesource (win ))) {
329- g_signal_connect_object (tilesource , "changed" ,
330- G_CALLBACK (infobar_tilesource_changed ), infobar , 0 );
331- g_signal_connect_object (tilesource , "page-changed" ,
332- G_CALLBACK (infobar_status_changed ), infobar , 0 );
333- }
333+ infobar_new_image (infobar );
334334}
335335
336336static void
@@ -340,11 +340,10 @@ infobar_set_imagewindow(Infobar *infobar, Imagewindow *win)
340340 */
341341 infobar -> win = win ;
342342
343- g_signal_connect_object (win , "changed" ,
344- G_CALLBACK (infobar_imagewindow_changed ), infobar , 0 );
345-
346343 g_signal_connect_object (win , "status-changed" ,
347- G_CALLBACK (infobar_status_changed ), infobar , 0 );
344+ G_CALLBACK (infobar_imagewindow_status_changed ), infobar , 0 );
345+ g_signal_connect_object (win , "new-image" ,
346+ G_CALLBACK (infobar_imagewindow_new_image ), infobar , 0 );
348347}
349348
350349static void
0 commit comments