diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-03-04 23:39:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-04 23:39:25 +0100 |
commit | c9d052330291b726660f3ac397ec82dbcf638bf0 (patch) | |
tree | 4bf0ce2b223507fd22e0e832ce835243d54ea52e | |
parent | 27377170d2808358d6eaf7f62415711d0d379819 (diff) | |
parent | 917dac78e76cba76165cca9b1c966e52fdd6ec3d (diff) |
Merge pull request #58770 from YeldhamDev/some_crumbles_left
Replace some bits of code left to work with the new `TabContainer`
-rw-r--r-- | editor/editor_resource_picker.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 2 | ||||
-rw-r--r-- | editor/property_editor.cpp | 2 | ||||
-rw-r--r-- | editor/scene_tree_editor.cpp | 6 |
5 files changed, 10 insertions, 8 deletions
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 2f14667fc0..fc1e466e9b 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -337,7 +337,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) { // Ensure that the FileSystem dock is visible. TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control(); - tab_container->set_current_tab(file_system_dock->get_index()); + tab_container->set_current_tab(tab_container->get_tab_idx_from_control(file_system_dock)); } break; default: { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index a4a2919034..827eeababf 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -810,7 +810,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) { } if (idx >= 0) { if (history_pos >= 0) { - idx = history[history_pos].control->get_index(); + idx = tab_container->get_tab_idx_from_control(history[history_pos].control); } tab_container->set_current_tab(idx); } else { @@ -1429,7 +1429,7 @@ void ScriptEditor::_menu_option(int p_option) { file_system_dock->navigate_to_path(path); // Ensure that the FileSystem dock is visible. TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control(); - tab_container->set_current_tab(file_system_dock->get_index()); + tab_container->set_current_tab(tab_container->get_tab_idx_from_control(file_system_dock)); } } break; case CLOSE_DOCS: { @@ -3376,7 +3376,7 @@ void ScriptEditor::_update_history_pos(int p_new_pos) { } history_pos = p_new_pos; - tab_container->set_current_tab(history[history_pos].control->get_index()); + tab_container->set_current_tab(tab_container->get_tab_idx_from_control(history[history_pos].control)); n = history[history_pos].control; diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 4d708dc7e0..7059509e72 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -63,7 +63,7 @@ void ProjectSettingsEditor::queue_save() { } void ProjectSettingsEditor::set_plugins_page() { - tab_container->set_current_tab(plugin_settings->get_index()); + tab_container->set_current_tab(tab_container->get_tab_idx_from_control(plugin_settings)); } void ProjectSettingsEditor::update_plugins() { diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index cd65ee7ae6..0282504c70 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -228,7 +228,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { file_system_dock->navigate_to_path(r->get_path()); // Ensure that the FileSystem dock is visible. TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control(); - tab_container->set_current_tab(file_system_dock->get_index()); + tab_container->set_current_tab(tab_container->get_tab_idx_from_control(file_system_dock)); } break; default: { if (p_which >= CONVERT_BASE_ID) { diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index ba65828ac1..c6a8a928db 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -135,7 +135,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i set_selected(n); - NodeDock::get_singleton()->get_parent()->call("set_current_tab", NodeDock::get_singleton()->get_index()); + TabContainer *tab_container = Object::cast_to<TabContainer>(NodeDock::get_singleton()->get_parent()); + NodeDock::get_singleton()->get_parent()->call("set_current_tab", tab_container->get_tab_idx_from_control(NodeDock::get_singleton())); NodeDock::get_singleton()->show_connections(); } else if (p_id == BUTTON_GROUPS) { @@ -144,7 +145,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i set_selected(n); - NodeDock::get_singleton()->get_parent()->call("set_current_tab", NodeDock::get_singleton()->get_index()); + TabContainer *tab_container = Object::cast_to<TabContainer>(NodeDock::get_singleton()->get_parent()); + NodeDock::get_singleton()->get_parent()->call("set_current_tab", tab_container->get_tab_idx_from_control(NodeDock::get_singleton())); NodeDock::get_singleton()->show_groups(); } } |