Mercurial > hg > octave-nkf
annotate gui/src/m-editor/file-editor-interface.h @ 15137:16a6b0a6855d gui
GUI: support for octave arguments and integrate with run-octave.
* src/octave.h (octave_initialize_interpreter, octave_execute_interpreter):
New functions.
(octave_cmdline_argc, octave_cmdline_argv, octave_embedded): New variables.
* src/octave.cc (octave_cmdline_argc, octave_cmdline_argv, octave_embedded):
New variables.
(octave_initialize_interpreter, octave_execute_interpreter): New functions.
(octave_main): Rewrite using them.
* run-octave.in (octave_executable): New variable.
(-gui): New option flag.
* gui/src/octave-adapter/octave-main-thread.cc (octave_main_thread::run):
Use octave_execute_interpreter.
* gui/src/octave-gui.cc (dissociate_terminal): New function.
(main): Use it. Also use octave_initialize_interpreter.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 05 Aug 2012 16:15:58 -0400 |
parents | 59175df7dcf6 |
children |
rev | line source |
---|---|
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
1 /* OctaveGUI - A graphical user interface for Octave |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
3 * |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
4 * This program is free software: you can redistribute it and/or modify |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
6 * published by the Free Software Foundation, either version 3 of the |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
7 * License, or (at your option) any later version. |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
8 * |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
13 * |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
16 */ |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
17 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
18 #ifndef FILEEDITORINTERFACE_H |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
19 #define FILEEDITORINTERFACE_H |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
20 |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
21 #include <QDockWidget> |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14778
diff
changeset
|
22 #include <QMenu> |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
23 #include <QToolBar> |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
24 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
25 class QTerminal; |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
26 class main_window; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
27 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
28 class file_editor_interface : public QDockWidget |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
29 { |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
30 Q_OBJECT |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
31 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
32 public: |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
33 file_editor_interface (QTerminal *terminal, main_window *mainWindow) |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
34 : QDockWidget ((QWidget*)mainWindow) // QDockWidget constructor is explicit, hence the cast. |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
35 { |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
36 setObjectName ("FileEditor"); |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
37 _terminal = terminal; |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
38 _main_window = mainWindow; |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
39 |
15045
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14830
diff
changeset
|
40 connect (this, SIGNAL (visibilityChanged (bool)), this, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14830
diff
changeset
|
41 SLOT (handle_visibility_changed (bool))); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
42 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
43 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
44 virtual ~file_editor_interface () { } |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14778
diff
changeset
|
45 |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14778
diff
changeset
|
46 virtual QMenu *debug_menu () = 0; |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
47 virtual QToolBar *toolbar () = 0; |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14778
diff
changeset
|
48 |
14830
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14795
diff
changeset
|
49 virtual void handle_entered_debug_mode () = 0; |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14795
diff
changeset
|
50 virtual void handle_quit_debug_mode () = 0; |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14795
diff
changeset
|
51 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
52 public slots: |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
53 virtual void request_new_file () = 0; |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
54 virtual void request_open_file () = 0; |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
55 virtual void request_open_file (QString fileName) = 0; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
56 |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
57 signals: |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
58 void active_changed (bool active); |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
59 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
60 protected: |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
61 QTerminal* _terminal; |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
62 main_window* _main_window; |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
63 |
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
64 void closeEvent (QCloseEvent *event) |
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
65 { |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
66 emit active_changed (false); |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
67 QDockWidget::closeEvent (event); |
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
68 } |
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
69 |
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
70 protected slots: |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
71 void handle_visibility_changed (bool visible) |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
72 { |
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
73 if (visible) |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
74 emit active_changed (true); |
14681
66ff321cb62e
Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
75 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
76 }; |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
77 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
78 #endif // FILEEDITORINTERFACE_H |