mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Make bottom panel into available dock slot
This commit is contained in:
parent
b79fe2e020
commit
67735cf213
30 changed files with 594 additions and 422 deletions
|
|
@ -65,12 +65,6 @@ EditorDebuggerNode::EditorDebuggerNode() {
|
|||
singleton = this;
|
||||
}
|
||||
|
||||
Ref<StyleBox> bottom_panel_margins = EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles));
|
||||
add_theme_constant_override("margin_top", -bottom_panel_margins->get_margin(SIDE_TOP));
|
||||
add_theme_constant_override("margin_left", -bottom_panel_margins->get_margin(SIDE_LEFT));
|
||||
add_theme_constant_override("margin_right", -bottom_panel_margins->get_margin(SIDE_RIGHT));
|
||||
add_theme_constant_override("margin_bottom", -bottom_panel_margins->get_margin(SIDE_BOTTOM));
|
||||
|
||||
tabs = memnew(TabContainer);
|
||||
tabs->set_tabs_visible(false);
|
||||
tabs->connect("tab_changed", callable_mp(this, &EditorDebuggerNode::_debugger_changed));
|
||||
|
|
@ -332,17 +326,19 @@ void EditorDebuggerNode::_notification(int p_what) {
|
|||
if (tabs->get_tab_count() > 1) {
|
||||
tabs->add_theme_style_override(SceneStringName(panel), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("DebuggerPanel"), EditorStringName(EditorStyles)));
|
||||
}
|
||||
|
||||
Ref<StyleBox> bottom_panel_margins = EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles));
|
||||
add_theme_constant_override("margin_top", -bottom_panel_margins->get_margin(SIDE_TOP));
|
||||
add_theme_constant_override("margin_left", -bottom_panel_margins->get_margin(SIDE_LEFT));
|
||||
add_theme_constant_override("margin_right", -bottom_panel_margins->get_margin(SIDE_RIGHT));
|
||||
add_theme_constant_override("margin_bottom", -bottom_panel_margins->get_margin(SIDE_BOTTOM));
|
||||
_update_margins();
|
||||
|
||||
remote_scene_tree->update_icon_max_width();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_READY: {
|
||||
// TODO: Replace this hack once EditorDebuggerNode is converted to a dock. It should be in the constructor.
|
||||
EditorDock *parent = Object::cast_to<EditorDock>(get_parent());
|
||||
if (parent) {
|
||||
parent->set_clip_contents(false);
|
||||
_update_margins();
|
||||
}
|
||||
|
||||
_update_debug_options();
|
||||
initializing = false;
|
||||
} break;
|
||||
|
|
@ -444,35 +440,41 @@ void EditorDebuggerNode::_update_errors() {
|
|||
last_error_count = error_count;
|
||||
last_warning_count = warning_count;
|
||||
|
||||
// TODO: Replace logic when EditorDock class is merged to be more flexible.
|
||||
TabContainer *parent = Object::cast_to<TabContainer>(get_parent());
|
||||
// TODO: Replace this hack once EditorDebuggerNode is converted to a dock.
|
||||
EditorDock *parent = Object::cast_to<EditorDock>(get_parent());
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
|
||||
int idx = parent->get_tab_idx_from_control(this);
|
||||
|
||||
if (error_count == 0 && warning_count == 0) {
|
||||
set_name(TTR("Debugger"));
|
||||
parent->set_tab_icon(idx, Ref<Texture2D>());
|
||||
parent->get_tab_bar()->set_font_color_override_all(idx, Color(0, 0, 0, 0));
|
||||
parent->set_dock_icon(Ref<Texture2D>());
|
||||
parent->set_title_color(Color(0, 0, 0, 0));
|
||||
} else {
|
||||
set_name(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")");
|
||||
if (error_count >= 1 && warning_count >= 1) {
|
||||
parent->set_tab_icon(idx, get_editor_theme_icon(SNAME("ErrorWarning")));
|
||||
parent->set_dock_icon(get_editor_theme_icon(SNAME("ErrorWarning")));
|
||||
// Use error color to represent the highest level of severity reported.
|
||||
parent->get_tab_bar()->set_font_color_override_all(idx, get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
|
||||
parent->set_title_color(get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
|
||||
} else if (error_count >= 1) {
|
||||
parent->set_tab_icon(idx, get_editor_theme_icon(SNAME("Error")));
|
||||
parent->get_tab_bar()->set_font_color_override_all(idx, get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
|
||||
parent->set_dock_icon(get_editor_theme_icon(SNAME("Error")));
|
||||
parent->set_title_color(get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
|
||||
} else {
|
||||
parent->set_tab_icon(idx, get_editor_theme_icon(SNAME("Warning")));
|
||||
parent->get_tab_bar()->set_font_color_override_all(idx, get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
|
||||
parent->set_dock_icon(get_editor_theme_icon(SNAME("Warning")));
|
||||
parent->set_title_color(get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EditorDebuggerNode::_update_margins() {
|
||||
Ref<StyleBox> bottom_panel_margins = EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles));
|
||||
add_theme_constant_override("margin_top", -bottom_panel_margins->get_margin(SIDE_TOP));
|
||||
add_theme_constant_override("margin_left", -bottom_panel_margins->get_margin(SIDE_LEFT));
|
||||
add_theme_constant_override("margin_right", -bottom_panel_margins->get_margin(SIDE_RIGHT));
|
||||
add_theme_constant_override("margin_bottom", -bottom_panel_margins->get_margin(SIDE_BOTTOM));
|
||||
}
|
||||
|
||||
void EditorDebuggerNode::_debugger_stopped(int p_id) {
|
||||
ScriptEditorDebugger *dbg = get_debugger(p_id);
|
||||
ERR_FAIL_NULL(dbg);
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ private:
|
|||
|
||||
ScriptEditorDebugger *_add_debugger();
|
||||
void _update_errors();
|
||||
void _update_margins();
|
||||
|
||||
friend class DebuggerEditorPlugin;
|
||||
friend class DebugAdapterParser;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue