Path: blob/master/editor/scene/2d/tiles/tile_proxies_manager_dialog.cpp
9913 views
/**************************************************************************/1/* tile_proxies_manager_dialog.cpp */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#include "tile_proxies_manager_dialog.h"3132#include "editor/editor_undo_redo_manager.h"33#include "editor/inspector/editor_properties_vector.h"34#include "editor/settings/editor_settings.h"35#include "scene/gui/popup_menu.h"36#include "scene/gui/separator.h"3738void TileProxiesManagerDialog::_right_clicked(int p_item, Vector2 p_local_mouse_pos, MouseButton p_mouse_button_index, Object *p_item_list) {39if (p_mouse_button_index != MouseButton::RIGHT) {40return;41}4243ItemList *item_list = Object::cast_to<ItemList>(p_item_list);44popup_menu->reset_size();45popup_menu->set_position(get_position() + item_list->get_global_mouse_position());46popup_menu->popup();47}4849void TileProxiesManagerDialog::_menu_id_pressed(int p_id) {50if (p_id == 0) {51// Delete.52_delete_selected_bindings();53}54}5556void TileProxiesManagerDialog::_delete_selected_bindings() {57EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();58undo_redo->create_action(TTR("Remove Tile Proxies"));5960Vector<int> source_level_selected = source_level_list->get_selected_items();61for (int i = 0; i < source_level_selected.size(); i++) {62int key = source_level_list->get_item_metadata(source_level_selected[i]);63int val = tile_set->get_source_level_tile_proxy(key);64undo_redo->add_do_method(*tile_set, "remove_source_level_tile_proxy", key);65undo_redo->add_undo_method(*tile_set, "set_source_level_tile_proxy", key, val);66}6768Vector<int> coords_level_selected = coords_level_list->get_selected_items();69for (int i = 0; i < coords_level_selected.size(); i++) {70Array key = coords_level_list->get_item_metadata(coords_level_selected[i]);71Array val = tile_set->get_coords_level_tile_proxy(key[0], key[1]);72undo_redo->add_do_method(*tile_set, "remove_coords_level_tile_proxy", key[0], key[1]);73undo_redo->add_undo_method(*tile_set, "set_coords_level_tile_proxy", key[0], key[1], val[0], val[1]);74}7576Vector<int> alternative_level_selected = alternative_level_list->get_selected_items();77for (int i = 0; i < alternative_level_selected.size(); i++) {78Array key = alternative_level_list->get_item_metadata(alternative_level_selected[i]);79Array val = tile_set->get_alternative_level_tile_proxy(key[0], key[1], key[2]);80undo_redo->add_do_method(*tile_set, "remove_alternative_level_tile_proxy", key[0], key[1], key[2]);81undo_redo->add_undo_method(*tile_set, "set_alternative_level_tile_proxy", key[0], key[1], key[2], val[0], val[1], val[2]);82}83undo_redo->add_do_method(this, "_update_lists");84undo_redo->add_undo_method(this, "_update_lists");85undo_redo->commit_action();8687committed_actions_count += 1;88}8990void TileProxiesManagerDialog::_update_lists() {91source_level_list->clear();92coords_level_list->clear();93alternative_level_list->clear();9495Array proxies = tile_set->get_source_level_tile_proxies();96for (int i = 0; i < proxies.size(); i++) {97Array proxy = proxies[i];98String text = vformat("%s", proxy[0]).rpad(5) + "-> " + vformat("%s", proxy[1]);99int id = source_level_list->add_item(text);100source_level_list->set_item_metadata(id, proxy[0]);101}102103proxies = tile_set->get_coords_level_tile_proxies();104for (int i = 0; i < proxies.size(); i++) {105Array proxy = proxies[i];106String text = vformat("%s, %s", proxy[0], proxy[1]).rpad(17) + "-> " + vformat("%s, %s", proxy[2], proxy[3]);107int id = coords_level_list->add_item(text);108coords_level_list->set_item_metadata(id, proxy.slice(0, 2));109}110111proxies = tile_set->get_alternative_level_tile_proxies();112for (int i = 0; i < proxies.size(); i++) {113Array proxy = proxies[i];114String text = vformat("%s, %s, %s", proxy[0], proxy[1], proxy[2]).rpad(24) + "-> " + vformat("%s, %s, %s", proxy[3], proxy[4], proxy[5]);115int id = alternative_level_list->add_item(text);116alternative_level_list->set_item_metadata(id, proxy.slice(0, 3));117}118}119120void TileProxiesManagerDialog::_update_enabled_property_editors() {121if (from.source_id == TileSet::INVALID_SOURCE) {122from.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS);123to.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS);124from.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE;125to.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE;126coords_from_property_editor->hide();127coords_to_property_editor->hide();128alternative_from_property_editor->hide();129alternative_to_property_editor->hide();130} else if (from.get_atlas_coords().x == -1 || from.get_atlas_coords().y == -1) {131from.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE;132to.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE;133coords_from_property_editor->show();134coords_to_property_editor->show();135alternative_from_property_editor->hide();136alternative_to_property_editor->hide();137} else {138coords_from_property_editor->show();139coords_to_property_editor->show();140alternative_from_property_editor->show();141alternative_to_property_editor->show();142}143144source_from_property_editor->update_property();145source_to_property_editor->update_property();146coords_from_property_editor->update_property();147coords_to_property_editor->update_property();148alternative_from_property_editor->update_property();149alternative_to_property_editor->update_property();150}151152void TileProxiesManagerDialog::_property_changed(const String &p_path, const Variant &p_value, const String &p_name, bool p_changing) {153_set(p_path, p_value);154}155156void TileProxiesManagerDialog::_add_button_pressed() {157EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();158if (from.source_id != TileSet::INVALID_SOURCE && to.source_id != TileSet::INVALID_SOURCE) {159Vector2i from_coords = from.get_atlas_coords();160Vector2i to_coords = to.get_atlas_coords();161if (from_coords.x >= 0 && from_coords.y >= 0 && to_coords.x >= 0 && to_coords.y >= 0) {162if (from.alternative_tile != TileSetSource::INVALID_TILE_ALTERNATIVE && to.alternative_tile != TileSetSource::INVALID_TILE_ALTERNATIVE) {163undo_redo->create_action(TTR("Create Alternative-level Tile Proxy"));164undo_redo->add_do_method(*tile_set, "set_alternative_level_tile_proxy", from.source_id, from.get_atlas_coords(), from.alternative_tile, to.source_id, to.get_atlas_coords(), to.alternative_tile);165if (tile_set->has_alternative_level_tile_proxy(from.source_id, from.get_atlas_coords(), from.alternative_tile)) {166Array a = tile_set->get_alternative_level_tile_proxy(from.source_id, from.get_atlas_coords(), from.alternative_tile);167undo_redo->add_undo_method(*tile_set, "set_alternative_level_tile_proxy", to.source_id, to.get_atlas_coords(), to.alternative_tile, a[0], a[1], a[2]);168} else {169undo_redo->add_undo_method(*tile_set, "remove_alternative_level_tile_proxy", from.source_id, from.get_atlas_coords(), from.alternative_tile);170}171} else {172undo_redo->create_action(TTR("Create Coords-level Tile Proxy"));173undo_redo->add_do_method(*tile_set, "set_coords_level_tile_proxy", from.source_id, from.get_atlas_coords(), to.source_id, to.get_atlas_coords());174if (tile_set->has_coords_level_tile_proxy(from.source_id, from.get_atlas_coords())) {175Array a = tile_set->get_coords_level_tile_proxy(from.source_id, from.get_atlas_coords());176undo_redo->add_undo_method(*tile_set, "set_coords_level_tile_proxy", to.source_id, to.get_atlas_coords(), a[0], a[1]);177} else {178undo_redo->add_undo_method(*tile_set, "remove_coords_level_tile_proxy", from.source_id, from.get_atlas_coords());179}180}181} else {182undo_redo->create_action(TTR("Create source-level Tile Proxy"));183undo_redo->add_do_method(*tile_set, "set_source_level_tile_proxy", from.source_id, to.source_id);184if (tile_set->has_source_level_tile_proxy(from.source_id)) {185undo_redo->add_undo_method(*tile_set, "set_source_level_tile_proxy", to.source_id, tile_set->get_source_level_tile_proxy(from.source_id));186} else {187undo_redo->add_undo_method(*tile_set, "remove_source_level_tile_proxy", from.source_id);188}189}190undo_redo->add_do_method(this, "_update_lists");191undo_redo->add_undo_method(this, "_update_lists");192undo_redo->commit_action();193committed_actions_count++;194}195}196197void TileProxiesManagerDialog::_clear_invalid_button_pressed() {198EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();199undo_redo->create_action(TTR("Delete All Invalid Tile Proxies"));200201undo_redo->add_do_method(*tile_set, "cleanup_invalid_tile_proxies");202203Array proxies = tile_set->get_source_level_tile_proxies();204for (int i = 0; i < proxies.size(); i++) {205Array proxy = proxies[i];206undo_redo->add_undo_method(*tile_set, "set_source_level_tile_proxy", proxy[0], proxy[1]);207}208209proxies = tile_set->get_coords_level_tile_proxies();210for (int i = 0; i < proxies.size(); i++) {211Array proxy = proxies[i];212undo_redo->add_undo_method(*tile_set, "set_coords_level_tile_proxy", proxy[0], proxy[1], proxy[2], proxy[3]);213}214215proxies = tile_set->get_alternative_level_tile_proxies();216for (int i = 0; i < proxies.size(); i++) {217Array proxy = proxies[i];218undo_redo->add_undo_method(*tile_set, "set_alternative_level_tile_proxy", proxy[0], proxy[1], proxy[2], proxy[3], proxy[4], proxy[5]);219}220undo_redo->add_do_method(this, "_update_lists");221undo_redo->add_undo_method(this, "_update_lists");222undo_redo->commit_action();223}224225void TileProxiesManagerDialog::_clear_all_button_pressed() {226EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();227undo_redo->create_action(TTR("Delete All Tile Proxies"));228229undo_redo->add_do_method(*tile_set, "clear_tile_proxies");230231Array proxies = tile_set->get_source_level_tile_proxies();232for (int i = 0; i < proxies.size(); i++) {233Array proxy = proxies[i];234undo_redo->add_undo_method(*tile_set, "set_source_level_tile_proxy", proxy[0], proxy[1]);235}236237proxies = tile_set->get_coords_level_tile_proxies();238for (int i = 0; i < proxies.size(); i++) {239Array proxy = proxies[i];240undo_redo->add_undo_method(*tile_set, "set_coords_level_tile_proxy", proxy[0], proxy[1], proxy[2], proxy[3]);241}242243proxies = tile_set->get_alternative_level_tile_proxies();244for (int i = 0; i < proxies.size(); i++) {245Array proxy = proxies[i];246undo_redo->add_undo_method(*tile_set, "set_alternative_level_tile_proxy", proxy[0], proxy[1], proxy[2], proxy[3], proxy[4], proxy[5]);247}248undo_redo->add_do_method(this, "_update_lists");249undo_redo->add_undo_method(this, "_update_lists");250undo_redo->commit_action();251}252253bool TileProxiesManagerDialog::_set(const StringName &p_name, const Variant &p_value) {254if (p_name == "from_source") {255from.source_id = MAX(int(p_value), -1);256} else if (p_name == "from_coords") {257from.set_atlas_coords(Vector2i(p_value).maxi(-1));258} else if (p_name == "from_alternative") {259from.alternative_tile = MAX(int(p_value), -1);260} else if (p_name == "to_source") {261to.source_id = MAX(int(p_value), 0);262} else if (p_name == "to_coords") {263to.set_atlas_coords(Vector2i(p_value).maxi(0));264} else if (p_name == "to_alternative") {265to.alternative_tile = MAX(int(p_value), 0);266} else {267return false;268}269_update_enabled_property_editors();270return true;271}272273bool TileProxiesManagerDialog::_get(const StringName &p_name, Variant &r_ret) const {274if (p_name == "from_source") {275r_ret = from.source_id;276} else if (p_name == "from_coords") {277r_ret = from.get_atlas_coords();278} else if (p_name == "from_alternative") {279r_ret = from.alternative_tile;280} else if (p_name == "to_source") {281r_ret = to.source_id;282} else if (p_name == "to_coords") {283r_ret = to.get_atlas_coords();284} else if (p_name == "to_alternative") {285r_ret = to.alternative_tile;286} else {287return false;288}289return true;290}291292void TileProxiesManagerDialog::_unhandled_key_input(Ref<InputEvent> p_event) {293ERR_FAIL_COND(p_event.is_null());294295if (p_event->is_pressed() && !p_event->is_echo() && (Object::cast_to<InputEventKey>(p_event.ptr()) || Object::cast_to<InputEventJoypadButton>(p_event.ptr()) || Object::cast_to<InputEventAction>(*p_event))) {296if (!is_inside_tree() || !is_visible()) {297return;298}299300if (popup_menu->activate_item_by_event(p_event, false)) {301set_input_as_handled();302}303}304}305306void TileProxiesManagerDialog::cancel_pressed() {307EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();308for (int i = 0; i < committed_actions_count; i++) {309undo_redo->undo();310}311committed_actions_count = 0;312}313314void TileProxiesManagerDialog::_bind_methods() {315ClassDB::bind_method(D_METHOD("_update_lists"), &TileProxiesManagerDialog::_update_lists);316ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &TileProxiesManagerDialog::_unhandled_key_input);317}318319void TileProxiesManagerDialog::update_tile_set(Ref<TileSet> p_tile_set) {320ERR_FAIL_COND(p_tile_set.is_null());321tile_set = p_tile_set;322committed_actions_count = 0;323_update_lists();324}325326TileProxiesManagerDialog::TileProxiesManagerDialog() {327// Tile proxy management window.328set_title(TTR("Tile Proxies Management"));329set_process_unhandled_key_input(true);330331to.source_id = 0;332to.set_atlas_coords(Vector2i());333to.alternative_tile = 0;334335VBoxContainer *vbox_container = memnew(VBoxContainer);336vbox_container->set_h_size_flags(Control::SIZE_EXPAND_FILL);337vbox_container->set_v_size_flags(Control::SIZE_EXPAND_FILL);338add_child(vbox_container);339340Label *source_level_label = memnew(Label);341source_level_label->set_text(TTR("Source-level proxies"));342vbox_container->add_child(source_level_label);343344source_level_list = memnew(ItemList);345source_level_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);346source_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);347source_level_list->set_select_mode(ItemList::SELECT_MULTI);348source_level_list->set_allow_rmb_select(true);349source_level_list->connect("item_clicked", callable_mp(this, &TileProxiesManagerDialog::_right_clicked).bind(source_level_list));350vbox_container->add_child(source_level_list);351352Label *coords_level_label = memnew(Label);353coords_level_label->set_text(TTR("Coords-level proxies"));354vbox_container->add_child(coords_level_label);355356coords_level_list = memnew(ItemList);357coords_level_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);358coords_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);359coords_level_list->set_select_mode(ItemList::SELECT_MULTI);360coords_level_list->set_allow_rmb_select(true);361coords_level_list->connect("item_clicked", callable_mp(this, &TileProxiesManagerDialog::_right_clicked).bind(coords_level_list));362vbox_container->add_child(coords_level_list);363364Label *alternative_level_label = memnew(Label);365alternative_level_label->set_text(TTR("Alternative-level proxies"));366vbox_container->add_child(alternative_level_label);367368alternative_level_list = memnew(ItemList);369alternative_level_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);370alternative_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);371alternative_level_list->set_select_mode(ItemList::SELECT_MULTI);372alternative_level_list->set_allow_rmb_select(true);373alternative_level_list->connect("item_clicked", callable_mp(this, &TileProxiesManagerDialog::_right_clicked).bind(alternative_level_list));374vbox_container->add_child(alternative_level_list);375376popup_menu = memnew(PopupMenu);377popup_menu->add_shortcut(ED_GET_SHORTCUT("ui_text_delete"));378popup_menu->connect(SceneStringName(id_pressed), callable_mp(this, &TileProxiesManagerDialog::_menu_id_pressed));379add_child(popup_menu);380381// Add proxy panel.382HSeparator *h_separator = memnew(HSeparator);383vbox_container->add_child(h_separator);384385Label *add_label = memnew(Label);386add_label->set_text(TTR("Add a new tile proxy:"));387vbox_container->add_child(add_label);388389HBoxContainer *hboxcontainer = memnew(HBoxContainer);390vbox_container->add_child(hboxcontainer);391392// From393VBoxContainer *vboxcontainer_from = memnew(VBoxContainer);394vboxcontainer_from->set_h_size_flags(Control::SIZE_EXPAND_FILL);395hboxcontainer->add_child(vboxcontainer_from);396397source_from_property_editor = memnew(EditorPropertyInteger);398source_from_property_editor->set_label(TTR("From Source"));399source_from_property_editor->set_object_and_property(this, "from_source");400source_from_property_editor->connect("property_changed", callable_mp(this, &TileProxiesManagerDialog::_property_changed));401source_from_property_editor->set_selectable(false);402source_from_property_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL);403source_from_property_editor->setup(-1, 99999, 1, false, true, false);404vboxcontainer_from->add_child(source_from_property_editor);405406coords_from_property_editor = memnew(EditorPropertyVector2i);407coords_from_property_editor->set_label(TTR("From Coords"));408coords_from_property_editor->set_object_and_property(this, "from_coords");409coords_from_property_editor->connect("property_changed", callable_mp(this, &TileProxiesManagerDialog::_property_changed));410coords_from_property_editor->set_selectable(false);411coords_from_property_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL);412coords_from_property_editor->setup(-1, 99999, true);413coords_from_property_editor->hide();414vboxcontainer_from->add_child(coords_from_property_editor);415416alternative_from_property_editor = memnew(EditorPropertyInteger);417alternative_from_property_editor->set_label(TTR("From Alternative"));418alternative_from_property_editor->set_object_and_property(this, "from_alternative");419alternative_from_property_editor->connect("property_changed", callable_mp(this, &TileProxiesManagerDialog::_property_changed));420alternative_from_property_editor->set_selectable(false);421alternative_from_property_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL);422alternative_from_property_editor->setup(-1, 99999, 1, false, true, false);423alternative_from_property_editor->hide();424vboxcontainer_from->add_child(alternative_from_property_editor);425426// To427VBoxContainer *vboxcontainer_to = memnew(VBoxContainer);428vboxcontainer_to->set_h_size_flags(Control::SIZE_EXPAND_FILL);429hboxcontainer->add_child(vboxcontainer_to);430431source_to_property_editor = memnew(EditorPropertyInteger);432source_to_property_editor->set_label(TTR("To Source"));433source_to_property_editor->set_object_and_property(this, "to_source");434source_to_property_editor->connect("property_changed", callable_mp(this, &TileProxiesManagerDialog::_property_changed));435source_to_property_editor->set_selectable(false);436source_to_property_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL);437source_to_property_editor->setup(-1, 99999, 1, false, true, false);438vboxcontainer_to->add_child(source_to_property_editor);439440coords_to_property_editor = memnew(EditorPropertyVector2i);441coords_to_property_editor->set_label(TTR("To Coords"));442coords_to_property_editor->set_object_and_property(this, "to_coords");443coords_to_property_editor->connect("property_changed", callable_mp(this, &TileProxiesManagerDialog::_property_changed));444coords_to_property_editor->set_selectable(false);445coords_to_property_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL);446coords_to_property_editor->setup(-1, 99999, true);447coords_to_property_editor->hide();448vboxcontainer_to->add_child(coords_to_property_editor);449450alternative_to_property_editor = memnew(EditorPropertyInteger);451alternative_to_property_editor->set_label(TTR("To Alternative"));452alternative_to_property_editor->set_object_and_property(this, "to_alternative");453alternative_to_property_editor->connect("property_changed", callable_mp(this, &TileProxiesManagerDialog::_property_changed));454alternative_to_property_editor->set_selectable(false);455alternative_to_property_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL);456alternative_to_property_editor->setup(-1, 99999, 1, false, true, false);457alternative_to_property_editor->hide();458vboxcontainer_to->add_child(alternative_to_property_editor);459460Button *add_button = memnew(Button);461add_button->set_text(TTR("Add"));462add_button->set_h_size_flags(Control::SIZE_SHRINK_CENTER);463add_button->connect(SceneStringName(pressed), callable_mp(this, &TileProxiesManagerDialog::_add_button_pressed));464vbox_container->add_child(add_button);465466h_separator = memnew(HSeparator);467vbox_container->add_child(h_separator);468469// Generic actions.470Label *generic_actions_label = memnew(Label);471generic_actions_label->set_text(TTR("Global actions:"));472vbox_container->add_child(generic_actions_label);473474hboxcontainer = memnew(HBoxContainer);475vbox_container->add_child(hboxcontainer);476477Button *clear_invalid_button = memnew(Button);478clear_invalid_button->set_text(TTR("Clear Invalid"));479clear_invalid_button->set_h_size_flags(Control::SIZE_SHRINK_CENTER);480clear_invalid_button->connect(SceneStringName(pressed), callable_mp(this, &TileProxiesManagerDialog::_clear_invalid_button_pressed));481hboxcontainer->add_child(clear_invalid_button);482483Button *clear_all_button = memnew(Button);484clear_all_button->set_text(TTR("Clear All"));485clear_all_button->set_h_size_flags(Control::SIZE_SHRINK_CENTER);486clear_all_button->connect(SceneStringName(pressed), callable_mp(this, &TileProxiesManagerDialog::_clear_all_button_pressed));487hboxcontainer->add_child(clear_all_button);488489h_separator = memnew(HSeparator);490vbox_container->add_child(h_separator);491}492493494