Save as functionality added.

This commit is contained in:
Kristoffer Erlandsson 2004-04-25 13:36:00 +00:00
parent 7d2d09f3f2
commit 34b66cf654
2 changed files with 23 additions and 6 deletions

View file

@ -70,8 +70,8 @@ shift=no
command="editsaveas"
key="s"
ctrl=no
alt=yes
shift=no
alt=no
shift=yes
[/hotkey]
[hotkey]
@ -103,7 +103,7 @@ height=600
[menu]
title=main_menu
image=lite
items=undo,redo,editsavemap,togglegrid,editquit,#editsaveas
items=undo,redo,editsavemap,editsaveas,togglegrid,editquit,
rect=3,1,107,22
xanchor=fixed
yanchor=fixed

View file

@ -139,9 +139,26 @@ void map_editor::edit_quit() {
}
void map_editor::edit_save_as() {
// TODO
gui::show_dialog(gui_, NULL, "",
"Not implemented.", gui::OK_ONLY);
std::string input_name = get_dir(get_dir(get_user_data_dir() + "/editor") + "/maps/");
int res = 0;
int overwrite = 0;
do {
res = gui::show_dialog(gui_, NULL, "", "Save As ", gui::OK_CANCEL, NULL,NULL,"",&input_name);
if (res == 0) {
if (file_exists(input_name)) {
overwrite = gui::show_dialog(gui_,NULL,"",
"Map already exists. Do you want to overwrite it?",gui::YES_NO);
}
else
overwrite = 0;
}
} while (res == 0 && overwrite != 0);
if (res == 0) {
set_file_to_save_as(input_name);
save_map("", true);
}
}
void map_editor::edit_set_start_pos() {