Add theme type variations for secondary Trees and ItemLists

This commit is contained in:
passivestar 2024-10-06 17:10:05 +04:00
parent db66bd35af
commit eb836d1490
15 changed files with 26 additions and 0 deletions

View file

@ -764,6 +764,7 @@ CreateDialog::CreateDialog() {
favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected)); favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected));
favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated)); favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated));
favorites->add_theme_constant_override("draw_guides", 1); favorites->add_theme_constant_override("draw_guides", 1);
favorites->set_theme_type_variation("SideTree");
SET_DRAG_FORWARDING_GCD(favorites, CreateDialog); SET_DRAG_FORWARDING_GCD(favorites, CreateDialog);
fav_vb->add_margin_child(TTR("Favorites:"), favorites, true); 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(SceneStringName(item_selected), callable_mp(this, &CreateDialog::_history_selected));
recent->connect("item_activated", callable_mp(this, &CreateDialog::_history_activated)); recent->connect("item_activated", callable_mp(this, &CreateDialog::_history_activated));
recent->add_theme_constant_override("draw_guides", 1); recent->add_theme_constant_override("draw_guides", 1);
recent->set_theme_type_variation("SideItemList");
VBoxContainer *vbc = memnew(VBoxContainer); VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE); vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE);

View file

@ -401,6 +401,7 @@ EditorPerformanceProfiler::EditorPerformanceProfiler() {
monitor_tree->connect("item_edited", callable_mp(this, &EditorPerformanceProfiler::_monitor_select)); monitor_tree->connect("item_edited", callable_mp(this, &EditorPerformanceProfiler::_monitor_select));
monitor_tree->create_item(); monitor_tree->create_item();
monitor_tree->set_hide_root(true); monitor_tree->set_hide_root(true);
monitor_tree->set_theme_type_variation("SideTree");
add_child(monitor_tree); add_child(monitor_tree);
monitor_draw = memnew(Control); monitor_draw = memnew(Control);

View file

@ -711,6 +711,7 @@ EditorProfiler::EditorProfiler() {
variables->set_column_expand(2, false); variables->set_column_expand(2, false);
variables->set_column_clip_content(2, true); variables->set_column_clip_content(2, true);
variables->set_column_custom_minimum_width(2, 50 * EDSCALE); 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)); variables->connect("item_edited", callable_mp(this, &EditorProfiler::_item_edited));
graph = memnew(TextureRect); graph = memnew(TextureRect);

View file

@ -810,6 +810,7 @@ EditorVisualProfiler::EditorVisualProfiler() {
variables->set_column_expand(2, false); variables->set_column_expand(2, false);
variables->set_column_clip_content(2, true); variables->set_column_clip_content(2, true);
variables->set_column_custom_minimum_width(2, 75 * EDSCALE); 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)); variables->connect("cell_selected", callable_mp(this, &EditorVisualProfiler::_item_selected));
graph = memnew(TextureRect); graph = memnew(TextureRect);

View file

