The Battle for Wesnoth  1.15.0-dev
editor_common.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by Tomasz Sniatowski <kailoran@gmail.com>
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 
15 /**
16  * @file
17  * Main (common) editor header. Contains forward declarations for most classes,
18  * logging macro definitions and base exception declarations
19  */
20 
21 #pragma once
22 
23 #include "exceptions.hpp"
24 #include "log.hpp"
25 
26 #include <deque>
27 #include <memory>
28 
30 #define DBG_ED LOG_STREAM_INDENT(debug, log_editor)
31 #define LOG_ED LOG_STREAM_INDENT(info, log_editor)
32 #define WRN_ED LOG_STREAM_INDENT(warn, log_editor)
33 #define ERR_ED LOG_STREAM_INDENT(err, log_editor)
34 #define SCOPE_ED log_scope2(log_editor, __func__)
35 
36 class display;
37 
38 namespace editor {
39 
41 {
42  editor_exception(const std::string& msg)
43  : game::error(msg)
44  {
45  }
46 };
47 
49 {
50  editor_logic_exception(const std::string& msg)
51  : editor_exception(msg)
52  {
53  }
54 };
55 
56 // forward declarations
57 class brush;
58 class editor_action;
59 class editor_controller;
60 class editor_display;
61 class editor_map;
62 class editor_mouse_handler;
63 class map_context;
64 class map_fragment;
65 class mouse_action;
66 
67 /** Action pointer typedef. */
68 using editor_action_ptr = std::unique_ptr<editor_action>;
69 
70 /** Action stack typedef. */
71 using action_stack = std::deque<editor_action_ptr>;
72 
73 } //end namespace editor
A map fragment – a collection of locations and information abut them.
std::unique_ptr< editor_action > editor_action_ptr
Action pointer typedef.
editor_exception(const std::string &msg)
editor_logic_exception(const std::string &msg)
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:109
lg::log_domain log_editor
std::deque< editor_action_ptr > action_stack
Action stack typedef.
The editor_controller class contains the mouse and keyboard event handling routines for the editor...
The brush class represents a single brush – a set of relative locations around a "hotspot"...
Definition: brush.hpp:25
Manage the empty-palette in the editor.
Definition: action.cpp:29
This class adds extra editor-specific functionality to a normal gamemap.
Definition: editor_map.hpp:69
Base class for all editor actions.
Definition: action_base.hpp:40
This class wraps around a map to provide a concise interface for the editor to work with...
Definition: map_context.hpp:55
Base class for all the errors encountered by the engine.
Definition: exceptions.hpp:29
Standard logging facilities (interface).
A mouse action receives events from the controller, and responds to them by creating an appropriate e...