[gegl] operation_reference.c: clamp property values with +-inf if more than 7 digits for int, display value



commit 1529eb81d4ad563de85bebc896b2c50efeb6b903
Author: Michael Murà <batolettre gmail com>
Date:   Fri Sep 2 00:08:35 2011 +0200

    operation_reference.c: clamp property values with +-inf if more than 7 digits for int, display value for float properties

 tools/operation_reference.c |  113 ++++++++++++++++++++++++++-----------------
 1 files changed, 69 insertions(+), 44 deletions(-)
---
diff --git a/tools/operation_reference.c b/tools/operation_reference.c
index d720bcc..f53bc35 100644
--- a/tools/operation_reference.c
+++ b/tools/operation_reference.c
@@ -102,56 +102,81 @@ list_properties (GType    type,
 
           if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), G_TYPE_DOUBLE))
             {
-            gdouble default_value = G_PARAM_SPEC_DOUBLE (self[prop_no])->default_value;
-            gdouble min = G_PARAM_SPEC_DOUBLE (self[prop_no])->minimum;
-            gdouble max = G_PARAM_SPEC_DOUBLE (self[prop_no])->maximum;
-
-            if (default_value<-10000000)
-              g_print ("-inf ");
-            else if (default_value>10000000)
-              g_print ("+inf");
-            else
-              g_print ("%2.2f", default_value);
-
-            g_print ("<br/>");
-            if (min<-10000000)
-              g_print ("-inf ");
-            else
-              g_print ("%2.2f", min);
-            
-            g_print ("-");
-
-            if (max>10000000)
-              g_print (" +inf");
-            else
-              g_print ("%2.2f", max);
+              gdouble default_value = G_PARAM_SPEC_DOUBLE (self[prop_no])->default_value;
+              gdouble min = G_PARAM_SPEC_DOUBLE (self[prop_no])->minimum;
+              gdouble max = G_PARAM_SPEC_DOUBLE (self[prop_no])->maximum;
+
+              if (default_value<-10000000)
+                g_print ("-inf ");
+              else if (default_value>10000000)
+                g_print ("+inf");
+              else
+                g_print ("%2.2f", default_value);
+
+              g_print ("<br/>");
+              if (min<-10000000)
+                g_print ("-inf ");
+              else
+                g_print ("%2.2f", min);
 
+              g_print ("-");
+
+              if (max>10000000)
+                g_print (" +inf");
+              else
+                g_print ("%2.2f", max);
             }
           else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), G_TYPE_INT))
             {
-              g_print ("%i", G_PARAM_SPEC_INT (self[prop_no])->default_value);
+              gdouble default_value = G_PARAM_SPEC_INT (self[prop_no])->default_value;
+              gint min = G_PARAM_SPEC_INT (self[prop_no])->minimum;
+              gint max = G_PARAM_SPEC_INT (self[prop_no])->maximum;
+
+              if (default_value<-10000000)
+                g_print ("-inf ");
+              else if (default_value>10000000)
+                g_print ("+inf");
+              else
+                g_print ("%i", default_value);
 
-            {
-            gint min = G_PARAM_SPEC_INT (self[prop_no])->minimum;
-            gint max = G_PARAM_SPEC_INT (self[prop_no])->maximum;
-            g_print ("<br/>");
-            if (min<-10000000)
-              g_print ("-inf ");
-            else
-              g_print ("%i", min);
-            
-            g_print ("-");
-
-            if (max>10000000)
-              g_print (" +inf");
-            else
-              g_print ("%i", max);
-            }
+              g_print ("<br/>");
+              if (min<-10000000)
+                g_print ("-inf ");
+              else
+                g_print ("%i", min);
 
+              g_print ("-");
+
+              if (max>10000000)
+                g_print (" +inf");
+              else
+                g_print ("%i", max);
             }
           else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), G_TYPE_FLOAT))
             {
-              g_print ("%2.2f", G_PARAM_SPEC_FLOAT (self[prop_no])->default_value);
+              gdouble default_value = G_PARAM_SPEC_FLOAT (self[prop_no])->default_value;
+              gdouble min = G_PARAM_SPEC_FLOAT (self[prop_no])->minimum;
+              gdouble max = G_PARAM_SPEC_FLOAT (self[prop_no])->maximum;
+
+              if (default_value<-10000000)
+                g_print ("-inf ");
+              else if (default_value>10000000)
+                g_print ("+inf");
+              else
+                g_print ("%2.2f", default_value);
+
+              g_print ("<br/>");
+              if (min<-10000000)
+                g_print ("-inf ");
+              else
+                g_print ("%2.2f", min);
+
+              g_print ("-");
+
+              if (max>10000000)
+                g_print (" +inf");
+              else
+                g_print ("%2.2f", max);
             }
           else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), G_TYPE_BOOLEAN))
             {



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