diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Fl_Value_Dial.H | 28 | ||||
-rw-r--r-- | src/Fl_Value_Dial.cxx | 34 | ||||
-rw-r--r-- | src/gipfel.cxx | 10 |
3 files changed, 52 insertions, 20 deletions
diff --git a/src/Fl_Value_Dial.H b/src/Fl_Value_Dial.H index 313d5a9..7d41aa5 100644 --- a/src/Fl_Value_Dial.H +++ b/src/Fl_Value_Dial.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Value_Dial.H,v 1.1 2005/05/17 09:20:38 hofmann Exp $" +// "$Id: Fl_Value_Dial.H,v 1.2 2005/05/18 11:34:30 hofmann Exp $" // // Value dial header file for the Fast Light Tool Kit (FLTK). // @@ -29,21 +29,23 @@ #include <FL/Fl_Dial.H> class Fl_Value_Dial : public Fl_Dial { - uchar textfont_, textsize_; - unsigned textcolor_; -public: - void draw(); - Fl_Value_Dial(int x,int y,int w,int h, const char *l = 0); - Fl_Font textfont() const {return (Fl_Font)textfont_;} - void textfont(uchar s) {textfont_ = s;} - uchar textsize() const {return textsize_;} - void textsize(uchar s) {textsize_ = s;} - Fl_Color textcolor() const {return (Fl_Color)textcolor_;} - void textcolor(unsigned s) {textcolor_ = s;} + uchar textfont_, textsize_; + unsigned textcolor_; + public: + void draw(); + int handle(int event); + + Fl_Value_Dial(int x,int y,int w,int h, const char *l = 0); + Fl_Font textfont() const {return (Fl_Font)textfont_;} + void textfont(uchar s) {textfont_ = s;} + uchar textsize() const {return textsize_;} + void textsize(uchar s) {textsize_ = s;} + Fl_Color textcolor() const {return (Fl_Color)textcolor_;} + void textcolor(unsigned s) {textcolor_ = s;} }; #endif // -// End of "$Id: Fl_Value_Dial.H,v 1.1 2005/05/17 09:20:38 hofmann Exp $". +// End of "$Id: Fl_Value_Dial.H,v 1.2 2005/05/18 11:34:30 hofmann Exp $". // diff --git a/src/Fl_Value_Dial.cxx b/src/Fl_Value_Dial.cxx index 38c7ad7..6e5c35c 100644 --- a/src/Fl_Value_Dial.cxx +++ b/src/Fl_Value_Dial.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Value_Dial.cxx,v 1.1 2005/05/17 09:20:38 hofmann Exp $" +// "$Id: Fl_Value_Dial.cxx,v 1.2 2005/05/18 11:34:30 hofmann Exp $" // // Value dial widget for the Fast Light Tool Kit (FLTK). // @@ -49,7 +49,37 @@ void Fl_Value_Dial::draw() { char buf[128]; format(buf); fl_font(textfont(), textsize()); - // draw_box(FL_DOWN_BOX,bxx,byy,35,fl_height(),color()); + fl_color(active_r() ? textcolor() : fl_inactive(textcolor())); fl_draw(buf, bxx, byy + fl_height() - 2, bww, bhh, FL_ALIGN_TOP); } + +int Fl_Value_Dial::handle(int event) { + switch (event) { + case FL_KEYBOARD : + switch (Fl::event_key()) { + case FL_Left: + handle_drag(clamp(increment(value(),-1))); + handle_release(); + return 1; + case FL_Right: + handle_drag(clamp(increment(value(),1))); + handle_release(); + return 1; + default: + return 0; + } + break; + case FL_FOCUS : + case FL_UNFOCUS : + if (Fl::visible_focus()) { + redraw(); + return 1; + } else return 0; + case FL_ENTER : + case FL_LEAVE : + return 1; + default: + return Fl_Dial::handle(event); + } +} diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 1d6f901..db1e863 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -1,5 +1,5 @@ // -// "$Id: gipfel.cxx,v 1.24 2005/05/17 09:20:39 hofmann Exp $" +// "$Id: gipfel.cxx,v 1.25 2005/05/18 11:34:30 hofmann Exp $" // // gipfel program. // @@ -154,7 +154,7 @@ create_control_window() { s_center = new Fl_Value_Dial(40, 60, 150, 150, NULL); s_center->type(FL_LINE_DIAL); s_center->labelsize(10); - s_center->step(0.001); + s_center->step(0.01); s_center->bounds(0.0, 360.0); s_center->angles(180, 540); s_center->callback((Fl_Callback*)angle_cb); @@ -179,7 +179,7 @@ create_control_window() { s_nick->type(1); s_nick->box(FL_THIN_DOWN_BOX); s_nick->labelsize(10); - s_nick->step(0.001); + s_nick->step(0.01); s_nick->bounds(-20.0, 20.0); s_nick->slider(FL_UP_BOX); s_nick->callback((Fl_Callback*)nick_cb); @@ -189,7 +189,7 @@ create_control_window() { s_tilt->type(1); s_tilt->box(FL_THIN_DOWN_BOX); s_tilt->labelsize(10); - s_tilt->step(0.001); + s_tilt->step(0.01); s_tilt->bounds(-10.0, 10.0); s_tilt->slider(FL_UP_BOX); s_tilt->callback((Fl_Callback*)tilt_cb); @@ -199,7 +199,7 @@ create_control_window() { s_height_dist->type(1); s_height_dist->box(FL_THIN_DOWN_BOX); s_height_dist->labelsize(10); - s_height_dist->step(-0.005); + s_height_dist->step(-0.002); s_height_dist->bounds(0.2, 0.01); s_height_dist->slider(FL_UP_BOX); s_height_dist->callback((Fl_Callback*)h_d_cb); |