@@ -346,8 +346,9 @@ imageui_tick(GtkWidget *widget, GdkFrameClock *frame_clock, gpointer user_data)
346346 double new_scale ;
347347
348348#ifdef DEBUG_VERBOSE
349+ // FIXME could display FPS from this?
350+ printf ("imageui_tick: dt = %g\n" , dt );
349351#endif /*DEBUG_VERBOSE*/
350- printf ("image_window_tick: dt = %g\n" , dt );
351352
352353 new_scale = scale ;
353354
@@ -903,6 +904,29 @@ imageui_new(TileSource *tile_source)
903904 return imageui ;
904905}
905906
907+ Imageui *
908+ imageui_duplicate (TileSource * tile_source , Imageui * old_imageui )
909+ {
910+ Imageui * new_imageui = imageui_new (tile_source );
911+
912+ /* We want to copy position and scale, so no bestfit.
913+ */
914+ g_object_set (new_imageui -> imagedisplay ,
915+ "bestfit" , FALSE,
916+ NULL );
917+
918+ double scale = imageui_get_scale (old_imageui );
919+ imageui_set_scale (new_imageui , scale );
920+
921+ // this won't work until imagedisplay has had a layout :( think about this
922+ // again
923+ int left , top , width , height ;
924+ imageui_get_position (old_imageui , & left , & top , & width , & height );
925+ imageui_set_position (new_imageui , left , top );
926+
927+ return new_imageui ;
928+ }
929+
906930void
907931imageui_image_to_gtk (Imageui * imageui ,
908932 double x_image , double y_image , double * x_gtk , double * y_gtk )
@@ -918,18 +942,3 @@ imageui_gtk_to_image(Imageui *imageui,
918942 imagedisplay_gtk_to_image (IMAGEDISPLAY (imageui -> imagedisplay ),
919943 x_gtk , y_gtk , x_image , y_image );
920944}
921-
922- void
923- imageui_copy_position (Imageui * new , Imageui * old )
924- {
925- copy_adj (
926- gtk_scrolled_window_get_hadjustment (
927- GTK_SCROLLED_WINDOW (new -> scrolled_window )),
928- gtk_scrolled_window_get_hadjustment (
929- GTK_SCROLLED_WINDOW (old -> scrolled_window )));
930- copy_adj (
931- gtk_scrolled_window_get_vadjustment (
932- GTK_SCROLLED_WINDOW (new -> scrolled_window )),
933- gtk_scrolled_window_get_vadjustment (
934- GTK_SCROLLED_WINDOW (old -> scrolled_window )));
935- }
0 commit comments