[gimp] Bug 776648 - Spin buttons of histogram box do not take image precision into account



commit 4ac59f842f2c652ea993821517c88dd51bad266a
Author: Thomas Manni <thomas manni free fr>
Date:   Sat Dec 31 09:25:46 2016 +0100

    Bug 776648 - Spin buttons of histogram box do not take image precision into account
    
    Adapt step and page increments of histogram box spin buttons adjustment according to
    the number of histogram bins.

 app/widgets/gimphistogrambox.c |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/app/widgets/gimphistogrambox.c b/app/widgets/gimphistogrambox.c
index c2ecbc0..98721f8 100644
--- a/app/widgets/gimphistogrambox.c
+++ b/app/widgets/gimphistogrambox.c
@@ -228,20 +228,42 @@ gimp_histogram_box_histogram_range (GimpHistogramView *view,
 
   if (box->n_bins != view->n_bins)
     {
+      gdouble upper;
+      gdouble page_increment;
+      gdouble step_increment;
+      guint   digits;
+
       box->n_bins = view->n_bins;
 
       if (box->n_bins == 256)
         {
-          gtk_adjustment_set_upper (box->high_adj, 255);
-          gtk_spin_button_set_digits (GTK_SPIN_BUTTON (box->low_spinbutton), 0);
-          gtk_spin_button_set_digits (GTK_SPIN_BUTTON (box->high_spinbutton), 0);
+          digits         = 0;
+          upper          = 255.0;
+          step_increment = 1.0;
+          page_increment = 16.0;
         }
       else
         {
-          gtk_adjustment_set_upper (box->high_adj, 1.0);
-          gtk_spin_button_set_digits (GTK_SPIN_BUTTON (box->low_spinbutton), 3);
-          gtk_spin_button_set_digits (GTK_SPIN_BUTTON (box->high_spinbutton), 3);
+          digits         = 3;
+          upper          = 1.0;
+          step_increment = 0.01;
+          page_increment = 0.1;
         }
+
+      g_object_set (G_OBJECT (box->high_adj),
+                    "upper", upper,
+                    "step-increment", step_increment,
+                    "page-increment", page_increment,
+                    NULL);
+
+      gtk_spin_button_set_digits (GTK_SPIN_BUTTON (box->high_spinbutton), digits);
+
+      g_object_set (G_OBJECT (box->low_adj),
+                    "step-increment", step_increment,
+                    "page-increment", page_increment,
+                    NULL);
+
+      gtk_spin_button_set_digits (GTK_SPIN_BUTTON (box->low_spinbutton), digits);
     }
 
   if (box->n_bins != 256)


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