Commit 2ebf0647 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

go back to using dpi as the default resolution unit.

2005-08-18  Sven Neumann  <sven@gimp.org>

	* 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).
parent 6265478d
2005-08-18 Sven Neumann <sven@gimp.org>
* 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 <sven@gimp.org>
* plug-ins/common/procedure-browser.c (run): reverted last change.
......
......@@ -22,6 +22,10 @@
#include <string.h>
#include <locale.h>
#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
#include <langinfo.h>
#endif
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
......@@ -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,
......
......@@ -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,
......
......@@ -22,7 +22,6 @@
#include "config.h"
#include <string.h>
#include <langinfo.h>
#include <glib-object.h>
......@@ -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 */
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment