[gimp/goat-invasion] app: respect GEGLs ui-range hints for properties



commit 7d5ca5e7418beec4889abdffd56efa3b2f277ebd
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Fri Mar 30 20:22:00 2012 +0100

    app: respect GEGLs ui-range hints for properties

 app/core/gimpparamspecs-duplicate.c |   31 +++++++++++++++++++++++++++++++
 app/widgets/gimppropwidgets.c       |   14 ++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpparamspecs-duplicate.c b/app/core/gimpparamspecs-duplicate.c
index c0b7426..ae1b285 100644
--- a/app/core/gimpparamspecs-duplicate.c
+++ b/app/core/gimpparamspecs-duplicate.c
@@ -97,6 +97,22 @@ gimp_param_spec_duplicate (GParamSpec *pspec)
                                 spec->default_value,
                                 pspec->flags);
     }
+  else if (GEGL_IS_PARAM_SPEC_DOUBLE (pspec))
+    {
+      GeglParamSpecDouble *gspec = GEGL_PARAM_SPEC_DOUBLE (pspec);
+      GParamSpecDouble    *spec = G_PARAM_SPEC_DOUBLE (pspec);
+
+      return gegl_param_spec_double (pspec->name,
+                                     g_param_spec_get_nick (pspec),
+                                     g_param_spec_get_blurb (pspec),
+                                     spec->minimum,
+                                     spec->maximum,
+                                     spec->default_value,
+                                     gspec->ui_minimum,
+                                     gspec->ui_maximum,
+                                     gspec->ui_gamma,
+                                     pspec->flags);
+    }
   else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
     {
       GParamSpecDouble *spec = G_PARAM_SPEC_DOUBLE (pspec);
@@ -121,6 +137,21 @@ gimp_param_spec_duplicate (GParamSpec *pspec)
                                  spec->default_value,
                                  pspec->flags);
     }
+  else if (GEGL_IS_PARAM_SPEC_INT (pspec))
+    {
+      GeglParamSpecInt *gspec = GEGL_PARAM_SPEC_INT (pspec);
+      GParamSpecInt *spec = G_PARAM_SPEC_INT (pspec);
+
+      return gegl_param_spec_int (pspec->name,
+                                  g_param_spec_get_nick (pspec),
+                                  g_param_spec_get_blurb (pspec),
+                                  spec->minimum,
+                                  spec->maximum,
+                                  spec->default_value,
+                                  gspec->ui_minimum,
+                                  gspec->ui_maximum,
+                                  pspec->flags);
+    }
   else if (G_IS_PARAM_SPEC_INT (pspec))
     {
       GParamSpecInt *spec = G_PARAM_SPEC_INT (pspec);
diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c
index 38df10c..36e467b 100644
--- a/app/widgets/gimppropwidgets.c
+++ b/app/widgets/gimppropwidgets.c
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 
 #include <gegl.h>
+#include <gegl-paramspecs.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
@@ -507,6 +508,19 @@ gimp_prop_spin_scale_new (GObject     *config,
 
   set_param_spec (G_OBJECT (adjustment), scale, param_spec);
 
+  if (GEGL_IS_PARAM_SPEC_DOUBLE (param_spec))
+    {
+      GeglParamSpecDouble *gspec = GEGL_PARAM_SPEC_DOUBLE (param_spec);
+      gimp_spin_scale_set_scale_limits (scale, gspec->ui_minimum, gspec->ui_maximum);
+    }
+
+  if (GEGL_IS_PARAM_SPEC_INT (param_spec))
+    {
+      GeglParamSpecInt *gspec = GEGL_PARAM_SPEC_INT (param_spec);
+      gimp_spin_scale_set_scale_limits (scale, gspec->ui_minimum, gspec->ui_maximum);
+    }
+
+
   g_signal_connect (adjustment, "value-changed",
                     G_CALLBACK (gimp_prop_adjustment_callback),
                     config);



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