[gimp] app: fix area-based scale_limits in gimp_prop_widget_new_from_pspec()



commit 694fde485ec4da3bc1242dcd85bab16730de081e
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jul 16 16:43:13 2017 +0200

    app: fix area-based scale_limits in gimp_prop_widget_new_from_pspec()
    
    Don't set scale limits outside the hard limits of the GParamSpec,
    and remove debug g_printerr().

 app/propgui/gimppropgui.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/app/propgui/gimppropgui.c b/app/propgui/gimppropgui.c
index 50bf67a..af69ed9 100644
--- a/app/propgui/gimppropgui.c
+++ b/app/propgui/gimppropgui.c
@@ -279,21 +279,19 @@ gimp_prop_widget_new_from_pspec (GObject                  *config,
 
                   if (HAS_KEY (pspec, "axis", "x"))
                     {
-                      g_printerr ("XXX setting width %d on %s\n",
-                                  area->width, pspec->name);
+                      gint min = MAX (lower, off_x);
+                      gint max = MIN (upper, off_x + area->width);
 
                       gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (widget),
-                                                        off_x,
-                                                        off_x + area->width);
+                                                        min, max);
                     }
                   else if (HAS_KEY (pspec, "axis","y"))
                     {
-                      g_printerr ("XXX setting height %d on %s\n",
-                                  area->height, pspec->name);
+                      gint min = MAX (lower, off_y);
+                      gint max = MIN (upper, off_y + area->height);
 
                       gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (widget),
-                                                        off_y,
-                                                        off_y + area->height);
+                                                        min, max);
                     }
                 }
             }


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