diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-07-08 19:47:49 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-07-08 19:47:49 +0200 |
commit | 029db5ead7c6f95f788047af2446cf302556f9d5 (patch) | |
tree | f59b042c47c97f299ae6e6490afbc94efdcf801b /src/gipfel.cxx | |
parent | 22774af9a081bc39d827533e0f532259bd395831 (diff) |
fix image saving
Diffstat (limited to 'src/gipfel.cxx')
-rw-r--r-- | src/gipfel.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 9a48ade..bcf4816 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -40,7 +40,7 @@ #define DEFAULT_DATAFILE DATADIR "/" PACKAGE_NAME "/alpinkoordinaten.dat" -char *img_file; +char *img_file = NULL; char *data_file = DEFAULT_DATAFILE; GipfelWidget *gipf = NULL; @@ -103,21 +103,22 @@ void open_cb() { view_win->redraw(); control_win->label(file); set_values(); + if (img_file) + free(img_file); + img_file = strdup(file); } } void track_cb() { char *file = fl_file_chooser("Track File?", NULL, NULL); - if (file && gipf->load_track(file) == 0) { + if (file && gipf->load_track(file) == 0) s_track_width->activate(); - } } void save_cb() { - char *file = fl_file_chooser("Save Image As?", NULL, NULL); - if (file) { + char *file = fl_file_chooser("Save Image As?", NULL, img_file); + if (file) gipf->save_image(file); - } } void focal_length_cb(Fl_Slider* o, void*) { @@ -506,9 +507,8 @@ int main(int argc, char** argv) { my_argc = argc - optind; my_argv = argv + optind; - if (my_argc >= 1) { - img_file = my_argv[0]; - } + if (my_argc >= 1) + img_file = strdup(my_argv[0]); if (data_file == NULL || err) { usage(); |