summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-01-30 20:07:01 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-01-30 20:07:01 +0100
commit98f0b3771837e66a35a0564836084f562145f414 (patch)
treed6a9a89ede1714c248dc3e99e0f1839bd5df15bf
parent3bb5d9edb7101e4591e31b522929a9c5d7ad7ea6 (diff)
make center_cb() a static method of GipfelWidget
-rw-r--r--src/GipfelWidget.H3
-rw-r--r--src/GipfelWidget.cxx22
2 files changed, 10 insertions, 15 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H
index 838f290..d475a80 100644
--- a/src/GipfelWidget.H
+++ b/src/GipfelWidget.H
@@ -48,6 +48,8 @@ class GipfelWidget : public Fl_Widget {
static int get_pixel(Fl_Image *img, int x, int y,
int *r, int *g, int *b);
+ static void center_cb(Fl_Widget *o, void *f);
+
public:
typedef enum {
NEAREST = 0,
@@ -56,7 +58,6 @@ class GipfelWidget : public Fl_Widget {
GipfelWidget(int X,int Y,int W, int H);
- void center();
int load_image(char *file);
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index b7a9c54..7586a7f 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -32,8 +32,6 @@
static double pi_d, deg2rad;
-static void center_cb(Fl_Widget *o, void *f);
-
GipfelWidget::GipfelWidget(int X,int Y,int W, int H): Fl_Widget(X, Y, W, H) {
pi_d = asin(1.0) * 2.0;
deg2rad = pi_d / 180.0;
@@ -571,23 +569,19 @@ GipfelWidget::get_view_height() {
}
void
-GipfelWidget::center() {
- Hill *m = choose_hill(pan->get_close_mountains(), "Center Peak");
+GipfelWidget::center_cb(Fl_Widget *o, void *f) {
+ GipfelWidget *g = (GipfelWidget*) f;
+
+ Hill *m = choose_hill(g->pan->get_close_mountains(), "Center Peak");
if (m) {
- set_center_angle(m->alph / deg2rad);
+ g->set_center_angle(m->alph / deg2rad);
- if (!known_hills->contains(m)) {
- known_hills->add(m);
+ if (!g->known_hills->contains(m)) {
+ g->known_hills->add(m);
}
-
}
}
-static void
-center_cb(Fl_Widget *o, void *f) {
- ((GipfelWidget*)f)->center();
-}
-
void
GipfelWidget::set_height_dist_ratio(double r) {
pan->set_height_dist_ratio(r);
@@ -610,8 +604,8 @@ GipfelWidget::set_show_hidden(int h) {
set_labels(pan->get_visible_mountains());
redraw();
-
}
+
void
GipfelWidget::set_view_lat(double v) {
pan->set_view_lat(v);