Merge branch 'master' of github.com:wesnoth/wesnoth

This commit is contained in:
Elvish_Hunter 2020-12-03 21:40:17 +01:00
commit 1fd4111cb9
12 changed files with 49 additions and 51 deletions

View file

@ -16,7 +16,7 @@ scons translations build=release --debug=time nls=true jobs=2 || exit 1
cd ./projectfiles/Xcode
xcodebuild CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -project "The Battle for Wesnoth.xcodeproj" -target "The Battle for Wesnoth" -configuration "$CFG"
xcodebuild CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO EXCLUDED_ARCHS=arm64 -project "The Battle for Wesnoth.xcodeproj" -target "The Battle for Wesnoth" -configuration "$CFG"
EXIT_VAL=$?
ccache -s

View file

@ -46,14 +46,14 @@ namespace gui2
* be tuned. This page will describe what can be tuned.
*
*/
window* build(const builder_window::window_resolution* definition)
std::unique_ptr<window> build(const builder_window::window_resolution& definition)
{
// We set the values from the definition since we can only determine the
// best size (if needed) after all widgets have been placed.
window* win = new window(definition);
auto win = std::make_unique<window>(definition);
assert(win);
for(const auto& lg : definition->linked_groups) {
for(const auto& lg : definition.linked_groups) {
if(win->has_linked_size_group(lg.id)) {
t_string msg = VGETTEXT("Linked '$id' group has multiple definitions.", {{"id", lg.id}});
@ -63,27 +63,27 @@ window* build(const builder_window::window_resolution* definition)
win->init_linked_size_group(lg.id, lg.fixed_width, lg.fixed_height);
}
win->set_click_dismiss(definition->click_dismiss);
win->set_click_dismiss(definition.click_dismiss);
const auto conf = win->cast_config_to<window_definition>();
assert(conf);
if(conf->grid) {
win->init_grid(*conf->grid);
win->finalize(*definition->grid);
win->finalize(*definition.grid);
} else {
win->init_grid(*definition->grid);
win->init_grid(*definition.grid);
}
win->add_to_keyboard_chain(win);
win->add_to_keyboard_chain(win.get());
return win;
}
window* build(const std::string& type)
std::unique_ptr<window> build(const std::string& type)
{
const builder_window::window_resolution& definition = get_window_builder(type);
window* window = build(&definition);
auto window = build(definition);
window->set_id(type);
return window;
}

View file

@ -28,14 +28,6 @@ namespace gui2
class window;
/**
* Builds a window.
*
* @param type The type id string of the window, this window
* must be registered at startup.
*/
window* build(const std::string& type);
/** Contains the info needed to instantiate a widget. */
struct builder_widget
{
@ -212,7 +204,15 @@ private:
/**
* Builds a window.
*
* @param type The type id string of the window, this window
* must be registered at startup.
*/
window* build(const builder_window::window_resolution* res);
std::unique_ptr<window> build(const std::string& type);
/**
* Builds a window.
*/
std::unique_ptr<window> build(const builder_window::window_resolution& res);
} // namespace gui2

View file

@ -74,7 +74,7 @@ bool modal_dialog::show(const unsigned auto_close_time)
return false;
}
window_.reset(build_window());
window_ = build_window();
assert(window_.get());
post_build(*window_);
@ -218,7 +218,7 @@ field_label* modal_dialog::register_label(const std::string& id,
return field;
}
window* modal_dialog::build_window() const
std::unique_ptr<window> modal_dialog::build_window() const
{
return build(window_id());
}

View file

@ -392,7 +392,7 @@ private:
*
* @returns The window to show.
*/
window* build_window() const;
std::unique_ptr<window> build_window() const;
/**
* Actions to be taken directly after the window is build.

View file

@ -41,7 +41,7 @@ void modeless_dialog::show(const bool allow_interaction, const unsigned /*auto_c
hide();
window_.reset(build_window());
window_ = build_window();
post_build(*window_);
@ -67,7 +67,7 @@ void modeless_dialog::hide()
window_.reset(nullptr); }
}
window* modeless_dialog::build_window() const
std::unique_ptr<window> modeless_dialog::build_window() const
{
return build(window_id());
}

View file

@ -100,7 +100,7 @@ private:
*
* @returns The window to show.
*/
window* build_window() const;
std::unique_ptr<window> build_window() const;
/**
* Actions to be taken directly after the window is build.

View file

@ -82,14 +82,13 @@ void stacked_widget::layout_children()
}
}
void
stacked_widget::finalize(std::vector<builder_grid_const_ptr> widget_builder)
void stacked_widget::finalize(const std::vector<builder_grid>& widget_builders)
{
assert(generator_);
string_map empty_data;
for(const auto & builder : widget_builder)
for(const auto & builder : widget_builders)
{
generator_->create_item(-1, *builder, empty_data, nullptr);
generator_->create_item(-1, builder, empty_data, nullptr);
}
swap_grid(nullptr, &get_grid(), generator_, "_content_grid");
@ -278,7 +277,7 @@ builder_stacked_widget::builder_stacked_widget(const config& real_cfg)
VALIDATE(cfg.has_child("layer"), _("No stack layers defined."));
for(const auto & layer : cfg.child_range("layer"))
{
stack.emplace_back(std::make_shared<builder_grid>(layer));
stack.emplace_back(layer);
}
}

View file

@ -123,7 +123,7 @@ private:
* @param widget_builder The builder to build the contents of the
* widget.
*/
void finalize(std::vector<builder_grid_const_ptr> widget_builder);
void finalize(const std::vector<builder_grid>& widget_builders);
/**
* Contains a pointer to the generator.
@ -208,7 +208,7 @@ struct builder_stacked_widget : public builder_styled_widget
widget* build() const;
/** The builders for all layers of the stack .*/
std::vector<builder_grid_const_ptr> stack;
std::vector<builder_grid> stack;
};
} // namespace implementation

