16 #define GETTEXT_DOMAIN "wesnoth-editor"
33 std::string addon_id =
"";
44 if(addon_id ==
"///newaddon///") {
45 std::string& addon_id_new = addon_id;
46 std::int64_t current_millis = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
47 addon_id =
"MyAwesomeAddon-"+std::to_string(current_millis);
48 if (gui2::dialogs::prompt::execute(addon_id_new)) {
49 addon_id = !
addon_filename_legal(addon_id_new) ?
"MyAwesomeAddon-"+std::to_string(current_millis) : addon_id_new;
53 if(addon_id ==
"mainline") {
92 *stream <<
"#textdomain wesnoth-" << addon_id <<
"\n"
93 <<
"[textdomain]" <<
"\n"
94 <<
" name=\"wesnoth-" << addon_id <<
"\"\n"
95 <<
" path=\"data/add-ons/" << addon_id <<
"/translations\"\n"
99 <<
" path=data/add-ons/" << addon_id <<
"\n"
100 <<
"[/binary_path]\n"
102 <<
"{~add-ons/" << addon_id <<
"/scenarios}\n"
103 <<
"{~add-ons/" << addon_id <<
"/utils}\n"
106 <<
" {~add-ons/" << addon_id <<
"/units}\n"
124 editor.context_manager_->load_map_dialog(
true);
136 editor.set_button_state();
139 if (take_screenshot) {
140 editor.do_screenshot(screenshot_filename);
145 if (!take_screenshot) {
149 ERR_ED <<
"Editor exception in editor::start: " <<
e.what();
Base class for editor actions.
static int get_instance_count()
Debugging aid.
The editor_controller class contains the mouse and keyboard event handling routines for the editor.
bool show(const unsigned auto_close_time=0)
Shows the window.
lg::log_domain log_editor("editor")
Declarations for File-IO.
Manage the empty-palette in the editor.
EXIT_STATUS start(bool clear_id, const std::string &filename, bool take_screenshot, const std::string &screenshot_filename)
Main interface for launching the editor from the title screen.
std::string initialize_addon()
static bool file_exists(const bfs::path &fpath)
bool is_directory(const std::string &fname)
Returns true if the given file is a directory.
filesystem::scoped_ostream ostream_file(const std::string &fname, std::ios_base::openmode mode, bool create_directory)
std::unique_ptr< std::ostream > scoped_ostream
static bool create_directory_if_missing(const bfs::path &dirpath)
std::string get_addons_dir()
constexpr uint32_t scope_editor
std::string filename
Filename.
bool addon_filename_legal(const std::string &name)
Checks whether an add-on file name is legal or not.