From 77f4d4abec3e9ad553bcc67c87d50838f0cef875 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 3 Mar 1999 17:48:29 +0000 Subject: [PATCH] More unit/resolution stuff (most if it from Michael). --Sven --- ChangeLog | 16 +++++++++++++ app/blend.c | 26 +++++++++++++++++---- app/core/gimpdrawable-blend.c | 26 +++++++++++++++++---- app/core/gimpimage-guides.c | 7 +++--- app/core/gimpimage-merge.c | 7 +++--- app/core/gimpimage-projection.c | 7 +++--- app/core/gimpimage-resize.c | 7 +++--- app/core/gimpimage-scale.c | 7 +++--- app/core/gimpimage.c | 7 +++--- app/core/gimpprojection-construct.c | 7 +++--- app/core/gimpprojection.c | 21 +++++++++-------- app/crop.c | 25 +++++++++++++++++---- app/dialogs/image-new-dialog.c | 35 ++++++++++------------------- app/display/gimpdisplay.c | 21 +++++++++-------- app/edit_selection.c | 25 ++++++++++++++++++--- app/file_new_dialog.c | 35 ++++++++++------------------- app/gdisplay.c | 21 +++++++++-------- app/gimpimage.c | 7 +++--- app/gui/file-new-dialog.c | 35 ++++++++++------------------- app/rect_select.c | 21 +++++++++++++++-- app/tools/blend.c | 26 +++++++++++++++++---- app/tools/crop.c | 25 +++++++++++++++++---- app/tools/edit_selection.c | 25 ++++++++++++++++++--- app/tools/gimpblendtool.c | 26 +++++++++++++++++---- app/tools/gimpcroptool.c | 25 +++++++++++++++++---- app/tools/gimpeditselectiontool.c | 25 ++++++++++++++++++--- app/tools/gimprectselecttool.c | 21 +++++++++++++++-- app/tools/rect_select.c | 21 +++++++++++++++-- 28 files changed, 394 insertions(+), 163 deletions(-) diff --git a/ChangeLog b/ChangeLog index 649306fed9..1ac2f45c53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Wed Mar 3 18:38:31 MET 1999 Sven Neumann + + More unit/resolution stuff (most of it from Michael). + + * app/gimpimage.c: use defaults from gimprc + + * app/gdisplay.c: a new format_string for coordinates + + * blend.c + * crop.c + * edit_selection.c + * rect_select.c: use the new format when displaying sizes + in the statusbar + + * file_new_dialog.c: cleaned up the advanced/simple cases + Wed Mar 3 17:59:09 MET 1999 Sven Neumann * gimprc.5.in diff --git a/app/blend.c b/app/blend.c index 4e90d25664..78c41c1ea6 100644 --- a/app/blend.c +++ b/app/blend.c @@ -711,10 +711,28 @@ blend_motion (Tool *tool, &blend_tool->endx, &blend_tool->endy, FALSE, 1); gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id); - g_snprintf (vector, STATUSBAR_SIZE, _("Blend: %d, %d"), - abs(blend_tool->endx - blend_tool->startx), - abs(blend_tool->endy - blend_tool->starty)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, vector); + if (gdisp->dot_for_dot) + { + g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Blend: "), + abs(blend_tool->endx - blend_tool->startx), + ", ", + abs(blend_tool->endy - blend_tool->starty)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Blend: "), + abs(blend_tool->endx - blend_tool->startx) * unit_factor / + gdisp->gimage->xresolution, + ", ", + abs(blend_tool->endy - blend_tool->starty) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, + vector); /* redraw the current tool */ draw_core_resume (blend_tool->core, tool); diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index 4e90d25664..78c41c1ea6 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -711,10 +711,28 @@ blend_motion (Tool *tool, &blend_tool->endx, &blend_tool->endy, FALSE, 1); gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id); - g_snprintf (vector, STATUSBAR_SIZE, _("Blend: %d, %d"), - abs(blend_tool->endx - blend_tool->startx), - abs(blend_tool->endy - blend_tool->starty)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, vector); + if (gdisp->dot_for_dot) + { + g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Blend: "), + abs(blend_tool->endx - blend_tool->startx), + ", ", + abs(blend_tool->endy - blend_tool->starty)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Blend: "), + abs(blend_tool->endx - blend_tool->startx) * unit_factor / + gdisp->gimage->xresolution, + ", ", + abs(blend_tool->endy - blend_tool->starty) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, + vector); /* redraw the current tool */ draw_core_resume (blend_tool->core, tool); diff --git a/app/core/gimpimage-guides.c b/app/core/gimpimage-guides.c index c2bc1a85d6..0f3bd68860 100644 --- a/app/core/gimpimage-guides.c +++ b/app/core/gimpimage-guides.c @@ -31,6 +31,7 @@ #include "undo.h" #include "gimpsignal.h" #include "gimpparasite.h" +#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview = NULL; gimage->parasites = parasite_list_new(); gimp_matrix_identity(gimage->transform); - gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */ - gimage->yresolution = 72.0; - gimage->unit = UNIT_PIXEL; + gimage->xresolution = default_xresolution; + gimage->yresolution = default_yresolution; + gimage->unit = default_units; gimage->save_proc= NULL; } diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index c2bc1a85d6..0f3bd68860 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -31,6 +31,7 @@ #include "undo.h" #include "gimpsignal.h" #include "gimpparasite.h" +#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview = NULL; gimage->parasites = parasite_list_new(); gimp_matrix_identity(gimage->transform); - gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */ - gimage->yresolution = 72.0; - gimage->unit = UNIT_PIXEL; + gimage->xresolution = default_xresolution; + gimage->yresolution = default_yresolution; + gimage->unit = default_units; gimage->save_proc= NULL; } diff --git a/app/core/gimpimage-projection.c b/app/core/gimpimage-projection.c index c2bc1a85d6..0f3bd68860 100644 --- a/app/core/gimpimage-projection.c +++ b/app/core/gimpimage-projection.c @@ -31,6 +31,7 @@ #include "undo.h" #include "gimpsignal.h" #include "gimpparasite.h" +#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview = NULL; gimage->parasites = parasite_list_new(); gimp_matrix_identity(gimage->transform); - gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */ - gimage->yresolution = 72.0; - gimage->unit = UNIT_PIXEL; + gimage->xresolution = default_xresolution; + gimage->yresolution = default_yresolution; + gimage->unit = default_units; gimage->save_proc= NULL; } diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index c2bc1a85d6..0f3bd68860 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -31,6 +31,7 @@ #include "undo.h" #include "gimpsignal.h" #include "gimpparasite.h" +#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview = NULL; gimage->parasites = parasite_list_new(); gimp_matrix_identity(gimage->transform); - gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */ - gimage->yresolution = 72.0; - gimage->unit = UNIT_PIXEL; + gimage->xresolution = default_xresolution; + gimage->yresolution = default_yresolution; + gimage->unit = default_units; gimage->save_proc= NULL; } diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index c2bc1a85d6..0f3bd68860 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -31,6 +31,7 @@ #include "undo.h" #include "gimpsignal.h" #include "gimpparasite.h" +#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview = NULL; gimage->parasites = parasite_list_new(); gimp_matrix_identity(gimage->transform); - gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */ - gimage->yresolution = 72.0; - gimage->unit = UNIT_PIXEL; + gimage->xresolution = default_xresolution; + gimage->yresolution = default_yresolution; + gimage->unit = default_units; gimage->save_proc= NULL; } diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index c2bc1a85d6..0f3bd68860 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -31,6 +31,7 @@ #include "undo.h" #include "gimpsignal.h" #include "gimpparasite.h" +#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview = NULL; gimage->parasites = parasite_list_new(); gimp_matrix_identity(gimage->transform); - gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */ - gimage->yresolution = 72.0; - gimage->unit = UNIT_PIXEL; + gimage->xresolution = default_xresolution; + gimage->yresolution = default_yresolution; + gimage->unit = default_units; gimage->save_proc= NULL; } diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index c2bc1a85d6..0f3bd68860 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -31,6 +31,7 @@ #include "undo.h" #include "gimpsignal.h" #include "gimpparasite.h" +#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview = NULL; gimage->parasites = parasite_list_new(); gimp_matrix_identity(gimage->transform); - gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */ - gimage->yresolution = 72.0; - gimage->unit = UNIT_PIXEL; + gimage->xresolution = default_xresolution; + gimage->yresolution = default_yresolution; + gimage->unit = default_units; gimage->save_proc= NULL; } diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index d3477977b5..ab3902cfec 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -1015,7 +1015,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) if (gdisp->dot_for_dot) { g_snprintf (buffer, CURSOR_STR_LENGTH, - gdisp->cursor_format_str, t_x, t_y); + gdisp->cursor_format_str, "", t_x, ", ", t_y); } else /* show real world units */ { @@ -1023,9 +1023,10 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) g_snprintf (buffer, CURSOR_STR_LENGTH, gdisp->cursor_format_str, + "", (float)t_x * unit_factor / gdisp->gimage->xresolution, - (float)t_y * unit_factor / gdisp->gimage->yresolution, - gimp_unit_get_symbol (gdisp->gimage->unit)); + ", ", + (float)t_y * unit_factor / gdisp->gimage->yresolution); } gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer); } @@ -1064,25 +1065,27 @@ gdisplay_resize_cursor_label (GDisplay *gdisp) if (gdisp->dot_for_dot) { g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str), - "%%d, %%d"); + "%%s%%d%%s%%d"); g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str, - gdisp->gimage->width, gdisp->gimage->height); + "", gdisp->gimage->width, ", ", gdisp->gimage->height); } else /* show real world units */ { float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str), - "%%.%df, %%.%df %%s", + "%%s%%.%df%%s%%.%df %s", gimp_unit_get_digits (gdisp->gimage->unit), - gimp_unit_get_digits (gdisp->gimage->unit)); + gimp_unit_get_digits (gdisp->gimage->unit), + gimp_unit_get_symbol (gdisp->gimage->unit)); g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str, + "", (float)gdisp->gimage->width * unit_factor / gdisp->gimage->xresolution, + ", ", (float)gdisp->gimage->height * unit_factor / - gdisp->gimage->yresolution, - gimp_unit_get_symbol (gdisp->gimage->unit)); + gdisp->gimage->yresolution); } cursor_label_width = gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer ); diff --git a/app/crop.c b/app/crop.c index 6f647ff1e0..d70d37545a 100644 --- a/app/crop.c +++ b/app/crop.c @@ -405,11 +405,28 @@ crop_motion (Tool *tool, crop->function == RESIZING_LEFT || crop->function == RESIZING_RIGHT) { gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), crop->context_id); - g_snprintf (size, STATUSBAR_SIZE, _("Crop: %d x %d"), - (crop->tx2 - crop->tx1), (crop->ty2 - crop->ty1)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id, size); + if (gdisp->dot_for_dot) + { + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Crop: "), + (crop->tx2 - crop->tx1), " x ", (crop->ty2 - crop->ty1)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Crop: "), + (float)(crop->tx2 - crop->tx1) * unit_factor / + gdisp->gimage->xresolution, + " x ", + (float)(crop->ty2 - crop->ty1) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id, + size); } - + draw_core_resume (crop->core, tool); } diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c index fbcc40261d..85a29cddfb 100644 --- a/app/dialogs/image-new-dialog.c +++ b/app/dialogs/image-new-dialog.c @@ -264,7 +264,6 @@ file_new_cmd_callback (GtkWidget *widget, GtkWidget *frame; GtkWidget *radio_box; gboolean advanced_options = FALSE; - GtkWidget *advanced_button; GSList *group; if(!new_dialog_run) @@ -312,7 +311,7 @@ file_new_cmd_callback (GtkWidget *widget, vals->res_unit = last_res_unit; } - if (vals->xresolution != vals->yresolution) + if (ABS (vals->xresolution - vals->yresolution) > 1e-5) advanced_options = TRUE; if (vals->type == INDEXED) @@ -419,8 +418,6 @@ file_new_cmd_callback (GtkWidget *widget, gtk_signal_connect (GTK_OBJECT (vals->simple_res), "value_changed", (GtkSignalFunc)file_new_resolution_callback, vals); gtk_box_pack_start (GTK_BOX (vbox2), vals->simple_res, TRUE, TRUE, 0); - if (!advanced_options) - gtk_widget_show (vals->simple_res); /* the advanced resolution stuff (not shown by default, but used to keep track of all the variables) */ @@ -444,7 +441,8 @@ file_new_cmd_callback (GtkWidget *widget, gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), _("pixels per "), 2, 3, 0.0); vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_BOTTOM); - gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE); + if (ABS (vals->xresolution - vals->yresolution) < 1e-5) + gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE); gtk_table_attach_defaults (GTK_TABLE (vals->resolution_sizeentry), vals->couple_resolutions, 1, 3, 3, 4); gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "value_changed", @@ -453,29 +451,20 @@ file_new_cmd_callback (GtkWidget *widget, (GtkSignalFunc)file_new_resolution_callback, vals); gtk_box_pack_start (GTK_BOX (vbox2), vals->resolution_sizeentry, TRUE, TRUE, 0); - if (advanced_options) + if (advanced_options != FALSE) { gtk_widget_show (vals->resolution_sizeentry); gtk_widget_show (vals->couple_resolutions); + } else { + gtk_widget_show (vals->simple_res); + button = gtk_button_new_with_label (_("Advanced options >>")); + gtk_box_pack_start (GTK_BOX (vbox2), button, + FALSE, FALSE, 0); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc)file_new_advanced_res_callback, vals); + gtk_widget_show (button); } - /* This code is commented out since it seems to be overkill... - * vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes")); - * gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE); - * gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0); - * gtk_widget_show (vals->change_size); - */ - - if (advanced_options) - advanced_button = gtk_button_new_with_label (_("Advanced options <<")); - else - advanced_button = gtk_button_new_with_label (_("Advanced options >>")); - gtk_box_pack_start (GTK_BOX (vbox2), advanced_button, - FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked", - (GtkSignalFunc)file_new_advanced_res_callback, vals); - gtk_widget_show (advanced_button); - /* hbox containing the Image type and fill type frames */ hbox = gtk_hbox_new(FALSE, 1); gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index d3477977b5..ab3902cfec 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -1015,7 +1015,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) if (gdisp->dot_for_dot) { g_snprintf (buffer, CURSOR_STR_LENGTH, - gdisp->cursor_format_str, t_x, t_y); + gdisp->cursor_format_str, "", t_x, ", ", t_y); } else /* show real world units */ { @@ -1023,9 +1023,10 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) g_snprintf (buffer, CURSOR_STR_LENGTH, gdisp->cursor_format_str, + "", (float)t_x * unit_factor / gdisp->gimage->xresolution, - (float)t_y * unit_factor / gdisp->gimage->yresolution, - gimp_unit_get_symbol (gdisp->gimage->unit)); + ", ", + (float)t_y * unit_factor / gdisp->gimage->yresolution); } gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer); } @@ -1064,25 +1065,27 @@ gdisplay_resize_cursor_label (GDisplay *gdisp) if (gdisp->dot_for_dot) { g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str), - "%%d, %%d"); + "%%s%%d%%s%%d"); g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str, - gdisp->gimage->width, gdisp->gimage->height); + "", gdisp->gimage->width, ", ", gdisp->gimage->height); } else /* show real world units */ { float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str), - "%%.%df, %%.%df %%s", + "%%s%%.%df%%s%%.%df %s", gimp_unit_get_digits (gdisp->gimage->unit), - gimp_unit_get_digits (gdisp->gimage->unit)); + gimp_unit_get_digits (gdisp->gimage->unit), + gimp_unit_get_symbol (gdisp->gimage->unit)); g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str, + "", (float)gdisp->gimage->width * unit_factor / gdisp->gimage->xresolution, + ", ", (float)gdisp->gimage->height * unit_factor / - gdisp->gimage->yresolution, - gimp_unit_get_symbol (gdisp->gimage->unit)); + gdisp->gimage->yresolution); } cursor_label_width = gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer ); diff --git a/app/edit_selection.c b/app/edit_selection.c index f7eab848cf..98ba24eb6a 100644 --- a/app/edit_selection.c +++ b/app/edit_selection.c @@ -345,9 +345,28 @@ edit_selection_motion (Tool *tool, #endif gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id); - g_snprintf (offset, STATUSBAR_SIZE, _("Move: %d, %d"), - (edit_select.x - edit_select.origx), (edit_select.y - edit_select.origy)); - gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id, offset); + if (gdisp->dot_for_dot) + { + g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Move: "), + (edit_select.x - edit_select.origx), + ", ", + (edit_select.y - edit_select.origy)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Move: "), + (edit_select.x - edit_select.origx) * unit_factor / + gdisp->gimage->xresolution, + ", ", + (edit_select.y - edit_select.origy) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id, + offset); draw_core_resume (edit_select.core, tool); } diff --git a/app/file_new_dialog.c b/app/file_new_dialog.c index fbcc40261d..85a29cddfb 100644 --- a/app/file_new_dialog.c +++ b/app/file_new_dialog.c @@ -264,7 +264,6 @@ file_new_cmd_callback (GtkWidget *widget, GtkWidget *frame; GtkWidget *radio_box; gboolean advanced_options = FALSE; - GtkWidget *advanced_button; GSList *group; if(!new_dialog_run) @@ -312,7 +311,7 @@ file_new_cmd_callback (GtkWidget *widget, vals->res_unit = last_res_unit; } - if (vals->xresolution != vals->yresolution) + if (ABS (vals->xresolution - vals->yresolution) > 1e-5) advanced_options = TRUE; if (vals->type == INDEXED) @@ -419,8 +418,6 @@ file_new_cmd_callback (GtkWidget *widget, gtk_signal_connect (GTK_OBJECT (vals->simple_res), "value_changed", (GtkSignalFunc)file_new_resolution_callback, vals); gtk_box_pack_start (GTK_BOX (vbox2), vals->simple_res, TRUE, TRUE, 0); - if (!advanced_options) - gtk_widget_show (vals->simple_res); /* the advanced resolution stuff (not shown by default, but used to keep track of all the variables) */ @@ -444,7 +441,8 @@ file_new_cmd_callback (GtkWidget *widget, gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), _("pixels per "), 2, 3, 0.0); vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_BOTTOM); - gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE); + if (ABS (vals->xresolution - vals->yresolution) < 1e-5) + gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE); gtk_table_attach_defaults (GTK_TABLE (vals->resolution_sizeentry), vals->couple_resolutions, 1, 3, 3, 4); gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "value_changed", @@ -453,29 +451,20 @@ file_new_cmd_callback (GtkWidget *widget, (GtkSignalFunc)file_new_resolution_callback, vals); gtk_box_pack_start (GTK_BOX (vbox2), vals->resolution_sizeentry, TRUE, TRUE, 0); - if (advanced_options) + if (advanced_options != FALSE) { gtk_widget_show (vals->resolution_sizeentry); gtk_widget_show (vals->couple_resolutions); + } else { + gtk_widget_show (vals->simple_res); + button = gtk_button_new_with_label (_("Advanced options >>")); + gtk_box_pack_start (GTK_BOX (vbox2), button, + FALSE, FALSE, 0); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc)file_new_advanced_res_callback, vals); + gtk_widget_show (button); } - /* This code is commented out since it seems to be overkill... - * vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes")); - * gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE); - * gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0); - * gtk_widget_show (vals->change_size); - */ - - if (advanced_options) - advanced_button = gtk_button_new_with_label (_("Advanced options <<")); - else - advanced_button = gtk_button_new_with_label (_("Advanced options >>")); - gtk_box_pack_start (GTK_BOX (vbox2), advanced_button, - FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked", - (GtkSignalFunc)file_new_advanced_res_callback, vals); - gtk_widget_show (advanced_button); - /* hbox containing the Image type and fill type frames */ hbox = gtk_hbox_new(FALSE, 1); gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); diff --git a/app/gdisplay.c b/app/gdisplay.c index d3477977b5..ab3902cfec 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -1015,7 +1015,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) if (gdisp->dot_for_dot) { g_snprintf (buffer, CURSOR_STR_LENGTH, - gdisp->cursor_format_str, t_x, t_y); + gdisp->cursor_format_str, "", t_x, ", ", t_y); } else /* show real world units */ { @@ -1023,9 +1023,10 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) g_snprintf (buffer, CURSOR_STR_LENGTH, gdisp->cursor_format_str, + "", (float)t_x * unit_factor / gdisp->gimage->xresolution, - (float)t_y * unit_factor / gdisp->gimage->yresolution, - gimp_unit_get_symbol (gdisp->gimage->unit)); + ", ", + (float)t_y * unit_factor / gdisp->gimage->yresolution); } gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer); } @@ -1064,25 +1065,27 @@ gdisplay_resize_cursor_label (GDisplay *gdisp) if (gdisp->dot_for_dot) { g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str), - "%%d, %%d"); + "%%s%%d%%s%%d"); g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str, - gdisp->gimage->width, gdisp->gimage->height); + "", gdisp->gimage->width, ", ", gdisp->gimage->height); } else /* show real world units */ { float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str), - "%%.%df, %%.%df %%s", + "%%s%%.%df%%s%%.%df %s", gimp_unit_get_digits (gdisp->gimage->unit), - gimp_unit_get_digits (gdisp->gimage->unit)); + gimp_unit_get_digits (gdisp->gimage->unit), + gimp_unit_get_symbol (gdisp->gimage->unit)); g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str, + "", (float)gdisp->gimage->width * unit_factor / gdisp->gimage->xresolution, + ", ", (float)gdisp->gimage->height * unit_factor / - gdisp->gimage->yresolution, - gimp_unit_get_symbol (gdisp->gimage->unit)); + gdisp->gimage->yresolution); } cursor_label_width = gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer ); diff --git a/app/gimpimage.c b/app/gimpimage.c index c2bc1a85d6..0f3bd68860 100644 --- a/app/gimpimage.c +++ b/app/gimpimage.c @@ -31,6 +31,7 @@ #include "undo.h" #include "gimpsignal.h" #include "gimpparasite.h" +#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview = NULL; gimage->parasites = parasite_list_new(); gimp_matrix_identity(gimage->transform); - gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */ - gimage->yresolution = 72.0; - gimage->unit = UNIT_PIXEL; + gimage->xresolution = default_xresolution; + gimage->yresolution = default_yresolution; + gimage->unit = default_units; gimage->save_proc= NULL; } diff --git a/app/gui/file-new-dialog.c b/app/gui/file-new-dialog.c index fbcc40261d..85a29cddfb 100644 --- a/app/gui/file-new-dialog.c +++ b/app/gui/file-new-dialog.c @@ -264,7 +264,6 @@ file_new_cmd_callback (GtkWidget *widget, GtkWidget *frame; GtkWidget *radio_box; gboolean advanced_options = FALSE; - GtkWidget *advanced_button; GSList *group; if(!new_dialog_run) @@ -312,7 +311,7 @@ file_new_cmd_callback (GtkWidget *widget, vals->res_unit = last_res_unit; } - if (vals->xresolution != vals->yresolution) + if (ABS (vals->xresolution - vals->yresolution) > 1e-5) advanced_options = TRUE; if (vals->type == INDEXED) @@ -419,8 +418,6 @@ file_new_cmd_callback (GtkWidget *widget, gtk_signal_connect (GTK_OBJECT (vals->simple_res), "value_changed", (GtkSignalFunc)file_new_resolution_callback, vals); gtk_box_pack_start (GTK_BOX (vbox2), vals->simple_res, TRUE, TRUE, 0); - if (!advanced_options) - gtk_widget_show (vals->simple_res); /* the advanced resolution stuff (not shown by default, but used to keep track of all the variables) */ @@ -444,7 +441,8 @@ file_new_cmd_callback (GtkWidget *widget, gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), _("pixels per "), 2, 3, 0.0); vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_BOTTOM); - gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE); + if (ABS (vals->xresolution - vals->yresolution) < 1e-5) + gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE); gtk_table_attach_defaults (GTK_TABLE (vals->resolution_sizeentry), vals->couple_resolutions, 1, 3, 3, 4); gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "value_changed", @@ -453,29 +451,20 @@ file_new_cmd_callback (GtkWidget *widget, (GtkSignalFunc)file_new_resolution_callback, vals); gtk_box_pack_start (GTK_BOX (vbox2), vals->resolution_sizeentry, TRUE, TRUE, 0); - if (advanced_options) + if (advanced_options != FALSE) { gtk_widget_show (vals->resolution_sizeentry); gtk_widget_show (vals->couple_resolutions); + } else { + gtk_widget_show (vals->simple_res); + button = gtk_button_new_with_label (_("Advanced options >>")); + gtk_box_pack_start (GTK_BOX (vbox2), button, + FALSE, FALSE, 0); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc)file_new_advanced_res_callback, vals); + gtk_widget_show (button); } - /* This code is commented out since it seems to be overkill... - * vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes")); - * gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE); - * gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0); - * gtk_widget_show (vals->change_size); - */ - - if (advanced_options) - advanced_button = gtk_button_new_with_label (_("Advanced options <<")); - else - advanced_button = gtk_button_new_with_label (_("Advanced options >>")); - gtk_box_pack_start (GTK_BOX (vbox2), advanced_button, - FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked", - (GtkSignalFunc)file_new_advanced_res_callback, vals); - gtk_widget_show (advanced_button); - /* hbox containing the Image type and fill type frames */ hbox = gtk_hbox_new(FALSE, 1); gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); diff --git a/app/rect_select.c b/app/rect_select.c index 5021e44fcc..0f0637546d 100644 --- a/app/rect_select.c +++ b/app/rect_select.c @@ -605,8 +605,25 @@ rect_select_motion (Tool *tool, } gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id); - g_snprintf (size, STATUSBAR_SIZE, _("Selection: %d x %d"), abs(rect_sel->w), abs(rect_sel->h)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id, size); + if (gdisp->dot_for_dot) + { + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Selection: "), abs(rect_sel->w), " x ", abs(rect_sel->h)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Selection: "), + (float)abs(rect_sel->w) * unit_factor / + gdisp->gimage->xresolution, + " x ", + (float)abs(rect_sel->h) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id, + size); draw_core_resume (rect_sel->core, tool); } diff --git a/app/tools/blend.c b/app/tools/blend.c index 4e90d25664..78c41c1ea6 100644 --- a/app/tools/blend.c +++ b/app/tools/blend.c @@ -711,10 +711,28 @@ blend_motion (Tool *tool, &blend_tool->endx, &blend_tool->endy, FALSE, 1); gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id); - g_snprintf (vector, STATUSBAR_SIZE, _("Blend: %d, %d"), - abs(blend_tool->endx - blend_tool->startx), - abs(blend_tool->endy - blend_tool->starty)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, vector); + if (gdisp->dot_for_dot) + { + g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Blend: "), + abs(blend_tool->endx - blend_tool->startx), + ", ", + abs(blend_tool->endy - blend_tool->starty)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Blend: "), + abs(blend_tool->endx - blend_tool->startx) * unit_factor / + gdisp->gimage->xresolution, + ", ", + abs(blend_tool->endy - blend_tool->starty) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, + vector); /* redraw the current tool */ draw_core_resume (blend_tool->core, tool); diff --git a/app/tools/crop.c b/app/tools/crop.c index 6f647ff1e0..d70d37545a 100644 --- a/app/tools/crop.c +++ b/app/tools/crop.c @@ -405,11 +405,28 @@ crop_motion (Tool *tool, crop->function == RESIZING_LEFT || crop->function == RESIZING_RIGHT) { gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), crop->context_id); - g_snprintf (size, STATUSBAR_SIZE, _("Crop: %d x %d"), - (crop->tx2 - crop->tx1), (crop->ty2 - crop->ty1)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id, size); + if (gdisp->dot_for_dot) + { + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Crop: "), + (crop->tx2 - crop->tx1), " x ", (crop->ty2 - crop->ty1)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Crop: "), + (float)(crop->tx2 - crop->tx1) * unit_factor / + gdisp->gimage->xresolution, + " x ", + (float)(crop->ty2 - crop->ty1) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id, + size); } - + draw_core_resume (crop->core, tool); } diff --git a/app/tools/edit_selection.c b/app/tools/edit_selection.c index f7eab848cf..98ba24eb6a 100644 --- a/app/tools/edit_selection.c +++ b/app/tools/edit_selection.c @@ -345,9 +345,28 @@ edit_selection_motion (Tool *tool, #endif gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id); - g_snprintf (offset, STATUSBAR_SIZE, _("Move: %d, %d"), - (edit_select.x - edit_select.origx), (edit_select.y - edit_select.origy)); - gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id, offset); + if (gdisp->dot_for_dot) + { + g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Move: "), + (edit_select.x - edit_select.origx), + ", ", + (edit_select.y - edit_select.origy)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Move: "), + (edit_select.x - edit_select.origx) * unit_factor / + gdisp->gimage->xresolution, + ", ", + (edit_select.y - edit_select.origy) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id, + offset); draw_core_resume (edit_select.core, tool); } diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index 4e90d25664..78c41c1ea6 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -711,10 +711,28 @@ blend_motion (Tool *tool, &blend_tool->endx, &blend_tool->endy, FALSE, 1); gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id); - g_snprintf (vector, STATUSBAR_SIZE, _("Blend: %d, %d"), - abs(blend_tool->endx - blend_tool->startx), - abs(blend_tool->endy - blend_tool->starty)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, vector); + if (gdisp->dot_for_dot) + { + g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Blend: "), + abs(blend_tool->endx - blend_tool->startx), + ", ", + abs(blend_tool->endy - blend_tool->starty)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Blend: "), + abs(blend_tool->endx - blend_tool->startx) * unit_factor / + gdisp->gimage->xresolution, + ", ", + abs(blend_tool->endy - blend_tool->starty) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, + vector); /* redraw the current tool */ draw_core_resume (blend_tool->core, tool); diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c index 6f647ff1e0..d70d37545a 100644 --- a/app/tools/gimpcroptool.c +++ b/app/tools/gimpcroptool.c @@ -405,11 +405,28 @@ crop_motion (Tool *tool, crop->function == RESIZING_LEFT || crop->function == RESIZING_RIGHT) { gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), crop->context_id); - g_snprintf (size, STATUSBAR_SIZE, _("Crop: %d x %d"), - (crop->tx2 - crop->tx1), (crop->ty2 - crop->ty1)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id, size); + if (gdisp->dot_for_dot) + { + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Crop: "), + (crop->tx2 - crop->tx1), " x ", (crop->ty2 - crop->ty1)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Crop: "), + (float)(crop->tx2 - crop->tx1) * unit_factor / + gdisp->gimage->xresolution, + " x ", + (float)(crop->ty2 - crop->ty1) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id, + size); } - + draw_core_resume (crop->core, tool); } diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index f7eab848cf..98ba24eb6a 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -345,9 +345,28 @@ edit_selection_motion (Tool *tool, #endif gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id); - g_snprintf (offset, STATUSBAR_SIZE, _("Move: %d, %d"), - (edit_select.x - edit_select.origx), (edit_select.y - edit_select.origy)); - gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id, offset); + if (gdisp->dot_for_dot) + { + g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Move: "), + (edit_select.x - edit_select.origx), + ", ", + (edit_select.y - edit_select.origy)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Move: "), + (edit_select.x - edit_select.origx) * unit_factor / + gdisp->gimage->xresolution, + ", ", + (edit_select.y - edit_select.origy) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id, + offset); draw_core_resume (edit_select.core, tool); } diff --git a/app/tools/gimprectselecttool.c b/app/tools/gimprectselecttool.c index 5021e44fcc..0f0637546d 100644 --- a/app/tools/gimprectselecttool.c +++ b/app/tools/gimprectselecttool.c @@ -605,8 +605,25 @@ rect_select_motion (Tool *tool, } gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id); - g_snprintf (size, STATUSBAR_SIZE, _("Selection: %d x %d"), abs(rect_sel->w), abs(rect_sel->h)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id, size); + if (gdisp->dot_for_dot) + { + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Selection: "), abs(rect_sel->w), " x ", abs(rect_sel->h)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Selection: "), + (float)abs(rect_sel->w) * unit_factor / + gdisp->gimage->xresolution, + " x ", + (float)abs(rect_sel->h) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id, + size); draw_core_resume (rect_sel->core, tool); } diff --git a/app/tools/rect_select.c b/app/tools/rect_select.c index 5021e44fcc..0f0637546d 100644 --- a/app/tools/rect_select.c +++ b/app/tools/rect_select.c @@ -605,8 +605,25 @@ rect_select_motion (Tool *tool, } gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id); - g_snprintf (size, STATUSBAR_SIZE, _("Selection: %d x %d"), abs(rect_sel->w), abs(rect_sel->h)); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id, size); + if (gdisp->dot_for_dot) + { + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Selection: "), abs(rect_sel->w), " x ", abs(rect_sel->h)); + } + else /* show real world units */ + { + float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); + + g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str, + _("Selection: "), + (float)abs(rect_sel->w) * unit_factor / + gdisp->gimage->xresolution, + " x ", + (float)abs(rect_sel->h) * unit_factor / + gdisp->gimage->yresolution); + } + gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id, + size); draw_core_resume (rect_sel->core, tool); }