14#include <QTextDocument>
15#include <Qsci/qsciscintilla.h>
48 const char *
what() const noexcept
override {
return m_msg.c_str(); }
51 std::string m_msg{
"File Saving was cancelled"};
55 ScriptEditor(
const QString &lexerName,
const QFont &font = QFont(), QWidget *parent =
nullptr);
56 ScriptEditor(QWidget *parent =
nullptr, QsciLexer *lexer =
nullptr, QString settingsGroup =
"");
61 void setSettingsGroup(
const QString &name);
63 QString settingsGroup()
const;
70 void setLexer(QsciLexer * )
override;
72 void setAutoMarginResize();
75 void enableAutoCompletion(AutoCompletionSource source = QsciScintilla::AcsAPIs);
77 void disableAutoCompletion();
80 QSize sizeHint()
const override;
82 using QsciScintilla::setText;
84 void setText(
int lineno,
const QString &text,
int index = 0);
86 void keyPressEvent(QKeyEvent *event)
override;
88 inline QString
fileName()
const {
return m_filename; }
90 void setFileName(
const QString &filename);
93 void wheelEvent(QWheelEvent *e)
override;
96 void clearKeyBinding(
const QString &keyCombination);
102 void replaceAll(
const QString &search,
const QString &replace,
bool regex,
bool caseSensitive,
bool matchWords,
103 bool wrap,
bool forward =
true);
112 void saveToCurrentFile();
114 void saveScript(
const QString &filename);
119 void setMarkerState(
bool enabled);
121 void updateProgressMarkerFromThread(
int lineno,
bool error =
false);
123 void updateProgressMarker(
int lineno,
bool error =
false);
125 void markExecutingLineAsError();
127 void updateCompletionAPI(
const QStringList &keywords);
131 virtual void showFindReplaceDialog();
134 void zoomTo(
int level)
override;
152 virtual void writeToDevice(QIODevice &device)
const;
154 void dropEvent(QDropEvent *de)
override;
155 void dragMoveEvent(QDragMoveEvent *de)
override;
156 void dragEnterEvent(QDragEnterEvent *de)
override;
157 QByteArray fromMimeData(
const QMimeData *source,
bool &rectangular)
const override;
164 void forwardKeyPressToBase(QKeyEvent *event);
#define EXPORT_OPT_MANTIDQT_COMMON
std::map< DeltaEMode::Type, std::string > index
Raises a dialog allowing the user to find/replace text in the editor.
Exception type to indicate that saving was cancelled.
const char * what() const noexcept override
Return a message.
This class provides an area to write scripts.
int m_currentExecLine
Hold the line number of the currently executing line.
QsciAPIs * scintillaAPI() const
Return a pointer to the object responsible for code completion.
void undoAvailable(bool)
Inform observers that undo information is available.
int m_progressArrowKey
The margin marker.
void redoAvailable(bool)
Inform observers that redo information is available.
void fileNameChanged(const QString &fileName)
Notify that the filename has been modified.
int m_previousKey
previous key
QsciAPIs * m_completer
A pointer to a QsciAPI object that handles the code completion.
void progressMade(const int progress)
Progress has been made in script execution.
QString fileName() const
The current filename.
static QColor g_success_colour
The colour of the marker for a success state.
static QColor g_error_colour
The colour of the marker for an error state.
FindReplaceDialog * m_findDialog
A pointer to the find replace dialog.
QString m_filename
The file name associated with this editor.
QString m_settingsGroup
Name of group that the settings are stored under.
void textZoomedIn()
Emitted when a zoom in is requested.
void textZoomedOut()
Emitted when a zoom out is requested.