[gimp] app: add gimp_display_shell_scrollbars_update_steppers()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_display_shell_scrollbars_update_steppers()
- Date: Tue, 5 Jan 2016 19:54:26 +0000 (UTC)
commit 73a9ac967caefa14175173e52e3ef750464d783c
Author: Michael Natterer <mitch gimp org>
Date: Tue Jan 5 20:53:34 2016 +0100
app: add gimp_display_shell_scrollbars_update_steppers()
for the code from gimp_display_shell_scroll_clamp_and_update() that
sets the scrollbar stepper sensitivity.
app/display/gimpdisplayshell-scroll.c | 33 +++++-----------------
app/display/gimpdisplayshell-scrollbars.c | 41 +++++++++++++++++++++++++++++
app/display/gimpdisplayshell-scrollbars.h | 6 ++++
3 files changed, 55 insertions(+), 25 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c
index 919264b..5345251 100644
--- a/app/display/gimpdisplayshell-scroll.c
+++ b/app/display/gimpdisplayshell-scroll.c
@@ -35,7 +35,6 @@
#include "gimpdisplay-foreach.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-expose.h"
-#include "gimpdisplayshell-rotate.h"
#include "gimpdisplayshell-rulers.h"
#include "gimpdisplayshell-scale.h"
#include "gimpdisplayshell-scroll.h"
@@ -198,34 +197,18 @@ gimp_display_shell_scroll_clamp_and_update (GimpDisplayShell *shell)
max_offset_y = sh + overpan_amount - shell->disp_height;
}
-
- /* Handle scrollbar stepper sensitiity */
-
- gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->hsb),
- min_offset_x < shell->offset_x ?
- GTK_SENSITIVITY_ON :
- GTK_SENSITIVITY_OFF);
-
- gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->hsb),
- max_offset_x > shell->offset_x ?
- GTK_SENSITIVITY_ON :
- GTK_SENSITIVITY_OFF);
-
- gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->vsb),
- min_offset_y < shell->offset_y ?
- GTK_SENSITIVITY_ON :
- GTK_SENSITIVITY_OFF);
-
- gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->vsb),
- max_offset_y > shell->offset_y ?
- GTK_SENSITIVITY_ON :
- GTK_SENSITIVITY_OFF);
-
-
/* Clamp */
shell->offset_x = CLAMP (shell->offset_x, min_offset_x, max_offset_x);
shell->offset_y = CLAMP (shell->offset_y, min_offset_y, max_offset_y);
+
+ /* Set scrollbar stepper sensitiity */
+
+ gimp_display_shell_scrollbars_update_steppers (shell,
+ min_offset_x,
+ max_offset_x,
+ min_offset_y,
+ max_offset_y);
}
else
{
diff --git a/app/display/gimpdisplayshell-scrollbars.c b/app/display/gimpdisplayshell-scrollbars.c
index 152dcd9..ee998c6 100644
--- a/app/display/gimpdisplayshell-scrollbars.c
+++ b/app/display/gimpdisplayshell-scrollbars.c
@@ -161,3 +161,44 @@ gimp_display_shell_scrollbars_setup_vertical (GimpDisplayShell *shell,
MINIMUM_STEP_AMOUNT),
NULL);
}
+
+/**
+ * gimp_display_shell_scrollbars_update_steppers:
+ * @shell:
+ * @min_offset_x:
+ * @max_offset_x:
+ * @min_offset_y:
+ * @max_offset_y:
+ *
+ * Sets the scrollbars' stepper sensitivity which is set differently
+ * from its adjustment limits because we support overscrolling.
+ **/
+void
+gimp_display_shell_scrollbars_update_steppers (GimpDisplayShell *shell,
+ gint min_offset_x,
+ gint max_offset_x,
+ gint min_offset_y,
+ gint max_offset_y)
+{
+ g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+ gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->hsb),
+ min_offset_x < shell->offset_x ?
+ GTK_SENSITIVITY_ON :
+ GTK_SENSITIVITY_OFF);
+
+ gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->hsb),
+ max_offset_x > shell->offset_x ?
+ GTK_SENSITIVITY_ON :
+ GTK_SENSITIVITY_OFF);
+
+ gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->vsb),
+ min_offset_y < shell->offset_y ?
+ GTK_SENSITIVITY_ON :
+ GTK_SENSITIVITY_OFF);
+
+ gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->vsb),
+ max_offset_y > shell->offset_y ?
+ GTK_SENSITIVITY_ON :
+ GTK_SENSITIVITY_OFF);
+}
diff --git a/app/display/gimpdisplayshell-scrollbars.h b/app/display/gimpdisplayshell-scrollbars.h
index 8a7dff1..954537d 100644
--- a/app/display/gimpdisplayshell-scrollbars.h
+++ b/app/display/gimpdisplayshell-scrollbars.h
@@ -26,5 +26,11 @@ void gimp_display_shell_scrollbars_setup_horizontal (GimpDisplayShell *shell,
void gimp_display_shell_scrollbars_setup_vertical (GimpDisplayShell *shell,
gdouble value);
+void gimp_display_shell_scrollbars_update_steppers (GimpDisplayShell *shell,
+ gint min_offset_x,
+ gint max_offset_x,
+ gint min_offset_y,
+ gint max_offset_y);
+
#endif /* __GIMP_DISPLAY_SHELL_SCROLLBARS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]