1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Added status bar and toggle scripts panel button to EditorHelp/VScripts

This commit is contained in:
Yuri Roubinsky
2021-09-14 12:17:47 +03:00
parent 3705ad7d8f
commit 1dda47c280
11 changed files with 88 additions and 18 deletions

View File

@@ -1612,6 +1612,11 @@ void EditorHelp::generate_doc() {
doc->merge_from(compdoc); //ensure all is up to date
}
void EditorHelp::_toggle_scripts_pressed() {
ScriptEditor::get_singleton()->toggle_scripts_panel();
update_toggle_scripts_button();
}
void EditorHelp::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY:
@@ -1622,7 +1627,11 @@ void EditorHelp::_notification(int p_what) {
if (is_inside_tree()) {
_class_desc_resized();
}
update_toggle_scripts_button();
} break;
case NOTIFICATION_VISIBILITY_CHANGED:
update_toggle_scripts_button();
break;
default:
break;
}
@@ -1676,6 +1685,15 @@ void EditorHelp::set_scroll(int p_scroll) {
class_desc->get_v_scroll()->set_value(p_scroll);
}
void EditorHelp::update_toggle_scripts_button() {
if (is_layout_rtl()) {
toggle_scripts_button->set_icon(get_theme_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? SNAME("Forward") : SNAME("Back"), SNAME("EditorIcons")));
} else {
toggle_scripts_button->set_icon(get_theme_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? SNAME("Back") : SNAME("Forward"), SNAME("EditorIcons")));
}
toggle_scripts_button->set_tooltip(vformat("%s (%s)", TTR("Toggle Scripts Panel"), ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text()));
}
void EditorHelp::_bind_methods() {
ClassDB::bind_method("_class_list_select", &EditorHelp::_class_list_select);
ClassDB::bind_method("_request_help", &EditorHelp::_request_help);
@@ -1706,6 +1724,16 @@ EditorHelp::EditorHelp() {
find_bar->hide();
find_bar->set_rich_text_label(class_desc);
status_bar = memnew(HBoxContainer);
add_child(status_bar);
status_bar->set_h_size_flags(SIZE_EXPAND_FILL);
status_bar->set_custom_minimum_size(Size2(0, 24 * EDSCALE));
toggle_scripts_button = memnew(Button);
toggle_scripts_button->set_flat(true);
toggle_scripts_button->connect("pressed", callable_mp(this, &EditorHelp::_toggle_scripts_pressed));
status_bar->add_child(toggle_scripts_button);
class_desc->set_selection_enabled(true);
scroll_locked = false;