diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2005-08-02 16:04:59 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2005-08-02 16:04:59 +0100 |
commit | 2d2a512cbf1a2ffa2c90ad664585b45503da5613 (patch) | |
tree | 9b0f390f7234b485f015c96db2d9f931b582d8d5 /src | |
parent | 0a21d1095f1d8e1ee0e386b5ae746a9981f404bd (diff) |
fix popup menu
Diffstat (limited to 'src')
-rw-r--r-- | src/GipfelWidget.cxx | 16 | ||||
-rw-r--r-- | src/Panorama.cxx | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index f82a2cf..6e0f9a3 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -84,7 +84,12 @@ GipfelWidget::load_image(const char *file) { int GipfelWidget::load_data(const char *file) { - return pan->load_data(file); + int r; + + r = pan->load_data(file); + update_menuitems(pan->get_close_mountains()); + + return r; } int @@ -113,6 +118,8 @@ GipfelWidget::set_viewpoint(const char *pos) { r = pan->set_viewpoint(pos); set_labels(pan->get_visible_mountains()); + update_menuitems(pan->get_close_mountains()); + return r; } @@ -260,6 +267,9 @@ GipfelWidget::set_cur_mountain(int m_x, int m_y) { for (i=0; i<mnts->get_num(); i++) { m = mnts->get(i); + if (m->flags & (HILL_DUPLICATE | HILL_TRACK_POINT)) { + continue; + } if (m_x - center_x >= m->x - 2 && m_x - center_x < m->x + 2 && m_y - center_y >= m->y - 2 && m_y - center_y < m->y + 2) { @@ -415,13 +425,12 @@ GipfelWidget::update_menuitems(Hills *h) { if (menuitems) { free(menuitems); - menuitems = NULL; } menuitems = (Fl_Menu_Item*) calloc(h->get_num(), sizeof(Fl_Menu_Item) + 1); j = 0; for (i=0; i<h_sort->get_num(); i++) { - if (h_sort->get(i)->flags & HILL_DUPLICATE) { + if (h_sort->get(i)->flags & (HILL_DUPLICATE | HILL_TRACK_POINT)) { continue; } menuitems[j].text = h_sort->get(i)->name; @@ -443,7 +452,6 @@ GipfelWidget::set_height_dist_ratio(double r) { h = pan->get_visible_mountains(); set_labels(h); - menuitems = (Fl_Menu_Item*) calloc(h->get_num(), sizeof(Fl_Menu_Item) + 1); update_menuitems(pan->get_close_mountains()); redraw(); } diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 33b3656..90e1208 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -101,7 +101,6 @@ Panorama::set_viewpoint(const char *name) { if (view_name) { free(view_name); - view_name = NULL; } view_name = strdup(name); |