annotate gui/src/m-editor/file-editor-interface.h @ 14830:41b86dc61306 gui

Removed run command, instead cding into the script directory and executing script directly. * file-editor-interface: Added methods for entering and quitting debug mode. * file-editor-tab: Removed run-command. * file-editor: Implemented methods for entering and quitting debug mode.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Mon, 02 Jul 2012 16:06:50 +0200
parents e3ae0850b105
children 1ffaad442161
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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>
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
24 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
25 class main_window;
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
26
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
27 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
28 {
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
29 Q_OBJECT
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
30
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31 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
32 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
33 : 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
34 {
14681
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
35 setObjectName ("FileEditor");
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
36 _terminal = terminal;
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
37 _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
38
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
39 connect (this, SIGNAL (visibilityChanged (bool)), this, SLOT (handle_visibility_changed (bool)));
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
40 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
41
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
42 virtual ~file_editor_interface () { }
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14778
diff changeset
43
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14778
diff changeset
44 virtual QMenu *debug_menu () = 0;
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14778
diff changeset
45
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
46 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
47 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
48
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
49 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
50 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
51 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
52 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
53
14681
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
54 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
55 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
56
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
57 protected:
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
58 QTerminal* _terminal;
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
59 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
60
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
61 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
62 {
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
63 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
64 QDockWidget::closeEvent (event);
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
65 }
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
66
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
67 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
68 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
69 {
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
70 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
71 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
72 }
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
73 };
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
74
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
75 #endif // FILEEDITORINTERFACE_H