From 40722f777c12c12b1080f1bccf8429288bb1502e Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Thu, 4 Jan 2007 19:47:28 +0100 Subject: fix segfault with old gipfel format --- src/ImageMetaData.cxx | 2 +- src/Panorama.cxx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx index 55ee08e..e9a1241 100644 --- a/src/ImageMetaData.cxx +++ b/src/ImageMetaData.cxx @@ -169,7 +169,7 @@ ImageMetaData::load_image_jpgcom(char *name) { int status; char buf[1024]; double lo, la, he, dir, ni, ti, fr, _k0, _k1; - int pt; + int pt = 0; int n, ret = 1; args[0] = "rdjpgcom"; diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 38cbd8c..1e3015a 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -233,6 +233,7 @@ Panorama::set_projection(ProjectionLSQ::Projection_t p) { if (proj) { delete proj; + proj = NULL; } switch(projection_type) { -- cgit v1.2.3 From 2084a22e7a91ae25cf668d0f9728cbdf32c3443e Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 16 Jan 2007 13:19:20 +0100 Subject: remove ; --- src/Fl_Search_Chooser.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Fl_Search_Chooser.cxx b/src/Fl_Search_Chooser.cxx index d4f93b2..99bbbd1 100644 --- a/src/Fl_Search_Chooser.cxx +++ b/src/Fl_Search_Chooser.cxx @@ -22,7 +22,7 @@ Fl_Search_Browser::find_prefix(const char *p) { select(i); return 0; } -}; +} int Fl_Search_Browser::find_prefix(const char *p, int s, int e) { -- cgit v1.2.3 From ecab9550adb2ab019faaf74ba34e528f6a5bd474 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 16 Jan 2007 15:04:31 +0100 Subject: improve choose viewpoint dialog --- src/Fl_Search_Chooser.H | 9 +++++---- src/Fl_Search_Chooser.cxx | 33 +++++++++++++++++++++------------ src/GipfelWidget.cxx | 3 ++- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/Fl_Search_Chooser.H b/src/Fl_Search_Chooser.H index e968452..4e89a1a 100644 --- a/src/Fl_Search_Chooser.H +++ b/src/Fl_Search_Chooser.H @@ -17,22 +17,23 @@ class Fl_Search_Browser : public Fl_Select_Browser { Fl_Search_Browser(int X, int Y, int W, int H, const char *c):Fl_Select_Browser(X,Y,W,H,c){}; int find_prefix(const char *p); + private: int find_prefix(const char *p, int s, int e); }; -class Fl_Search_Chooser { +class Fl_Search_Chooser : public Fl_Window { private: public: - Fl_Window *w; Fl_Search_Browser *sb; Fl_Search_Chooser(const char *title); void add(const char *t, void *d); + void *data(); - void show(); - int shown(); + + int handle(int event); }; #endif diff --git a/src/Fl_Search_Chooser.cxx b/src/Fl_Search_Chooser.cxx index 99bbbd1..0ef435d 100644 --- a/src/Fl_Search_Chooser.cxx +++ b/src/Fl_Search_Chooser.cxx @@ -56,19 +56,19 @@ static void input_cb(Fl_Input* in, void*c) { static void ok_cb(Fl_Input* in, void*c) { Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c; - sc->w->hide(); + sc->hide(); } static void cancel_cb(Fl_Input* in, void*c) { Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c; sc->sb->deselect(); - sc->w->hide(); + sc->hide(); } -Fl_Search_Chooser::Fl_Search_Chooser(const char *title) { - w = new Fl_Window(320, 320, title?title:"Choose"); - Fl_Group *g = new Fl_Group(10, 10, w->w() - 10, w->h() - 10); +Fl_Search_Chooser::Fl_Search_Chooser(const char *title) : Fl_Window(320, 320, title?title:"Choose") { + Fl::visible_focus(0); + Fl_Group *g = new Fl_Group(10, 10, w() - 10, h() - 10); sb = new Fl_Search_Browser(g->x(), g->y(), g->w() , g->h() - 100, NULL); sb->type(FL_HOLD_BROWSER); Fl_Input *in = new Fl_Input(g->x()+50, g->h()-80, g->w()-80, 20, "Search"); @@ -80,7 +80,7 @@ Fl_Search_Chooser::Fl_Search_Chooser(const char *title) { ok_b->callback((Fl_Callback*) ok_cb, this); Fl::focus(in); g->end(); - w->end(); + end(); } void @@ -98,12 +98,21 @@ Fl_Search_Chooser::data() { } } -void -Fl_Search_Chooser::show() { - w->show(); -} int -Fl_Search_Chooser::shown() { - return w->shown(); +Fl_Search_Chooser::handle(int event) { + switch(event) { + case FL_KEYBOARD: + int key = Fl::event_key(); + + if (key == FL_Up || key == FL_Down) { + return sb->handle(event); + } else if (key == FL_Enter) { + hide(); + return 1; + } + + } + + return Fl_Window::handle(event); } diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index 4f250cb..9d43f7b 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -193,7 +193,7 @@ GipfelWidget::set_viewpoint(const char *pos) { r = pan->set_viewpoint(pos); set_labels(pan->get_visible_mountains()); - + redraw(); return r; } @@ -201,6 +201,7 @@ void GipfelWidget::set_viewpoint(const Hill *m) { pan->set_viewpoint(m); set_labels(pan->get_visible_mountains()); + redraw(); } static void -- cgit v1.2.3 From ea65a7c0bcd3c8bf5c889b11141210b23b987916 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 16 Jan 2007 15:15:21 +0100 Subject: fix focus issue after choose viewpoint dialog --- src/Fl_Search_Chooser.H | 4 ++++ src/Fl_Search_Chooser.cxx | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Fl_Search_Chooser.H b/src/Fl_Search_Chooser.H index 4e89a1a..aacb57e 100644 --- a/src/Fl_Search_Chooser.H +++ b/src/Fl_Search_Chooser.H @@ -24,11 +24,15 @@ class Fl_Search_Browser : public Fl_Select_Browser { class Fl_Search_Chooser : public Fl_Window { private: + int visible_focus; + public: Fl_Search_Browser *sb; Fl_Search_Chooser(const char *title); + void close(); + void add(const char *t, void *d); void *data(); diff --git a/src/Fl_Search_Chooser.cxx b/src/Fl_Search_Chooser.cxx index 0ef435d..0b3cc93 100644 --- a/src/Fl_Search_Chooser.cxx +++ b/src/Fl_Search_Chooser.cxx @@ -56,17 +56,18 @@ static void input_cb(Fl_Input* in, void*c) { static void ok_cb(Fl_Input* in, void*c) { Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c; - sc->hide(); + sc->close(); } static void cancel_cb(Fl_Input* in, void*c) { Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c; sc->sb->deselect(); - sc->hide(); + sc->close(); } Fl_Search_Chooser::Fl_Search_Chooser(const char *title) : Fl_Window(320, 320, title?title:"Choose") { + visible_focus = Fl::visible_focus(); Fl::visible_focus(0); Fl_Group *g = new Fl_Group(10, 10, w() - 10, h() - 10); sb = new Fl_Search_Browser(g->x(), g->y(), g->w() , g->h() - 100, NULL); @@ -83,6 +84,12 @@ Fl_Search_Chooser::Fl_Search_Chooser(const char *title) : Fl_Window(320, 320, ti end(); } +void +Fl_Search_Chooser::close() { + hide(); + Fl::visible_focus(visible_focus); +} + void Fl_Search_Chooser::add(const char *t, void *d) { sb->add(t, d); @@ -108,10 +115,8 @@ Fl_Search_Chooser::handle(int event) { if (key == FL_Up || key == FL_Down) { return sb->handle(event); } else if (key == FL_Enter) { - hide(); - return 1; + close(); } - } return Fl_Window::handle(event); -- cgit v1.2.3