diff options
| author | Bill Spitzak <spitzak@gmail.com> | 2000-06-15 05:37:40 +0000 |
|---|---|---|
| committer | Bill Spitzak <spitzak@gmail.com> | 2000-06-15 05:37:40 +0000 |
| commit | 4ab82443bd55b96f7db233e47b94338f70c01238 (patch) | |
| tree | ba7560669868120a2434903774703bd3082d5771 /src | |
| parent | 43b5617c47f59da19d9b77c6b67612c0fa530951 (diff) | |
Added a bunch of missing FL_EXTERN's to glut.h (I have not really
tested this, but I believe this is why I keep getting mail about glut
not linking on win32. If anybody can check this please do so!)
Fix for sliders so that clicking on one with a small (or zero)
slider_size will not move the slider.
I put Fl_Button.H in fl_shortcut.cxx so that it gets the FL_EXTERN for
fl_old_shortcut() (and also assures the declarations match).
Fixed xpaint link in the documentation.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1212 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Slider.cxx | 46 | ||||
| -rw-r--r-- | src/fl_shortcut.cxx | 7 |
2 files changed, 28 insertions, 25 deletions
diff --git a/src/Fl_Slider.cxx b/src/Fl_Slider.cxx index 8489960aa..a58d458eb 100644 --- a/src/Fl_Slider.cxx +++ b/src/Fl_Slider.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Slider.cxx,v 1.8.2.8 2000/06/10 18:24:31 bill Exp $" +// "$Id: Fl_Slider.cxx,v 1.8.2.9 2000/06/15 05:37:39 bill Exp $" // // Slider widget for the Fast Light Tool Kit (FLTK). // @@ -95,8 +95,8 @@ void Fl_Slider::draw_bg(int x, int y, int w, int h) { } void Fl_Slider::draw(int x, int y, int w, int h) { - double val; + double val; if (minimum() == maximum()) val = 0.5; else { @@ -179,43 +179,47 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) { if (!Fl::event_inside(x, y, w, h)) return 0; handle_push(); case FL_DRAG: { + + double val; + if (minimum() == maximum()) + val = 0.5; + else { + val = (value()-minimum())/(maximum()-minimum()); + if (val > 1.0) val = 1.0; + else if (val < 0.0) val = 0.0; + } + int W = (horizontal() ? w : h); - //int H = (horizontal() ? h : w); int mx = (horizontal() ? Fl::event_x()-x : Fl::event_y()-y); - int S = int(slider_size_*W+.5); if (S >= W) return 0; - int X; + int S; static int offcenter; - double val = - (maximum()-minimum()) ? (value()-minimum())/(maximum()-minimum()) : 0.5; - if (type() == FL_HOR_FILL_SLIDER || type() == FL_VERT_FILL_SLIDER) { - if (val >= 1.0) X = W; - else if (val <= 0.0) X = 0; - else X = int(val*W+.5); - + S = 0; if (event == FL_PUSH) { + int X = int(val*W+.5); offcenter = mx-X; - if (offcenter < -S/2) offcenter = 0; - else if (offcenter > S/2) offcenter = 0; + if (offcenter < -10 || offcenter > 10) offcenter = 0; else return 1; } - S = 0; - } else { - if (val >= 1.0) X = W-S; - else if (val <= 0.0) X = 0; - else X = int(val*(W-S)+.5); + } else { + S = int(slider_size_*W+.5); if (S >= W) return 0; + int T = (horizontal() ? h : w)/2+1; + if (type()==FL_VERT_NICE_SLIDER || type()==FL_HOR_NICE_SLIDER) T += 4; + if (S < T) S = T; if (event == FL_PUSH) { + int X = int(val*(W-S)+.5); offcenter = mx-X; if (offcenter < 0) offcenter = 0; else if (offcenter > S) offcenter = S; else return 1; } } - X = mx-offcenter; + + int X = mx-offcenter; double v; TRY_AGAIN: if (X < 0) { @@ -251,5 +255,5 @@ int Fl_Slider::handle(int event) { } // -// End of "$Id: Fl_Slider.cxx,v 1.8.2.8 2000/06/10 18:24:31 bill Exp $". +// End of "$Id: Fl_Slider.cxx,v 1.8.2.9 2000/06/15 05:37:39 bill Exp $". // diff --git a/src/fl_shortcut.cxx b/src/fl_shortcut.cxx index ebfad4cfd..45bd22368 100644 --- a/src/fl_shortcut.cxx +++ b/src/fl_shortcut.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_shortcut.cxx,v 1.4.2.7 2000/06/14 19:57:20 mike Exp $" +// "$Id: fl_shortcut.cxx,v 1.4.2.8 2000/06/15 05:37:40 bill Exp $" // // Shortcut support routines for the Fast Light Tool Kit (FLTK). // @@ -41,6 +41,7 @@ #include <FL/Fl.H> #include <FL/Fl_Widget.H> +#include <FL/Fl_Button.H> #include <FL/fl_draw.H> #include <ctype.h> #include <string.h> @@ -48,8 +49,6 @@ #include <FL/x.H> #endif -extern FL_EXPORT int fl_old_shortcut(const char*); - int Fl::test_shortcut(int shortcut) { if (!shortcut) return 0; @@ -193,5 +192,5 @@ int Fl_Widget::test_shortcut() { } // -// End of "$Id: fl_shortcut.cxx,v 1.4.2.7 2000/06/14 19:57:20 mike Exp $". +// End of "$Id: fl_shortcut.cxx,v 1.4.2.8 2000/06/15 05:37:40 bill Exp $". // |
