summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2013-10-11 20:08:53 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2013-10-11 20:08:53 +0200
commit726ab3d3492c481af3f612f525231ba18dddf7a6 (patch)
treefee23369af515417639a4c406435efa628f6d46c
parenta1957ae738e07e76b48f1d9e77fbd884ec3c9c84 (diff)
call comp_params() automatically on release when more than 1 hill is marked
-rw-r--r--src/GipfelWidget.H3
-rw-r--r--src/GipfelWidget.cxx7
-rw-r--r--src/Stitch.cxx2
-rw-r--r--src/gipfel.cxx4
4 files changed, 11 insertions, 5 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H
index b2af2e7..db67d5e 100644
--- a/src/GipfelWidget.H
+++ b/src/GipfelWidget.H
@@ -30,6 +30,7 @@ class GipfelWidget : public Fl_Group {
ImageMetaData *md;
int mouse_x, mouse_y;
char focused_mountain_label[128];
+ void (*params_changed_cb)();
int handle(int event);
Hill * find_mountain(Hills *mnts, int m_x, int m_y);
@@ -42,7 +43,7 @@ class GipfelWidget : public Fl_Group {
static void toggle_hidden_cb(Fl_Widget *o, void *f);
public:
- GipfelWidget(int X,int Y,int W, int H);
+ GipfelWidget(int X,int Y,int W, int H, void (*changed_cb)());
int load_image(char *file);
int save_image(char *file);
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index 682f30c..d264ae1 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -29,7 +29,7 @@
static double pi_d, deg2rad;
-GipfelWidget::GipfelWidget(int X,int Y,int W, int H): Fl_Group(X, Y, W, H) {
+GipfelWidget::GipfelWidget(int X,int Y,int W, int H, void (*changed_cb)()): Fl_Group(X, Y, W, H) {
end();
pi_d = asin(1.0) * 2.0;
deg2rad = pi_d / 180.0;
@@ -46,6 +46,7 @@ GipfelWidget::GipfelWidget(int X,int Y,int W, int H): Fl_Group(X, Y, W, H) {
track_points = NULL;
fl_register_images();
mouse_x = mouse_y = 0;
+ params_changed_cb = changed_cb;
}
int
@@ -611,6 +612,8 @@ GipfelWidget::comp_params() {
set_labels(pan->get_visible_mountains());
redraw();
fl_cursor(FL_CURSOR_DEFAULT);
+ if (params_changed_cb)
+ params_changed_cb();
return ret;
}
@@ -675,6 +678,8 @@ GipfelWidget::handle(int event) {
return 1;
case FL_RELEASE:
cur_mountain = NULL;
+ if (known_hills->get_num() > 1)
+ comp_params();
return 1;
case FL_ENTER:
return 1;
diff --git a/src/Stitch.cxx b/src/Stitch.cxx
index 23bb4ad..7b9fc04 100644
--- a/src/Stitch.cxx
+++ b/src/Stitch.cxx
@@ -42,7 +42,7 @@ int
Stitch::load_image(char *file) {
for (int i = 0; i < MAX_PICS; i++) {
if (gipf[i] == NULL) {
- gipf[i] = new GipfelWidget(0, 0, 800, 600);
+ gipf[i] = new GipfelWidget(0, 0, 800, 600, NULL);
if (gipf[i]->load_image(file) != 0) {
delete gipf[i];
gipf[i] = NULL;
diff --git a/src/gipfel.cxx b/src/gipfel.cxx
index a780a43..f3775b0 100644
--- a/src/gipfel.cxx
+++ b/src/gipfel.cxx
@@ -630,7 +630,7 @@ int main(int argc, char** argv) {
view_win->resizable(g);
scroll = new Fl_Scroll(0, 0, view_win->w(), view_win->h());
- gipf = new GipfelWidget(0, 0, 800, 600);
+ gipf = new GipfelWidget(0, 0, 800, 600, set_values);
if (img_file) {
gipf->load_image(img_file);
view_win->label(img_file);
@@ -716,7 +716,7 @@ export_hills(const char *export_file, double visibility) {
return 1;
}
- gipf = new GipfelWidget(0,0,800,600);
+ gipf = new GipfelWidget(0,0,800,600, NULL);
gipf->load_image(img_file);
gipf->load_data(data_file);
gipf->set_height_dist_ratio(visibility);