The Battle for Wesnoth
1.13.4+dev
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
editor
editor_main.cpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2008 - 2016 by Tomasz Sniatowski <
[email protected]
>
3
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY.
11
12
See the COPYING file for more details.
13
*/
14
#define GETTEXT_DOMAIN "wesnoth-editor"
15
16
#include "
controller/editor_controller.hpp
"
17
18
#include "
gettext.hpp
"
19
#include "
filesystem.hpp
"
20
#include "
editor/action/action_base.hpp
"
21
22
#include <boost/algorithm/string/replace.hpp>
23
24
lg::log_domain
log_editor
(
"editor"
);
25
26
namespace
editor
{
27
28
EXIT_STATUS
start
(
const
config
& game_conf,
CVideo
& video,
const
std::string
& filename
/* = "" */
,
29
bool
take_screenshot
/* = false */
,
const
std::string
& screenshot_filename
/* = "map_screenshot.bmp" */
)
30
{
31
EXIT_STATUS
e
=
EXIT_ERROR
;
32
try
{
33
hotkey::scope_changer
h_
;
34
hotkey::deactivate_all_scopes
();
35
hotkey::set_scope_active
(
hotkey::SCOPE_EDITOR
);
36
editor_controller
editor
(game_conf, video);
37
if
(!filename.empty() &&
filesystem::file_exists
(filename)) {
38
if
(
filesystem::is_directory
(filename)) {
39
editor.
context_manager_
->set_default_dir(filename);
40
editor.
context_manager_
->load_map_dialog(
true
);
41
}
else
{
42
editor.
context_manager_
->load_map(filename,
false
);
43
}
44
45
if
(take_screenshot) {
46
editor.
do_screenshot
(screenshot_filename);
47
e =
EXIT_NORMAL
;
48
}
49
}
50
51
if
(!take_screenshot)
52
e = editor.
main_loop
();
53
54
}
catch
(
editor_exception
& e) {
55
ERR_ED
<<
"Editor exception in editor::start: "
<< e.
what
() << std::endl;
56
throw
;
57
}
58
if
(
editor_action::get_instance_count
() != 0) {
59
ERR_ED
<<
"Possibly leaked "
<<
editor_action::get_instance_count
() <<
" action objects"
<< std::endl;
60
}
61
62
return
e
;
63
}
64
65
}
//end namespace editor
gettext.hpp
game_config::editor
bool editor
Definition:
game_config.cpp:62
editor::editor_controller::do_screenshot
void do_screenshot(const std::string &screenshot_filename="map_screenshot.bmp")
Takes a screenshot.
Definition:
editor_controller.cpp:190
game::error::what
const char * what() const
Definition:
exceptions.hpp:35
log_editor
lg::log_domain log_editor("editor")
CVideo
Definition:
video.hpp:58
hotkey::set_scope_active
void set_scope_active(scope s, bool set)
Definition:
hotkey_command.cpp:301
lg::log_domain
Definition:
log.hpp:98
hotkey::SCOPE_EDITOR
Definition:
hotkey_command.hpp:34
editor::editor_action::get_instance_count
static int get_instance_count()
Debugging aid.
Definition:
action_base.hpp:94
action_base.hpp
Base class for editor actions.
editor_controller.hpp
editor::editor_controller::context_manager_
boost::scoped_ptr< context_manager > context_manager_
Definition:
editor_controller.hpp:240
editor::editor_controller
The editor_controller class contains the mouse and keyboard event handling routines for the editor...
Definition:
editor_controller.hpp:68
h_
int h_
Definition:
font.cpp:607
editor::EXIT_NORMAL
Definition:
editor_main.hpp:26
editor::editor_exception
Definition:
editor_common.hpp:39
filesystem::is_directory
bool is_directory(const std::string &fname)
Returns true if the given file is a directory.
Definition:
filesystem_boost.cpp:871
editor
Manage the empty-palette in the editor.
Definition:
action.cpp:28
hotkey::deactivate_all_scopes
void deactivate_all_scopes()
Definition:
hotkey_command.cpp:294
editor::EXIT_ERROR
Definition:
editor_main.hpp:29
filesystem.hpp
Declarations for File-IO.
editor::EXIT_STATUS
EXIT_STATUS
Definition:
editor_main.hpp:25
hotkey::scope_changer
Definition:
hotkey_command.hpp:241
editor::editor_controller::main_loop
EXIT_STATUS main_loop()
Editor main loop.
Definition:
editor_controller.cpp:172
ERR_ED
#define ERR_ED
Definition:
editor_common.hpp:31
e
#define e
config
A config object defines a single node in a WML file, with access to child nodes.
Definition:
config.hpp:83
filesystem::file_exists
bool file_exists(const std::string &name)
Returns true if a file or directory with such name already exists.
Definition:
filesystem_boost.cpp:876
string
GLsizei const GLcharARB ** string
Definition:
glew.h:4503
editor::start
EXIT_STATUS start(const config &game_conf, CVideo &video, const std::string &filename, bool take_screenshot, const std::string &screenshot_filename)
Main interface for launching the editor from the title screen.
Definition:
editor_main.cpp:28
Generated by
1.8.8