The Battle for Wesnoth  1.17.0-dev
editor_common.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2021
3  by Tomasz Sniatowski <kailoran@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 /**
17  * @file
18  * Main (common) editor header. Contains forward declarations for most classes,
19  * logging macro definitions and base exception declarations
20  */
21 
22 #pragma once
23 
24 #include "exceptions.hpp"
25 #include "log.hpp"
26 
27 #include <deque>
28 #include <memory>
29 
31 #define DBG_ED LOG_STREAM_INDENT(debug, log_editor)
32 #define LOG_ED LOG_STREAM_INDENT(info, log_editor)
33 #define WRN_ED LOG_STREAM_INDENT(warn, log_editor)
34 #define ERR_ED LOG_STREAM_INDENT(err, log_editor)
35 #define SCOPE_ED log_scope2(log_editor, __func__)
36 
37 class display;
38 
39 namespace editor {
40 
42 {
43  editor_exception(const std::string& msg)
44  : game::error(msg)
45  {
46  }
47 };
48 
50 {
51  editor_logic_exception(const std::string& msg)
52  : editor_exception(msg)
53  {
54  }
55 };
56 
57 // forward declarations
58 class brush;
59 class editor_action;
60 class editor_controller;
61 class editor_display;
62 class editor_map;
63 class editor_mouse_handler;
64 class map_context;
65 class map_fragment;
66 class mouse_action;
67 
68 /** Action stack typedef. */
69 using action_stack = std::deque<std::unique_ptr<editor_action>>;
70 
71 } //end namespace editor
A map fragment – a collection of locations and information abut them.
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:110
lg::log_domain log_editor
The editor_controller class contains the mouse and keyboard event handling routines for the editor...
std::deque< std::unique_ptr< editor_action > > action_stack
Action stack typedef.
The brush class represents a single brush – a set of relative locations around a "hotspot"...
Definition: brush.hpp:26
Manage the empty-palette in the editor.
Definition: action.cpp:30
This class adds extra editor-specific functionality to a normal gamemap.
Definition: editor_map.hpp:70
Base class for all editor actions.
Definition: action_base.hpp:41
This class wraps around a map to provide a concise interface for the editor to work with...
Definition: map_context.hpp:60
Base class for all the errors encountered by the engine.
Definition: exceptions.hpp:28
Standard logging facilities (interface).
A mouse action receives events from the controller, and responds to them by creating an appropriate e...