app/widgets/gimpsizebox.c round displayed resolution instead of just

2005-01-02  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpsizebox.c
	* app/widgets/gimptemplateeditor.c: round displayed resolution
	instead of just casting to integer values. Use image size limits
	from libgimpbase/gimplimits.h instead of some arbitrary numbers.
This commit is contained in:
Sven Neumann 2005-01-02 16:55:50 +00:00 committed by Sven Neumann
parent c84a37cdc0
commit 23a3bdf31e
3 changed files with 29 additions and 22 deletions

View File

@ -1,3 +1,10 @@
2005-01-02 Sven Neumann <sven@gimp.org>
* app/widgets/gimpsizebox.c
* app/widgets/gimptemplateeditor.c: round displayed resolution
instead of just casting to integer values. Use image size limits
from libgimpbase/gimplimits.h instead of some arbitrary numbers.
2005-01-02 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/plug-ins/clothify.py

View File

@ -222,23 +222,22 @@ gimp_size_box_constructor (GType type,
TRUE, TRUE,
_("_Width:"),
box->width, box->xresolution,
0, 100000, 0, box->width,
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE,
0, box->width,
_("H_eight:"),
box->height, box->yresolution,
0, 100000, 0, box->height);
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE,
0, box->height);
priv->size_entry = GIMP_SIZE_ENTRY (entry);
priv->size_chain = GIMP_COORDINATES_CHAINBUTTON (GIMP_SIZE_ENTRY (entry));
priv->aspect = (gdouble) box->width / (gdouble) box->height;
priv->size_entry = GIMP_SIZE_ENTRY (entry);
priv->size_chain = GIMP_COORDINATES_CHAINBUTTON (GIMP_SIZE_ENTRY (entry));
priv->aspect = (gdouble) box->width / (gdouble) box->height;
/*
* let gimp_prop_coordinates_callback know how to
* interpret the chainbutton. This should be removed
* eventually.
* let gimp_prop_coordinates_callback know how to interpret the chainbutton
*/
g_object_set_data (G_OBJECT (priv->size_chain),
"constrains-ratio",
GINT_TO_POINTER (TRUE));
"constrains-ratio", GINT_TO_POINTER (TRUE));
gimp_prop_coordinates_connect (G_OBJECT (box),
"width", "height",
@ -450,14 +449,13 @@ gimp_size_box_update_resolution (GimpSizeBox *box)
if (priv->res_label)
{
gchar *text;
gint xres = ROUND (box->xresolution);
gint yres = ROUND (box->yresolution);
if ((gint) box->xresolution != (gint) box->yresolution)
text = g_strdup_printf (_("%d x %d dpi"),
(gint) box->xresolution,
(gint) box->yresolution);
if (xres != yres)
text = g_strdup_printf (_("%d x %d dpi"), xres, yres);
else
text = g_strdup_printf (_("%d dpi"),
(gint) box->yresolution);
text = g_strdup_printf (_("%d dpi"), yres);
gtk_label_set_text (GTK_LABEL (priv->res_label), text);
g_free (text);

View File

@ -649,6 +649,8 @@ gimp_template_editor_template_notify (GimpTemplate *template,
GimpAspectType aspect;
const gchar *desc;
gchar *text;
gint xres;
gint yres;
if (param_spec)
{
@ -690,13 +692,13 @@ gimp_template_editor_template_notify (GimpTemplate *template,
gimp_enum_get_value (GIMP_TYPE_IMAGE_BASE_TYPE, template->image_type,
NULL, NULL, &desc, NULL);
if ((gint) template->xresolution != (gint) template->yresolution)
text = g_strdup_printf (_("%d x %d dpi, %s"),
(gint) template->xresolution,
(gint) template->yresolution, desc);
xres = ROUND (template->xresolution);
yres = ROUND (template->yresolution);
if (xres != yres)
text = g_strdup_printf (_("%d x %d dpi, %s"), xres, yres, desc);
else
text = g_strdup_printf (_("%d dpi, %s"),
(gint) template->yresolution, desc);
text = g_strdup_printf (_("%d dpi, %s"), yres, desc);
gtk_label_set_text (GTK_LABEL (editor->more_label), text);
g_free (text);