@@ -149,6 +149,10 @@ static void cb_change_pseudo_color(GtkRadioAction* action,
149149static void cb_image_reference(GtkWidget *widget,
150150 const char *filename,
151151 gpointer user_data);
152+ static void cb_set_pixelsize(GtkWidget *widget,
153+ double pixelsize,
154+ const gchar *pixelsize_unit,
155+ gpointer user_data);
152156static void menu_add_widget (GtkUIManager *ui, GtkWidget *widget, GtkContainer *container);
153157static void
154158cb_balloon_changed(GtkWidget *widget,
@@ -859,6 +863,8 @@ class Giv:Win from Gtk:Window
859863 gtk_widget_show(selfp->w_imgv);
860864 g_signal_connect(selfp->w_imgv, "file-reference",
861865 G_CALLBACK(cb_image_reference), self);
866+ g_signal_connect(selfp->w_imgv, "set-pixelsize",
867+ G_CALLBACK(cb_set_pixelsize), self);
862868 g_signal_connect(selfp->w_imgv, "button-press-event",
863869 G_CALLBACK(cb_button_press_event), self);
864870 g_signal_connect(selfp->w_imgv, "button-release-event",
@@ -1063,7 +1069,7 @@ class Giv:Win from Gtk:Window
10631069 }
10641070
10651071 selfp->idle_index = selfp->filename_list_index;
1066- selfp->do_fit_on_load_image = TRUE ;
1072+ selfp->do_fit_on_load_image = FALSE ;
10671073 selfp->idle_handle = g_idle_add(cb_load_image_when_idle,
10681074 self);
10691075#if 0
@@ -2122,9 +2128,9 @@ cb_motion_event(GtkWidget *widget,
21222128 do_update_label = false;
21232129 }
21242130 else if (selfp->do_show_sub_pixel)
2125- g_string_sprintf (info_label, " (%7.3f, %7.3f)", x, y);
2131+ g_string_printf (info_label, " (%7.3f, %7.3f)", x, y);
21262132 else
2127- g_string_sprintf (info_label, " (%4.0f, %4.0f)", floor(x), floor(y));
2133+ g_string_printf (info_label, " (%4.0f, %4.0f)", floor(x), floor(y));
21282134
21292135 if (do_update_measure_distance) {
21302136 double m_dist = sqrt(sqr(selfp->measure_x2 - selfp->measure_x1)
@@ -2153,11 +2159,11 @@ cb_motion_event(GtkWidget *widget,
21532159 // TBD - clean this up so it works for arbitrary size date
21542160 double val = giv_image_get_value(selfp->img_org,
21552161 (int)x, (int)y, selfp->current_slice);
2156- g_string_sprintfa (info_label, " [");
2157- g_string_sprintfa (info_label,
2162+ g_string_append_printf (info_label, " [");
2163+ g_string_append_printf (info_label,
21582164 selfp->format,
21592165 val);
2160- g_string_sprintfa (info_label,
2166+ g_string_append_printf (info_label,
21612167 "] = #%02X",
21622168 (int)val);
21632169 if (selfp->w_contrast_view)
@@ -2168,7 +2174,7 @@ cb_motion_event(GtkWidget *widget,
21682174 || selfp->img_org->img_type == GIVIMAGE_RGBA_U16) {
21692175 GivImageRgbAlpha16 rgba = giv_image_get_rgba_value(selfp->img_org,
21702176 (int)x, (int)y, selfp->current_slice);
2171- g_string_sprintfa (info_label,
2177+ g_string_append_printf (info_label,
21722178 " [%3d %3d %3d %3d] = #%08lX",
21732179 rgba.red, rgba.green, rgba.blue, rgba.alpha,
21742180 (unsigned long)(rgba.red<<24)
@@ -2179,7 +2185,7 @@ cb_motion_event(GtkWidget *widget,
21792185 else {
21802186 GivImageRgb16 rgb = giv_image_get_rgb_value(selfp->img_org,
21812187 (int)x, (int)y, 0);
2182- g_string_sprintfa (info_label,
2188+ g_string_append_printf (info_label,
21832189 " [%3d %3d %3d] = #%6X",
21842190 rgb.red, rgb.green, rgb.blue,
21852191 (int)(rgb.red<<16) + (rgb.green<<8) + rgb.blue);
@@ -3669,6 +3675,19 @@ static void cb_image_reference(GtkWidget *widget,
36693675
36703676}
36713677
3678+ // Update the pixel size from the giv file
3679+ static void cb_set_pixelsize(GtkWidget *widget,
3680+ double pixelsize,
3681+ const gchar *pixelsize_unit,
3682+ gpointer user_data)
3683+ {
3684+ GivWin *self = (GivWin *)user_data;
3685+ selfp->pixelsize = pixelsize;
3686+ if (selfp->pixelsize_unit)
3687+ g_free(selfp->pixelsize_unit);
3688+ selfp->pixelsize_unit = g_strdup(pixelsize_unit);
3689+ }
3690+
36723691#if 0
36733692static void cb_set_orientation(giv_parser_orientation_t hflip,
36743693 giv_parser_orientation_t vflip,
0 commit comments