diff options
-rw-r--r-- | src/Fl_Value_Dial.H | 49 | ||||
-rw-r--r-- | src/Fl_Value_Dial.cxx | 55 | ||||
-rw-r--r-- | src/GipfelWidget.cxx | 10 | ||||
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/gipfel.cxx | 15 |
5 files changed, 123 insertions, 12 deletions
diff --git a/src/Fl_Value_Dial.H b/src/Fl_Value_Dial.H new file mode 100644 index 0000000..313d5a9 --- /dev/null +++ b/src/Fl_Value_Dial.H @@ -0,0 +1,49 @@ +// +// "$Id: Fl_Value_Dial.H,v 1.1 2005/05/17 09:20:38 hofmann Exp $" +// +// Value dial header file for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2004 by Bill Spitzak and others. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to "fltk-bugs@fltk.org". +// + +#ifndef Fl_Value_Dial_H +#define Fl_Value_Dial_H + +#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;} +}; + +#endif + +// +// End of "$Id: Fl_Value_Dial.H,v 1.1 2005/05/17 09:20:38 hofmann Exp $". +// diff --git a/src/Fl_Value_Dial.cxx b/src/Fl_Value_Dial.cxx new file mode 100644 index 0000000..38c7ad7 --- /dev/null +++ b/src/Fl_Value_Dial.cxx @@ -0,0 +1,55 @@ +// +// "$Id: Fl_Value_Dial.cxx,v 1.1 2005/05/17 09:20:38 hofmann Exp $" +// +// Value dial widget for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2004 by Bill Spitzak and others. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to "fltk-bugs@fltk.org". +// + +#include <FL/Fl.H> +#include <FL/fl_draw.H> +#include <math.h> +#include "Fl_Value_Dial.H" + +Fl_Value_Dial::Fl_Value_Dial(int X, int Y, int W, int H, const char*l) +: Fl_Dial(X,Y,W,H,l) { + step(1,100); + textfont_ = FL_HELVETICA; + textsize_ = 10; + textcolor_ = FL_BLACK; +} + +void Fl_Value_Dial::draw() { + int sxx = x(), syy = y(), sww = w(), shh = h(); + int bxx = x(), byy = y(), bww = w(), bhh = h(); + + if (damage()&FL_DAMAGE_ALL) draw_box(box(),sxx,syy,sww,shh,color()); + Fl_Dial::draw(sxx+Fl::box_dx(box()), + syy+Fl::box_dy(box()), + sww-Fl::box_dw(box()), + shh-Fl::box_dh(box())); + + 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); +} diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index b611bf0..c291685 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -1,5 +1,5 @@ // -// "$Id: GipfelWidget.cxx,v 1.30 2005/05/10 19:05:51 hofmann Exp $" +// "$Id: GipfelWidget.cxx,v 1.31 2005/05/17 09:20:38 hofmann Exp $" // // GipfelWidget routines. // @@ -186,8 +186,12 @@ GipfelWidget::set_labels(Hills *v) { for (j=0; j<v->get_num() && j < i; j++) { n = v->get(j); - if (overlap(m->x, m->label_x, n->x, n->label_x) && - overlap(m->label_y - height, m->label_y, n->label_y - height, n->label_y)) { + // Check for overlapping labels and + // overlaps between labels and peak markers + if ((overlap(m->x, m->label_x, n->x, n->label_x) && + overlap(m->label_y - height, m->label_y, n->label_y - height, n->label_y)) || + (overlap(m->x, m->label_x, n->x - 2, n->x + 2) && + overlap(m->label_y - height, m->label_y, n->y - 2, n->y + 2))) { m->label_y = n->label_y - height - 1; } } diff --git a/src/Makefile.am b/src/Makefile.am index 32f6fc7..8c078fc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,9 +4,11 @@ gipfel_SOURCES = \ gipfel.cxx \ GipfelWidget.cxx \ Panorama.cxx \ - Hill.cxx + Hill.cxx \ + Fl_Value_Dial.cxx noinst_HEADERS = \ GipfelWidget.H \ Panorama.H \ - Hill.H + Hill.H \ + Fl_Value_Dial.H diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 8c05d07..1d6f901 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -1,5 +1,5 @@ // -// "$Id: gipfel.cxx,v 1.23 2005/05/10 17:57:11 hofmann Exp $" +// "$Id: gipfel.cxx,v 1.24 2005/05/17 09:20:39 hofmann Exp $" // // gipfel program. // @@ -43,7 +43,8 @@ #include <FL/Fl_Menu_Bar.H> #include <FL/Fl_Menu_Item.H> #include <FL/Fl_Valuator.H> -#include <FL/Fl_Dial.H> +#include <FL/Fl_Value_Slider.H> +#include "Fl_Value_Dial.H" #include "GipfelWidget.H" @@ -150,7 +151,7 @@ create_control_window() { m = new Fl_Menu_Bar(0, 0, 400, 30); m->menu(menuitems); - s_center = new Fl_Dial(40, 60, 150, 150, NULL); + 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); @@ -164,7 +165,7 @@ create_control_window() { Fl_Box *west = new Fl_Box(0, 125, 40, 20, "West"); - s_scale = new Fl_Slider(235, 60, 160, 15, "Scale"); + s_scale = new Fl_Value_Slider(235, 60, 160, 15, "Scale"); s_scale->type(1); s_scale->box(FL_THIN_DOWN_BOX); s_scale->labelsize(10); @@ -174,7 +175,7 @@ create_control_window() { s_scale->callback((Fl_Callback*)scale_cb); s_scale->align(FL_ALIGN_TOP); - s_nick = new Fl_Slider(235, 90, 160, 15, "Nick"); + s_nick = new Fl_Value_Slider(235, 90, 160, 15, "Nick (deg.)"); s_nick->type(1); s_nick->box(FL_THIN_DOWN_BOX); s_nick->labelsize(10); @@ -184,7 +185,7 @@ create_control_window() { s_nick->callback((Fl_Callback*)nick_cb); s_nick->align(FL_ALIGN_TOP); - s_tilt = new Fl_Slider(235, 120, 160, 15, "Tilt"); + s_tilt = new Fl_Value_Slider(235, 120, 160, 15, "Tilt (deg.)"); s_tilt->type(1); s_tilt->box(FL_THIN_DOWN_BOX); s_tilt->labelsize(10); @@ -194,7 +195,7 @@ create_control_window() { s_tilt->callback((Fl_Callback*)tilt_cb); s_tilt->align(FL_ALIGN_TOP); - s_height_dist = new Fl_Slider(235, 150, 160, 15, "Visibility"); + s_height_dist = new Fl_Value_Slider(235, 150, 160, 15, "Visibility"); s_height_dist->type(1); s_height_dist->box(FL_THIN_DOWN_BOX); s_height_dist->labelsize(10); |