From eb836d1490bd61fbf74cebeb1b954202210fde2f Mon Sep 17 00:00:00 2001 From: passivestar <60579014+passivestar@users.noreply.github.com> Date: Sun, 6 Oct 2024 17:10:05 +0400 Subject: [PATCH] Add theme type variations for secondary Trees and ItemLists --- editor/create_dialog.cpp | 2 ++ editor/debugger/editor_performance_profiler.cpp | 1 + editor/debugger/editor_profiler.cpp | 1 + editor/debugger/editor_visual_profiler.cpp | 1 + editor/debugger/script_editor_debugger.cpp | 2 ++ editor/editor_feature_profile.cpp | 1 + editor/export/project_export.cpp | 1 + editor/filesystem_dock.cpp | 1 + editor/gui/editor_file_dialog.cpp | 2 ++ editor/plugins/script_editor_plugin.cpp | 2 ++ editor/plugins/shader_editor_plugin.cpp | 1 + editor/plugins/sprite_frames_editor_plugin.cpp | 1 + editor/plugins/tiles/tile_map_layer_editor.cpp | 4 ++++ editor/plugins/tiles/tile_set_editor.cpp | 2 ++ scene/theme/default_theme.cpp | 4 ++++ 15 files changed, 26 insertions(+) diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 330ac3b437e..a7a3639e242 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -764,6 +764,7 @@ CreateDialog::CreateDialog() { favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected)); favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated)); favorites->add_theme_constant_override("draw_guides", 1); + favorites->set_theme_type_variation("SideTree"); SET_DRAG_FORWARDING_GCD(favorites, CreateDialog); fav_vb->add_margin_child(TTR("Favorites:"), favorites, true); @@ -779,6 +780,7 @@ CreateDialog::CreateDialog() { recent->connect(SceneStringName(item_selected), callable_mp(this, &CreateDialog::_history_selected)); recent->connect("item_activated", callable_mp(this, &CreateDialog::_history_activated)); recent->add_theme_constant_override("draw_guides", 1); + recent->set_theme_type_variation("SideItemList"); VBoxContainer *vbc = memnew(VBoxContainer); vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE); diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index 1ea9a665347..31e31db33a7 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -401,6 +401,7 @@ EditorPerformanceProfiler::EditorPerformanceProfiler() { monitor_tree->connect("item_edited", callable_mp(this, &EditorPerformanceProfiler::_monitor_select)); monitor_tree->create_item(); monitor_tree->set_hide_root(true); + monitor_tree->set_theme_type_variation("SideTree"); add_child(monitor_tree); monitor_draw = memnew(Control); diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index d244b6b4cd9..df69c191de8 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -711,6 +711,7 @@ EditorProfiler::EditorProfiler() { variables->set_column_expand(2, false); variables->set_column_clip_content(2, true); variables->set_column_custom_minimum_width(2, 50 * EDSCALE); + variables->set_theme_type_variation("SideTree"); variables->connect("item_edited", callable_mp(this, &EditorProfiler::_item_edited)); graph = memnew(TextureRect); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index d4859fbe4d9..a11494030ed 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -810,6 +810,7 @@ EditorVisualProfiler::EditorVisualProfiler() { variables->set_column_expand(2, false); variables->set_column_clip_content(2, true); variables->set_column_custom_minimum_width(2, 75 * EDSCALE); + variables->set_theme_type_variation("SideTree"); variables->connect("cell_selected", callable_mp(this, &EditorVisualProfiler::_item_selected)); graph = memnew(TextureRect); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index cbe7910518c..024fff99b2a 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1914,6 +1914,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { stack_dump->set_column_title(0, TTR("Stack Frames")); stack_dump->set_hide_root(true); stack_dump->set_v_size_flags(SIZE_EXPAND_FILL); + stack_dump->set_theme_type_variation("SideTree"); stack_dump->connect("cell_selected", callable_mp(this, &ScriptEditorDebugger::_stack_dump_frame_selected)); stack_vb->add_child(stack_dump); @@ -1949,6 +1950,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { breakpoints_tree->set_allow_reselect(true); breakpoints_tree->set_allow_rmb_select(true); breakpoints_tree->set_hide_root(true); + breakpoints_tree->set_theme_type_variation("SideTree"); breakpoints_tree->connect("item_mouse_selected", callable_mp(this, &ScriptEditorDebugger::_breakpoints_item_rmb_selected)); breakpoints_tree->create_item(); diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 44fc9e37020..718d90d9aff 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -985,6 +985,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { class_list->connect("cell_selected", callable_mp(this, &EditorFeatureProfileManager::_class_list_item_selected)); class_list->connect("item_edited", callable_mp(this, &EditorFeatureProfileManager::_class_list_item_edited), CONNECT_DEFERRED); class_list->connect("item_collapsed", callable_mp(this, &EditorFeatureProfileManager::_class_list_item_collapsed)); + class_list->set_theme_type_variation("SideTree"); // It will be displayed once the user creates or chooses a profile. class_list_vbc->hide(); diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index f9137082d70..145154c7598 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -1390,6 +1390,7 @@ ProjectExportDialog::ProjectExportDialog() { preset_vb->add_child(mc); mc->set_v_size_flags(Control::SIZE_EXPAND_FILL); presets = memnew(ItemList); + presets->set_theme_type_variation("SideItemList"); presets->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); SET_DRAG_FORWARDING_GCD(presets, ProjectExportDialog); mc->add_child(presets); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 53982b37b9f..e7a56aacccf 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -4210,6 +4210,7 @@ FileSystemDock::FileSystemDock() { files = memnew(FileSystemList); files->set_v_size_flags(SIZE_EXPAND_FILL); files->set_select_mode(ItemList::SELECT_MULTI); + files->set_theme_type_variation("SideItemList"); SET_DRAG_FORWARDING_GCD(files, FileSystemDock); files->connect("item_clicked", callable_mp(this, &FileSystemDock::_file_list_item_clicked)); files->connect(SceneStringName(gui_input), callable_mp(this, &FileSystemDock::_file_list_gui_input)); diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index 77d0ba7a60a..e27ea3ea590 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -2291,6 +2291,7 @@ EditorFileDialog::EditorFileDialog() { favorites->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); fav_vb->add_child(favorites); favorites->set_v_size_flags(Control::SIZE_EXPAND_FILL); + favorites->set_theme_type_variation("SideItemList"); favorites->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_favorite_selected)); VBoxContainer *rec_vb = memnew(VBoxContainer); @@ -2300,6 +2301,7 @@ EditorFileDialog::EditorFileDialog() { recent = memnew(ItemList); recent->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); recent->set_allow_reselect(true); + recent->set_theme_type_variation("SideItemList"); rec_vb->add_margin_child(TTR("Recent:"), recent, true); recent->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_recent_selected)); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 7e0331d15c1..18896348dc1 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -4110,6 +4110,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { scripts_vbox->add_child(script_list); script_list->set_custom_minimum_size(Size2(100, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing script_list->set_v_size_flags(SIZE_EXPAND_FILL); + script_list->set_theme_type_variation("SideItemList"); script_split->set_split_offset(200 * EDSCALE); _sort_list_on_update = true; script_list->connect("item_clicked", callable_mp(this, &ScriptEditor::_script_list_clicked), CONNECT_DEFERRED); @@ -4153,6 +4154,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { members_overview = memnew(ItemList); members_overview->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + members_overview->set_theme_type_variation("SideItemList"); overview_vbox->add_child(members_overview); members_overview->set_allow_reselect(true); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 6b00a2c9c5a..3962d924004 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -813,6 +813,7 @@ ShaderEditorPlugin::ShaderEditorPlugin() { shader_list = memnew(ItemList); shader_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); shader_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); + shader_list->set_theme_type_variation("SideItemList"); left_panel->add_child(shader_list); shader_list->connect(SceneStringName(item_selected), callable_mp(this, &ShaderEditorPlugin::_shader_selected)); shader_list->connect("item_clicked", callable_mp(this, &ShaderEditorPlugin::_shader_list_clicked)); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 37d5b787eb9..e0c785d3e1f 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -2129,6 +2129,7 @@ SpriteFramesEditor::SpriteFramesEditor() { frame_list->set_max_columns(0); frame_list->set_icon_mode(ItemList::ICON_MODE_TOP); frame_list->set_max_text_lines(2); + frame_list->set_theme_type_variation("SideItemList"); SET_DRAG_FORWARDING_GCD(frame_list, SpriteFramesEditor); frame_list->connect(SceneStringName(gui_input), callable_mp(this, &SpriteFramesEditor::_frame_list_gui_input)); // HACK: The item_selected signal is emitted before the Frame Duration spinbox loses focus and applies the change. diff --git a/editor/plugins/tiles/tile_map_layer_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp index dcfd92f6f9e..3d3d841be38 100644 --- a/editor/plugins/tiles/tile_map_layer_editor.cpp +++ b/editor/plugins/tiles/tile_map_layer_editor.cpp @@ -2413,6 +2413,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { sources_list->set_stretch_ratio(0.25); sources_list->set_custom_minimum_size(Size2(70, 0) * EDSCALE); sources_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); + sources_list->set_theme_type_variation("SideItemList"); sources_list->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_source_display).unbind(1)); sources_list->connect(SceneStringName(item_selected), callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::set_sources_lists_current)); sources_list->connect("item_activated", callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::display_tile_set_editor_panel).unbind(1)); @@ -2449,6 +2450,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { scene_tiles_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); scene_tiles_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); scene_tiles_list->set_select_mode(ItemList::SELECT_MULTI); + scene_tiles_list->set_theme_type_variation("SideItemList"); scene_tiles_list->connect("multi_selected", callable_mp(this, &TileMapLayerEditorTilesPlugin::_scenes_list_multi_selected)); scene_tiles_list->connect("empty_clicked", callable_mp(this, &TileMapLayerEditorTilesPlugin::_scenes_list_lmb_empty_clicked)); scene_tiles_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); @@ -2478,6 +2480,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { patterns_item_list->set_max_text_lines(2); patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); patterns_item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); + patterns_item_list->set_theme_type_variation("SideItemList"); patterns_item_list->connect(SceneStringName(gui_input), callable_mp(this, &TileMapLayerEditorTilesPlugin::_patterns_item_list_gui_input)); patterns_item_list->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_selection_pattern_from_tileset_pattern_selection).unbind(1)); patterns_item_list->connect("item_activated", callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_selection_pattern_from_tileset_pattern_selection).unbind(1)); @@ -3539,6 +3542,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { terrains_tile_list->set_same_column_width(true); terrains_tile_list->set_fixed_icon_size(Size2(32, 32) * EDSCALE); terrains_tile_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); + terrains_tile_list->set_theme_type_variation("SideItemList"); tilemap_tab_terrains->add_child(terrains_tile_list); // --- Toolbar --- diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 7e5336ce064..7c9e0ac5154 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -861,6 +861,7 @@ TileSetEditor::TileSetEditor() { sources_list->set_fixed_icon_size(Size2(60, 60) * EDSCALE); sources_list->set_h_size_flags(SIZE_EXPAND_FILL); sources_list->set_v_size_flags(SIZE_EXPAND_FILL); + sources_list->set_theme_type_variation("SideItemList"); sources_list->connect(SceneStringName(item_selected), callable_mp(this, &TileSetEditor::_source_selected)); sources_list->connect(SceneStringName(item_selected), callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::set_sources_lists_current)); sources_list->connect(SceneStringName(visibility_changed), callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::synchronize_sources_list).bind(sources_list, source_sort_button)); @@ -946,6 +947,7 @@ TileSetEditor::TileSetEditor() { patterns_item_list->set_max_text_lines(2); patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); patterns_item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); + patterns_item_list->set_theme_type_variation("SideItemList"); patterns_item_list->connect(SceneStringName(gui_input), callable_mp(this, &TileSetEditor::_patterns_item_list_gui_input)); main_vb->add_child(patterns_item_list); patterns_item_list->hide(); diff --git a/scene/theme/default_theme.cpp b/scene/theme/default_theme.cpp index caf44ac392f..7bf6878ef2e 100644 --- a/scene/theme/default_theme.cpp +++ b/scene/theme/default_theme.cpp @@ -898,6 +898,8 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_constant("scrollbar_h_separation", "Tree", Math::round(4 * scale)); theme->set_constant("scrollbar_v_separation", "Tree", Math::round(4 * scale)); + theme->set_type_variation("SideTree", "Tree"); + // ItemList theme->set_stylebox(SceneStringName(panel), "ItemList", make_flat_stylebox(style_normal_color)); @@ -923,6 +925,8 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_constant("outline_size", "ItemList", 0); + theme->set_type_variation("SideItemList", "ItemList"); + // TabContainer Ref style_tab_selected = make_flat_stylebox(style_normal_color, 10, 4, 10, 4, 0);