diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2016-05-27 15:29:04 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2016-05-27 15:29:04 +0100 |
commit | daf0ed646f90ed149a45838e5e6ebf9c577672f7 (patch) | |
tree | a5ec4f965f45f7fd499fcd1d07b77e4f64aa0b25 /tools | |
parent | 9daaa709207adf77eb5cf7c440782eaad3a3f7b2 (diff) |
Added, goto next and previous breakpoint and remove all, issue 1690
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 58 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.h | 3 |
2 files changed, 61 insertions, 0 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index e3c339f1d6..42bcc4213e 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1434,6 +1434,61 @@ void ScriptEditor::_menu_option(int p_option) { current->get_text_edit()->set_line_as_breakpoint(line,dobreak); get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),line+1,dobreak); } break; + case DEBUG_REMOVE_ALL_BREAKPOINTS: { + List<int> bpoints; + current->get_text_edit()->get_breakpoints(&bpoints); + + for(List<int>::Element *E=bpoints.front();E;E=E->next()) { + int line = E->get(); + bool dobreak = !current->get_text_edit()->is_line_set_as_breakpoint(line); + current->get_text_edit()->set_line_as_breakpoint(line,dobreak); + get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),line+1,dobreak); + } + } + case DEBUG_GOTO_NEXT_BREAKPOINT: { + List<int> bpoints; + current->get_text_edit()->get_breakpoints(&bpoints); + if (bpoints.size() <= 0) { + return; + } + + int line=current->get_text_edit()->cursor_get_line(); + // wrap around + if (line >= bpoints[bpoints.size() - 1]) { + current->get_text_edit()->cursor_set_line(bpoints[0]); + } else { + for(List<int>::Element *E=bpoints.front();E;E=E->next()) { + int bline = E->get(); + if (bline > line) { + current->get_text_edit()->cursor_set_line(bline); + return; + } + } + } + + } break; + case DEBUG_GOTO_PREV_BREAKPOINT: { + List<int> bpoints; + current->get_text_edit()->get_breakpoints(&bpoints); + if (bpoints.size() <= 0) { + return; + } + + int line=current->get_text_edit()->cursor_get_line(); + // wrap around + if (line <= bpoints[0]) { + current->get_text_edit()->cursor_set_line(bpoints[bpoints.size() - 1]); + } else { + for(List<int>::Element *E=bpoints.back();E;E=E->prev()) { + int bline = E->get(); + if (bline < line) { + current->get_text_edit()->cursor_set_line(bline); + return; + } + } + } + + } break; case DEBUG_NEXT: { if (debugger) @@ -2550,6 +2605,9 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb->add_child(debug_menu); debug_menu->set_text(TTR("Debug")); debug_menu->get_popup()->add_item(TTR("Toggle Breakpoint"),DEBUG_TOGGLE_BREAKPOINT,KEY_F9); + debug_menu->get_popup()->add_item(TTR("Remove All Breakpoints"), DEBUG_REMOVE_ALL_BREAKPOINTS, KEY_MASK_CTRL|KEY_MASK_SHIFT|KEY_F9); + debug_menu->get_popup()->add_item(TTR("Goto Next Breakpoint"), DEBUG_GOTO_NEXT_BREAKPOINT, KEY_MASK_CTRL|KEY_PERIOD); + debug_menu->get_popup()->add_item(TTR("Goto Previous Breakpoint"), DEBUG_GOTO_PREV_BREAKPOINT, KEY_MASK_CTRL|KEY_COMMA); debug_menu->get_popup()->add_separator(); debug_menu->get_popup()->add_item(TTR("Step Over"),DEBUG_NEXT,KEY_F10); debug_menu->get_popup()->add_item(TTR("Step Into"),DEBUG_STEP,KEY_F11); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 20e0b621c4..017d2f026a 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -151,6 +151,9 @@ class ScriptEditor : public VBoxContainer { SEARCH_CLASSES, SEARCH_WEBSITE, DEBUG_TOGGLE_BREAKPOINT, + DEBUG_REMOVE_ALL_BREAKPOINTS, + DEBUG_GOTO_NEXT_BREAKPOINT, + DEBUG_GOTO_PREV_BREAKPOINT, DEBUG_NEXT, DEBUG_STEP, DEBUG_BREAK, |