diff libgui/src/octave-adapter/octave-link.h @ 16350:d4b6ad43bc87

use direct callbacks instead to handle history and workspace list updates * history-docwidget.h, history-dockwidget.cc (history_dock_widget::_update_event_enabled): Delete data member and all uses. * history-dockwidget.cc (history_dock_widget::construct): Don't install a timer. (history_dock_widget::update_history_callback): Now public. * workspace-model.cc (workspace_model::workspace_model): Don't install a timer. (workspace_model::_update_event_enabled): Delete data member and all uses. (workspace_model::update_workspace_callback): Now public. * workspace-view (workspace_view::model_changed): call workspace_model::update_workspace_callback. * main-window.h, main-window.cc (main_window::update_workspace, main_window::update_history): New functions. (main_window::construct): Connect them to corresponding signals. * octave-event-listener.h (octave_event_listener::update_workspace, octave_event_listener::update_history): New virtual functions. * octave-link.h, octave-link.cc (octave_link::update_workspace, octave_link::update_history, octave_link::do_update_workspace, octave_link::do_update_history, octave_link::post_input_event_hook_fcn, octave_link::do_post_input_event_hook_fcn): New functions. * octave-main-thread.cc (pre_input_event_hook_fcn, post_input_event_hook_fcn): New functions. (octave_main_thread::run): Install pre- and post- input event callback functions. * octave-qt-event-listener.h, octave-qt-event-listener.cc (octave_qt_event_listener::update_workspace octave_qt_event_listener::update_history): New functions. (octave_qt_event_listener::update_workspace_signal, octave_qt_event_listener::update_history_signal): New signals.
author John W. Eaton <jwe@octave.org>
date Thu, 21 Mar 2013 02:28:48 -0400
parents 7f423c6111c6
children 8430ea8c1594
line wrap: on
line diff
--- a/libgui/src/octave-adapter/octave-link.h	Thu Mar 21 02:14:19 2013 -0400
+++ b/libgui/src/octave-adapter/octave-link.h	Thu Mar 21 02:28:48 2013 -0400
@@ -120,6 +120,30 @@
       ? instance->do_last_working_directory () : std::string ();
   }
 
+  static void update_workspace (void)
+  {
+    if (instance_ok ())
+      instance->do_update_workspace ();
+  }
+
+  static void update_history (void)
+  {
+    if (instance_ok ())
+      instance->do_update_history ();
+  }
+
+  static void pre_input_event_hook_fcn (void)
+  {
+    if (instance_ok ())
+      instance->do_pre_input_event_hook_fcn ();
+  }
+
+  static void post_input_event_hook_fcn (void)
+  {
+    if (instance_ok ())
+      instance->do_post_input_event_hook_fcn ();
+  }
+
 private:
 
   static octave_link *instance;
@@ -180,6 +204,11 @@
   void do_finished_readline_hook (void) { }
 
   std::string do_last_working_directory (void);
+  void do_update_workspace (void);
+  void do_update_history (void);
+
+  void do_pre_input_event_hook_fcn (void);
+  void do_post_input_event_hook_fcn (void);
 };
 
 #endif // OCTAVELINK_H