16 #define GETTEXT_DOMAIN "wesnoth-editor"
34 bool& copy_edge_terrain)
36 , width_(register_integer("width", true, width))
37 , height_(register_integer("height", true, height))
40 , expand_direction_(expand_direction)
41 , direction_buttons_{}
43 register_bool(
"copy_edge_terrain",
false, copy_edge_terrain);
45 register_label(
"old_width",
false, std::to_string(width));
46 register_label(
"old_height",
false, std::to_string(height));
51 slider& height = find_widget<slider>(
"height");
56 slider& width = find_widget<slider>(
"width");
61 std::string name_prefix =
"expand";
62 for(
int i = 0;
i < 9; ++
i) {
63 std::string name = name_prefix + std::to_string(
i);
65 = find_widget<toggle_button>(name,
false,
true);
80 if(x < 0 || x > 2 || y < 0 || y > 2) {
97 for(
int i = 0;
i < 9; ++
i) {
136 if(xdiff < 0 || ydiff < 0 || (xdiff > 0 && ydiff > 0)) {
141 if(xdiff < 0 || ydiff < 0) {
void set_direction_icon(int index, const std::string &icon)
void update_expand_direction()
int old_width_
The original width.
toggle_button * direction_buttons_[9]
The toggle buttons show the state of expand_direction_.
field_integer * height_
The currently selected height.
int old_height_
The original height.
virtual void pre_show() override
Actions to be taken before showing the window.
EXPAND_DIRECTION & expand_direction_
The selected expansion direction.
field_integer * width_
The execute function.
Abstract base class for all modal dialogs.
T get_widget_value()
Gets the value of the field.
void swap(config &lhs, config &rhs)
Implement non-member swap function for std::swap (calls config::swap).
Implements some helper classes to ease adding fields to a dialog and hide the synchronization needed.
static int resize_grid_xy_to_idx(const int x, const int y)
Convert a coordinate on a 3 by 3 grid to an index, return 9 for out of bounds.
REGISTER_DIALOG(editor_edit_unit)
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
std::size_t index(std::string_view str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
static map_location::direction sw
static map_location::direction se
static map_location::direction nw
static map_location::direction ne