Merge branch 'fix-6861' into 'master'

Draft: Issue #6861: Symmetry Drawing: Decimal input bugs the symmetry.

See merge request GNOME/gimp!459
This commit is contained in:
Vinicius Monego 2025-07-01 07:26:19 +00:00
commit 5a0e10f289
2 changed files with 42 additions and 46 deletions

View file

@ -117,25 +117,25 @@ gimp_mandala_class_init (GimpMandalaClass *klass)
symmetry_class->get_transform = gimp_mandala_get_transform;
symmetry_class->active_changed = gimp_mandala_active_changed;
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_CENTER_X,
"center-x",
_("Center abscissa"),
NULL,
0.0, G_MAXDOUBLE, 0.0,
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
GIMP_CONFIG_PROP_UINT (object_class, PROP_CENTER_X,
"center-x",
_("Center abscissa"),
NULL,
0, G_MAXUINT, 0,
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
pspec = g_object_class_find_property (object_class, "center-x");
gegl_param_spec_set_property_key (pspec, "unit", "pixel-coordinate");
gegl_param_spec_set_property_key (pspec, "axis", "x");
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_CENTER_Y,
"center-y",
_("Center ordinate"),
NULL,
0.0, G_MAXDOUBLE, 0.0,
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
GIMP_CONFIG_PROP_UINT (object_class, PROP_CENTER_Y,
"center-y",
_("Center ordinate"),
NULL,
0, G_MAXUINT, 0,
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
pspec = g_object_class_find_property (object_class, "center-y");
gegl_param_spec_set_property_key (pspec, "unit", "pixel-coordinate");
@ -204,10 +204,9 @@ gimp_mandala_set_property (GObject *object,
switch (property_id)
{
case PROP_CENTER_X:
if (g_value_get_double (value) > 0.0 &&
g_value_get_double (value) < (gdouble) gimp_image_get_width (image))
if (g_value_get_uint (value) < (guint) gimp_image_get_width (image))
{
mandala->center_x = g_value_get_double (value);
mandala->center_x = g_value_get_uint (value);
if (mandala->vertical_guide)
{
@ -225,10 +224,9 @@ gimp_mandala_set_property (GObject *object,
break;
case PROP_CENTER_Y:
if (g_value_get_double (value) > 0.0 &&
g_value_get_double (value) < (gdouble) gimp_image_get_height (image))
if (g_value_get_uint (value) < (guint) gimp_image_get_height (image))
{
mandala->center_y = g_value_get_double (value);
mandala->center_y = g_value_get_uint (value);
if (mandala->horizontal_guide)
{
@ -274,10 +272,10 @@ gimp_mandala_get_property (GObject *object,
switch (property_id)
{
case PROP_CENTER_X:
g_value_set_double (value, mandala->center_x);
g_value_set_uint (value, mandala->center_x);
break;
case PROP_CENTER_Y:
g_value_set_double (value, mandala->center_y);
g_value_set_uint (value, mandala->center_y);
break;
case PROP_SIZE:
g_value_set_int (value, mandala->size);

View file

@ -155,25 +155,25 @@ gimp_mirror_class_init (GimpMirrorClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_MIRROR_POSITION_X,
"mirror-position-x",
_("Vertical axis position"),
NULL,
0.0, G_MAXDOUBLE, 0.0,
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
GIMP_CONFIG_PROP_UINT (object_class, PROP_MIRROR_POSITION_X,
"mirror-position-x",
_("Vertical axis position"),
NULL,
0, G_MAXUINT, 0,
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
pspec = g_object_class_find_property (object_class, "mirror-position-x");
gegl_param_spec_set_property_key (pspec, "unit", "pixel-coordinate");
gegl_param_spec_set_property_key (pspec, "axis", "x");
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_MIRROR_POSITION_Y,
"mirror-position-y",
_("Horizontal axis position"),
NULL,
0.0, G_MAXDOUBLE, 0.0,
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
GIMP_CONFIG_PROP_UINT (object_class, PROP_MIRROR_POSITION_Y,
"mirror-position-y",
_("Horizontal axis position"),
NULL,
0, G_MAXUINT, 0,
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
pspec = g_object_class_find_property (object_class, "mirror-position-y");
gegl_param_spec_set_property_key (pspec, "unit", "pixel-coordinate");
@ -237,10 +237,9 @@ gimp_mirror_set_property (GObject *object,
break;
case PROP_MIRROR_POSITION_X:
if (g_value_get_double (value) >= 0.0 &&
g_value_get_double (value) < (gdouble) gimp_image_get_width (image))
if (g_value_get_uint (value) < (guint) gimp_image_get_width (image))
{
mirror->mirror_position_x = g_value_get_double (value);
mirror->mirror_position_x = g_value_get_uint (value);
if (mirror->vertical_guide)
{
@ -258,10 +257,9 @@ gimp_mirror_set_property (GObject *object,
break;
case PROP_MIRROR_POSITION_Y:
if (g_value_get_double (value) >= 0.0 &&
g_value_get_double (value) < (gdouble) gimp_image_get_height (image))
if (g_value_get_uint (value) < (guint) gimp_image_get_height (image))
{
mirror->mirror_position_y = g_value_get_double (value);
mirror->mirror_position_y = g_value_get_uint (value);
if (mirror->horizontal_guide)
{
@ -307,10 +305,10 @@ gimp_mirror_get_property (GObject *object,
g_value_set_boolean (value, mirror->disable_transformation);
break;
case PROP_MIRROR_POSITION_X:
g_value_set_double (value, mirror->mirror_position_x);
g_value_set_uint (value, mirror->mirror_position_x);
break;
case PROP_MIRROR_POSITION_Y:
g_value_set_double (value, mirror->mirror_position_y);
g_value_set_uint (value, mirror->mirror_position_y);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -566,7 +564,7 @@ gimp_mirror_guide_removed_cb (GObject *object,
"point-symmetry", FALSE,
NULL);
g_object_set (mirror,
"mirror-position-x", 0.0,
"mirror-position-x", 0,
NULL);
if (mirror->horizontal_guide &&
@ -616,7 +614,7 @@ gimp_mirror_guide_position_cb (GObject *object,
else if (guide == mirror->vertical_guide)
{
g_object_set (mirror,
"mirror-position-x", (gdouble) gimp_guide_get_position (guide),
"mirror-position-x", (guint) gimp_guide_get_position (guide),
NULL);
}
}