mirror of
https://github.com/godotengine/godot.git
synced 2025-10-25 18:54:43 +00:00
Add bookmarks for easier code navigation
This commit is contained in:
parent
21e2419e24
commit
0bfcf8bc2f
13 changed files with 252 additions and 3 deletions
|
|
@ -213,6 +213,7 @@ void ScriptTextEditor::_load_theme_settings() {
|
|||
Color function_color = EDITOR_GET("text_editor/highlighting/function_color");
|
||||
Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color");
|
||||
Color mark_color = EDITOR_GET("text_editor/highlighting/mark_color");
|
||||
Color bookmark_color = EDITOR_GET("text_editor/highlighting/bookmark_color");
|
||||
Color breakpoint_color = EDITOR_GET("text_editor/highlighting/breakpoint_color");
|
||||
Color executing_line_color = EDITOR_GET("text_editor/highlighting/executing_line_color");
|
||||
Color code_folding_color = EDITOR_GET("text_editor/highlighting/code_folding_color");
|
||||
|
|
@ -245,6 +246,7 @@ void ScriptTextEditor::_load_theme_settings() {
|
|||
text_edit->add_color_override("number_color", number_color);
|
||||
text_edit->add_color_override("function_color", function_color);
|
||||
text_edit->add_color_override("member_variable_color", member_variable_color);
|
||||
text_edit->add_color_override("bookmark_color", bookmark_color);
|
||||
text_edit->add_color_override("breakpoint_color", breakpoint_color);
|
||||
text_edit->add_color_override("executing_line_color", executing_line_color);
|
||||
text_edit->add_color_override("mark_color", mark_color);
|
||||
|
|
@ -1066,6 +1068,22 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
|
||||
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();
|
||||
|
|
@ -1499,6 +1517,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
|
|||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
|
||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
|
||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
|
||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
|
||||
|
||||
if (p_selection) {
|
||||
context_menu->add_separator();
|
||||
|
|
@ -1651,6 +1670,16 @@ ScriptTextEditor::ScriptTextEditor() {
|
|||
|
||||
search_menu->get_popup()->connect("id_pressed", this, "_edit_option");
|
||||
|
||||
PopupMenu *bookmarks = memnew(PopupMenu);
|
||||
bookmarks->set_name("bookmarks");
|
||||
edit_menu->get_popup()->add_child(bookmarks);
|
||||
edit_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "bookmarks");
|
||||
bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
|
||||
bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_bookmarks"), BOOKMARK_REMOVE_ALL);
|
||||
bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_bookmark"), BOOKMARK_GOTO_NEXT);
|
||||
bookmarks->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV);
|
||||
bookmarks->connect("id_pressed", this, "_edit_option");
|
||||
|
||||
edit_hb->add_child(edit_menu);
|
||||
|
||||
quick_open = memnew(ScriptEditorQuickOpen);
|
||||
|
|
@ -1692,6 +1721,10 @@ void ScriptTextEditor::register_editor() {
|
|||
ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), 0);
|
||||
ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), 0);
|
||||
ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KEY_MASK_CMD | KEY_K);
|
||||
ED_SHORTCUT("script_text_editor/toggle_bookmark", TTR("Toggle Bookmark"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_B);
|
||||
ED_SHORTCUT("script_text_editor/goto_next_bookmark", TTR("Go to Next Bookmark"), KEY_MASK_CMD | KEY_B);
|
||||
ED_SHORTCUT("script_text_editor/goto_previous_bookmark", TTR("Go to Previous Bookmark"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B);
|
||||
ED_SHORTCUT("script_text_editor/remove_all_bookmarks", TTR("Remove All Bookmarks"), 0);
|
||||
ED_SHORTCUT("script_text_editor/toggle_fold_line", TTR("Fold/Unfold Line"), KEY_MASK_ALT | KEY_F);
|
||||
ED_SHORTCUT("script_text_editor/fold_all_lines", TTR("Fold All Lines"), 0);
|
||||
ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), 0);
|
||||
|
|
@ -1699,7 +1732,7 @@ void ScriptTextEditor::register_editor() {
|
|||
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_C);
|
||||
ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CTRL | KEY_SPACE);
|
||||
#else
|
||||
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD | KEY_B);
|
||||
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD | KEY_D);
|
||||
ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CMD | KEY_SPACE);
|
||||
#endif
|
||||
ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue