Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #define GETTEXT_DOMAIN "wesnoth-editor"
00016
00017 #include "editor_controller.hpp"
00018
00019 #include "../construct_dialog.hpp"
00020 #include "../gettext.hpp"
00021 #include "../filesystem.hpp"
00022
00023 #include <boost/algorithm/string/replace.hpp>
00024
00025 lg::log_domain log_editor("editor");
00026
00027 namespace editor {
00028
00029 EXIT_STATUS start(const config& game_conf, CVideo& video, const std::string& filename ,
00030 bool take_screenshot , const std::string& screenshot_filename )
00031 {
00032 EXIT_STATUS e = EXIT_ERROR;
00033 try {
00034 hotkey::scope_changer h_(game_conf, "hotkey_editor");
00035 hotkey::deactivate_all_scopes();
00036 hotkey::set_scope_active(hotkey::SCOPE_GENERAL);
00037 hotkey::set_scope_active(hotkey::SCOPE_EDITOR);
00038 editor_controller editor(game_conf, video);
00039 if (!filename.empty()) {
00040 if (is_directory(filename)) {
00041
00042
00043 editor.context_manager_->load_map_dialog(true);
00044 } else {
00045 editor.context_manager_->load_map(filename, false);
00046 }
00047 }
00048 if(take_screenshot) {
00049 editor.do_screenshot(screenshot_filename);
00050 e = EXIT_NORMAL;
00051 } else {
00052 e = editor.main_loop();
00053 }
00054 } catch (editor_exception& e) {
00055 ERR_ED << "Editor exception in editor::start: " << e.what() << "\n";
00056 throw;
00057 }
00058
00059
00060
00061
00062
00063
00064 return e;
00065 }
00066
00067 }