diff libgui/src/m-editor/file-editor.cc @ 18640:2d5d0d86432e gui-release

gui: Add select all menu (Bug #41797) * libgui//qterminal/libqterminal/QTerminal.h: Add selectAll popup menu and virtual function. * libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp,h: Add selectAll function. * libgui/qterminal/libqterminal/unix/TerminalView.cpp,h: add selectAll function. * libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp,h: Add selectAll function. * libgui/src/documentation-dock-widget.cc,h: Add selectAll function. * libgui/src/files-dock-widget.cc,h: Add selectAll function. * libgui/src/history-dock-widget.cc,h: Add selectAll function. * libgui/src/m-editor/file-editor-tab.cc,h: Add select_all function and signal. * libgui/src/m-editor/file-editor.cc,h: Add request_selectall and selectAll function, add Edit->select all menu. * libgui/src/main-window.cc: add selectAll function, selectAll menu. * libgui/src/octave-dock-widget.cc,h: Add virtual selectAll function and connect to mainwindow selectall signal. * libgui/src/qtinfo/webinfo.cc,h: Add selectAll function. * libgui/src/workspace-view.cc,h: Add selectAll function.
author John Donoghue <john.donoghue@ieee.org>
date Tue, 11 Mar 2014 19:27:23 -0400
parents de76baa76aa1
children 26d15a57f45b
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc
+++ b/libgui/src/m-editor/file-editor.cc
@@ -595,6 +595,13 @@
 }
 
 void
+file_editor::request_selectall (void)
+{
+  emit fetab_selectall (_tab_widget->currentWidget ());
+}
+
+
+void
 file_editor::request_context_help (bool)
 {
   emit fetab_context_help (_tab_widget->currentWidget (), false);
@@ -1006,6 +1013,9 @@
     = new QAction (QIcon (":/actions/icons/bp_rm_all.png"),
                    tr ("&Remove All Breakpoints"), _tool_bar);
 
+  _selectall_action
+    = new QAction (tr ("Select All"), _tool_bar);
+
   _comment_selection_action
     = new QAction (tr ("&Comment"), _tool_bar);
   _uncomment_selection_action
@@ -1128,6 +1138,8 @@
   editMenu->addAction (_cut_action);
   editMenu->addAction (_paste_action);
   editMenu->addSeparator ();
+  editMenu->addAction (_selectall_action);
+  editMenu->addSeparator ();
   editMenu->addAction (_find_action);
   editMenu->addSeparator ();
   editMenu->addAction (_comment_selection_action);
@@ -1224,6 +1236,9 @@
   connect (_paste_action, SIGNAL (triggered ()),
            this, SLOT (request_paste ()));
 
+  connect (_selectall_action, SIGNAL (triggered ()),
+           this, SLOT (request_selectall ()));
+
   connect (_save_action, SIGNAL (triggered ()),
            this, SLOT (request_save_file ()));
 
@@ -1377,6 +1392,9 @@
   connect (this, SIGNAL (fetab_paste (const QWidget*)),
            f, SLOT (paste (const QWidget*)));
 
+  connect (this, SIGNAL (fetab_selectall (const QWidget*)),
+           f, SLOT (select_all (const QWidget*)));
+
   connect (this, SIGNAL (fetab_context_help (const QWidget*, bool)),
            f, SLOT (context_help (const QWidget*, bool)));
 
@@ -1481,6 +1499,17 @@
       request_paste ();
     }
 }
+void
+file_editor::selectAll ()
+{
+  QWidget * foc_w = focusWidget ();
+
+  if (foc_w && foc_w->inherits ("octave_qscintilla"))
+    {
+      request_selectall ();
+    }
+}
+
 
 void
 file_editor::set_shortcuts (bool set)
@@ -1500,6 +1529,7 @@
       _copy_action->setShortcut (QKeySequence::Copy);
       _cut_action->setShortcut (QKeySequence::Cut);
       _paste_action->setShortcut (QKeySequence::Paste);
+      _selectall_action->setShortcut (QKeySequence::SelectAll);
       _context_help_action->setShortcut (QKeySequence::HelpContents);
       _context_doc_action->setShortcut (Qt::SHIFT + Qt::Key_F1);
 
@@ -1536,6 +1566,7 @@
       _copy_action->setShortcut (no_key);
       _cut_action->setShortcut (no_key);
       _paste_action->setShortcut (no_key);
+      _selectall_action->setShortcut (no_key);
       _context_help_action->setShortcut (no_key);
 
       _find_action->setShortcut (no_key);