@ -1914,6 +1914,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
stack_dump->set_column_title(0, TTR("Stack Frames")); stack_dump->set_column_title(0, TTR("Stack Frames"));
stack_dump->set_hide_root(true); stack_dump->set_hide_root(true);
stack_dump->set_v_size_flags(SIZE_EXPAND_FILL); 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_dump->connect("cell_selected", callable_mp(this, &ScriptEditorDebugger::_stack_dump_frame_selected));
stack_vb->add_child(stack_dump); stack_vb->add_child(stack_dump);
@ -1949,6 +1950,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
breakpoints_tree->set_allow_reselect(true); breakpoints_tree->set_allow_reselect(true);
breakpoints_tree->set_allow_rmb_select(true); breakpoints_tree->set_allow_rmb_select(true);
breakpoints_tree->set_hide_root(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->connect("item_mouse_selected", callable_mp(this, &ScriptEditorDebugger::_breakpoints_item_rmb_selected));
breakpoints_tree->create_item(); breakpoints_tree->create_item();

View file

@ -985,6 +985,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
class_list->connect("cell_selected", callable_mp(this, &EditorFeatureProfileManager::_class_list_item_selected)); 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_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->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. // It will be displayed once the user creates or chooses a profile.
class_list_vbc->hide(); class_list_vbc->hide();

View file

@ -1390,6 +1390,7 @@ ProjectExportDialog::ProjectExportDialog() {
preset_vb->add_child(mc); preset_vb->add_child(mc);
mc->set_v_size_flags(Control::SIZE_EXPAND_FILL); mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
presets = memnew(ItemList); presets = memnew(ItemList);
presets->set_theme_type_variation("SideItemList");
presets->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); presets->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
SET_DRAG_FORWARDING_GCD(presets, ProjectExportDialog); SET_DRAG_FORWARDING_GCD(presets, ProjectExportDialog);
mc->add_child(presets); mc->add_child(presets);

View file

@ -4210,6 +4210,7 @@ FileSystemDock::FileSystemDock() {
files = memnew(FileSystemList); files = memnew(FileSystemList);
files->set_v_size_flags(SIZE_EXPAND_FILL); files->set_v_size_flags(SIZE_EXPAND_FILL);
files->set_select_mode(ItemList::SELECT_MULTI); files->set_select_mode(ItemList::SELECT_MULTI);
files->set_theme_type_variation("SideItemList");
SET_DRAG_FORWARDING_GCD(files, FileSystemDock); SET_DRAG_FORWARDING_GCD(files, FileSystemDock);
files->connect("item_clicked", callable_mp(this, &FileSystemDock::_file_list_item_clicked)); 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)); files->connect(SceneStringName(gui_input), callable_mp(this, &FileSystemDock::_file_list_gui_input));

View file

@ -2291,6 +2291,7 @@ EditorFileDialog::EditorFileDialog() {
favorites->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); favorites->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
fav_vb->add_child(favorites); fav_vb->add_child(favorites);
favorites->set_v_size_flags(Control::SIZE_EXPAND_FILL); 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)); favorites->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_favorite_selected));
VBoxContainer *rec_vb = memnew(VBoxContainer); VBoxContainer *rec_vb = memnew(VBoxContainer);
@ -2300,6 +2301,7 @@ EditorFileDialog::EditorFileDialog() {
recent = memnew(ItemList); recent = memnew(ItemList);
recent->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); recent->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
recent->set_allow_reselect(true); recent->set_allow_reselect(true);
recent->set_theme_type_variation("SideItemList");
rec_vb->add_margin_child(TTR("Recent:"), recent, true); rec_vb->add_margin_child(TTR("Recent:"), recent, true);
recent->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_recent_selected)); recent->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_recent_selected));

View file

@ -4110,6 +4110,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
scripts_vbox->add_child(script_list); 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_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_v_size_flags(SIZE_EXPAND_FILL);
script_list->set_theme_type_variation("SideItemList");
script_split->set_split_offset(200 * EDSCALE); script_split->set_split_offset(200 * EDSCALE);
_sort_list_on_update = true; _sort_list_on_update = true;
script_list->connect("item_clicked", callable_mp(this, &ScriptEditor::_script_list_clicked), CONNECT_DEFERRED); 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 = memnew(ItemList);
members_overview->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); members_overview->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
members_overview->set_theme_type_variation("SideItemList");
overview_vbox->add_child(members_overview); overview_vbox->add_child(members_overview);
members_overview->set_allow_reselect(true); members_overview->set_allow_reselect(true);

View file

@ -813,6 +813,7 @@ ShaderEditorPlugin::ShaderEditorPlugin() {
shader_list = memnew(ItemList); shader_list = memnew(ItemList);
shader_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); shader_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
shader_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); shader_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
shader_list->set_theme_type_variation("SideItemList");
left_panel->add_child(shader_list); left_panel->add_child(shader_list);
shader_list->connect(SceneStringName(item_selected), callable_mp(this, &ShaderEditorPlugin::_shader_selected)); shader_list->connect(SceneStringName(item_selected), callable_mp(this, &ShaderEditorPlugin::_shader_selected));
shader_list->connect("item_clicked", callable_mp(this, &ShaderEditorPlugin::_shader_list_clicked)); shader_list->connect("item_clicked", callable_mp(this, &ShaderEditorPlugin::_shader_list_clicked));

