summaryrefslogtreecommitdiff
path: root/editor/rename_dialog.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2020-03-06 14:00:16 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-03-26 15:49:40 +0100
commit4758057f205a7d2e0d2db2c034705b7afcdf310f (patch)
tree3a96eee6ba8758976581fcecb32faacd285baaee /editor/rename_dialog.cpp
parentf51fdc6eef636eba7bf43d313995e708f690c782 (diff)
Working multiple window support, including editor
Diffstat (limited to 'editor/rename_dialog.cpp')
-rw-r--r--editor/rename_dialog.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index 2d7b7027c8..d8bb090fd2 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -56,7 +56,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
GridContainer *grd_main = memnew(GridContainer);
grd_main->set_columns(2);
- grd_main->set_v_size_flags(SIZE_EXPAND_FILL);
+ grd_main->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(grd_main);
// ---- 1st & 2nd row
@@ -67,7 +67,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
lne_search = memnew(LineEdit);
lne_search->set_placeholder(TTR("Search"));
lne_search->set_name("lne_search");
- lne_search->set_h_size_flags(SIZE_EXPAND_FILL);
+ lne_search->set_h_size_flags(Control::SIZE_EXPAND_FILL);
Label *lbl_replace = memnew(Label);
lbl_replace->set_text(TTR("Replace"));
@@ -75,7 +75,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
lne_replace = memnew(LineEdit);
lne_replace->set_placeholder(TTR("Replace"));
lne_replace->set_name("lne_replace");
- lne_replace->set_h_size_flags(SIZE_EXPAND_FILL);
+ lne_replace->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_main->add_child(lbl_search);
grd_main->add_child(lbl_replace);
@@ -90,7 +90,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
lne_prefix = memnew(LineEdit);
lne_prefix->set_placeholder(TTR("Prefix"));
lne_prefix->set_name("lne_prefix");
- lne_prefix->set_h_size_flags(SIZE_EXPAND_FILL);
+ lne_prefix->set_h_size_flags(Control::SIZE_EXPAND_FILL);
Label *lbl_suffix = memnew(Label);
lbl_suffix->set_text(TTR("Suffix"));
@@ -98,7 +98,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
lne_suffix = memnew(LineEdit);
lne_suffix->set_placeholder(TTR("Suffix"));
lne_suffix->set_name("lne_suffix");
- lne_suffix->set_h_size_flags(SIZE_EXPAND_FILL);
+ lne_suffix->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_main->add_child(lbl_prefix);
grd_main->add_child(lbl_suffix);
@@ -124,7 +124,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
// ---- Tab Substitute
VBoxContainer *vbc_substitute = memnew(VBoxContainer);
- vbc_substitute->set_h_size_flags(SIZE_EXPAND_FILL);
+ vbc_substitute->set_h_size_flags(Control::SIZE_EXPAND_FILL);
vbc_substitute->set_custom_minimum_size(Size2(0, feature_min_height));
vbc_substitute->set_name(TTR("Substitute"));
@@ -143,9 +143,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
but_insert_name = memnew(Button);
but_insert_name->set_text("NAME");
but_insert_name->set_tooltip(String("${NAME}\n") + TTR("Node name"));
- but_insert_name->set_focus_mode(FOCUS_NONE);
+ but_insert_name->set_focus_mode(Control::FOCUS_NONE);
but_insert_name->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${NAME}"));
- but_insert_name->set_h_size_flags(SIZE_EXPAND_FILL);
+ but_insert_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_name);
// Parent
@@ -153,9 +153,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
but_insert_parent = memnew(Button);
but_insert_parent->set_text("PARENT");
but_insert_parent->set_tooltip(String("${PARENT}\n") + TTR("Node's parent name, if available"));
- but_insert_parent->set_focus_mode(FOCUS_NONE);
+ but_insert_parent->set_focus_mode(Control::FOCUS_NONE);
but_insert_parent->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${PARENT}"));
- but_insert_parent->set_h_size_flags(SIZE_EXPAND_FILL);
+ but_insert_parent->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_parent);
// Type
@@ -163,9 +163,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
but_insert_type = memnew(Button);
but_insert_type->set_text("TYPE");
but_insert_type->set_tooltip(String("${TYPE}\n") + TTR("Node type"));
- but_insert_type->set_focus_mode(FOCUS_NONE);
+ but_insert_type->set_focus_mode(Control::FOCUS_NONE);
but_insert_type->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${TYPE}"));
- but_insert_type->set_h_size_flags(SIZE_EXPAND_FILL);
+ but_insert_type->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_type);
// Scene
@@ -173,9 +173,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
but_insert_scene = memnew(Button);
but_insert_scene->set_text("SCENE");
but_insert_scene->set_tooltip(String("${SCENE}\n") + TTR("Current scene name"));
- but_insert_scene->set_focus_mode(FOCUS_NONE);
+ but_insert_scene->set_focus_mode(Control::FOCUS_NONE);
but_insert_scene->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${SCENE}"));
- but_insert_scene->set_h_size_flags(SIZE_EXPAND_FILL);
+ but_insert_scene->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_scene);
// Root
@@ -183,9 +183,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
but_insert_root = memnew(Button);
but_insert_root->set_text("ROOT");
but_insert_root->set_tooltip(String("${ROOT}\n") + TTR("Root node name"));
- but_insert_root->set_focus_mode(FOCUS_NONE);
+ but_insert_root->set_focus_mode(Control::FOCUS_NONE);
but_insert_root->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${ROOT}"));
- but_insert_root->set_h_size_flags(SIZE_EXPAND_FILL);
+ but_insert_root->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_root);
// Count
@@ -193,9 +193,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
but_insert_count = memnew(Button);
but_insert_count->set_text("COUNTER");
but_insert_count->set_tooltip(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options."));
- but_insert_count->set_focus_mode(FOCUS_NONE);
+ but_insert_count->set_focus_mode(Control::FOCUS_NONE);
but_insert_count->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${COUNTER}"));
- but_insert_count->set_h_size_flags(SIZE_EXPAND_FILL);
+ but_insert_count->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_count);
chk_per_level_counter = memnew(CheckBox);
@@ -240,7 +240,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
// ---- Tab Process
VBoxContainer *vbc_process = memnew(VBoxContainer);
- vbc_process->set_h_size_flags(SIZE_EXPAND_FILL);
+ vbc_process->set_h_size_flags(Control::SIZE_EXPAND_FILL);
vbc_process->set_name(TTR("Post-Process"));
vbc_process->set_custom_minimum_size(Size2(0, feature_min_height));
tabc_features->add_child(vbc_process);
@@ -296,8 +296,8 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
// ---- Dialog related
- set_custom_minimum_size(Size2(383, 0));
- set_as_toplevel(true);
+ set_min_size(Size2(383, 0));
+ //set_as_toplevel(true);
get_ok()->set_text(TTR("Rename"));
Button *but_reset = add_button(TTR("Reset"));
@@ -347,7 +347,7 @@ void RenameDialog::_bind_methods() {
void RenameDialog::_update_substitute() {
- LineEdit *focus_owner_line_edit = Object::cast_to<LineEdit>(get_focus_owner());
+ LineEdit *focus_owner_line_edit = Object::cast_to<LineEdit>(scene_tree_editor->get_focus_owner());
bool is_main_field = _is_main_field(focus_owner_line_edit);
but_insert_name->set_disabled(!is_main_field);
@@ -358,12 +358,12 @@ void RenameDialog::_update_substitute() {
but_insert_count->set_disabled(!is_main_field);
// The focus mode seems to be reset when disabling/re-enabling
- but_insert_name->set_focus_mode(FOCUS_NONE);
- but_insert_parent->set_focus_mode(FOCUS_NONE);
- but_insert_type->set_focus_mode(FOCUS_NONE);
- but_insert_scene->set_focus_mode(FOCUS_NONE);
- but_insert_root->set_focus_mode(FOCUS_NONE);
- but_insert_count->set_focus_mode(FOCUS_NONE);
+ but_insert_name->set_focus_mode(Control::FOCUS_NONE);
+ but_insert_parent->set_focus_mode(Control::FOCUS_NONE);
+ but_insert_type->set_focus_mode(Control::FOCUS_NONE);
+ but_insert_scene->set_focus_mode(Control::FOCUS_NONE);
+ but_insert_root->set_focus_mode(Control::FOCUS_NONE);
+ but_insert_count->set_focus_mode(Control::FOCUS_NONE);
}
void RenameDialog::_post_popup() {
@@ -652,7 +652,7 @@ bool RenameDialog::_is_main_field(LineEdit *line_edit) {
void RenameDialog::_insert_text(String text) {
- LineEdit *focus_owner = Object::cast_to<LineEdit>(get_focus_owner());
+ LineEdit *focus_owner = Object::cast_to<LineEdit>(scene_tree_editor->get_focus_owner());
if (_is_main_field(focus_owner)) {
focus_owner->selection_delete();