diff options
Diffstat (limited to 'editor/create_dialog.cpp')
-rw-r--r-- | editor/create_dialog.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 3e09a9a760..6cbb1b1791 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -193,7 +193,7 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p item->set_text(0, p_type + " (" + ScriptServer::get_global_class_path(p_type).get_file() + ")"); } if (!can_instance) { - item->set_custom_color(0, get_color("disabled_font_color", "Editor")); + item->set_custom_color(0, search_options->get_theme_color("disabled_font_color", "Editor")); item->set_selectable(0, false); } else if (!(*to_select && (*to_select)->get_text(0) == search_box->get_text())) { String search_term = search_box->get_text().to_lower(); @@ -248,7 +248,7 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p item->set_collapsed(collapse); } - const String &description = EditorHelp::get_doc_data()->class_list[p_type].brief_description; + const String &description = DTR(EditorHelp::get_doc_data()->class_list[p_type].brief_description); item->set_tooltip(0, description); item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, base_type)); @@ -310,11 +310,11 @@ void CreateDialog::_update_search() { EditorData &ed = EditorNode::get_editor_data(); root->set_text(0, base_type); - if (has_icon(base_type, "EditorIcons")) { - root->set_icon(0, get_icon(base_type, "EditorIcons")); + if (search_options->has_theme_icon(base_type, "EditorIcons")) { + root->set_icon(0, search_options->get_theme_icon(base_type, "EditorIcons")); } - TreeItem *to_select = search_box->get_text() == base_type ? root : NULL; + TreeItem *to_select = search_box->get_text() == base_type ? root : nullptr; for (List<StringName>::Element *I = type_list.front(); I; I = I->next()) { @@ -417,7 +417,7 @@ void CreateDialog::_update_search() { favorite->set_pressed(favorite_list.find(to_select->get_text(0)) != -1); } - get_ok()->set_disabled(root->get_children() == NULL); + get_ok()->set_disabled(root->get_children() == nullptr); } void CreateDialog::_confirmed() { @@ -460,23 +460,22 @@ void CreateDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("confirmed", callable_mp(this, &CreateDialog::_confirmed)); - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - favorite->set_icon(get_icon("Favorites", "EditorIcons")); + favorite->set_icon(search_options->get_theme_icon("Favorites", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed)); } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible_in_tree()) { + if (is_visible()) { search_box->call_deferred("grab_focus"); // still not visible search_box->select_all(); + } else { + EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size())); + search_loaded_scripts.clear(); } } break; - case NOTIFICATION_POPUP_HIDE: { - EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", get_rect()); - search_loaded_scripts.clear(); - } break; } } @@ -539,7 +538,7 @@ Object *CreateDialog::instance_selected() { } } - return NULL; + return nullptr; } void CreateDialog::_item_selected() { @@ -556,13 +555,13 @@ void CreateDialog::_item_selected() { if (!EditorHelp::get_doc_data()->class_list.has(name)) return; - help_bit->set_text(EditorHelp::get_doc_data()->class_list[name].brief_description); + help_bit->set_text(DTR(EditorHelp::get_doc_data()->class_list[name].brief_description)); get_ok()->set_disabled(false); } void CreateDialog::_hide_requested() { - _closed(); // From WindowDialog. + _cancel_pressed(); // From AcceptDialog. } void CreateDialog::_favorite_toggled() { @@ -662,7 +661,7 @@ Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) { ToolButton *tb = memnew(ToolButton); tb->set_icon(ti->get_icon(0)); tb->set_text(ti->get_text(0)); - set_drag_preview(tb); + favorites->set_drag_preview(tb); return d; } @@ -743,8 +742,6 @@ CreateDialog::CreateDialog() { is_replace_mode = false; - set_resizable(true); - HSplitContainer *hsc = memnew(HSplitContainer); add_child(hsc); @@ -754,7 +751,7 @@ CreateDialog::CreateDialog() { VBoxContainer *fav_vb = memnew(VBoxContainer); vsc->add_child(fav_vb); fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE); - fav_vb->set_v_size_flags(SIZE_EXPAND_FILL); + fav_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL); favorites = memnew(Tree); fav_vb->add_margin_child(TTR("Favorites:"), favorites, true); @@ -763,13 +760,16 @@ CreateDialog::CreateDialog() { favorites->set_allow_reselect(true); favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected)); favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated)); - favorites->set_drag_forwarding(this); - favorites->add_constant_override("draw_guides", 1); +#ifndef _MSC_VER +#warning cant forward drag data to a non control, must be fixed +#endif + //favorites->set_drag_forwarding(this); + favorites->add_theme_constant_override("draw_guides", 1); VBoxContainer *rec_vb = memnew(VBoxContainer); vsc->add_child(rec_vb); rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE); - rec_vb->set_v_size_flags(SIZE_EXPAND_FILL); + rec_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL); recent = memnew(Tree); rec_vb->add_margin_child(TTR("Recent:"), recent, true); @@ -778,15 +778,15 @@ CreateDialog::CreateDialog() { recent->set_allow_reselect(true); recent->connect("cell_selected", callable_mp(this, &CreateDialog::_history_selected)); recent->connect("item_activated", callable_mp(this, &CreateDialog::_history_activated)); - recent->add_constant_override("draw_guides", 1); + recent->add_theme_constant_override("draw_guides", 1); VBoxContainer *vbc = memnew(VBoxContainer); hsc->add_child(vbc); vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE); - vbc->set_h_size_flags(SIZE_EXPAND_FILL); + vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); HBoxContainer *search_hb = memnew(HBoxContainer); search_box = memnew(LineEdit); - search_box->set_h_size_flags(SIZE_EXPAND_FILL); + search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_hb->add_child(search_box); favorite = memnew(Button); favorite->set_flat(true); |