changeset 16514:db045633405c

Added clear command window implementation to MainWindow Clear COmmand Window menu. * libgui/src/main-window.cc, libgui/src/main-window.h (main_window::construct_edit_menu): removed menu disable from clear_command_window_action, and added signal-slot connect. (main_window::handle_clear_command_window_request): New function. (main_window::clear_command_window_callback): New function.
author John Donoghue <john.donoghue@ieee.org>
date Sat, 13 Apr 2013 17:39:16 -0400
parents 44f3a9f6e791
children 87b78e75a2b9
files libgui/src/main-window.cc libgui/src/main-window.h
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Sat Apr 13 16:46:48 2013 -0400
+++ b/libgui/src/main-window.cc	Sat Apr 13 17:39:16 2013 -0400
@@ -164,6 +164,12 @@
 }
 
 void
+main_window::handle_clear_command_window_request (void)
+{
+  octave_link::post_event (this, &main_window::clear_command_window_callback);
+}
+
+void
 main_window::handle_clear_history_request (void)
 {
   octave_link::post_event (this, &main_window::clear_history_callback);
@@ -960,7 +966,6 @@
 
   QAction *clear_command_window_action
     = edit_menu->addAction (tr ("Clear Command Window"));
-  clear_command_window_action->setEnabled (false); // TODO: Make this work.
 
   QAction *clear_command_history
     = edit_menu->addAction(tr ("Clear Command History"));
@@ -974,6 +979,9 @@
   connect (_paste_action, SIGNAL (triggered()),
            command_window, SLOT (pasteClipboard ()));
 
+  connect (clear_command_window_action, SIGNAL (triggered ()),
+           this, SLOT (handle_clear_command_window_request ()));
+
   connect (clear_command_history, SIGNAL (triggered ()),
            this, SLOT (handle_clear_history_request ()));
 
@@ -1322,6 +1330,14 @@
 }
 
 void
+main_window::clear_command_window_callback (void)
+{
+  Fclc ();
+  command_editor::interrupt (true);
+}
+
+
+void
 main_window::clear_history_callback (void)
 {
   Fhistory (ovl ("-c"));
--- a/libgui/src/main-window.h	Sat Apr 13 16:46:48 2013 -0400
+++ b/libgui/src/main-window.h	Sat Apr 13 17:39:16 2013 -0400
@@ -83,6 +83,7 @@
   void report_status_message (const QString& statusMessage);
   void handle_save_workspace_request (void);
   void handle_load_workspace_request (const QString& file = QString ());
+  void handle_clear_command_window_request (void);
   void handle_clear_workspace_request (void);
   void handle_clear_history_request (void);
   void handle_rename_variable_request (const QString& old_name,
@@ -176,6 +177,8 @@
 
   void rename_variable_callback (const name_pair& names);
 
+  void clear_command_window_callback (void);
+
   void clear_workspace_callback (void);
 
   void clear_history_callback (void);