diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GipfelWidget.H | 2 | ||||
-rw-r--r-- | src/GipfelWidget.cxx | 13 | ||||
-rw-r--r-- | src/Panorama.cxx | 1 | ||||
-rw-r--r-- | src/gipfel.cxx | 13 |
4 files changed, 25 insertions, 4 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H index 0ddfbef..45bfaee 100644 --- a/src/GipfelWidget.H +++ b/src/GipfelWidget.H @@ -130,7 +130,7 @@ class GipfelWidget : public Fl_Widget { int get_distortion_profile_name(char *buf, int buflen); - int save_distortion_params(const char *prof_name); + int save_distortion_params(const char *prof_name, int force); int load_distortion_params(const char *prof_name); diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index 7abb1dd..2563d73 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -107,8 +107,13 @@ GipfelWidget::load_image(char *file) { load_distortion_params(buf); if (isnan(pan->parms.k0)) { pan->parms.k0 = 0.0; + } + if (isnan(pan->parms.k1)) { pan->parms.k1 = 0.0; } + if (isnan(pan->parms.x0)) { + pan->parms.x0 = 0.0; + } } return 0; @@ -832,9 +837,15 @@ GipfelWidget::load_distortion_params(const char *prof_name) { } int -GipfelWidget::save_distortion_params(const char *prof_name) { +GipfelWidget::save_distortion_params(const char *prof_name, int force) { + int dummy; Fl_Preferences prof(dist_prefs, prof_name); + + if (!force && (prof.get("k0", dummy, 0) == 0)) { + return 1; + } + prof.set("k0", pan->parms.k0); prof.set("k1", pan->parms.k1); prof.set("x0", pan->parms.x0); diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 7b1529b..27e4579 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -29,6 +29,7 @@ Panorama::Panorama() { parms.scale = 3500.0; parms.k0 = 0.0; parms.k1 = 0.0; + parms.x0 = 0.0; view_name = NULL; view_phi = 0.0; view_lam = 0.0; diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 3fbf945..6df400f 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -178,7 +178,9 @@ void save_distortion_cb(Fl_Widget *, void *) { const char * prof_name; double k0, k1, x0; + buf[0] = '\0'; gipf->get_distortion_params(&k0, &k1, &x0); + gipf->get_distortion_profile_name(buf, sizeof(buf)); prof_name = fl_input("Save Distortion Profile (k0=%f, k1=%f, x0=%f)", buf, k0, k1, x0); @@ -187,7 +189,12 @@ void save_distortion_cb(Fl_Widget *, void *) { return; } - gipf->save_distortion_params(prof_name); + if (gipf->save_distortion_params(prof_name, 0) != 0) { + if (fl_choice("A profile with this name exists.\n", + "Cancel", "Overwrite", NULL) == 1) { + gipf->save_distortion_params(prof_name, 1); + } + } set_values(); } @@ -580,7 +587,9 @@ stitch(GipfelWidget::sample_mode_t m, int b_16, snprintf(buf, sizeof(buf), "%s/%s", path, argv[i]); dot = strrchr(buf, '.'); - *dot = '\0'; + if (dot) { + *dot = '\0'; + } strncat(buf, ".tiff", sizeof(buf)); st->set_output(argv[i], new TIFFOutputImage(buf, b_16?16:8)); |