Skip to content

Commit

Permalink
Merge pull request #65437 from YuriSizov/theme-gui-renames
Browse files Browse the repository at this point in the history
Improve naming of theme properties throughout GUI code
  • Loading branch information
akien-mga committed Sep 7, 2022
2 parents 5c5079b + 39ef611 commit 80dacac
Show file tree
Hide file tree
Showing 54 changed files with 231 additions and 223 deletions.
2 changes: 1 addition & 1 deletion doc/classes/CheckBox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The [CheckBox] text's font color when it's pressed.
</theme_item>
<theme_item name="check_v_adjust" data_type="constant" type="int" default="0">
<theme_item name="check_v_offset" data_type="constant" type="int" default="0">
The vertical offset used when rendering the check icons (in pixels).
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="4">
Expand Down
34 changes: 17 additions & 17 deletions doc/classes/CheckButton.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The [CheckButton] text's font color when it's pressed.
</theme_item>
<theme_item name="check_v_adjust" data_type="constant" type="int" default="0">
<theme_item name="check_v_offset" data_type="constant" type="int" default="0">
The vertical offset used when rendering the toggle icons (in pixels).
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="4">
Expand All @@ -50,30 +50,30 @@
<theme_item name="font_size" data_type="font_size" type="int">
Font size of the [CheckButton]'s text.
</theme_item>
<theme_item name="off" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked (for left-to-right layouts).
</theme_item>
<theme_item name="off_disabled" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked and disabled (for left-to-right layouts).
</theme_item>
<theme_item name="off_disabled_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked and disabled (for right-to-left layouts).
</theme_item>
<theme_item name="off_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked (for right-to-left layouts).
</theme_item>
<theme_item name="on" data_type="icon" type="Texture2D">
<theme_item name="checked" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is checked (for left-to-right layouts).
</theme_item>
<theme_item name="on_disabled" data_type="icon" type="Texture2D">
<theme_item name="checked_disabled" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is checked and disabled (for left-to-right layouts).
</theme_item>
<theme_item name="on_disabled_mirrored" data_type="icon" type="Texture2D">
<theme_item name="checked_disabled_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is checked and disabled (for right-to-left layouts).
</theme_item>
<theme_item name="on_mirrored" data_type="icon" type="Texture2D">
<theme_item name="checked_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is checked (for right-to-left layouts).
</theme_item>
<theme_item name="unchecked" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked (for left-to-right layouts).
</theme_item>
<theme_item name="unchecked_disabled" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked and disabled (for left-to-right layouts).
</theme_item>
<theme_item name="unchecked_disabled_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked and disabled (for right-to-left layouts).
</theme_item>
<theme_item name="unchecked_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked (for right-to-left layouts).
</theme_item>
<theme_item name="disabled" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is disabled.
</theme_item>
Expand Down
10 changes: 5 additions & 5 deletions doc/classes/FileDialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@
</constant>
</constants>
<theme_items>
<theme_item name="file_icon_modulate" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The color modulation applied to the file icon.
</theme_item>
<theme_item name="files_disabled" data_type="color" type="Color" default="Color(1, 1, 1, 0.25)">
<theme_item name="file_disabled_color" data_type="color" type="Color" default="Color(1, 1, 1, 0.25)">
The color tint for disabled files (when the [FileDialog] is used in open folder mode).
</theme_item>
<theme_item name="folder_icon_modulate" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
<theme_item name="file_icon_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The color modulation applied to the file icon.
</theme_item>
<theme_item name="folder_icon_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The color modulation applied to the folder icon.
</theme_item>
<theme_item name="back_folder" data_type="icon" type="Texture2D">
Expand Down
12 changes: 6 additions & 6 deletions doc/classes/ItemList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -469,18 +469,18 @@
<theme_item name="font_size" data_type="font_size" type="int">
Font size of the item's text.
</theme_item>
<theme_item name="bg" data_type="style" type="StyleBox">
Default [StyleBox] for the [ItemList], i.e. used when the control is not being focused.
</theme_item>
<theme_item name="bg_focus" data_type="style" type="StyleBox">
[StyleBox] used when the [ItemList] is being focused.
</theme_item>
<theme_item name="cursor" data_type="style" type="StyleBox">
[StyleBox] used for the cursor, when the [ItemList] is being focused.
</theme_item>
<theme_item name="cursor_unfocused" data_type="style" type="StyleBox">
[StyleBox] used for the cursor, when the [ItemList] is not being focused.
</theme_item>
<theme_item name="focus" data_type="style" type="StyleBox">
The focused style for the [ItemList], drawn on top of the background, but below everything else.
</theme_item>
<theme_item name="panel" data_type="style" type="StyleBox">
The background style for the [ItemList].
</theme_item>
<theme_item name="selected" data_type="style" type="StyleBox">
[StyleBox] for the selected items, used when the [ItemList] is not being focused.
</theme_item>
Expand Down
2 changes: 0 additions & 2 deletions doc/classes/Panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@
<theme_item name="panel" data_type="style" type="StyleBox">
The style of this [Panel].
</theme_item>
<theme_item name="panel_fg" data_type="style" type="StyleBox">
</theme_item>
</theme_items>
</class>
4 changes: 2 additions & 2 deletions doc/classes/ProgressBar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
<theme_item name="font_size" data_type="font_size" type="int">
Font size used to draw the fill percentage if [member percent_visible] is [code]true[/code].
</theme_item>
<theme_item name="bg" data_type="style" type="StyleBox">
<theme_item name="background" data_type="style" type="StyleBox">
The style of the background.
</theme_item>
<theme_item name="fg" data_type="style" type="StyleBox">
<theme_item name="fill" data_type="style" type="StyleBox">
The style of the progress (i.e. the part that fills the bar).
</theme_item>
</theme_items>
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/ScrollContainer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
</constant>
</constants>
<theme_items>
<theme_item name="bg" data_type="style" type="StyleBox">
<theme_item name="panel" data_type="style" type="StyleBox">
The background [StyleBox] of the [ScrollContainer].
</theme_item>
</theme_items>
Expand Down
12 changes: 6 additions & 6 deletions doc/classes/Tree.xml
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,6 @@
<theme_item name="updown" data_type="icon" type="Texture2D">
The updown arrow icon to display for the [constant TreeItem.CELL_MODE_RANGE] mode cell.
</theme_item>
<theme_item name="bg" data_type="style" type="StyleBox">
Default [StyleBox] for the [Tree], i.e. used when the control is not being focused.
</theme_item>
<theme_item name="bg_focus" data_type="style" type="StyleBox">
[StyleBox] used when the [Tree] is being focused.
</theme_item>
<theme_item name="button_pressed" data_type="style" type="StyleBox">
[StyleBox] used when a button in the tree is pressed.
</theme_item>
Expand All @@ -582,6 +576,12 @@
<theme_item name="custom_button_pressed" data_type="style" type="StyleBox">
[StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's pressed.
</theme_item>
<theme_item name="focus" data_type="style" type="StyleBox">
The focused style for the [Tree], drawn on top of everything.
</theme_item>
<theme_item name="panel" data_type="style" type="StyleBox">
The background style for the [Tree].
</theme_item>
<theme_item name="selected" data_type="style" type="StyleBox">
[StyleBox] for the selected items, used when the [Tree] is not being focused.
</theme_item>
Expand Down
4 changes: 2 additions & 2 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,7 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
draw_texture(
icon_to_draw,
ofs,
p_index == hovering_key_idx ? get_theme_color(SNAME("folder_icon_modulate"), SNAME("FileDialog")) : Color(1, 1, 1));
p_index == hovering_key_idx ? get_theme_color(SNAME("folder_icon_color"), SNAME("FileDialog")) : Color(1, 1, 1));
}

