Add theme type variations for secondary Trees and ItemLists

This commit is contained in:
passivestar 2024-10-06 17:10:05 +04:00
parent fd4c29a189
commit 0ff5d5fd04
24 changed files with 35 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("TreeSecondary");
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("ItemListSecondary");
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("TreeSecondary");
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("TreeSecondary");
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("TreeSecondary");
variables->connect("cell_selected", callable_mp(this, &EditorVisualProfiler::_item_selected));
graph = memnew(TextureRect);

View file

@ -1921,6 +1921,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("TreeSecondary");
stack_dump->connect("cell_selected", callable_mp(this, &ScriptEditorDebugger::_stack_dump_frame_selected));
stack_vb->add_child(stack_dump);
@ -1956,6 +1957,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("TreeSecondary");
breakpoints_tree->connect("item_mouse_selected", callable_mp(this, &ScriptEditorDebugger::_breakpoints_item_rmb_selected));
breakpoints_tree->create_item();

View file

@ -735,6 +735,7 @@ EditorAssetInstaller::EditorAssetInstaller() {
source_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
source_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
source_tree->connect("item_edited", callable_mp(this, &EditorAssetInstaller::_item_checked_cbk));
source_tree->set_theme_type_variation("TreeSecondary");
source_tree_vb->add_child(source_tree);
VBoxContainer *destination_tree_vb = memnew(VBoxContainer);

View file

@ -959,6 +959,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
effects->set_allow_rmb_select(true);
effects->set_focus_mode(FOCUS_CLICK);
effects->set_allow_reselect(true);
effects->set_theme_type_variation("TreeSecondary");
effects->connect(SceneStringName(gui_input), callable_mp(this, &EditorAudioBus::_effects_gui_input));
send = memnew(OptionButton);

View file

@ -989,6 +989,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("TreeSecondary");
// It will be displayed once the user creates or chooses a profile.
class_list_vbc->hide();

View file

@ -353,6 +353,7 @@ SectionedInspector::SectionedInspector() :
sections->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
sections->set_v_size_flags(SIZE_EXPAND_FILL);
sections->set_hide_root(true);
sections->set_theme_type_variation("TreeSecondary");
left_vb->add_child(sections, true);

View file

@ -1411,6 +1411,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("ItemListSecondary");
presets->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
SET_DRAG_FORWARDING_GCD(presets, ProjectExportDialog);
mc->add_child(presets);

View file

@ -4146,6 +4146,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("ItemListSecondary");
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

@ -2317,6 +2317,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("ItemListSecondary");
favorites->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_favorite_selected));
VBoxContainer *rec_vb = memnew(VBoxContainer);
@ -2326,6 +2327,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("ItemListSecondary");
rec_vb->add_margin_child(TTR("Recent:"), recent, true);
recent->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_recent_selected));

View file

@ -4154,6 +4154,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("ItemListSecondary");
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);
@ -4197,6 +4198,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("ItemListSecondary");
overview_vbox->add_child(members_overview);
members_overview->set_allow_reselect(true);
@ -4206,6 +4208,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
help_overview = memnew(ItemList);
help_overview->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
help_overview->set_theme_type_variation("ItemListSecondary");
overview_vbox->add_child(help_overview);
help_overview->set_allow_reselect(true);
help_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing

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("ItemListSecondary");
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

