mirror of
https://github.com/godotengine/godot.git
synced 2025-11-03 15:11:19 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
parent
64a63e0861
commit
b5e1e05ef2
1439 changed files with 1 additions and 34187 deletions
|
|
@ -108,7 +108,6 @@ ConnectionInfoDialog::ConnectionInfoDialog() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Vector<String> ScriptTextEditor::get_functions() {
|
||||
|
||||
String errortxt;
|
||||
int line = -1, col;
|
||||
TextEdit *te = code_editor->get_text_edit();
|
||||
|
|
@ -116,11 +115,9 @@ Vector<String> ScriptTextEditor::get_functions() {
|
|||
List<String> fnc;
|
||||
|
||||
if (script->get_language()->validate(text, line, col, errortxt, script->get_path(), &fnc)) {
|
||||
|
||||
//if valid rewrite functions to latest
|
||||
functions.clear();
|
||||
for (List<String>::Element *E = fnc.front(); E; E = E->next()) {
|
||||
|
||||
functions.push_back(E->get());
|
||||
}
|
||||
}
|
||||
|
|
@ -129,7 +126,6 @@ Vector<String> ScriptTextEditor::get_functions() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::apply_code() {
|
||||
|
||||
if (script.is_null())
|
||||
return;
|
||||
script->set_source_code(code_editor->get_text_edit()->get_text());
|
||||
|
|
@ -194,13 +190,11 @@ void ScriptTextEditor::_update_member_keywords() {
|
|||
ClassDB::get_integer_constant_list(instance_base, &clist);
|
||||
|
||||
for (List<String>::Element *E = clist.front(); E; E = E->next()) {
|
||||
|
||||
code_editor->get_text_edit()->add_member_keyword(E->get(), member_variable_color);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptTextEditor::_load_theme_settings() {
|
||||
|
||||
TextEdit *text_edit = code_editor->get_text_edit();
|
||||
|
||||
text_edit->clear_colors();
|
||||
|
|
@ -285,7 +279,6 @@ void ScriptTextEditor::_load_theme_settings() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_set_theme_for_script() {
|
||||
|
||||
if (!theme_loaded)
|
||||
return;
|
||||
|
||||
|
|
@ -295,7 +288,6 @@ void ScriptTextEditor::_set_theme_for_script() {
|
|||
script->get_language()->get_reserved_words(&keywords);
|
||||
|
||||
for (List<String>::Element *E = keywords.front(); E; E = E->next()) {
|
||||
|
||||
text_edit->add_keyword_color(E->get(), colors_cache.keyword_color);
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +322,6 @@ void ScriptTextEditor::_set_theme_for_script() {
|
|||
ClassDB::get_class_list(&types);
|
||||
|
||||
for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
|
||||
|
||||
String n = E->get();
|
||||
if (n.begins_with("_"))
|
||||
n = n.substr(1, n.length());
|
||||
|
|
@ -344,7 +335,6 @@ void ScriptTextEditor::_set_theme_for_script() {
|
|||
ScriptServer::get_global_class_list(&global_classes);
|
||||
|
||||
for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) {
|
||||
|
||||
text_edit->add_keyword_color(E->get(), colors_cache.usertype_color);
|
||||
}
|
||||
|
||||
|
|
@ -367,7 +357,6 @@ void ScriptTextEditor::_set_theme_for_script() {
|
|||
script->get_language()->get_comment_delimiters(&comments);
|
||||
|
||||
for (List<String>::Element *E = comments.front(); E; E = E->next()) {
|
||||
|
||||
String comment = E->get();
|
||||
String beg = comment.get_slice(" ", 0);
|
||||
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
|
||||
|
|
@ -379,7 +368,6 @@ void ScriptTextEditor::_set_theme_for_script() {
|
|||
List<String> strings;
|
||||
script->get_language()->get_string_delimiters(&strings);
|
||||
for (List<String>::Element *E = strings.front(); E; E = E->next()) {
|
||||
|
||||
String string = E->get();
|
||||
String beg = string.get_slice(" ", 0);
|
||||
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
|
||||
|
|
@ -402,7 +390,6 @@ void ScriptTextEditor::_warning_clicked(Variant p_line) {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::reload_text() {
|
||||
|
||||
ERR_FAIL_COND(script.is_null());
|
||||
|
||||
TextEdit *te = code_editor->get_text_edit();
|
||||
|
|
@ -423,7 +410,6 @@ void ScriptTextEditor::reload_text() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::add_callback(const String &p_function, PoolStringArray p_args) {
|
||||
|
||||
String code = code_editor->get_text_edit()->get_text();
|
||||
int pos = script->get_language()->find_function(p_function, code);
|
||||
if (pos == -1) {
|
||||
|
|
@ -445,22 +431,18 @@ bool ScriptTextEditor::show_members_overview() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::update_settings() {
|
||||
|
||||
code_editor->update_editor_settings();
|
||||
}
|
||||
|
||||
bool ScriptTextEditor::is_unsaved() {
|
||||
|
||||
return code_editor->get_text_edit()->get_version() != code_editor->get_text_edit()->get_saved_version();
|
||||
}
|
||||
|
||||
Variant ScriptTextEditor::get_edit_state() {
|
||||
|
||||
return code_editor->get_edit_state();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::set_edit_state(const Variant &p_state) {
|
||||
|
||||
code_editor->set_edit_state(p_state);
|
||||
|
||||
Dictionary state = p_state;
|
||||
|
|
@ -477,47 +459,38 @@ void ScriptTextEditor::set_edit_state(const Variant &p_state) {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_convert_case(CodeTextEditor::CaseStyle p_case) {
|
||||
|
||||
code_editor->convert_case(p_case);
|
||||
}
|
||||
|
||||
void ScriptTextEditor::trim_trailing_whitespace() {
|
||||
|
||||
code_editor->trim_trailing_whitespace();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::insert_final_newline() {
|
||||
|
||||
code_editor->insert_final_newline();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::convert_indent_to_spaces() {
|
||||
|
||||
code_editor->convert_indent_to_spaces();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::convert_indent_to_tabs() {
|
||||
|
||||
code_editor->convert_indent_to_tabs();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::tag_saved_version() {
|
||||
|
||||
code_editor->get_text_edit()->tag_saved_version();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::goto_line(int p_line, bool p_with_error) {
|
||||
|
||||
code_editor->goto_line(p_line);
|
||||
}
|
||||
|
||||
void ScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
|
||||
|
||||
code_editor->goto_line_selection(p_line, p_begin, p_end);
|
||||
}
|
||||
|
||||
void ScriptTextEditor::goto_line_centered(int p_line) {
|
||||
|
||||
code_editor->goto_line_centered(p_line);
|
||||
}
|
||||
|
||||
|
|
@ -530,7 +503,6 @@ void ScriptTextEditor::clear_executing_line() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::ensure_focus() {
|
||||
|
||||
code_editor->get_text_edit()->grab_focus();
|
||||
}
|
||||
|
||||
|
|
@ -551,7 +523,6 @@ String ScriptTextEditor::get_name() {
|
|||
}
|
||||
|
||||
Ref<Texture> ScriptTextEditor::get_icon() {
|
||||
|
||||
if (get_parent_control() && get_parent_control()->has_icon(script->get_class(), "EditorIcons")) {
|
||||
return get_parent_control()->get_icon(script->get_class(), "EditorIcons");
|
||||
}
|
||||
|
|
@ -560,7 +531,6 @@ Ref<Texture> ScriptTextEditor::get_icon() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_validate_script() {
|
||||
|
||||
String errortxt;
|
||||
int line = -1, col;
|
||||
TextEdit *te = code_editor->get_text_edit();
|
||||
|
|
@ -586,7 +556,6 @@ void ScriptTextEditor::_validate_script() {
|
|||
|
||||
functions.clear();
|
||||
for (List<String>::Element *E = fnc.front(); E; E = E->next()) {
|
||||
|
||||
functions.push_back(E->get());
|
||||
}
|
||||
script_is_valid = true;
|
||||
|
|
@ -679,7 +648,6 @@ void ScriptTextEditor::_validate_script() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_update_bookmark_list() {
|
||||
|
||||
bookmarks_menu->clear();
|
||||
bookmarks_menu->set_size(Size2(1, 1));
|
||||
|
||||
|
|
@ -711,7 +679,6 @@ void ScriptTextEditor::_update_bookmark_list() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_bookmark_item_pressed(int p_idx) {
|
||||
|
||||
if (p_idx < 4) { // Any item before the separator.
|
||||
_edit_option(bookmarks_menu->get_item_id(p_idx));
|
||||
} else {
|
||||
|
|
@ -720,7 +687,6 @@ void ScriptTextEditor::_bookmark_item_pressed(int p_idx) {
|
|||
}
|
||||
|
||||
static Vector<Node *> _find_all_node_for_script(Node *p_base, Node *p_current, const Ref<Script> &p_script) {
|
||||
|
||||
Vector<Node *> nodes;
|
||||
|
||||
if (p_current->get_owner() != p_base && p_base != p_current) {
|
||||
|
|
@ -741,7 +707,6 @@ static Vector<Node *> _find_all_node_for_script(Node *p_base, Node *p_current, c
|
|||
}
|
||||
|
||||
static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Script> &p_script) {
|
||||
|
||||
if (p_current->get_owner() != p_base && p_base != p_current)
|
||||
return NULL;
|
||||
Ref<Script> c = p_current->get_script();
|
||||
|
|
@ -757,7 +722,6 @@ static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Scri
|
|||
}
|
||||
|
||||
static void _find_changed_scripts_for_external_editor(Node *p_base, Node *p_current, Set<Ref<Script>> &r_scripts) {
|
||||
|
||||
if (p_current->get_owner() != p_base && p_base != p_current)
|
||||
return;
|
||||
Ref<Script> c = p_current->get_script();
|
||||
|
|
@ -771,7 +735,6 @@ static void _find_changed_scripts_for_external_editor(Node *p_base, Node *p_curr
|
|||
}
|
||||
|
||||
void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_for_script) {
|
||||
|
||||
if (!bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")))
|
||||
return;
|
||||
|
||||
|
|
@ -785,14 +748,12 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
|
|||
}
|
||||
|
||||
for (Set<Ref<Script>>::Element *E = scripts.front(); E; E = E->next()) {
|
||||
|
||||
Ref<Script> script = E->get();
|
||||
|
||||
if (p_for_script.is_valid() && p_for_script != script)
|
||||
continue;
|
||||
|
||||
if (script->get_path() == "" || script->get_path().find("local://") != -1 || script->get_path().find("::") != -1) {
|
||||
|
||||
continue; //internal script, who cares, though weird
|
||||
}
|
||||
|
||||
|
|
@ -800,7 +761,6 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
|
|||
uint64_t date = FileAccess::get_modified_time(script->get_path());
|
||||
|
||||
if (last_date != date) {
|
||||
|
||||
Ref<Script> rel_script = ResourceLoader::load(script->get_path(), script->get_class(), true);
|
||||
ERR_CONTINUE(!rel_script.is_valid());
|
||||
script->set_source_code(rel_script->get_source_code());
|
||||
|
|
@ -811,13 +771,11 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_code_complete_scripts(void *p_ud, const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) {
|
||||
|
||||
ScriptTextEditor *ste = (ScriptTextEditor *)p_ud;
|
||||
ste->_code_complete_script(p_code, r_options, r_force);
|
||||
}
|
||||
|
||||
void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) {
|
||||
|
||||
if (color_panel->is_visible_in_tree())
|
||||
return;
|
||||
Node *base = get_tree()->get_edited_scene_root();
|
||||
|
|
@ -832,7 +790,6 @@ void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCo
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_update_breakpoint_list() {
|
||||
|
||||
breakpoints_menu->clear();
|
||||
breakpoints_menu->set_size(Size2(1, 1));
|
||||
|
||||
|
|
@ -864,7 +821,6 @@ void ScriptTextEditor::_update_breakpoint_list() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) {
|
||||
|
||||
if (p_idx < 4) { // Any item before the separator.
|
||||
_edit_option(breakpoints_menu->get_item_id(p_idx));
|
||||
} else {
|
||||
|
|
@ -874,12 +830,10 @@ void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_breakpoint_toggled(int p_row) {
|
||||
|
||||
ScriptEditor::get_singleton()->get_debugger()->set_breakpoint(script->get_path(), p_row + 1, code_editor->get_text_edit()->is_line_set_as_breakpoint(p_row));
|
||||
}
|
||||
|
||||
void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_column) {
|
||||
|
||||
Node *base = get_tree()->get_edited_scene_root();
|
||||
if (base) {
|
||||
base = _find_node_for_script(base, base, script);
|
||||
|
|
@ -899,14 +853,12 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
|
|||
}
|
||||
|
||||
} else if (script->get_language()->lookup_code(code_editor->get_text_edit()->get_text_for_lookup_completion(), p_symbol, script->get_path(), base, result) == OK) {
|
||||
|
||||
_goto_line(p_row);
|
||||
|
||||
result.class_name = result.class_name.trim_prefix("_");
|
||||
|
||||
switch (result.type) {
|
||||
case ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION: {
|
||||
|
||||
if (result.script.is_valid()) {
|
||||
emit_signal("request_open_script_at_line", result.script, result.location - 1);
|
||||
} else {
|
||||
|
|
@ -918,7 +870,6 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
|
|||
emit_signal("go_to_help", "class_name:" + result.class_name);
|
||||
} break;
|
||||
case ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT: {
|
||||
|
||||
StringName cname = result.class_name;
|
||||
bool success;
|
||||
while (true) {
|
||||
|
|
@ -939,7 +890,6 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
|
|||
|
||||
} break;
|
||||
case ScriptLanguage::LookupResult::RESULT_CLASS_METHOD: {
|
||||
|
||||
StringName cname = result.class_name;
|
||||
|
||||
while (true) {
|
||||
|
|
@ -955,7 +905,6 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
|
|||
|
||||
} break;
|
||||
case ScriptLanguage::LookupResult::RESULT_CLASS_ENUM: {
|
||||
|
||||
StringName cname = result.class_name;
|
||||
StringName success;
|
||||
while (true) {
|
||||
|
|
@ -1094,50 +1043,40 @@ void ScriptTextEditor::_lookup_connections(int p_row, String p_method) {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_edit_option(int p_op) {
|
||||
|
||||
TextEdit *tx = code_editor->get_text_edit();
|
||||
|
||||
switch (p_op) {
|
||||
case EDIT_UNDO: {
|
||||
|
||||
tx->undo();
|
||||
tx->call_deferred("grab_focus");
|
||||
} break;
|
||||
case EDIT_REDO: {
|
||||
|
||||
tx->redo();
|
||||
tx->call_deferred("grab_focus");
|
||||
} break;
|
||||
case EDIT_CUT: {
|
||||
|
||||
tx->cut();
|
||||
tx->call_deferred("grab_focus");
|
||||
} break;
|
||||
case EDIT_COPY: {
|
||||
|
||||
tx->copy();
|
||||
tx->call_deferred("grab_focus");
|
||||
} break;
|
||||
case EDIT_PASTE: {
|
||||
|
||||
tx->paste();
|
||||
tx->call_deferred("grab_focus");
|
||||
} break;
|
||||
case EDIT_SELECT_ALL: {
|
||||
|
||||
tx->select_all();
|
||||
tx->call_deferred("grab_focus");
|
||||
} break;
|
||||
case EDIT_MOVE_LINE_UP: {
|
||||
|
||||
code_editor->move_lines_up();
|
||||
} break;
|
||||
case EDIT_MOVE_LINE_DOWN: {
|
||||
|
||||
code_editor->move_lines_down();
|
||||
} break;
|
||||
case EDIT_INDENT_LEFT: {
|
||||
|
||||
Ref<Script> scr = script;
|
||||
if (scr.is_null())
|
||||
return;
|
||||
|
|
@ -1145,7 +1084,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
tx->indent_left();
|
||||
} break;
|
||||
case EDIT_INDENT_RIGHT: {
|
||||
|
||||
Ref<Script> scr = script;
|
||||
if (scr.is_null())
|
||||
return;
|
||||
|
|
@ -1153,38 +1091,30 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
tx->indent_right();
|
||||
} break;
|
||||
case EDIT_DELETE_LINE: {
|
||||
|
||||
code_editor->delete_lines();
|
||||
} break;
|
||||
case EDIT_CLONE_DOWN: {
|
||||
|
||||
code_editor->clone_lines_down();
|
||||
} break;
|
||||
case EDIT_TOGGLE_FOLD_LINE: {
|
||||
|
||||
tx->toggle_fold_line(tx->cursor_get_line());
|
||||
tx->update();
|
||||
} break;
|
||||
case EDIT_FOLD_ALL_LINES: {
|
||||
|
||||
tx->fold_all_lines();
|
||||
tx->update();
|
||||
} break;
|
||||
case EDIT_UNFOLD_ALL_LINES: {
|
||||
|
||||
tx->unhide_all_lines();
|
||||
tx->update();
|
||||
} break;
|
||||
case EDIT_TOGGLE_COMMENT: {
|
||||
|
||||
_edit_option_toggle_inline_comment();
|
||||
} break;
|
||||
case EDIT_COMPLETE: {
|
||||
|
||||
tx->query_code_comple();
|
||||
} break;
|
||||
case EDIT_AUTO_INDENT: {
|
||||
|
||||
String text = tx->get_text();
|
||||
Ref<Script> scr = script;
|
||||
if (scr.is_null())
|
||||
|
|
@ -1212,35 +1142,27 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
tx->end_complex_operation();
|
||||
} break;
|
||||
case EDIT_TRIM_TRAILING_WHITESAPCE: {
|
||||
|
||||
trim_trailing_whitespace();
|
||||
} break;
|
||||
case EDIT_CONVERT_INDENT_TO_SPACES: {
|
||||
|
||||
convert_indent_to_spaces();
|
||||
} break;
|
||||
case EDIT_CONVERT_INDENT_TO_TABS: {
|
||||
|
||||
convert_indent_to_tabs();
|
||||
} break;
|
||||
case EDIT_PICK_COLOR: {
|
||||
|
||||
color_panel->popup();
|
||||
} break;
|
||||
case EDIT_TO_UPPERCASE: {
|
||||
|
||||
_convert_case(CodeTextEditor::UPPER);
|
||||
} break;
|
||||
case EDIT_TO_LOWERCASE: {
|
||||
|
||||
_convert_case(CodeTextEditor::LOWER);
|
||||
} break;
|
||||
case EDIT_CAPITALIZE: {
|
||||
|
||||
_convert_case(CodeTextEditor::CAPITALIZE);
|
||||
} break;
|
||||
case EDIT_EVALUATE: {
|
||||
|
||||
Expression expression;
|
||||
Vector<String> lines = code_editor->get_text_edit()->get_selection_text().split("\n");
|
||||
PoolStringArray results;
|
||||
|
|
@ -1266,23 +1188,18 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
code_editor->get_text_edit()->end_complex_operation();
|
||||
} break;
|
||||
case SEARCH_FIND: {
|
||||
|
||||
code_editor->get_find_replace_bar()->popup_search();
|
||||
} break;
|
||||
case SEARCH_FIND_NEXT: {
|
||||
|
||||
code_editor->get_find_replace_bar()->search_next();
|
||||
} break;
|
||||
case SEARCH_FIND_PREV: {
|
||||
|
||||
code_editor->get_find_replace_bar()->search_prev();
|
||||
} break;
|
||||
case SEARCH_REPLACE: {
|
||||
|
||||
code_editor->get_find_replace_bar()->popup_replace();
|
||||
} break;
|
||||
case SEARCH_IN_FILES: {
|
||||
|
||||
String selected_text = code_editor->get_text_edit()->get_selection_text();
|
||||
|
||||
// Yep, because it doesn't make sense to instance this dialog for every single script open...
|
||||
|
|
@ -1290,39 +1207,31 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
emit_signal("search_in_files_requested", selected_text);
|
||||
} break;
|
||||
case SEARCH_LOCATE_FUNCTION: {
|
||||
|
||||
quick_open->popup_dialog(get_functions());
|
||||
quick_open->set_title(TTR("Go to Function"));
|
||||
} break;
|
||||
case SEARCH_GOTO_LINE: {
|
||||
|
||||
goto_line_dialog->popup_find_line(tx);
|
||||
} break;
|
||||
case BOOKMARK_TOGGLE: {
|
||||
|
||||
code_editor->toggle_bookmark();
|
||||
} break;
|
||||
case BOOKMARK_GOTO_NEXT: {
|
||||
|
||||
code_editor->goto_next_bookmark();
|
||||
} break;
|
||||
case BOOKMARK_GOTO_PREV: {
|
||||
|
||||
code_editor->goto_prev_bookmark();
|
||||
} break;
|
||||
case BOOKMARK_REMOVE_ALL: {
|
||||
|
||||
code_editor->remove_all_bookmarks();
|
||||
} break;
|
||||
case DEBUG_TOGGLE_BREAKPOINT: {
|
||||
|
||||
int line = tx->cursor_get_line();
|
||||
bool dobreak = !tx->is_line_set_as_breakpoint(line);
|
||||
tx->set_line_as_breakpoint(line, dobreak);
|
||||
ScriptEditor::get_singleton()->get_debugger()->set_breakpoint(script->get_path(), line + 1, dobreak);
|
||||
} break;
|
||||
case DEBUG_REMOVE_ALL_BREAKPOINTS: {
|
||||
|
||||
List<int> bpoints;
|
||||
tx->get_breakpoints(&bpoints);
|
||||
|
||||
|
|
@ -1334,7 +1243,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
}
|
||||
} break;
|
||||
case DEBUG_GOTO_NEXT_BREAKPOINT: {
|
||||
|
||||
List<int> bpoints;
|
||||
tx->get_breakpoints(&bpoints);
|
||||
if (bpoints.size() <= 0) {
|
||||
|
|
@ -1362,7 +1270,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
|
||||
} break;
|
||||
case DEBUG_GOTO_PREV_BREAKPOINT: {
|
||||
|
||||
List<int> bpoints;
|
||||
tx->get_breakpoints(&bpoints);
|
||||
if (bpoints.size() <= 0) {
|
||||
|
|
@ -1389,7 +1296,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
|
||||
} break;
|
||||
case HELP_CONTEXTUAL: {
|
||||
|
||||
String text = tx->get_selection_text();
|
||||
if (text == "")
|
||||
text = tx->get_word_under_cursor();
|
||||
|
|
@ -1398,7 +1304,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
}
|
||||
} break;
|
||||
case LOOKUP_SYMBOL: {
|
||||
|
||||
String text = tx->get_word_under_cursor();
|
||||
if (text == "")
|
||||
text = tx->get_selection_text();
|
||||
|
|
@ -1453,7 +1358,6 @@ void ScriptTextEditor::_change_syntax_highlighter(int p_idx) {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method("_validate_script", &ScriptTextEditor::_validate_script);
|
||||
ClassDB::bind_method("_update_bookmark_list", &ScriptTextEditor::_update_bookmark_list);
|
||||
ClassDB::bind_method("_bookmark_item_pressed", &ScriptTextEditor::_bookmark_item_pressed);
|
||||
|
|
@ -1478,7 +1382,6 @@ void ScriptTextEditor::_bind_methods() {
|
|||
}
|
||||
|
||||
Control *ScriptTextEditor::get_edit_menu() {
|
||||
|
||||
return edit_hb;
|
||||
}
|
||||
|
||||
|
|
@ -1487,7 +1390,6 @@ void ScriptTextEditor::clear_edit_menu() {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::reload(bool p_soft) {
|
||||
|
||||
TextEdit *te = code_editor->get_text_edit();
|
||||
Ref<Script> scr = script;
|
||||
if (scr.is_null())
|
||||
|
|
@ -1499,12 +1401,10 @@ void ScriptTextEditor::reload(bool p_soft) {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::get_breakpoints(List<int> *p_breakpoints) {
|
||||
|
||||
code_editor->get_text_edit()->get_breakpoints(p_breakpoints);
|
||||
}
|
||||
|
||||
void ScriptTextEditor::set_tooltip_request_func(String p_method, Object *p_obj) {
|
||||
|
||||
code_editor->get_text_edit()->set_tooltip_request_func(p_obj, p_method, this);
|
||||
}
|
||||
|
||||
|
|
@ -1512,18 +1412,15 @@ void ScriptTextEditor::set_debugger_active(bool p_active) {
|
|||
}
|
||||
|
||||
Variant ScriptTextEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
||||
|
||||
return Variant();
|
||||
}
|
||||
|
||||
bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
|
||||
|
||||
Dictionary d = p_data;
|
||||
if (d.has("type") && (String(d["type"]) == "resource" ||
|
||||
String(d["type"]) == "files" ||
|
||||
String(d["type"]) == "nodes" ||
|
||||
String(d["type"]) == "files_and_dirs")) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1531,7 +1428,6 @@ bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_
|
|||
}
|
||||
|
||||
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
|
||||
|
||||
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -1550,7 +1446,6 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
|
|||
}
|
||||
|
||||
void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
|
||||
|
||||
Dictionary d = p_data;
|
||||
|
||||
TextEdit *te = code_editor->get_text_edit();
|
||||
|
|
@ -1558,7 +1453,6 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
|
|||
te->_get_mouse_pos(p_point, row, col);
|
||||
|
||||
if (d.has("type") && String(d["type"]) == "resource") {
|
||||
|
||||
Ref<Resource> res = d["resource"];
|
||||
if (!res.is_valid()) {
|
||||
return;
|
||||
|
|
@ -1575,12 +1469,10 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
|
|||
}
|
||||
|
||||
if (d.has("type") && (String(d["type"]) == "files" || String(d["type"]) == "files_and_dirs")) {
|
||||
|
||||
Array files = d["files"];
|
||||
|
||||
String text_to_drop;
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
|
||||
if (i > 0)
|
||||
text_to_drop += ",";
|
||||
text_to_drop += "\"" + String(files[i]).c_escape() + "\"";
|
||||
|
|
@ -1592,7 +1484,6 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
|
|||
}
|
||||
|
||||
if (d.has("type") && String(d["type"]) == "nodes") {
|
||||
|
||||
Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
|
||||
|
||||
if (!sn) {
|
||||
|
|
@ -1603,7 +1494,6 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
|
|||
Array nodes = d["nodes"];
|
||||
String text_to_drop;
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
|
||||
if (i > 0)
|
||||
text_to_drop += ",";
|
||||
|
||||
|
|
@ -1624,7 +1514,6 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
|
||||
|
||||
Ref<InputEventMouseButton> mb = ev;
|
||||
Ref<InputEventKey> k = ev;
|
||||
Point2 local_pos;
|
||||
|
|
@ -1743,7 +1632,6 @@ void ScriptTextEditor::_color_changed(const Color &p_color) {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p_foldable, bool p_open_docs, bool p_goto_definition, Vector2 p_pos) {
|
||||
|
||||
context_menu->clear();
|
||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
|
||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
|
||||
|
|
@ -2005,7 +1893,6 @@ ScriptTextEditor::~ScriptTextEditor() {
|
|||
}
|
||||
|
||||
static ScriptEditorBase *create_editor(const RES &p_resource) {
|
||||
|
||||
if (Object::cast_to<Script>(*p_resource)) {
|
||||
return memnew(ScriptTextEditor);
|
||||
}
|
||||
|
|
@ -2013,7 +1900,6 @@ static ScriptEditorBase *create_editor(const RES &p_resource) {
|
|||
}
|
||||
|
||||
void ScriptTextEditor::register_editor() {
|
||||
|
||||
ED_SHORTCUT("script_text_editor/undo", TTR("Undo"), KEY_MASK_CMD | KEY_Z);
|
||||
ED_SHORTCUT("script_text_editor/redo", TTR("Redo"), KEY_MASK_CMD | KEY_Y);
|
||||
ED_SHORTCUT("script_text_editor/cut", TTR("Cut"), KEY_MASK_CMD | KEY_X);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue