Mercurial > hg > octave-lyh
annotate gui/src/TerminalView.h @ 13869:d80086a9880e gui
Initial implementation of a Qt Win32 terminal widget.
* src/AbstractTerminalView.h, src/AbstractTerminalView.cpp,
src/terminal/win32/QConsole.h, src/terminal/win32/QConsole.cpp,
src/terminal/win32/QConsole, src/terminal/win32/QConsoleColors.h,
src/terminal/win32/QConsoleColors.cpp, src/WinTerminalView/h,
src/WinTerminalView.cpp: New files.
* octave-gui.pro (win32-msvc*:CONFIG): Remove console.
(SOURCES): Remove src/terminal/TerminalEmulation.cpp, src/TerminalView.cpp,
src/TerminalHighlighter.cpp.
(unix:SOURCES): Move here.
(SOURCES): Add AbstractItemView.cpp.
(win32:SOURCES): New clause.
(HEADERS): Remove src/terminal/TerminalEmulation.h, src/TerminalView.h,
src/TerminalHighlighter.h.
(unix:HEADERS): Move here.
(win32:HEADERS): New clause.
(win32:INCLUDEPATH): Likewise.
* src/FileEditorMdiSubWindow.h (AbstractTerminalView.h): New include.
(FileEditorMdiSubWindow::initEditor): Change first argument to
AbstractTerminalView*.
(FileEditorMdiSubWindow::m_terminalView): New member.
(FileEditorMdiSubWindow::m_terminalEmulation): Remove member.
* src/FileEditorMdiSubWindow.cpp (FileEditorMdiSubWindow::runFile): Call
AbstractTerminalView::sendText.
(FileEditorMdiSubWindow::initEditor): Change first argument to
AbstractTerminalView* and store into m_terminalView.
* src/MainWindow.h (AbstractTerminalView.h): New include, replacing
TerminalView.h.
(MainWindow::m_terminalView): Change member type to AbstractTerminalView*.
(MainWindow::terminalView): Change return type to AbstractTerminalView*.
* src/MainWindow.cpp (MainWindow::openEditorFile): Change first argument of
FileEditorMdiSubWindow::initEditor call to AbstractTerminalView*.
(MainWindow::handleSaveWorkspaceRequest,
MainWindow::handleLoadWorkspaceRequest,
MainWindow::handleClearWorkspaceRequest,
MainWindow::handleCommandDoubleClicked): Call AbstractTerminalView::widget to
get the terminal widget.
(MainWindow::construct): Likewise + call AbstractTerminalView::create to
create the terminal widget.
* src/TerminalView.h (class TerminalView): Inherit from AbstractTerminalView.
(TerminalView::sendText): Change argument to const reference.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Wed, 16 Nov 2011 18:51:04 +0000 |
parents | c0e66d6e3dc8 |
children |
rev | line source |
---|---|
13504
13e3d60aff2d
Replaced Quint with OctaveGUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
1 /* OctaveGUI - A graphical user interface for Octave |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13667
diff
changeset
|
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) |
13501 | 3 * |
4 * This program is free software: you can redistribute it and/or modify | |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13667
diff
changeset
|
5 * it under the terms of the GNU Affero General Public License as |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13667
diff
changeset
|
6 * published by the Free Software Foundation, either version 3 of the |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13667
diff
changeset
|
7 * License, or (at your option) any later version. |
13501 | 8 * |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13667
diff
changeset
|
12 * GNU Affero General Public License for more details. |
13501 | 13 * |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13667
diff
changeset
|
14 * You should have received a copy of the GNU Affero General Public License |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13667
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
13501 | 16 */ |
17 | |
18 #ifndef OCTAVETERMINAL_H | |
19 #define OCTAVETERMINAL_H | |
13626
cc90c62ada21
Removed terminal, instead now using QPlainTextEdit, which looks much nicer and is not that error-prone...
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
20 #include <QPlainTextEdit> |
13869
d80086a9880e
Initial implementation of a Qt Win32 terminal widget.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13674
diff
changeset
|
21 #include "AbstractTerminalView.h" |
13640
bad5cb3cfe20
Cleanly separated terminal emulation code with an interface for platform-dependent terminals.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13637
diff
changeset
|
22 #include "TerminalEmulation.h" |
13501 | 23 |
13869
d80086a9880e
Initial implementation of a Qt Win32 terminal widget.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13674
diff
changeset
|
24 class TerminalView: |
d80086a9880e
Initial implementation of a Qt Win32 terminal widget.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13674
diff
changeset
|
25 public QPlainTextEdit, |
d80086a9880e
Initial implementation of a Qt Win32 terminal widget.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13674
diff
changeset
|
26 public AbstractTerminalView, |
d80086a9880e
Initial implementation of a Qt Win32 terminal widget.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13674
diff
changeset
|
27 Terminal |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
28 { |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
29 Q_OBJECT |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
30 public: |
13648
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13640
diff
changeset
|
31 TerminalView (QWidget * parent = 0); |
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13640
diff
changeset
|
32 ~TerminalView (); |
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13640
diff
changeset
|
33 |
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13640
diff
changeset
|
34 TerminalEmulation *terminalEmulation () |
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13640
diff
changeset
|
35 { |
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13640
diff
changeset
|
36 return m_terminalEmulation; |
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13640
diff
changeset
|
37 } |
13501 | 38 |
13869
d80086a9880e
Initial implementation of a Qt Win32 terminal widget.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13674
diff
changeset
|
39 // AbstractTerminalView interface |
d80086a9880e
Initial implementation of a Qt Win32 terminal widget.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13674
diff
changeset
|
40 void sendText (const QString& text) |
d80086a9880e
Initial implementation of a Qt Win32 terminal widget.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13674
diff
changeset
|
41 { m_terminalEmulation->transmitText(text); } |
d80086a9880e
Initial implementation of a Qt Win32 terminal widget.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13674
diff
changeset
|
42 QWidget* widget (void) { return this; } |
13626
cc90c62ada21
Removed terminal, instead now using QPlainTextEdit, which looks much nicer and is not that error-prone...
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
43 |
13640
bad5cb3cfe20
Cleanly separated terminal emulation code with an interface for platform-dependent terminals.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13637
diff
changeset
|
44 // Terminal Interface |
bad5cb3cfe20
Cleanly separated terminal emulation code with an interface for platform-dependent terminals.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13637
diff
changeset
|
45 QTextCursor textCursor(); |
bad5cb3cfe20
Cleanly separated terminal emulation code with an interface for platform-dependent terminals.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13637
diff
changeset
|
46 void setTextCursor (const QTextCursor &cursor); |
13633
707c1490a85e
Replaced BEL debug message with emitting bell signal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13628
diff
changeset
|
47 void bell (); |
707c1490a85e
Replaced BEL debug message with emitting bell signal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13628
diff
changeset
|
48 |
13626
cc90c62ada21
Removed terminal, instead now using QPlainTextEdit, which looks much nicer and is not that error-prone...
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
49 protected: |
cc90c62ada21
Removed terminal, instead now using QPlainTextEdit, which looks much nicer and is not that error-prone...
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
50 void keyPressEvent (QKeyEvent *keyEvent); |
13666
68c50b393f1d
Improved highlighting and incremented version.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13648
diff
changeset
|
51 void mousePressEvent (QMouseEvent *mouseEvent); |
13667
9b74f97919e1
Fixed KPtyDevice.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13666
diff
changeset
|
52 void mouseDoubleClickEvent (QMouseEvent *mouseEvent); |
9b74f97919e1
Fixed KPtyDevice.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13666
diff
changeset
|
53 void wheelEvent (QWheelEvent *wheelEvent); |
13626
cc90c62ada21
Removed terminal, instead now using QPlainTextEdit, which looks much nicer and is not that error-prone...
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
54 |
13501 | 55 private: |
13640
bad5cb3cfe20
Cleanly separated terminal emulation code with an interface for platform-dependent terminals.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13637
diff
changeset
|
56 TerminalEmulation *m_terminalEmulation; |
13501 | 57 }; |
58 #endif // OCTAVETERMINAL_H |