@ -257,6 +257,7 @@ ShaderFileEditor::ShaderFileEditor() {
versions->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
versions->connect(SceneStringName(item_selected), callable_mp(this, &ShaderFileEditor::_version_selected));
versions->set_custom_minimum_size(Size2i(200 * EDSCALE, 0));
versions->set_theme_type_variation("TreeSecondary");
main_hs->add_child(versions);
VBoxContainer *main_vb = memnew(VBoxContainer);

View file

@ -1103,6 +1103,7 @@ void Skeleton3DEditor::create_editors() {
joint_tree->set_v_size_flags(SIZE_EXPAND_FILL);
joint_tree->set_h_size_flags(SIZE_EXPAND_FILL);
joint_tree->set_allow_rmb_select(true);
joint_tree->set_theme_type_variation("TreeSecondary");
SET_DRAG_FORWARDING_GCD(joint_tree, Skeleton3DEditor);
s_con->add_child(joint_tree);

View file

@ -1956,6 +1956,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
// HACK: The cell_selected signal is emitted before the FPS spinbox loses focus and applies the change.
animations->connect("cell_selected", callable_mp(this, &SpriteFramesEditor::_animation_selected), CONNECT_DEFERRED);
animations->connect("item_edited", callable_mp(this, &SpriteFramesEditor::_animation_name_edited));
animations->set_theme_type_variation("TreeSecondary");
animations->set_allow_reselect(true);
add_anim->set_shortcut_context(animations);

View file

@ -938,6 +938,7 @@ ThemeItemImportTree::ThemeItemImportTree() {
import_items_tree->set_column_custom_minimum_width(IMPORT_ITEM_DATA, 80 * EDSCALE);
import_items_tree->set_column_clip_content(1, true);
import_items_tree->set_column_clip_content(2, true);
import_items_tree->set_theme_type_variation("TreeSecondary");
ScrollContainer *import_bulk_sc = memnew(ScrollContainer);
import_bulk_sc->set_custom_minimum_size(Size2(260.0, 0.0) * EDSCALE);
@ -1937,6 +1938,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_dialog_side_vb->add_child(edit_type_list);
edit_type_list->connect(SceneStringName(item_selected), callable_mp(this, &ThemeItemEditorDialog::_edited_type_selected));
edit_type_list->connect("button_clicked", callable_mp(this, &ThemeItemEditorDialog::_edited_type_button_pressed));
edit_type_list->set_theme_type_variation("TreeSecondary");
Label *edit_add_type_label = memnew(Label);
edit_add_type_label->set_text(TTR("Add Type:"));

View file

@ -318,6 +318,7 @@ AtlasMergingDialog::AtlasMergingDialog() {
atlas_merging_atlases_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
atlas_merging_atlases_list->set_custom_minimum_size(Size2(100, 200));
atlas_merging_atlases_list->set_select_mode(ItemList::SELECT_MULTI);
atlas_merging_atlases_list->set_theme_type_variation("ItemListSecondary");
atlas_merging_atlases_list->connect("multi_selected", callable_mp(this, &AtlasMergingDialog::_update_texture).unbind(2));
atlas_merging_h_split_container->add_child(atlas_merging_atlases_list);

View file

@ -2415,6 +2415,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("ItemListSecondary");
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));
@ -3531,6 +3532,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
terrains_tree->set_custom_minimum_size(Size2(70, 0) * EDSCALE);
terrains_tree->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST);
terrains_tree->set_hide_root(true);
terrains_tree->set_theme_type_variation("ItemListSecondary");
terrains_tree->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_tiles_list));
tilemap_tab_terrains->add_child(terrains_tree);

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("ItemListSecondary");
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("ItemListSecondary");
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

@ -1294,6 +1294,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
commit_list->set_columns(2); // Commit msg, author
commit_list->set_column_custom_minimum_width(0, 40);
commit_list->set_column_custom_minimum_width(1, 20);
commit_list->set_theme_type_variation("TreeSecondary");
commit_list->connect(SceneStringName(item_selected), callable_mp(this, &VersionControlEditorPlugin::_load_diff).bind(commit_list));
version_commit_dock->add_child(commit_list);

View file

@ -6676,6 +6676,7 @@ VisualShaderEditor::VisualShaderEditor() {
parameters->set_h_size_flags(SIZE_EXPAND_FILL);
parameters->set_v_size_flags(SIZE_EXPAND_FILL);
parameters->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
parameters->set_theme_type_variation("TreeSecondary");
parameters->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_param_selected));
parameters->connect("nothing_selected", callable_mp(this, &VisualShaderEditor::_param_unselected));
sc->add_child(parameters);

View file

@ -2132,6 +2132,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("TreeSecondary", "Tree");
p_theme->set_type_variation("ItemListSecondary", "ItemList");
}
// Editor inspector.