mirror of https://github.com/GNOME/gimp.git
renamed struct member "unit" to "resolution_unit".
2004-10-12 Sven Neumann <sven@gimp.org> * app/core/gimpimage.[ch]: renamed struct member "unit" to "resolution_unit". * app/actions/image-commands.c * app/core/gimp-edit.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-undo-push.c * app/dialogs/info-window.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c: * app/xcf/xcf-load.c * app/xcf/xcf-save.c: changed accordingly. Use gimp_image_get_unit() where appropriate. * app/core/gimptemplate.c (gimp_template_set_from_image): fixed unit handling. Don't touch the template unit, it is used as the initial display unit. This will need further changes...
This commit is contained in:
parent
fcc342b00b
commit
ab6c609ce1
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
2004-10-12 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimpimage.[ch]: renamed struct member "unit" to
|
||||||
|
"resolution_unit".
|
||||||
|
|
||||||
|
* app/actions/image-commands.c
|
||||||
|
* app/core/gimp-edit.c
|
||||||
|
* app/core/gimpimage-duplicate.c
|
||||||
|
* app/core/gimpimage-undo-push.c
|
||||||
|
* app/dialogs/info-window.c
|
||||||
|
* app/vectors/gimpvectors-export.c
|
||||||
|
* app/widgets/gimptoolbox-dnd.c:
|
||||||
|
* app/xcf/xcf-load.c
|
||||||
|
* app/xcf/xcf-save.c: changed accordingly. Use gimp_image_get_unit()
|
||||||
|
where appropriate.
|
||||||
|
|
||||||
|
* app/core/gimptemplate.c (gimp_template_set_from_image): fixed
|
||||||
|
unit handling. Don't touch the template unit, it is used as the
|
||||||
|
initial display unit. This will need further changes...
|
||||||
|
|
||||||
2004-10-12 Michael Natterer <mitch@gimp.org>
|
2004-10-12 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpwidgets-utils.c (gimp_enum_radio_frame_add):
|
* app/widgets/gimpwidgets-utils.c (gimp_enum_radio_frame_add):
|
||||||
|
|
|
@ -616,7 +616,7 @@ image_scale_implement (ImageResizeOptions *options)
|
||||||
|
|
||||||
if (options->dialog->resolution_x == gimage->xresolution &&
|
if (options->dialog->resolution_x == gimage->xresolution &&
|
||||||
options->dialog->resolution_y == gimage->yresolution &&
|
options->dialog->resolution_y == gimage->yresolution &&
|
||||||
options->dialog->unit == gimage->unit &&
|
options->dialog->unit == gimage->resolution_unit &&
|
||||||
options->dialog->width == gimage->width &&
|
options->dialog->width == gimage->width &&
|
||||||
options->dialog->height == gimage->height)
|
options->dialog->height == gimage->height)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -241,7 +241,8 @@ gimp_edit_paste_as_new (Gimp *gimp,
|
||||||
{
|
{
|
||||||
gimp_image_set_resolution (gimage,
|
gimp_image_set_resolution (gimage,
|
||||||
invoke->xresolution, invoke->yresolution);
|
invoke->xresolution, invoke->yresolution);
|
||||||
gimp_image_set_unit (gimage, invoke->unit);
|
gimp_image_set_unit (gimage,
|
||||||
|
gimp_image_get_unit (invoke));
|
||||||
}
|
}
|
||||||
|
|
||||||
layer = gimp_layer_new_from_tiles (paste->tiles,
|
layer = gimp_layer_new_from_tiles (paste->tiles,
|
||||||
|
|
|
@ -74,10 +74,10 @@ gimp_image_duplicate (GimpImage *gimage)
|
||||||
gimp_image_get_colormap_size (gimage),
|
gimp_image_get_colormap_size (gimage),
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
/* Copy resolution and unit information */
|
/* Copy resolution information */
|
||||||
new_gimage->xresolution = gimage->xresolution;
|
new_gimage->xresolution = gimage->xresolution;
|
||||||
new_gimage->yresolution = gimage->yresolution;
|
new_gimage->yresolution = gimage->yresolution;
|
||||||
new_gimage->unit = gimage->unit;
|
new_gimage->resolution_unit = gimage->resolution_unit;
|
||||||
|
|
||||||
/* Copy floating layer */
|
/* Copy floating layer */
|
||||||
floating_layer = gimp_image_floating_sel (gimage);
|
floating_layer = gimp_image_floating_sel (gimage);
|
||||||
|
|
|
@ -253,7 +253,7 @@ gimp_image_undo_push_image_resolution (GimpImage *gimage,
|
||||||
|
|
||||||
ru->xres = gimage->xresolution;
|
ru->xres = gimage->xresolution;
|
||||||
ru->yres = gimage->yresolution;
|
ru->yres = gimage->yresolution;
|
||||||
ru->unit = gimage->unit;
|
ru->unit = gimage->resolution_unit;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -286,12 +286,12 @@ undo_pop_image_resolution (GimpUndo *undo,
|
||||||
accum->resolution_changed = TRUE;
|
accum->resolution_changed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ru->unit != undo->gimage->unit)
|
if (ru->unit != undo->gimage->resolution_unit)
|
||||||
{
|
{
|
||||||
GimpUnit unit;
|
GimpUnit unit;
|
||||||
|
|
||||||
unit = undo->gimage->unit;
|
unit = undo->gimage->resolution_unit;
|
||||||
undo->gimage->unit = ru->unit;
|
undo->gimage->resolution_unit = ru->unit;
|
||||||
ru->unit = unit;
|
ru->unit = unit;
|
||||||
|
|
||||||
accum->unit_changed = TRUE;
|
accum->unit_changed = TRUE;
|
||||||
|
|
|
@ -511,7 +511,7 @@ gimp_image_init (GimpImage *gimage)
|
||||||
gimage->height = 0;
|
gimage->height = 0;
|
||||||
gimage->xresolution = 1.0;
|
gimage->xresolution = 1.0;
|
||||||
gimage->yresolution = 1.0;
|
gimage->yresolution = 1.0;
|
||||||
gimage->unit = GIMP_UNIT_INCH;
|
gimage->resolution_unit = GIMP_UNIT_INCH;
|
||||||
gimage->base_type = GIMP_RGB;
|
gimage->base_type = GIMP_RGB;
|
||||||
|
|
||||||
gimage->cmap = NULL;
|
gimage->cmap = NULL;
|
||||||
|
@ -639,7 +639,7 @@ gimp_image_constructor (GType type,
|
||||||
|
|
||||||
gimage->xresolution = config->default_image->xresolution;
|
gimage->xresolution = config->default_image->xresolution;
|
||||||
gimage->yresolution = config->default_image->yresolution;
|
gimage->yresolution = config->default_image->yresolution;
|
||||||
gimage->unit = config->default_image->resolution_unit;
|
gimage->resolution_unit = config->default_image->resolution_unit;
|
||||||
|
|
||||||
gimage->grid = gimp_config_duplicate (GIMP_CONFIG (config->default_grid));
|
gimage->grid = gimp_config_duplicate (GIMP_CONFIG (config->default_grid));
|
||||||
|
|
||||||
|
@ -1391,12 +1391,12 @@ gimp_image_set_unit (GimpImage *gimage,
|
||||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||||
g_return_if_fail (unit > GIMP_UNIT_PIXEL);
|
g_return_if_fail (unit > GIMP_UNIT_PIXEL);
|
||||||
|
|
||||||
if (gimage->unit != unit)
|
if (gimage->resolution_unit != unit)
|
||||||
{
|
{
|
||||||
gimp_image_undo_push_image_resolution (gimage,
|
gimp_image_undo_push_image_resolution (gimage,
|
||||||
_("Change Image Unit"));
|
_("Change Image Unit"));
|
||||||
|
|
||||||
gimage->unit = unit;
|
gimage->resolution_unit = unit;
|
||||||
gimp_image_unit_changed (gimage);
|
gimp_image_unit_changed (gimage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1406,7 +1406,7 @@ gimp_image_get_unit (const GimpImage *gimage)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_UNIT_INCH);
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_UNIT_INCH);
|
||||||
|
|
||||||
return gimage->unit;
|
return gimage->resolution_unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -108,7 +108,7 @@ struct _GimpImage
|
||||||
gint width, height; /* width and height attributes */
|
gint width, height; /* width and height attributes */
|
||||||
gdouble xresolution; /* image x-res, in dpi */
|
gdouble xresolution; /* image x-res, in dpi */
|
||||||
gdouble yresolution; /* image y-res, in dpi */
|
gdouble yresolution; /* image y-res, in dpi */
|
||||||
GimpUnit unit; /* resolution unit */
|
GimpUnit resolution_unit; /* resolution unit */
|
||||||
GimpImageBaseType base_type; /* base gimp_image type */
|
GimpImageBaseType base_type; /* base gimp_image type */
|
||||||
|
|
||||||
guchar *cmap; /* colormap--for indexed */
|
guchar *cmap; /* colormap--for indexed */
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
|
|
||||||
#include "config/gimpconfig.h"
|
#include "config/gimpconfig.h"
|
||||||
#include "config/gimpconfig-params.h"
|
#include "config/gimpconfig-params.h"
|
||||||
#include "config/gimpcoreconfig.h"
|
|
||||||
|
|
||||||
#include "gimp.h"
|
#include "gimp.h"
|
||||||
#include "gimpcontext.h"
|
#include "gimpcontext.h"
|
||||||
|
@ -383,10 +382,9 @@ gimp_template_set_from_image (GimpTemplate *template,
|
||||||
g_object_set (template,
|
g_object_set (template,
|
||||||
"width", gimp_image_get_width (gimage),
|
"width", gimp_image_get_width (gimage),
|
||||||
"height", gimp_image_get_height (gimage),
|
"height", gimp_image_get_height (gimage),
|
||||||
"unit", gimp_image_get_unit (gimage),
|
|
||||||
"xresolution", xresolution,
|
"xresolution", xresolution,
|
||||||
"yresolution", yresolution,
|
"yresolution", yresolution,
|
||||||
"resolution-unit", gimage->gimp->config->default_image->resolution_unit,
|
"resolution-unit", gimp_image_get_unit (gimage),
|
||||||
"image-type", image_type,
|
"image-type", image_type,
|
||||||
"comment", comment,
|
"comment", comment,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -426,7 +426,7 @@ info_window_update_cursor (GimpDisplay *gdisp,
|
||||||
gchar buf[32];
|
gchar buf[32];
|
||||||
|
|
||||||
if (unit == GIMP_UNIT_PIXEL)
|
if (unit == GIMP_UNIT_PIXEL)
|
||||||
unit = image->unit;
|
unit = gimp_image_get_unit (image);
|
||||||
|
|
||||||
unit_factor = _gimp_unit_get_factor (image->gimp, unit);
|
unit_factor = _gimp_unit_get_factor (image->gimp, unit);
|
||||||
unit_digits = _gimp_unit_get_digits (image->gimp, unit);
|
unit_digits = _gimp_unit_get_digits (image->gimp, unit);
|
||||||
|
@ -544,7 +544,7 @@ info_window_update (GimpDisplay *gdisp)
|
||||||
unit = GIMP_DISPLAY_SHELL (gdisp->shell)->unit;
|
unit = GIMP_DISPLAY_SHELL (gdisp->shell)->unit;
|
||||||
|
|
||||||
if (unit == GIMP_UNIT_PIXEL)
|
if (unit == GIMP_UNIT_PIXEL)
|
||||||
unit = image->unit;
|
unit = gimp_image_get_unit (image);
|
||||||
|
|
||||||
unit_factor = _gimp_unit_get_factor (image->gimp, unit);
|
unit_factor = _gimp_unit_get_factor (image->gimp, unit);
|
||||||
unit_digits = _gimp_unit_get_digits (image->gimp, unit);
|
unit_digits = _gimp_unit_get_digits (image->gimp, unit);
|
||||||
|
@ -557,7 +557,7 @@ info_window_update (GimpDisplay *gdisp)
|
||||||
image->height * unit_factor / image->yresolution);
|
image->height * unit_factor / image->yresolution);
|
||||||
|
|
||||||
/* resolution */
|
/* resolution */
|
||||||
unit = image->unit;
|
unit = gimp_image_get_unit (image);
|
||||||
unit_factor = _gimp_unit_get_factor (image->gimp, unit);
|
unit_factor = _gimp_unit_get_factor (image->gimp, unit);
|
||||||
|
|
||||||
g_snprintf (format_buf, sizeof (format_buf), _("pixels/%s"),
|
g_snprintf (format_buf, sizeof (format_buf), _("pixels/%s"),
|
||||||
|
|
|
@ -172,7 +172,7 @@ gimp_vectors_export_image_size (const GimpImage *image,
|
||||||
h = (gdouble) image->height / image->yresolution;
|
h = (gdouble) image->height / image->yresolution;
|
||||||
|
|
||||||
/* FIXME: should probably use the display unit here */
|
/* FIXME: should probably use the display unit here */
|
||||||
unit = image->unit;
|
unit = gimp_image_get_unit (image);
|
||||||
switch (unit)
|
switch (unit)
|
||||||
{
|
{
|
||||||
case GIMP_UNIT_INCH: abbrev = "in"; break;
|
case GIMP_UNIT_INCH: abbrev = "in"; break;
|
||||||
|
|
|
@ -166,7 +166,8 @@ gimp_toolbox_drop_drawable (GtkWidget *widget,
|
||||||
|
|
||||||
gimp_image_set_resolution (new_image,
|
gimp_image_set_resolution (new_image,
|
||||||
gimage->xresolution, gimage->yresolution);
|
gimage->xresolution, gimage->yresolution);
|
||||||
gimp_image_set_unit (new_image, gimage->unit);
|
gimp_image_set_unit (new_image,
|
||||||
|
gimp_image_get_unit (gimage));
|
||||||
|
|
||||||
if (GIMP_IS_LAYER (drawable))
|
if (GIMP_IS_LAYER (drawable))
|
||||||
new_type = G_TYPE_FROM_INSTANCE (drawable);
|
new_type = G_TYPE_FROM_INSTANCE (drawable);
|
||||||
|
|
|
@ -434,7 +434,7 @@ xcf_load_image_props (XcfInfo *info,
|
||||||
unit = GIMP_UNIT_INCH;
|
unit = GIMP_UNIT_INCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimage->unit = unit;
|
gimage->resolution_unit = unit;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ xcf_load_image_props (XcfInfo *info,
|
||||||
unit_strings[3],
|
unit_strings[3],
|
||||||
unit_strings[4]);
|
unit_strings[4]);
|
||||||
|
|
||||||
gimage->unit = unit;
|
gimage->resolution_unit = unit;
|
||||||
|
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
g_free (unit_strings[i]);
|
g_free (unit_strings[i]);
|
||||||
|
|
|
@ -414,6 +414,7 @@ xcf_save_image_props (XcfInfo *info,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpParasite *parasite = NULL;
|
GimpParasite *parasite = NULL;
|
||||||
|
GimpUnit unit = gimp_image_get_unit (gimage);
|
||||||
|
|
||||||
/* check and see if we should save the colormap property */
|
/* check and see if we should save the colormap property */
|
||||||
if (gimage->cmap)
|
if (gimage->cmap)
|
||||||
|
@ -438,9 +439,8 @@ xcf_save_image_props (XcfInfo *info,
|
||||||
xcf_check_error (xcf_save_prop (info, gimage, PROP_PARASITES,
|
xcf_check_error (xcf_save_prop (info, gimage, PROP_PARASITES,
|
||||||
error, gimage->parasites));
|
error, gimage->parasites));
|
||||||
|
|
||||||
if (gimage->unit < _gimp_unit_get_number_of_built_in_units (gimage->gimp))
|
if (unit < _gimp_unit_get_number_of_built_in_units (gimage->gimp))
|
||||||
xcf_check_error (xcf_save_prop (info, gimage, PROP_UNIT,
|
xcf_check_error (xcf_save_prop (info, gimage, PROP_UNIT, error, unit));
|
||||||
error, gimage->unit));
|
|
||||||
|
|
||||||
if (gimp_container_num_children (gimage->vectors) > 0)
|
if (gimp_container_num_children (gimage->vectors) > 0)
|
||||||
{
|
{
|
||||||
|
@ -450,9 +450,8 @@ xcf_save_image_props (XcfInfo *info,
|
||||||
xcf_check_error (xcf_save_prop (info, gimage, PROP_VECTORS, error));
|
xcf_check_error (xcf_save_prop (info, gimage, PROP_VECTORS, error));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gimage->unit >= _gimp_unit_get_number_of_built_in_units (gimage->gimp))
|
if (unit >= _gimp_unit_get_number_of_built_in_units (gimage->gimp))
|
||||||
xcf_check_error (xcf_save_prop (info, gimage, PROP_USER_UNIT,
|
xcf_check_error (xcf_save_prop (info, gimage, PROP_USER_UNIT, error, unit));
|
||||||
error, gimage->unit));
|
|
||||||
|
|
||||||
if (GIMP_IS_GRID (gimage->grid))
|
if (GIMP_IS_GRID (gimage->grid))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue