annotate libgui/src/octave-qt-event-listener.cc @ 16395:fc491da603f6

also provide a hook for exiting debugger * file-editor-interface.h (file_editor_interface::insert_debugger_pointer_request): Rename from file_editor_interface::handle_update_debug_pointer_request (file_editor_interface::delete_debugger_pointer_request): New function. * file-editor-tab.h, file-editor-tab.cc (file_editor_tab::insert_debugger_pointer): Rename from file_editor_tab::set_debugger_position. Change all uses. (file_editor_tab::delete_debugger_pointer): New function. * file-editor.h, file-editor.cc (file_editor::handle_insert_debugger_pointer_request): Renamem from file_editor::handle_update_debug_pointer_request. Change all uses. (file_editor::handle_delete_debugger_pointer_request): New function. (file_editor::add_file_editor_tab): Connect fetab_delete_debugger_pointer signal to delete_debugger_pointer. (file_editor::fetab_insert_debugger_pointer): Rename from file_editor::fetab_set_debugger_position. Change all uses. (file_editor::fetab_delete_debugger_pointer): New signal. * main-window.h, main-window.cc (main_window::handle_insert_debugger_pointer_request): Rename from main_window::handle_update_debug_pointer_request. (main_window::handle_delete_debugger_pointer_request): New function. (main_window::construct): Connect delete_debugger_pointer_signal to handle_delete_debugger_pointer_request. * octave-event-listener.h (event_listener::insert_debugger_pointer): Rename from event_listener::update_debug_pointer): (event_listener::delete_debugger_pointer): New function * octave-link.h, octave-link.cc (octave_link::do_insert_debugger_pointer): Rename from octave_link::do_update_debug_pointer. Change all uses. (octave_link::do_delete_debugger_pointer): New function. (octave_link::do_enter_debugger_event_hook_fcn): Rename from octave_link::do_debug_input_event_hook_fcn. (octave_link::do_exit_debugger_event_hook_fcn): New function. (enter_debugger_event_hook_fcn): Rename form debug_input_event_hook_fcn. Change all uses. (octave_link::exit_debugger_event_hook_fcn): New function. * octave-main-thread.h, octave-main-thread.cc (enter_debugger_event_hook_fcn): Rename from debug_input_event_hook_fcn. (exit_debugger_event_hook_fcn): New function. (octave_main_thread::run): Install exit_debugger_event_hook_fcn hook function. * octave-qt-event-listener.h, octave-qt-event-listener.cc (octave_qt_event_listener::insert_debugger_pointer): Rename from octave_qt_event_listener::update_debug_pointer. Change all uses. (octave_qt_event_listener::delete_debugger_pointer): New function. * octave-qt-event-listener.h (octave_qt_event_listener::update_debug_pointer_signal): Rename from octave_qt_event_listener::insert_debugger_pointer_signal. Change all uses. (octave_qt_event_listner::delete_debugger_pointer_signal): New signal. * input.cc (enter_debugger_event_hook_functions): Rename from debug_input_event_hook_functions. Change all uses. (exit_debugger_event_hook_functions): New static variable. (exit_debugger_cleanup): new function. (get_debug_input): Use unwind-protect to run exit_debugger_event_hook_functions on return. (Fadd_enter_debugger_event_hook): Rename from Fadd_debug_input_event_hook. Change all uses. (Fremove_enter_debugger_event_hook): Rename from Fremove_debug_input_event_hook. Change all uses. (Fadd_exit_debugger_event_hook, Fremove_exit_debugger_event_hook): New functions.
author John W. Eaton <jwe@octave.org>
date Fri, 29 Mar 2013 22:37:01 -0400
parents 4902484f9181
children f9a737fd8829
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
1 /*
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
2
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
3 Copyright (C) 2011-2012 Jacob Dawid
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
4
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
8 under the terms of the GNU General Public License as published by the
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
10 option) any later version.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
11
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
15 for more details.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
16
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17 You should have received a copy of the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 along with Octave; see the file COPYING. If not, see
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
19 <http://www.gnu.org/licenses/>.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
20
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21 */
14719
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
22
15286
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
23 #ifdef HAVE_CONFIG_H
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
24 #include <config.h>
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
25 #endif
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
26
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16350
diff changeset
27 #include <iostream>
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16350
diff changeset
28
14719
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
29 #include "octave-qt-event-listener.h"
14721
ec76264adca9 Removed last bits of Qt from octave_link.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
30 #include <QApplication>
14719
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
32 octave_qt_event_listener::octave_qt_event_listener (QObject *p)
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
33 : QObject (p), octave_event_listener ()
14719
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
34 {
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
35 }
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
36
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
37 void
15359
d6ea3c0f80d8 pass std::string objects by const reference, not value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
38 octave_qt_event_listener::current_directory_has_changed (const std::string& directory)
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
39 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
40 emit current_directory_has_changed_signal
15900
80e99730e5d4 gui: set locale to C before starting the interpreter
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
41 (QString::fromUtf8 (directory.data (), directory.size ()));
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
42 }
14721
ec76264adca9 Removed last bits of Qt from octave_link.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
43
ec76264adca9 Removed last bits of Qt from octave_link.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
44 void
16350
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
45 octave_qt_event_listener::update_workspace (void)
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
46 {
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
47 emit update_workspace_signal ();
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
48 }
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
49
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
50 void
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
51 octave_qt_event_listener::update_history (void)
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
52 {
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
53 emit update_history_signal ();
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
54 }
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
55
d4b6ad43bc87 use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents: 15900
diff changeset
56 void
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
57 octave_qt_event_listener::insert_debugger_pointer (const std::string& file,
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
58 int line)
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16350
diff changeset
59 {
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
60 emit insert_debugger_pointer_signal (QString::fromStdString (file), line);
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
61 }
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
62
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
63 void
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
64 octave_qt_event_listener::delete_debugger_pointer (const std::string& file,
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
65 int line)
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
66 {
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
67 emit delete_debugger_pointer_signal (QString::fromStdString (file), line);
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16350
diff changeset
68 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16350
diff changeset
69
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16350
diff changeset
70 void
16386
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
71 octave_qt_event_listener::update_dbstop_marker (bool insert,
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
72 const std::string& file,
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
73 int line)
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
74 {
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
75 emit update_dbstop_marker_signal (insert, QString::fromStdString (file),
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
76 line);
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
77 }
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
78
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
79 void
14721
ec76264adca9 Removed last bits of Qt from octave_link.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
80 octave_qt_event_listener::about_to_exit ()
ec76264adca9 Removed last bits of Qt from octave_link.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
81 {
ec76264adca9 Removed last bits of Qt from octave_link.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
82 qApp->quit ();
ec76264adca9 Removed last bits of Qt from octave_link.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
83 }
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
84
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
85 void
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
86 octave_qt_event_listener::entered_debug_mode ()
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
87 { emit entered_debug_mode_signal (); }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
88
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
89 void
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
90 octave_qt_event_listener::quit_debug_mode ()
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
91 { emit quit_debug_mode_signal (); }
14754
626a8ff2fe8c The GUI now shows performance information in the status bar of the GUI (ie. how much overhead it causes in the octave thread compares to the terminal version).
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14726
diff changeset
92