Add theme type variations for secondary Trees and ItemLists

This commit is contained in:
passivestar 2024-10-06 17:10:05 +04:00
parent 6732a0fd86
commit 64a492489e
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("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);

View File

@ -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);

View File

@ -712,6 +712,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);

View File

@ -807,6 +807,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);

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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));

View File

@ -2300,6 +2300,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);
@ -2309,6 +2310,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));

View File

@ -4156,6 +4156,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);
@ -4199,6 +4200,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);

View File

@ -821,6 +821,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));

View File

@ -2130,6 +2130,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.

View File

@ -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 ---

View File

@ -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();

View File

@ -2126,6 +2126,10 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
// EditorValidationPanel.
p_theme->set_stylebox(SceneStringName(panel), "EditorValidationPanel", p_config.tree_panel_style);
// Secondary trees and item lists.
p_theme->set_type_variation("SideTree", "Tree");
p_theme->set_type_variation("SideItemList", "ItemList");
}
// Editor inspector.