View file

@ -271,8 +271,8 @@ window* manager::get_window(const unsigned id)
} // namespace
window::window(const builder_window::window_resolution* definition)
: panel(implementation::builder_window(::config {"definition", definition->definition}), type())
window::window(const builder_window::window_resolution& definition)
: panel(implementation::builder_window(::config {"definition", definition.definition}), type())
, video_(CVideo::get_singleton())
, status_(NEW)
, show_mode_(none)
@ -285,19 +285,19 @@ window::window(const builder_window::window_resolution* definition)
, restore_(true)
, is_toplevel_(!is_in_dialog())
, restorer_()
, automatic_placement_(definition->automatic_placement)
, horizontal_placement_(definition->horizontal_placement)
, vertical_placement_(definition->vertical_placement)
, maximum_width_(definition->maximum_width)
, maximum_height_(definition->maximum_height)
, x_(definition->x)
, y_(definition->y)
, w_(definition->width)
, h_(definition->height)
, reevaluate_best_size_(definition->reevaluate_best_size)
, functions_(definition->functions)
, tooltip_(definition->tooltip)
, helptip_(definition->helptip)
, automatic_placement_(definition.automatic_placement)
, horizontal_placement_(definition.horizontal_placement)
, vertical_placement_(definition.vertical_placement)
, maximum_width_(definition.maximum_width)
, maximum_height_(definition.maximum_height)
, x_(definition.x)
, y_(definition.y)
, w_(definition.width)
, h_(definition.height)
, reevaluate_best_size_(definition.reevaluate_best_size)
, functions_(definition.functions)
, tooltip_(definition.tooltip)
, helptip_(definition.helptip)
, click_dismiss_(false)
, enter_disabled_(false)
, escape_disabled_(false)

View file

@ -62,13 +62,13 @@ class distributor;
class window : public panel
{
friend class debug_layout_graph;
friend window* build(const builder_window::window_resolution*);
friend std::unique_ptr<window> build(const builder_window::window_resolution&);
friend struct window_implementation;
friend class invalidate_layout_blocker;
friend class pane;
public:
explicit window(const builder_window::window_resolution* definition);
explicit window(const builder_window::window_resolution& definition);
~window();

View file

@ -66,8 +66,7 @@ int intf_show_dialog(lua_State* L)
config def_cfg = luaW_checkconfig(L, 1);
gui2::builder_window::window_resolution def(def_cfg);
std::unique_ptr<gui2::window> wp;
wp.reset(gui2::build(&def));
std::unique_ptr<gui2::window> wp(gui2::build(def));
if(!lua_isnoneornil(L, 2)) {
lua_pushvalue(L, 2);