diff options
| author | Carl E. Thompson <devel-fltk@carlthompson.net> | 1999-03-10 00:13:52 +0000 |
|---|---|---|
| committer | Carl E. Thompson <devel-fltk@carlthompson.net> | 1999-03-10 00:13:52 +0000 |
| commit | f7e1ff774270fc053f208a11e1a841d60f1c891d (patch) | |
| tree | 22dbac7b7784459b2704af01d63877eb91cb8f0b | |
| parent | 72d1391dbb92a183286a4710f035bb79e00b3aea (diff) | |
Changes Fl_Dial to use XForms defaults for angles
-Carl
git-svn-id: file:///fltk/svn/fltk/trunk@397 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | documentation/Fl_Dial.html | 10 | ||||
| -rw-r--r-- | src/Fl_Dial.cxx | 14 | ||||
| -rw-r--r-- | test/valuators.fl | 6 |
3 files changed, 16 insertions, 14 deletions
diff --git a/documentation/Fl_Dial.html b/documentation/Fl_Dial.html index a320d7df5..db0659f8e 100644 --- a/documentation/Fl_Dial.html +++ b/documentation/Fl_Dial.html @@ -34,12 +34,12 @@ and label string. The default type is <TT>FL_NORMAL_DIAL</TT>. Destroys the valuator. <H4><A name=Fl_Dial.angles>void Fl_Dial::angles(short a, short b)</A></H4> Sets the angles used for the minimum and maximum values. By default -these are 225 and 135, respectively. (0 degrees is straight up and the +these are 0 and 360, respectively. (0 degrees is straight down and the angles progress clockwise.) The angles specified should be greater than -or equal to 0 and less than 360. The progress of the dial always starts at -the minimum angle and progresses clockwise to the maximum angle. Currently, -counter-clockwise progression is not supported (but user code can always -use 1/value()). +or equal to 0 and less than or equal to 360. The progress of the dial always +starts at the minimum angle and progresses clockwise to the maximum angle. +Currently, counter-clockwise progression is not supported (but user code can +always use 1/value()). <H4><A name=Fl_Dial.type>type(uchar)</A></H4> Sets the type of the dial to: <UL> diff --git a/src/Fl_Dial.cxx b/src/Fl_Dial.cxx index e8d9a91a8..aa83e70aa 100644 --- a/src/Fl_Dial.cxx +++ b/src/Fl_Dial.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Dial.cxx,v 1.10 1999/03/09 07:51:10 bill Exp $" +// "$Id: Fl_Dial.cxx,v 1.11 1999/03/10 00:13:52 carl Exp $" // // Circular dial widget for the Fast Light Tool Kit (FLTK). // @@ -50,9 +50,9 @@ void Fl_Dial::draw(int x, int y, int w, int h) { int foo = (box() > _FL_ROUND_UP_BOX && Fl::box_dx(box())); if (foo) {x--; y--; w+=2; h+=2;} fl_color(color()); - fl_pie(x, y, w-1, h-1, 90-a1, 360+90-angle); + fl_pie(x, y, w-1, h-1, 270-a1, 360+270-angle); fl_color(selection_color()); - fl_pie(x, y, w-1, h-1, 90-angle, 90-a1); + fl_pie(x, y, w-1, h-1, 270-angle, 270-a1); if (foo) { fl_color(FL_BLACK); fl_arc(x, y, w, h, 0, 360); @@ -72,7 +72,7 @@ void Fl_Dial::draw(int x, int y, int w, int h) { fl_begin_line(); fl_vertex(0, 0); fl_vertex(.5, 0); fl_end_line(); } */ - fl_rotate(225-angle); + fl_rotate(45-angle); fl_color(selection_color()); if (type() == FL_LINE_DIAL) { fl_begin_polygon(); @@ -114,7 +114,7 @@ int Fl_Dial::handle(int event, int x, int y, int w, int h) { int my = Fl::event_y()-y-h/2; if (!mx && !my) return 1; angle = atan2((float)-my, (float)-mx) + M_PI; - angle = (angle*360) / (2*M_PI) + 90; + angle = (angle*360) / (2*M_PI) + 270; while (angle < oldangle-180) angle += 360; while (angle > oldangle+180) angle -= 360; if (angle <= a1) { @@ -143,9 +143,9 @@ Fl_Dial::Fl_Dial(int x, int y, int w, int h, const char* l) : Fl_Valuator(x, y, w, h, l) { box(FL_OVAL_BOX); selection_color(FL_INACTIVE_COLOR); // was 37 - angles(225,135); + angles(0,360); } // -// End of "$Id: Fl_Dial.cxx,v 1.10 1999/03/09 07:51:10 bill Exp $". +// End of "$Id: Fl_Dial.cxx,v 1.11 1999/03/10 00:13:52 carl Exp $". // diff --git a/test/valuators.fl b/test/valuators.fl index 582a7d6f4..70dc3ea13 100644 --- a/test/valuators.fl +++ b/test/valuators.fl @@ -133,20 +133,22 @@ fflush(stdout);} callback {printf("%g \\r",o->value()); fflush(stdout);} selected xywh {315 280 65 65} color 10 selection_color 1 labelsize 8 - code0 {o->angles(180,135);} + code0 {o->angles(0,315);} } Fl_Dial {} { label FL_LINE_DIAL callback {printf("%g \\r",o->value()); fflush(stdout);} xywh {395 280 65 65} type Line color 10 selection_color 1 labelsize 8 - code0 {o->angles(0,360);} + code1 {o->value(0.5);} } Fl_Dial {} { label FL_FILL_DIAL callback {printf("%g \\r",o->value()); fflush(stdout);} xywh {475 280 65 65} type Fill color 10 selection_color 1 labelsize 8 + code0 {o->angles(45,315);} + code1 {o->value(1.0);} } Fl_Box {} { label Fl_Roller |
