SciDAVis
1.D4
|
Editor widget with support for evaluating expressions and executing code. More...
#include <ScriptEdit.h>
Public Slots | |
void | evaluate () |
void | execute () |
void | executeAll () |
QString | exportASCII (const QString &file=QString::null) |
void | exportPDF (const QString &fileName) |
QString | importASCII (const QString &file=QString::null) |
void | insertFunction (const QString &) |
void | insertFunction (QAction *action) |
void | print () |
void | scriptPrint (const QString &) |
void | setContext (QObject *context) |
void | updateIndentation () |
Public Member Functions | |
void | customEvent (QEvent *) |
Handle changing of scripting environment. | |
int | lineNumber (int pos) const |
Map cursor positions to line numbers. | |
ScriptEdit (ScriptingEnv *env, QWidget *parent=0, QString name="") | |
Constructor. | |
Public Member Functions inherited from scripted | |
scripted (ScriptingEnv *env) | |
void | scriptingChangeEvent (ScriptingChangeEvent *) |
~scripted () |
Protected Member Functions | |
virtual void | contextMenuEvent (QContextMenuEvent *e) |
virtual void | keyPressEvent (QKeyEvent *e) |
Private Slots | |
void | handleContentsChange (int position, int chars_removed, int chars_added) |
Called whenever the contents of the text document changes. | |
void | insertErrorMsg (const QString &message) |
Insert an error message from the scripting system at printCursor. |
Private Attributes | |
QAction * | actionEval |
QAction * | actionExecute |
QAction * | actionExecuteAll |
QAction * | actionExport |
QAction * | actionImport |
QAction * | actionPrint |
bool | d_changing_fmt |
True iff the text is programmatically changed and handleContentsChange() should do nothing. | |
bool | d_error |
True iff we are inside evaluate(), execute() or executeAll() there were errors. | |
QTextBlockFormat | d_fmt_default |
Format used for resetting success/failure markers. | |
QTextBlockFormat | d_fmt_failure |
Format used for marking code that resulted in an error. | |
QTextBlockFormat | d_fmt_success |
Format used for marking code that was executed or evaluated successfully. | |
QMenu * | functionsMenu |
Submenu of context menu with mathematical functions. | |
Script * | myScript |
Script used for executing/evaluating code or expressions. | |
QTextCursor | printCursor |
Cursor used for output of evaluation results and error messages. |
Additional Inherited Members | |
Protected Attributes inherited from scripted | |
ScriptingEnv * | scriptEnv |
Editor widget with support for evaluating expressions and executing code.
ScriptEdit::ScriptEdit | ( | ScriptingEnv * | env, |
QWidget * | parent = 0 , |
||
QString | name = "" |
||
) |
Constructor.
References actionEval, actionExecute, actionExecuteAll, actionExport, actionImport, actionPrint, d_fmt_default, d_fmt_failure, d_fmt_success, evaluate(), execute(), executeAll(), exportASCII(), functionsMenu, handleContentsChange(), importASCII(), insertErrorMsg(), insertFunction(), myScript, ScriptingEnv::newScript(), print(), printCursor, scripted::scriptEnv, and scriptPrint().
|
protectedvirtual |
void ScriptEdit::customEvent | ( | QEvent * | e | ) |
Handle changing of scripting environment.
References insertErrorMsg(), myScript, ScriptingEnv::newScript(), print(), scripted::scriptEnv, SCRIPTING_CHANGE_EVENT, scripted::scriptingChangeEvent(), and scriptPrint().
|
slot |
References d_changing_fmt, d_error, d_fmt_default, d_fmt_failure, d_fmt_success, Script::eval(), lineNumber(), myScript, printCursor, Script::setCode(), and Script::setName().
Referenced by ScriptEdit().
|
slot |
References d_changing_fmt, d_error, d_fmt_failure, d_fmt_success, Script::exec(), lineNumber(), myScript, printCursor, Script::setCode(), and Script::setName().
Referenced by Note::execute(), and ScriptEdit().
|
slot |
References Script::exec(), myScript, printCursor, Script::setCode(), and Script::setName().
Referenced by Note::executeAll(), and ScriptEdit().
|
slot |
References ScriptingEnv::fileFilter(), and scripted::scriptEnv.
Referenced by Note::exportASCII(), and ScriptEdit().
|
slot |
Referenced by Note::exportPDF().
|
privateslot |
Called whenever the contents of the text document changes.
References d_changing_fmt, and d_fmt_default.
Referenced by ScriptEdit().
|
slot |
References ScriptingEnv::fileFilter(), and scripted::scriptEnv.
Referenced by Note::importASCII(), and ScriptEdit().
|
privateslot |
Insert an error message from the scripting system at printCursor.
After insertion, the text cursor will have the error message selected, allowing the user to delete it and fix the error.
References d_error, and printCursor.
Referenced by customEvent(), and ScriptEdit().
|
slot |
Referenced by insertFunction(), and ScriptEdit().
|
slot |
References insertFunction(), ScriptingEnv::mathFunctions(), and scripted::scriptEnv.
|
protectedvirtual |
References updateIndentation().
int ScriptEdit::lineNumber | ( | int | pos | ) | const |
Map cursor positions to line numbers.
Referenced by evaluate(), execute(), and scriptPrint().
|
slot |
Referenced by customEvent(), Note::print(), and ScriptEdit().
|
slot |
References lineNumber(), and printCursor.
Referenced by customEvent(), and ScriptEdit().
|
inlineslot |
References myScript, and Script::setContext().
|
slot |
Referenced by keyPressEvent().
|
private |
Referenced by contextMenuEvent(), and ScriptEdit().
|
private |
Referenced by contextMenuEvent(), and ScriptEdit().
|
private |
Referenced by contextMenuEvent(), and ScriptEdit().
|
private |
Referenced by contextMenuEvent(), and ScriptEdit().
|
private |
Referenced by contextMenuEvent(), and ScriptEdit().
|
private |
Referenced by contextMenuEvent(), and ScriptEdit().
|
private |
True iff the text is programmatically changed and handleContentsChange() should do nothing.
Referenced by evaluate(), execute(), and handleContentsChange().
|
private |
True iff we are inside evaluate(), execute() or executeAll() there were errors.
Referenced by evaluate(), execute(), and insertErrorMsg().
|
private |
Format used for resetting success/failure markers.
Referenced by evaluate(), handleContentsChange(), and ScriptEdit().
|
private |
Format used for marking code that resulted in an error.
Referenced by evaluate(), execute(), and ScriptEdit().
|
private |
Format used for marking code that was executed or evaluated successfully.
Referenced by evaluate(), execute(), and ScriptEdit().
|
private |
Submenu of context menu with mathematical functions.
Referenced by contextMenuEvent(), and ScriptEdit().
|
private |
Script used for executing/evaluating code or expressions.
Referenced by customEvent(), evaluate(), execute(), executeAll(), ScriptEdit(), and setContext().
|
private |
Cursor used for output of evaluation results and error messages.
Referenced by evaluate(), execute(), executeAll(), insertErrorMsg(), ScriptEdit(), and scriptPrint().