Mercurial > hg > octave-lyh
annotate gui/src/OctaveLink.h @ 13522:09d9cb7c3014
Further simplified OctaveLink by removing the readline event hook.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Wed, 20 Jul 2011 00:34:38 +0200 |
parents | 16b33b7ef1b3 |
children | b48ac9ad8de0 |
rev | line source |
---|---|
13501 | 1 /* |
2 * | |
3 * Copyright (C) 2007, 2008, 2009 John P. Swensen | |
4 * | |
13504
13e3d60aff2d
Replaced Quint with OctaveGUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
5 * OctaveGUI - A graphical user interface for Octave |
13501 | 6 * Copyright (C) 2011 Jacob Dawid |
7 * jacob.dawid@googlemail.com | |
8 * This file is as a part of OctaveDE. | |
9 * | |
10 * Octave is free software; you can redistribute it and/or modify it | |
11 * under the terms of the GNU General Public License as published by the | |
12 * Free Software Foundation; either version 2, or (at your option) any | |
13 * later version. | |
14 * | |
15 * Octave is distributed in the hope that it will be useful, but WITHOUT | |
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
18 * for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with Octave; see the file COPYING. If not, write to the Free | |
22 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
23 * 02110-1301, USA. | |
24 * | |
25 * */ | |
26 | |
27 #ifndef OCTAVELINK_H | |
28 #define OCTAVELINK_H | |
29 | |
30 // Octave includes | |
31 #undef PACKAGE_BUGREPORT | |
32 #undef PACKAGE_NAME | |
33 #undef PACKAGE_STRING | |
34 #undef PACKAGE_TARNAME | |
35 #undef PACKAGE_VERSION | |
36 #undef PACKAGE_URL | |
37 #include <octave/config.h> | |
38 #include "octave/cmd-edit.h" | |
39 #include "octave/error.h" | |
40 #include "octave/file-io.h" | |
41 #include "octave/input.h" | |
42 #include "octave/lex.h" | |
43 #include "octave/load-path.h" | |
44 #include "octave/octave.h" | |
45 #include "octave/oct-hist.h" | |
46 #include "octave/oct-map.h" | |
47 #include "octave/oct-obj.h" | |
48 #include "octave/ops.h" | |
49 #include "octave/ov.h" | |
50 #include "octave/ov-usr-fcn.h" | |
51 #include "octave/symtab.h" | |
52 #include "octave/pt.h" | |
53 #include "octave/pt-eval.h" | |
54 #include "octave/config.h" | |
55 #include "octave/Range.h" | |
56 #include "octave/toplev.h" | |
57 #include "octave/procstream.h" | |
58 #include "octave/sighandlers.h" | |
59 #include "octave/debug.h" | |
60 #include "octave/sysdep.h" | |
61 #include "octave/ov.h" | |
62 #include "octave/unwind-prot.h" | |
63 #include "octave/utils.h" | |
64 #include "octave/variables.h" | |
65 | |
66 // Standard includes | |
67 #include <iostream> | |
68 #include <string> | |
69 #include <vector> | |
70 #include <readline/readline.h> | |
71 | |
72 // Qt includes | |
73 #include <QMutexLocker> | |
74 #include <QMutex> | |
75 #include <QFileInfo> | |
76 #include <QList> | |
77 #include <QString> | |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
78 #include <QStringList> |
13501 | 79 #include <QVector> |
80 #include <QSemaphore> | |
81 #include <QObject> | |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
82 #include <QStringListModel> |
13501 | 83 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
84 typedef symbol_table::symbol_record SymbolRecord; |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
85 typedef octave_value OctaveValue; |
13501 | 86 |
87 /** | |
88 * \class OctaveLink | |
89 * Manages a link to an octave instance. | |
90 */ | |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
91 class OctaveLink:QObject |
13501 | 92 { |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
93 Q_OBJECT |
13501 | 94 public: |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
95 static OctaveLink * |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
96 instance () |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
97 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
98 return &m_singleton; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
99 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
100 static QString |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
101 octaveValueAsQString (OctaveValue octaveValue); |
13501 | 102 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
103 /** |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
104 * Returns a copy of the current symbol table buffer. |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
105 * \return Copy of the current symbol table buffer. |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
106 */ |
13521
16b33b7ef1b3
Raised update interval to 500ms.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13520
diff
changeset
|
107 QList < SymbolRecord > copyCurrentSymbolTable (); |
13501 | 108 |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
109 void |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
110 updateHistoryModel (); |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
111 |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
112 QStringListModel * |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
113 historyModel (); |
13501 | 114 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
115 /** |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
116 * Updates the current symbol table with new data |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
117 * from octave. |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
118 */ |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
119 void |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
120 fetchSymbolTable (); |
13501 | 121 |
122 signals: | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
123 void |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
124 symbolTableChanged (); |
13501 | 125 |
126 private: | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
127 OctaveLink (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
128 ~OctaveLink (); |
13501 | 129 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
130 /** Variable related member variables. */ |
13513
e19c454ed485
Added version script for Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
131 QSemaphore * m_symbolTableSemaphore; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
132 QList < SymbolRecord > m_symbolTableBuffer; |
13501 | 133 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
134 /** History related member variables. */ |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
135 QStringListModel *m_historyModel; |
13519
35ecb6063c7b
Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
136 |
13513
e19c454ed485
Added version script for Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
137 static OctaveLink m_singleton; |
13501 | 138 }; |
139 #endif // OCTAVELINK_H |