[gimp] app: remove current implementation of GimpSpinScale soft bounds.



commit 4e6d320591bf2bff231a0ac751b9ec41b161ed61
Author: Jehan <jehan girinstud io>
Date:   Fri Jul 1 13:58:55 2016 +0200

    app: remove current implementation of GimpSpinScale soft bounds.
    
    Mitch gets a better idea to deal with soft limits (i.e. min/max values
    different from the property min/max) applied to a spin scale created by
    gimp_prop_spin_scale_new().
    So let's just remove the current implementation (using locale data on
    the GimpConfig object). The symmetry spin scales are back with crazy
    huge maximums, which makes quite a horrible GUI, but this is only
    temporary until Mitch commits his new implementation.

 app/core/gimpsymmetry-mandala.c |   27 +++++---------------
 app/core/gimpsymmetry-mirror.c  |   26 +++++--------------
 app/core/gimpsymmetry-tiling.c  |   50 +++++++++-----------------------------
 app/widgets/gimppropgui.c       |   25 -------------------
 app/widgets/gimppropwidgets.c   |   29 +---------------------
 5 files changed, 27 insertions(+), 130 deletions(-)
---
diff --git a/app/core/gimpsymmetry-mandala.c b/app/core/gimpsymmetry-mandala.c
index 87deb2e..77940c3 100644
--- a/app/core/gimpsymmetry-mandala.c
+++ b/app/core/gimpsymmetry-mandala.c
@@ -155,18 +155,12 @@ gimp_mandala_init (GimpMandala *mandala)
 static void
 gimp_mandala_constructed (GObject *object)
 {
-  GimpSymmetry *sym;
-  gdouble      *x_max = g_new (gdouble, 1);
-  gdouble      *y_max = g_new (gdouble, 1);
-
-  sym = GIMP_SYMMETRY (object);
-
-  *x_max = gimp_image_get_width (sym->image);
-  *y_max = gimp_image_get_height (sym->image);
-
-  g_object_set_data_full (object, "center-x:max", x_max, g_free);
-  g_object_set_data_full (object, "center-y:max", y_max, g_free);
+  GimpSymmetry *sym = GIMP_SYMMETRY (object);
 
+  /* TODO:
+   * - "center-x" property should be soft-limited by the width;
+   * - "center-y" property should be soft-limited by the height.
+   */
   g_signal_connect_object (sym->image, "size-changed-detailed",
                            G_CALLBACK (gimp_mandala_image_size_changed_cb),
                            sym, 0);
@@ -548,15 +542,8 @@ gimp_mandala_image_size_changed_cb (GimpImage    *image,
   if (previous_width != gimp_image_get_width (image) ||
       previous_height != gimp_image_get_height (image))
     {
-      gdouble *x_max = g_new (gdouble, 1);
-      gdouble *y_max = g_new (gdouble, 1);
-
-      *x_max = gimp_image_get_width (image);
-      *y_max = gimp_image_get_height (image);
-
-      g_object_set_data_full (G_OBJECT (sym), "center-x:max", x_max, g_free);
-      g_object_set_data_full (G_OBJECT (sym), "center-y:max", y_max, g_free);
-
+      /* TODO: change soft limits of "center-x" and "center-y"
+       * properties. */
       g_signal_emit_by_name (sym, "gui-param-changed", sym->image);
     }
 }
diff --git a/app/core/gimpsymmetry-mirror.c b/app/core/gimpsymmetry-mirror.c
index ac68f5e..2c4d36c 100644
--- a/app/core/gimpsymmetry-mirror.c
+++ b/app/core/gimpsymmetry-mirror.c
@@ -181,17 +181,12 @@ gimp_mirror_init (GimpMirror *mirror)
 static void
 gimp_mirror_constructed (GObject *object)
 {
-  GimpSymmetry *sym;
-  gdouble      *x_max = g_new (gdouble, 1);
-  gdouble      *y_max = g_new (gdouble, 1);
+  GimpSymmetry *sym = GIMP_SYMMETRY (object);
 
-  sym = GIMP_SYMMETRY (object);
-
-  *x_max = gimp_image_get_width (sym->image);
-  *y_max = gimp_image_get_height (sym->image);
-
-  g_object_set_data_full (object, "horizontal-position:max", y_max, g_free);
-  g_object_set_data_full (object, "vertical-position:max", x_max, g_free);
+  /* TODO:
+   * - "horizontal-position" property should be soft-limited by the height;
+   * - "vertical-position" property should be soft-limited by the width.
+   */
 
   g_signal_connect_object (sym->image, "size-changed-detailed",
                            G_CALLBACK (gimp_mirror_image_size_changed_cb),
@@ -747,15 +742,8 @@ gimp_mirror_image_size_changed_cb (GimpImage    *image,
   if (previous_width != gimp_image_get_width (image) ||
       previous_height != gimp_image_get_height (image))
     {
-      gdouble *x_max = g_new (gdouble, 1);
-      gdouble *y_max = g_new (gdouble, 1);
-
-      *x_max = gimp_image_get_width (image);
-      *y_max = gimp_image_get_height (image);
-
-      g_object_set_data_full (G_OBJECT (sym), "vertical-position:max", x_max, g_free);
-      g_object_set_data_full (G_OBJECT (sym), "horizontal-position:max", y_max, g_free);
-
+      /* TODO: change soft limits of "vertical-position" and
+       * "horizontal-position" properties. */
       g_signal_emit_by_name (sym, "gui-param-changed", sym->image);
     }
 }
diff --git a/app/core/gimpsymmetry-tiling.c b/app/core/gimpsymmetry-tiling.c
index 5b68b5d..331a763 100644
--- a/app/core/gimpsymmetry-tiling.c
+++ b/app/core/gimpsymmetry-tiling.c
@@ -150,21 +150,14 @@ gimp_tiling_init (GimpTiling *tiling)
 static void
 gimp_tiling_constructed (GObject *object)
 {
-  GimpSymmetry *sym       = GIMP_SYMMETRY (object);
-  GimpTiling   *tiling    = GIMP_TILING (object);
-  gdouble      *x_max     = g_new (gdouble, 1);
-  gdouble      *y_max     = g_new (gdouble, 1);
-  gdouble      *shift_max = g_new (gdouble, 1);
-
-  /* Set property values to actual image size. */
-  *x_max     = gimp_image_get_width (sym->image);
-  *y_max     = gimp_image_get_height (sym->image);
-  *shift_max = *x_max;
-
-  g_object_set_data_full (object, "x-interval:max", x_max, g_free);
-  g_object_set_data_full (object, "y-interval:max", y_max, g_free);
-  g_object_set_data_full (object, "shift:max", shift_max, g_free);
+  GimpSymmetry *sym    = GIMP_SYMMETRY (object);
+  GimpTiling   *tiling = GIMP_TILING (object);
 
+  /* TODO:
+   * - "x-interval" property should be soft-limited by the image width;
+   * - "shift" property should be soft-limited by the width;
+   * - "y-interval" property should be soft-limited by the height.
+   */
   g_signal_connect_object (sym->image, "size-changed-detailed",
                            G_CALLBACK (gimp_tiling_image_size_changed_cb),
                            sym, 0);
@@ -373,30 +366,11 @@ gimp_tiling_image_size_changed_cb (GimpImage    *image,
                                    gint          previous_height,
                                    GimpSymmetry *sym)
 {
-  if (previous_width != gimp_image_get_width (image))
-    {
-      gdouble *x_max     = g_new (gdouble, 1);
-      gdouble *shift_max = g_new (gdouble, 1);
-
-      *x_max     = gimp_image_get_width (sym->image);
-      *shift_max = *x_max;
-
-      g_object_set_data_full (G_OBJECT (sym), "x-interval:max",
-                              x_max, g_free);
-      g_object_set_data_full (G_OBJECT (sym), "shift:max",
-                              shift_max, g_free);
-    }
-  if (previous_height != gimp_image_get_height (image))
-    {
-      gdouble *y_max     = g_new (gdouble, 1);
-
-      *y_max = gimp_image_get_height (sym->image);
-
-      g_object_set_data_full (G_OBJECT (sym), "y-interval:max",
-                              y_max, g_free);
-    }
-
   if (previous_width != gimp_image_get_width (image) ||
       previous_height != gimp_image_get_height (image))
-    g_signal_emit_by_name (sym, "gui-param-changed", sym->image);
+    {
+      /* TODO: change soft limits of "x-interval", "y-interval" and
+       * "shift" properties. */
+      g_signal_emit_by_name (sym, "gui-param-changed", sym->image);
+    }
 }
diff --git a/app/widgets/gimppropgui.c b/app/widgets/gimppropgui.c
index 426dc1f..116b4ea 100644
--- a/app/widgets/gimppropgui.c
+++ b/app/widgets/gimppropgui.c
@@ -160,37 +160,12 @@ gimp_prop_widget_new_from_pspec (GObject               *config,
       else
         {
           gdouble value;
-          gdouble *config_value;
-          gchar   *config_key;
 
           /* Get the min and max for the given property. */
           _gimp_prop_widgets_get_numeric_values (config, pspec,
                                                  &value, &lower, &upper,
                                                  G_STRFUNC);
 
-          /* A given config object may have locale min/max. */
-          config_key = g_strconcat (pspec->name, ":min", NULL);
-          config_value = g_object_get_data (G_OBJECT (config),
-                                            config_key);
-          if (config_value &&
-              *config_value > lower &&
-              *config_value < upper)
-            {
-              lower = *config_value;
-            }
-          g_free (config_key);
-
-          config_key = g_strconcat (pspec->name, ":max", NULL);
-          config_value = g_object_get_data (G_OBJECT (config),
-                                            config_key);
-          if (config_value &&
-              *config_value > lower &&
-              *config_value < upper)
-            {
-              upper = *config_value;
-            }
-          g_free (config_key);
-
           if ((upper - lower <= 1.0) &&
               (G_IS_PARAM_SPEC_FLOAT (pspec) ||
                G_IS_PARAM_SPEC_DOUBLE (pspec)))
diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c
index 99c4051..79f52df 100644
--- a/app/widgets/gimppropwidgets.c
+++ b/app/widgets/gimppropwidgets.c
@@ -493,9 +493,7 @@ static void   gimp_prop_adjustment_notify   (GObject       *config,
  * If @label is #NULL, the @property_name's nick will be used as label
  * of the returned widget.
  * The property's lower and upper values will be used as min/max of the
- * #GimpSpinScale, unless the object carries locale data superseding
- * the property's setting, with the respective keys "@property_name:min"
- * and "@property_name:max".
+ * #GimpSpinScale.
  *
  * Return value:  A new #GimpSpinScale widget.
  *
@@ -512,8 +510,6 @@ gimp_prop_spin_scale_new (GObject     *config,
   GParamSpec    *param_spec;
   GtkAdjustment *adjustment;
   GtkWidget     *scale;
-  gdouble       *config_value;
-  gchar         *config_key;
   gdouble        value;
   gdouble        lower;
   gdouble        upper;
@@ -528,29 +524,6 @@ gimp_prop_spin_scale_new (GObject     *config,
                                                G_STRFUNC))
     return NULL;
 
-  /* Check if locale min/max for this specific config object exist. */
-  config_key = g_strconcat (param_spec->name, ":min", NULL);
-  config_value = g_object_get_data (G_OBJECT (config),
-                                    config_key);
-  if (config_value &&
-      *config_value > lower &&
-      *config_value < upper)
-    {
-      lower = *config_value;
-    }
-  g_free (config_key);
-
-  config_key = g_strconcat (param_spec->name, ":max", NULL);
-  config_value = g_object_get_data (G_OBJECT (config),
-                                    config_key);
-  if (config_value &&
-      *config_value > lower &&
-      *config_value < upper)
-    {
-      upper = *config_value;
-    }
-  g_free (config_key);
-
   /* Get label. */
   if (! label)
     label = g_param_spec_get_nick (param_spec);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]