diff --git a/ChangeLog b/ChangeLog index 2cf5e417d3..e4d35a2acf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-08-18 Sven Neumann + + * app/core/gimptemplate.c: go back to using dpi as the default + resolution unit. + + * app/core/gimp-utils.[ch]: moved the code to determine the unit + from the locale settings here as gimp_get_default_unit(). + + * app/dialogs/print-size-dialog.c + * app/widgets/gimpimagepropview.c: use the unit returned by the + new function to display the print size (bug #107497). + 2005-08-18 Sven Neumann * plug-ins/common/procedure-browser.c (run): reverted last change. diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c index ba5d41ccd9..4b774ca049 100644 --- a/app/core/gimp-utils.c +++ b/app/core/gimp-utils.c @@ -22,6 +22,10 @@ #include #include +#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT +#include +#endif + #include #include @@ -195,6 +199,25 @@ gimp_get_default_language (const gchar *category) return lang; } +GimpUnit +gimp_get_default_unit (void) +{ +#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT + const gchar *measurement = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT); + + switch (*((guchar *) measurement)) + { + case 1: /* metric */ + return GIMP_UNIT_MM; + + case 2: /* imperial */ + return GIMP_UNIT_INCH; + } +#endif + + return GIMP_UNIT_INCH; +} + gboolean gimp_boolean_handled_accum (GSignalInvocationHint *ihint, GValue *return_accu, diff --git a/app/core/gimp-utils.h b/app/core/gimp-utils.h index f6e0a4efeb..55d3d3397a 100644 --- a/app/core/gimp-utils.h +++ b/app/core/gimp-utils.h @@ -42,6 +42,7 @@ gint64 gimp_g_list_get_memsize (GList *list, gint64 gimp_g_value_get_memsize (GValue *value); gchar * gimp_get_default_language (const gchar *category); +GimpUnit gimp_get_default_unit (void); gboolean gimp_boolean_handled_accum (GSignalInvocationHint *ihint, GValue *return_accu, diff --git a/app/core/gimptemplate.c b/app/core/gimptemplate.c index 948362ac7b..69a09d1ea8 100644 --- a/app/core/gimptemplate.c +++ b/app/core/gimptemplate.c @@ -22,7 +22,6 @@ #include "config.h" #include -#include #include @@ -70,20 +69,19 @@ enum }; -static void gimp_template_class_init (GimpTemplateClass *klass); +static void gimp_template_class_init (GimpTemplateClass *klass); -static void gimp_template_finalize (GObject *object); -static void gimp_template_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_template_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); -static void gimp_template_notify (GObject *object, - GParamSpec *pspec); -static GimpUnit gimp_template_unit_from_locale (void); +static void gimp_template_finalize (GObject *object); +static void gimp_template_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_template_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); +static void gimp_template_notify (GObject *object, + GParamSpec *pspec); static GimpViewableClass *parent_class = NULL; @@ -174,8 +172,7 @@ gimp_template_class_init (GimpTemplateClass *klass) GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_RESOLUTION_UNIT, "resolution-unit", NULL, - FALSE, FALSE, - gimp_template_unit_from_locale (), + FALSE, FALSE, GIMP_UNIT_INCH, 0); GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_IMAGE_TYPE, @@ -343,25 +340,6 @@ gimp_template_notify (GObject *object, gimp_viewable_invalidate_preview (GIMP_VIEWABLE (object)); } -static GimpUnit -gimp_template_unit_from_locale (void) -{ -#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT - const gchar *measurement = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT); - - switch (*((guchar *) measurement)) - { - case 1: /* metric */ - return GIMP_UNIT_MM; - - case 2: /* imperial */ - return GIMP_UNIT_INCH; - } -#endif - - return GIMP_UNIT_INCH; -} - /* public functions */ diff --git a/app/dialogs/print-size-dialog.c b/app/dialogs/print-size-dialog.c index 5112c600e8..87b0c53e98 100644 --- a/app/dialogs/print-size-dialog.c +++ b/app/dialogs/print-size-dialog.c @@ -26,6 +26,7 @@ #include "dialogs-types.h" #include "core/gimpimage.h" +#include "core/gimp-utils.h" #include "widgets/gimphelp-ids.h" #include "widgets/gimpviewabledialog.h" @@ -153,7 +154,7 @@ print_size_dialog_new (GimpImage *image, height = gimp_spin_button_new (&adj, 1, 1, 1, 1, 10, 0, 1, 2); gtk_entry_set_width_chars (GTK_ENTRY (height), SB_WIDTH); - entry = gimp_size_entry_new (0, gimp_image_get_unit (image), "%p", + entry = gimp_size_entry_new (0, gimp_get_default_unit (), "%p", FALSE, FALSE, FALSE, SB_WIDTH, GIMP_SIZE_ENTRY_UPDATE_SIZE); private->size_entry = GIMP_SIZE_ENTRY (entry); @@ -322,7 +323,7 @@ print_size_dialog_reset (PrintSizeDialog *private) gdouble xres, yres; gimp_size_entry_set_unit (private->resolution_entry, - gimp_image_get_unit (private->image)); + gimp_get_default_unit ()); gimp_image_get_resolution (private->image, &xres, &yres); print_size_dialog_set_resolution (private, xres, yres); diff --git a/app/widgets/gimpimagepropview.c b/app/widgets/gimpimagepropview.c index 34a153f704..f2707168e6 100644 --- a/app/widgets/gimpimagepropview.c +++ b/app/widgets/gimpimagepropview.c @@ -32,6 +32,7 @@ #include "core/gimpimage.h" #include "core/gimpundostack.h" #include "core/gimpunit.h" +#include "core/gimp-utils.h" #include "gimpimagepropview.h" #include "gimppropwidgets.h" @@ -355,12 +356,7 @@ gimp_image_prop_view_update (GimpImagePropView *view) gtk_label_set_text (GTK_LABEL (view->pixel_size_label), buf); /* print size */ -#if 0 - unit = GIMP_DISPLAY_SHELL (gdisp->shell)->unit; - - if (unit == GIMP_UNIT_PIXEL) -#endif - unit = gimp_image_get_unit (image); + unit = gimp_get_default_unit (); unit_factor = _gimp_unit_get_factor (image->gimp, unit); unit_digits = _gimp_unit_get_digits (image->gimp, unit);