summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2005-04-13 20:24:53 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2005-04-13 20:24:53 +0000
commitcb69ce80f60b07e152ca464c2c08eaeb3b159ec6 (patch)
tree37ea856f254afca991650b75da93b3f1eeabbeed
parent5e7c5bafd0828f09ca66d5311636700b51cc77ea (diff)
add h_d slider
add h_d slider
-rw-r--r--src/GipfelWidget.H4
-rw-r--r--src/GipfelWidget.cxx8
-rw-r--r--src/Panorama.cxx14
-rw-r--r--src/gipfel.cxx22
4 files changed, 39 insertions, 9 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H
index 4d1f0fe..316fbca 100644
--- a/src/GipfelWidget.H
+++ b/src/GipfelWidget.H
@@ -1,5 +1,5 @@
//
-// "$Id: GipfelWidget.H,v 1.4 2005/04/13 21:58:31 hofmann Exp $"
+// "$Id: GipfelWidget.H,v 1.5 2005/04/13 22:24:53 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -51,6 +51,8 @@ class GipfelWidget : public Fl_Widget {
void set_center_angle(double a);
void set_scale(double s);
+
+ void set_height_dist_ratio(double r);
void draw();
};
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index 03267aa..b586240 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: GipfelWidget.cxx,v 1.4 2005/04/13 21:58:31 hofmann Exp $"
+// "$Id: GipfelWidget.cxx,v 1.5 2005/04/13 22:24:53 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -148,6 +148,12 @@ GipfelWidget::set_scale(double s) {
redraw();
}
+void
+GipfelWidget::set_height_dist_ratio(double r) {
+ pan->set_height_dist_ratio(r);
+ redraw();
+}
+
int
GipfelWidget::handle(int event) {
int mark_x, mark_y;
diff --git a/src/Panorama.cxx b/src/Panorama.cxx
index 7236d3e..995b5ec 100644
--- a/src/Panorama.cxx
+++ b/src/Panorama.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Panorama.cxx,v 1.3 2005/04/13 21:58:31 hofmann Exp $"
+// "$Id: Panorama.cxx,v 1.4 2005/04/13 22:24:53 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -33,7 +33,7 @@ Panorama::Panorama() {
visible_mountains = NULL;
m1 = NULL;
m2 = NULL;
- height_dist_ratio = 0.10;
+ height_dist_ratio = 0.07;
pi = asin(1.0) * 2.0;
deg2rad = pi / 180.0;
a_center = 0.2*pi;
@@ -140,13 +140,21 @@ Panorama::move_mountain(Mountain *m, int x, int y) {
void
Panorama::set_center_angle(double a) {
a_center = a;
- fprintf(stderr, "--> %f\n", a);
+ fprintf(stderr, "--> angle%f\n", a);
update_visible_mountains();
}
void
Panorama::set_scale(double s) {
scale = s;
+ fprintf(stderr, "-->scale %f\n", s);
+ update_visible_mountains();
+}
+
+void
+Panorama::set_height_dist_ratio(double r) {
+ height_dist_ratio = r;
+ fprintf(stderr, "-->ratio %f\n", r);
update_visible_mountains();
}
diff --git a/src/gipfel.cxx b/src/gipfel.cxx
index 3705986..14c618c 100644
--- a/src/gipfel.cxx
+++ b/src/gipfel.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: gipfel.cxx,v 1.5 2005/04/13 21:58:31 hofmann Exp $"
+// "$Id: gipfel.cxx,v 1.6 2005/04/13 22:24:53 hofmann Exp $"
//
// flpsed program.
//
@@ -66,6 +66,12 @@ void angle_cb(Fl_Slider* o, void*) {
}
}
+void h_d_cb(Fl_Slider* o, void*) {
+ if (gipf) {
+ gipf->set_height_dist_ratio((double)(o->value()));
+ }
+}
+
void about_cb() {
fl_message("flpsed -- a pseudo PostScript editor\n"
"(c) Johannes Hofmann 2004, 2005\n\n"
@@ -141,17 +147,25 @@ int main(int argc, char** argv) {
s->box(FL_THIN_DOWN_BOX);
s->labelsize(10);
s->step(10.0);
- s->bounds(0.0, 800.0);
+ s->bounds(0.0, 2000.0);
s->slider(FL_UP_BOX);
s->callback((Fl_Callback*)scale_cb);
Fl_Slider* a = new Fl_Slider(160, 30, 160, 15, "angle");
a->type(1);
a->box(FL_THIN_DOWN_BOX);
a->labelsize(10);
- a->step(0.01);
- a->bounds(-4.0, 4.0);
+ a->step(0.0001);
+ a->bounds(-6.4, 6.4);
a->slider(FL_UP_BOX);
a->callback((Fl_Callback*)angle_cb);
+ Fl_Slider* r = new Fl_Slider(320, 30, 160, 15, "height-dist");
+ r->type(1);
+ r->box(FL_THIN_DOWN_BOX);
+ r->labelsize(10);
+ r->step(-0.005);
+ r->bounds(0.2, 0.02);
+ r->slider(FL_UP_BOX);
+ r->callback((Fl_Callback*)h_d_cb);
scroll = new Fl_Scroll(0, 60, win->w(), win->h()-60);