Commit e8aac6d5 authored by Jehan's avatar Jehan

app: do not allow mandala center position out of the image dimensions.

parent bf6d45ea
......@@ -207,33 +207,41 @@ gimp_mandala_set_property (GObject *object,
switch (property_id)
{
case PROP_CENTER_X:
mandala->center_x = g_value_get_double (value);
if (mandala->vertical_guide)
if (g_value_get_double (value) > 0.0 &&
g_value_get_double (value) < (gdouble) gimp_image_get_width (image))
{
g_signal_handlers_block_by_func (mandala->vertical_guide,
gimp_mandala_guide_position_cb,
mandala);
gimp_image_move_guide (image, mandala->vertical_guide,
mandala->center_x,
FALSE);
g_signal_handlers_unblock_by_func (mandala->vertical_guide,
gimp_mandala_guide_position_cb,
mandala);
mandala->center_x = g_value_get_double (value);
if (mandala->vertical_guide)
{
g_signal_handlers_block_by_func (mandala->vertical_guide,
gimp_mandala_guide_position_cb,
mandala);
gimp_image_move_guide (image, mandala->vertical_guide,
mandala->center_x,
FALSE);
g_signal_handlers_unblock_by_func (mandala->vertical_guide,
gimp_mandala_guide_position_cb,
mandala);
}
}
break;
case PROP_CENTER_Y:
mandala->center_y = g_value_get_double (value);
if (mandala->horizontal_guide)
if (g_value_get_double (value) > 0.0 &&
g_value_get_double (value) < (gdouble) gimp_image_get_height (image))
{
g_signal_handlers_block_by_func (mandala->horizontal_guide,
gimp_mandala_guide_position_cb,
mandala);
gimp_image_move_guide (image, mandala->horizontal_guide,
mandala->center_y,
FALSE);
g_signal_handlers_unblock_by_func (mandala->horizontal_guide,
gimp_mandala_guide_position_cb,
mandala);
mandala->center_y = g_value_get_double (value);
if (mandala->horizontal_guide)
{
g_signal_handlers_block_by_func (mandala->horizontal_guide,
gimp_mandala_guide_position_cb,
mandala);
gimp_image_move_guide (image, mandala->horizontal_guide,
mandala->center_y,
FALSE);
g_signal_handlers_unblock_by_func (mandala->horizontal_guide,
gimp_mandala_guide_position_cb,
mandala);
}
}
break;
case PROP_SIZE:
......
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