[gimp] app: mandala center coordinates should also be settable by number...
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: mandala center coordinates should also be settable by number...
- Date: Thu, 11 Feb 2016 16:20:48 +0000 (UTC)
commit 609dcc544895b5a888a62def6f6db6fa1e5e0811
Author: Jehan <jehan girinstud io>
Date: Mon Feb 8 16:29:24 2016 +0100
app: mandala center coordinates should also be settable by number...
... not only by guide moving. Both ways are complementary.
app/core/gimpsymmetry-mandala.c | 67 ++++++++++++++++++++++++++++----------
1 files changed, 49 insertions(+), 18 deletions(-)
---
diff --git a/app/core/gimpsymmetry-mandala.c b/app/core/gimpsymmetry-mandala.c
index 0d99c64..9f31f28 100644
--- a/app/core/gimpsymmetry-mandala.c
+++ b/app/core/gimpsymmetry-mandala.c
@@ -114,15 +114,23 @@ gimp_mandala_class_init (GimpMandalaClass *klass)
symmetry_class->get_operation = gimp_mandala_get_operation;
symmetry_class->active_changed = gimp_mandala_active_changed;
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_X,
- "center-x", _("Center abscisse"),
- 0.0, 10000.0, 0.0,
- GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_Y,
- "center-y", _("Center ordinate"),
- 0.0, 10000.0, 0.0,
- GIMP_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_CENTER_X,
+ g_param_spec_double ("center-x",
+ _("Center abscisse"),
+ _("Center abscisse"),
+ 0.0, 10000.0, 0.0,
+ GIMP_CONFIG_PARAM_FLAGS |
+ GIMP_PARAM_STATIC_STRINGS |
+ GIMP_SYMMETRY_PARAM_GUI));
+
+ g_object_class_install_property (object_class, PROP_CENTER_Y,
+ g_param_spec_double ("center-y",
+ _("Center ordinate"),
+ _("Center ordinate"),
+ 0.0, 10000.0, 0.0,
+ GIMP_CONFIG_PARAM_FLAGS |
+ GIMP_PARAM_STATIC_STRINGS |
+ GIMP_SYMMETRY_PARAM_GUI));
GIMP_CONFIG_PROP_INT (object_class, PROP_SIZE,
"size",
@@ -199,25 +207,44 @@ gimp_mandala_finalize (GObject *object)
static void
gimp_mandala_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GimpMandala *mandala = GIMP_MANDALA (object);
+ GimpImage *image = GIMP_SYMMETRY (mandala)->image;
switch (property_id)
{
case PROP_CENTER_X:
mandala->center_x = g_value_get_double (value);
if (mandala->vertical_guide)
- gimp_guide_set_position (mandala->vertical_guide,
- mandala->center_x);
+ {
+ 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)
- gimp_guide_set_position (mandala->horizontal_guide,
- mandala->center_y);
+ {
+ 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:
mandala->size = g_value_get_int (value);
@@ -397,11 +424,15 @@ gimp_mandala_guide_position_cb (GObject *object,
if (guide == mandala->horizontal_guide)
{
- mandala->center_y = (gdouble) gimp_guide_get_position (guide);
+ g_object_set (G_OBJECT (mandala),
+ "center-y", (gdouble) gimp_guide_get_position (guide),
+ NULL);
}
else if (guide == mandala->vertical_guide)
{
- mandala->center_x = (gdouble) gimp_guide_get_position (guide);
+ g_object_set (G_OBJECT (mandala),
+ "center-x", (gdouble) gimp_guide_get_position (guide),
+ NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]