From 2668a87af7bbec1bf8a2ae971748f65885fe6fcf Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 26 Feb 2010 20:44:35 +0000 Subject: Fixed Scrollbar events when max is less than min (STR #2283) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7161 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Scrollbar.cxx | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/Fl_Scrollbar.cxx b/src/Fl_Scrollbar.cxx index d01472268..5ef37385d 100644 --- a/src/Fl_Scrollbar.cxx +++ b/src/Fl_Scrollbar.cxx @@ -36,23 +36,32 @@ #define REPEAT .05 void Fl_Scrollbar::increment_cb() { - int ls = maximum()>=minimum() ? linesize_ : -linesize_; + char inv = maximum() -ls) i = -ls; - break; - case 6: - i = int((maximum()-minimum())*slider_size()/(1.0-slider_size())) - ls; - if (i < ls) i = ls; - break; + case 1: // clicked on arrow left + i = -ls; + break; + default: // clicked on arrow right + i = ls; + break; + case 5: // clicked into the box next to the slider on the left + i = -(int((maximum()-minimum())*slider_size()/(1.0-slider_size()))); + if (inv) { + if (i<-ls) i = -ls; + } else { + if (i>-ls) i = -ls; // err + } + break; + case 6: // clicked into the box next to the slider on the right + i = (int((maximum()-minimum())*slider_size()/(1.0-slider_size()))); + if (inv) { + if (i>ls) i = ls; + } else { + if (i=minimum() ? linesize_ : -linesize_; + handle_drag(clamp(value() + ls * Fl::e_dx)); return 1; } else { if (Fl::e_dy==0) return 0; - handle_drag(clamp(value() + linesize_ * Fl::e_dy)); + int ls = maximum()>=minimum() ? linesize_ : -linesize_; + handle_drag(clamp(value() + ls * Fl::e_dy)); return 1; } case FL_SHORTCUT: -- cgit v1.2.3