// Helper.
Expand Down Expand Up @@ -4766,7 +4766,7 @@ void AnimationTrackEditor::_notification(int p_what) {
view_group->set_icon(get_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup"), SNAME("EditorIcons")));
selected_filter->set_icon(get_theme_icon(SNAME("AnimationFilter"), SNAME("EditorIcons")));
imported_anim_warning->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
main_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
main_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Tree")));
edit->get_popup()->set_item_icon(edit->get_popup()->get_item_index(EDIT_APPLY_RESET), get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
} break;

Expand Down
2 changes: 1 addition & 1 deletion editor/editor_audio_buses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ void EditorAudioBuses::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
bus_scroll->add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
bus_scroll->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Tree")));
} break;

case NOTIFICATION_READY: {
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_dir_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p

p_item->set_metadata(0, p_dir->get_path());
p_item->set_icon(0, tree->get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
p_item->set_icon_modulate(0, tree->get_theme_color(SNAME("folder_icon_modulate"), SNAME("FileDialog")));
p_item->set_icon_modulate(0, tree->get_theme_color(SNAME("folder_icon_color"), SNAME("FileDialog")));

if (!p_item->get_parent()) {
p_item->set_text(0, "res://");
Expand Down
8 changes: 4 additions & 4 deletions editor/editor_file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void EditorFileDialog::_update_theme_item_cache() {
theme_cache.favorites_down = get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons"));

theme_cache.folder = get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"));
theme_cache.folder_icon_modulate = get_theme_color(SNAME("folder_icon_modulate"), SNAME("FileDialog"));
theme_cache.folder_icon_color = get_theme_color(SNAME("folder_icon_color"), SNAME("FileDialog"));

theme_cache.action_copy = get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons"));
theme_cache.action_delete = get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"));
Expand Down Expand Up @@ -839,7 +839,7 @@ void EditorFileDialog::update_file_list() {
d["dir"] = true;

item_list->set_item_metadata(-1, d);
item_list->set_item_icon_modulate(-1, theme_cache.folder_icon_modulate);
item_list->set_item_icon_modulate(-1, theme_cache.folder_icon_color);

dirs.pop_front();
}
Expand Down Expand Up @@ -1385,7 +1385,7 @@ void EditorFileDialog::_update_favorites() {
for (int i = 0; i < favorited_paths.size(); i++) {
favorites->add_item(favorited_names[i], theme_cache.folder);
favorites->set_item_metadata(-1, favorited_paths[i]);
favorites->set_item_icon_modulate(-1, theme_cache.folder_icon_modulate);
favorites->set_item_icon_modulate(-1, theme_cache.folder_icon_color);

if (i == current_favorite) {
favorite->set_pressed(true);
Expand Down Expand Up @@ -1468,7 +1468,7 @@ void EditorFileDialog::_update_recent() {
for (int i = 0; i < recentd_paths.size(); i++) {
recent->add_item(recentd_names[i], theme_cache.folder);
recent->set_item_metadata(-1, recentd_paths[i]);
recent->set_item_icon_modulate(-1, theme_cache.folder_icon_modulate);
recent->set_item_icon_modulate(-1, theme_cache.folder_icon_color);
}
EditorSettings::get_singleton()->set_recent_dirs(recentd);
}
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_file_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class EditorFileDialog : public ConfirmationDialog {
Ref<Texture2D> favorites_down;

Ref<Texture2D> folder;
Color folder_icon_modulate;
Color folder_icon_color;

Ref<Texture2D> action_copy;
Ref<Texture2D> action_delete;
Expand Down
4 changes: 2 additions & 2 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3487,9 +3487,9 @@ void EditorInspector::_update_inspector_bg() {
n = n->get_parent();
}
count_subinspectors = MIN(15, count_subinspectors);
add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg" + itos(count_subinspectors), SNAME("Editor")));
add_theme_style_override("panel", get_theme_stylebox("sub_inspector_bg" + itos(count_subinspectors), SNAME("Editor")));
} else {
add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Tree")));
}
}
void EditorInspector::set_sub_inspector(bool p_enable) {
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_resource_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ void EditorResourcePicker::_notification(int p_what) {
} break;

case NOTIFICATION_DRAW: {
draw_style_box(get_theme_stylebox(SNAME("bg"), SNAME("Tree")), Rect2(Point2(), get_size()));
draw_style_box(get_theme_stylebox(SNAME("panel"), SNAME("Tree")), Rect2(Point2(), get_size()));
} break;

case NOTIFICATION_DRAG_BEGIN: {
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void EditorSettingsDialog::_update_icons() {
shortcut_search_box->set_clear_button_enabled(true);

restart_close_button->set_icon(shortcuts->get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
restart_container->add_theme_style_override("panel", shortcuts->get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
restart_container->add_theme_style_override("panel", shortcuts->get_theme_stylebox(SNAME("panel"), SNAME("Tree")));
restart_icon->set_texture(shortcuts->get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
restart_label->add_theme_color_override("font_color", shortcuts->get_theme_color(SNAME("warning_color"), SNAME("Editor")));
}
Expand Down
Loading

0 comments on commit 80dacac

Please sign in to comment.