[gimp] app: only use area dim., not off., for ui range of pixel-distance op props



commit e701700a88b11424dea7e0d261fe83c77df5510c
Author: Ell <ell_se yahoo com>
Date:   Sun Jul 2 19:50:08 2017 -0400

    app: only use area dim., not off., for ui range of pixel-distance op props
    
    Don't offset the ui range of op properties that use pixel-distance
    units to the top-left corner of the region, since they're relative;
    only do that for pixel-coordinate units.  Let their ui range be
    [0, width/height].

 app/widgets/gimppropgui.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimppropgui.c b/app/widgets/gimppropgui.c
index 3f30233..2eb068c 100644
--- a/app/widgets/gimppropgui.c
+++ b/app/widgets/gimppropgui.c
@@ -264,14 +264,23 @@ gimp_prop_widget_new_from_pspec (GObject                  *config,
               if (HAS_KEY (pspec, "unit", "pixel-coordinate") ||
                   HAS_KEY (pspec, "unit", "pixel-distance"))
                 {
+                  gint off_x = 0;
+                  gint off_y = 0;
+
+                  if (HAS_KEY (pspec, "unit", "pixel-coordinate"))
+                    {
+                      off_x = area->x;
+                      off_y = area->y;
+                    }
+
                   if (HAS_KEY (pspec, "axis", "x"))
                     {
                       g_printerr ("XXX setting width %d on %s\n",
                                   area->width, pspec->name);
 
                       gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (widget),
-                                                        area->x,
-                                                        area->x + area->width);
+                                                        off_x,
+                                                        off_x + area->width);
                     }
                   else if (HAS_KEY (pspec, "axis","y"))
                     {
@@ -279,8 +288,8 @@ gimp_prop_widget_new_from_pspec (GObject                  *config,
                                   area->height, pspec->name);
 
                       gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (widget),
-                                                        area->y,
-                                                        area->y + area->height);
+                                                        off_y,
+                                                        off_y + area->height);
                     }
                 }
             }


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