View file

@ -2129,6 +2129,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
frame_list->set_max_columns(0); frame_list->set_max_columns(0);
frame_list->set_icon_mode(ItemList::ICON_MODE_TOP); frame_list->set_icon_mode(ItemList::ICON_MODE_TOP);
frame_list->set_max_text_lines(2); frame_list->set_max_text_lines(2);
frame_list->set_theme_type_variation("SideItemList");
SET_DRAG_FORWARDING_GCD(frame_list, SpriteFramesEditor); SET_DRAG_FORWARDING_GCD(frame_list, SpriteFramesEditor);
frame_list->connect(SceneStringName(gui_input), callable_mp(this, &SpriteFramesEditor::_frame_list_gui_input)); 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. // HACK: The item_selected signal is emitted before the Frame Duration spinbox loses focus and applies the change.

View file

@ -2413,6 +2413,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
sources_list->set_stretch_ratio(0.25); sources_list->set_stretch_ratio(0.25);
sources_list->set_custom_minimum_size(Size2(70, 0) * EDSCALE); sources_list->set_custom_minimum_size(Size2(70, 0) * EDSCALE);
sources_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); 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(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(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)); 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_h_size_flags(Control::SIZE_EXPAND_FILL);
scene_tiles_list->set_v_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_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("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->connect("empty_clicked", callable_mp(this, &TileMapLayerEditorTilesPlugin::_scenes_list_lmb_empty_clicked));
scene_tiles_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); 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_max_text_lines(2);
patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); 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_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(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(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)); 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_same_column_width(true);
terrains_tile_list->set_fixed_icon_size(Size2(32, 32) * EDSCALE); 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_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST);
terrains_tile_list->set_theme_type_variation("SideItemList");
tilemap_tab_terrains->add_child(terrains_tile_list); tilemap_tab_terrains->add_child(terrains_tile_list);
// --- Toolbar --- // --- Toolbar ---

View file

@ -861,6 +861,7 @@ TileSetEditor::TileSetEditor() {
sources_list->set_fixed_icon_size(Size2(60, 60) * EDSCALE); sources_list->set_fixed_icon_size(Size2(60, 60) * EDSCALE);
sources_list->set_h_size_flags(SIZE_EXPAND_FILL); sources_list->set_h_size_flags(SIZE_EXPAND_FILL);
sources_list->set_v_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(this, &TileSetEditor::_source_selected));
sources_list->connect(SceneStringName(item_selected), callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::set_sources_lists_current)); 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)); 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_max_text_lines(2);
patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); 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_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)); patterns_item_list->connect(SceneStringName(gui_input), callable_mp(this, &TileSetEditor::_patterns_item_list_gui_input));
main_vb->add_child(patterns_item_list); main_vb->add_child(patterns_item_list);
patterns_item_list->hide(); patterns_item_list->hide();

View file

@ -898,6 +898,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("scrollbar_h_separation", "Tree", Math::round(4 * scale)); theme->set_constant("scrollbar_h_separation", "Tree", Math::round(4 * scale));
theme->set_constant("scrollbar_v_separation", "Tree", Math::round(4 * scale)); theme->set_constant("scrollbar_v_separation", "Tree", Math::round(4 * scale));
theme->set_type_variation("SideTree", "Tree");
// ItemList // ItemList
theme->set_stylebox(SceneStringName(panel), "ItemList", make_flat_stylebox(style_normal_color)); theme->set_stylebox(SceneStringName(panel), "ItemList", make_flat_stylebox(style_normal_color));
@ -923,6 +925,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("outline_size", "ItemList", 0); theme->set_constant("outline_size", "ItemList", 0);
theme->set_type_variation("SideItemList", "ItemList");
// TabContainer // TabContainer
Ref<StyleBoxFlat> style_tab_selected = make_flat_stylebox(style_normal_color, 10, 4, 10, 4, 0); Ref<StyleBoxFlat> style_tab_selected = make_flat_stylebox(style_normal_color, 10, 4, 10, 4, 0);