diff libgui/src/m-editor/file-editor.cc @ 19663:8ef79bc61d8a gui-release

add actions for moving/selecting to matching brace * file-editor-tab.cc (move_match_brace): new slot for signal from editor for moving or selecting to the matching brace * file-editor-tab.h: new slot move_match_brace * file-editor.cc (request_move_match_brace): new slot for new action; (request_sel_match_brace): new slot for new action; (construct): add new action for moving/selecting to matching brace into edit/navigation menu; (add_file_editor_tab): connect new signal to new slot in file_editor_tab; (set_shortcuts): set the shortcuts from the settings for the new actions * file-editor.h: new actions, new related slots, new signals for editor tabs * shortcut-manager.cc (do_init_data): initialize shortcuts for new actions from settings or with default values
author Torsten <ttl@justmail.de>
date Sat, 24 Jan 2015 22:46:20 +0100
parents 4b980842edba
children b30cd22e6471
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Fri Jan 23 16:39:32 2015 -0500
+++ b/libgui/src/m-editor/file-editor.cc	Sat Jan 24 22:46:20 2015 +0100
@@ -860,6 +860,17 @@
   emit fetab_goto_line (_tab_widget->currentWidget ());
 }
 
+void
+file_editor::request_move_match_brace (bool)
+{
+  emit fetab_move_match_brace (_tab_widget->currentWidget (), false);
+}
+
+void
+file_editor::request_sel_match_brace (bool)
+{
+  emit fetab_move_match_brace (_tab_widget->currentWidget (), true);
+}
 
 void
 file_editor::request_completion (bool)
@@ -1402,6 +1413,13 @@
   _goto_line_action = add_action (_edit_nav_menu, QIcon (),
           tr ("Go &to Line..."), SLOT (request_goto_line (bool)));
 
+  _edit_cmd_menu->addSeparator ();
+
+  _move_to_matching_brace  = add_action (_edit_nav_menu, QIcon (),
+          tr ("Move to Matching Brace"), SLOT (request_move_match_brace (bool)));
+  _sel_to_matching_brace  = add_action (_edit_nav_menu, QIcon (),
+          tr ("Select to Matching Brace"), SLOT (request_sel_match_brace (bool)));
+
   _edit_nav_menu->addSeparator ();
 
   _next_bookmark_action =  add_action (_edit_nav_menu, QIcon (),
@@ -1715,6 +1733,9 @@
   connect (this, SIGNAL (fetab_goto_line (const QWidget*, int)),
            f, SLOT (goto_line (const QWidget*, int)));
 
+  connect (this, SIGNAL (fetab_move_match_brace (const QWidget*, bool)),
+           f, SLOT (move_match_brace (const QWidget*, bool)));
+
   connect (this, SIGNAL (fetab_completion (const QWidget*)),
            f, SLOT (show_auto_completion (const QWidget*)));
 
@@ -1806,6 +1827,8 @@
   shortcut_manager::set_shortcut (_unindent_selection_action, "editor_edit:unindent_selection");
   shortcut_manager::set_shortcut (_completion_action, "editor_edit:completion_list");
   shortcut_manager::set_shortcut (_goto_line_action, "editor_edit:goto_line");
+  shortcut_manager::set_shortcut (_move_to_matching_brace, "editor_edit:move_to_brace");
+  shortcut_manager::set_shortcut (_sel_to_matching_brace, "editor_edit:select_to_brace");
   shortcut_manager::set_shortcut (_toggle_bookmark_action, "editor_edit:toggle_bookmark");
   shortcut_manager::set_shortcut (_next_bookmark_action, "editor_edit:next_bookmark");
   shortcut_manager::set_shortcut (_previous_bookmark_action, "editor_edit:previous_bookmark");