SciDAVis
1.D4
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
scidavis
src
ScriptEdit.h
Go to the documentation of this file.
1
/***************************************************************************
2
File : ScriptEdit.h
3
Project : SciDAVis
4
--------------------------------------------------------------------
5
Copyright : (C) 2006 by Ion Vasilief,
6
Tilman Benkert,
7
Knut Franke
8
Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
9
Description : Scripting classes
10
11
***************************************************************************/
12
13
/***************************************************************************
14
* *
15
* This program is free software; you can redistribute it and/or modify *
16
* it under the terms of the GNU General Public License as published by *
17
* the Free Software Foundation; either version 2 of the License, or *
18
* (at your option) any later version. *
19
* *
20
* This program is distributed in the hope that it will be useful, *
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
23
* GNU General Public License for more details. *
24
* *
25
* You should have received a copy of the GNU General Public License *
26
* along with this program; if not, write to the Free Software *
27
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
28
* Boston, MA 02110-1301 USA *
29
* *
30
***************************************************************************/
31
#ifndef SCRIPTEDIT_H
32
#define SCRIPTEDIT_H
33
34
#include "
ScriptingEnv.h
"
35
#include "
Script.h
"
36
37
#include <QMenu>
38
#include <QTextEdit>
39
40
class
QAction;
41
class
QMenu;
42
49
class
ScriptEdit
:
public
QTextEdit,
public
scripted
50
{
51
Q_OBJECT
52
53
public
:
55
ScriptEdit
(
ScriptingEnv
*env, QWidget *parent=0, QString name=
""
);
56
58
void
customEvent
(QEvent*);
60
int
lineNumber
(
int
pos)
const
;
61
62
public
slots:
63
void
execute
();
64
void
executeAll
();
65
void
evaluate
();
66
void
print
();
67
void
exportPDF
(
const
QString& fileName);
68
QString
exportASCII
(
const
QString &file=QString::null);
69
QString
importASCII
(
const
QString &file=QString::null);
70
void
insertFunction
(
const
QString &);
71
void
insertFunction
(QAction * action);
72
void
setContext
(QObject *context) {
myScript
->
setContext
(context); }
73
void
scriptPrint
(
const
QString&);
74
void
updateIndentation
();
75
76
protected
:
77
virtual
void
contextMenuEvent
(QContextMenuEvent *e);
78
virtual
void
keyPressEvent
(QKeyEvent *e);
79
80
private
:
82
Script
*
myScript
;
83
QAction *
actionExecute
, *
actionExecuteAll
, *
actionEval
, *
actionPrint
, *
actionImport
, *
actionExport
;
85
QMenu *
functionsMenu
;
87
QTextCursor
printCursor
;
89
QTextBlockFormat
d_fmt_default
;
91
QTextBlockFormat
d_fmt_success
;
93
QTextBlockFormat
d_fmt_failure
;
95
bool
d_error
;
97
bool
d_changing_fmt
;
98
99
private
slots:
101
105
void
insertErrorMsg
(
const
QString &message);
107
void
handleContentsChange
(
int
position,
int
chars_removed,
int
chars_added);
108
};
109
110
#endif
Generated by
1.8.1