diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_themes.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 13 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 21 | ||||
-rw-r--r-- | editor/script_editor_debugger.h | 7 |
4 files changed, 38 insertions, 5 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 4f1e6c1771..f628a23d5f 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -411,6 +411,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("SceneTabFG", "EditorStyles", make_flat_stylebox(title_color_hl, 10, 5, 10, 5)); theme->set_stylebox("SceneTabBG", "EditorStyles", make_empty_stylebox(6, 5, 6, 5)); theme->set_icon("close", "Tabs", theme->get_icon("GuiClose", "EditorIcons")); + theme->set_stylebox("button_pressed", "Tabs", style_menu); + theme->set_stylebox("button", "Tabs", style_menu); // Separators (no separators) theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width)); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 19de027287..e69fa6da88 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -977,16 +977,27 @@ void ScriptTextEditor::_edit_option(int p_op) { Ref<Script> scr = get_edited_script(); if (scr.is_null()) return; + + te->begin_complex_operation(); int begin, end; if (te->is_selection_active()) { begin = te->get_selection_from_line(); end = te->get_selection_to_line(); + // ignore if the cursor is not past the first column + if (te->get_selection_to_column() == 0) { + end--; + } } else { begin = 0; end = te->get_line_count() - 1; } scr->get_language()->auto_indent_code(text, begin, end); - te->set_text(text); + Vector<String> lines = text.split("\n"); + for (int i = begin; i <= end; ++i) { + te->set_line(i, lines[i]); + } + + te->end_complex_operation(); } break; case EDIT_TRIM_TRAILING_WHITESAPCE: { diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index fee67df9c9..d1ad503542 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -306,8 +306,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da String error = p_data[1]; step->set_disabled(!can_continue); next->set_disabled(!can_continue); - reason->set_text(error); - reason->set_tooltip(error); + _set_reason_text(error, MESSAGE_ERROR); breaked = true; dobreak->set_disabled(true); docontinue->set_disabled(false); @@ -761,6 +760,21 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da } } +void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType p_type) { + switch (p_type) { + case MESSAGE_ERROR: + reason->add_color_override("font_color", get_color("error_color", "Editor")); + break; + case MESSAGE_WARNING: + reason->add_color_override("font_color", get_color("warning_color", "Editor")); + break; + default: + reason->add_color_override("font_color", get_color("success_color", "Editor")); + } + reason->set_text(p_reason); + reason->set_tooltip(p_reason); +} + void ScriptEditorDebugger::_performance_select(Object *, int, bool) { perf_draw->update(); @@ -921,8 +935,7 @@ void ScriptEditorDebugger::_notification(int p_what) { dobreak->set_disabled(false); tabs->set_current_tab(0); - reason->set_text(TTR("Child Process Connected")); - reason->set_tooltip(TTR("Child Process Connected")); + _set_reason_text(TTR("Child Process Connected"), MESSAGE_SUCCESS); profiler->clear(); inspect_scene_tree->clear(); diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index d255d73167..bee49bf15c 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -56,6 +56,12 @@ class ScriptEditorDebugger : public Control { GDCLASS(ScriptEditorDebugger, Control); + enum MessageType { + MESSAGE_ERROR, + MESSAGE_WARNING, + MESSAGE_SUCCESS, + }; + AcceptDialog *msgdialog; Button *debugger_button; @@ -144,6 +150,7 @@ class ScriptEditorDebugger : public Control { void _scene_tree_selected(); void _scene_tree_request(); void _parse_message(const String &p_msg, const Array &p_data); + void _set_reason_text(const String &p_msg, MessageType p_type); void _scene_tree_property_select_object(ObjectID p_object); void _scene_tree_property_value_edited(const String &p_prop, const Variant &p_value); |