23 #ifndef SCRIPTEDITORWIDGET_H 24 #define SCRIPTEDITORWIDGET_H 26 #include "../models/breakPointModel.h" 28 #include "abstractPyScintillaWidget.h" 29 #include "../global.h" 31 #include <qfilesystemwatcher.h> 37 #include <qmetaobject.h> 38 #include "../models/classNavigatorItem.h" 40 #if QT_VERSION >= 0x050000 41 #include <QtPrintSupport/qprinter.h> 46 #include <Qsci/qsciprinter.h> 61 QList<int> bookmarkLines;
67 Q_DECLARE_METATYPE(QList<ito::ScriptEditorStorage>)
77 ScriptEditorWidget(QWidget* parent = NULL);
78 ~ScriptEditorWidget();
80 bool m_errorMarkerVisible;
83 RetVal saveFile(
bool askFirst =
true);
84 RetVal saveAsFile(
bool askFirst =
true);
86 RetVal openFile(QString file,
bool ignorePresentDocument =
false);
88 inline QString getFilename()
const {
return m_filename; }
89 inline bool hasNoFilename()
const {
return m_filename.isNull(); }
90 inline bool getCanCopy()
const {
return canCopy; }
91 bool isBookmarked()
const;
92 inline QString getUntitledName()
const {
return tr(
"Untitled%1").arg(unnamedNumber); }
93 inline QString getCurrentClass()
const {
return m_currentClass; }
94 inline QString getCurrentMethod()
const {
return m_currentMethod; }
96 RetVal setCursorPosAndEnsureVisible(
const int line,
bool errorMessageClick =
false);
97 RetVal setCursorPosAndEnsureVisibleWithSelection(
const int line,
const QString ¤tClass,
const QString ¤tMethod);
104 bool canInsertFromMimeData(
const QMimeData *source)
const;
105 void autoAdaptLineNumberColumnWidth();
107 void dropEvent(QDropEvent *event);
108 virtual void loadSettings();
109 bool event(QEvent *event);
110 void mouseReleaseEvent(QMouseEvent *event);
118 markerBookmarkAndPyBug = markerBookmark | markerPyBug
123 void contextMenuEvent (QContextMenuEvent * event);
125 int getMarginNumber(
int xPos);
129 RetVal toggleBookmark(
int line);
130 RetVal clearAllBookmarks();
131 RetVal gotoNextBookmark();
132 RetVal gotoPreviousBookmark();
134 RetVal toggleBreakpoint(
int line);
135 RetVal toggleEnableBreakpoint(
int line);
136 RetVal editBreakpoint(
int line);
137 RetVal clearAllBreakpoints();
138 RetVal gotoNextBreakPoint();
139 RetVal gotoPreviousBreakPoint();
141 bool lineAcceptsBPs(
int line);
143 RetVal changeFilename(
const QString &newFilename);
145 QFileSystemWatcher *m_pFileSysWatcher;
146 QMutex fileSystemWatcherMutex;
149 struct BookmarkErrorEntry
153 QString errorMessage;
154 QString errorComment;
157 QList<BookmarkErrorEntry> bookmarkErrorHandles;
158 int syntaxErrorHandle;
160 bool m_syntaxCheckerEnabled;
161 int m_syntaxCheckerInterval;
162 QTimer *m_syntaxTimer;
169 bool markedForDeletion;
172 QList<BPMarker> m_breakPointMap;
174 unsigned int markBreakPoint;
175 unsigned int markCBreakPoint;
176 unsigned int markBreakPointDisabled;
177 unsigned int markCBreakPointDisabled;
178 unsigned int markBookmark;
179 unsigned int markSyntaxError;
180 unsigned int markBookmarkSyntaxError;
182 unsigned int markCurrentLine;
183 int markCurrentLineHandle;
185 unsigned int markMask1;
186 unsigned int markMask2;
187 unsigned int markMaskBreakpoints;
194 QMenu *syntaxErrorMenu;
195 QMenu *breakpointMenu;
198 std::map<QString,QAction*> bookmarkMenuActions;
199 std::map<QString,QAction*> breakpointMenuActions;
200 std::map<QString,QAction*> editorMenuActions;
208 bool m_pythonExecutable;
212 static const QString lineBreak;
213 static int unnamedAutoIncrement;
216 bool m_ClassNavigatorEnabled;
217 QTimer *m_classNavigatorTimer;
218 bool m_classNavigatorTimerEnabled;
219 int m_classNavigatorInterval;
220 QString m_currentClass;
221 QString m_currentMethod;
223 int buildClassTree(
ClassNavigatorItem *parent,
int parentDepth,
int lineNumber,
int singleIndentation = -1);
224 int getIndentationLength(
const QString &str)
const;
227 void pythonRunFile(QString filename);
228 void pythonRunSelection(QString selectionText);
229 void pythonDebugFile(QString filename);
230 void closeRequest(ScriptEditorWidget* sew,
bool ignoreModifications);
231 void marginChanged();
232 void requestModelRebuild(ScriptEditorWidget *editor);
235 void menuToggleBookmark();
237 void syntaxCheckResult(QString a, QString b);
238 void errorListChange(
const QStringList &errorList);
239 void menuClearAllBookmarks();
240 void menuGotoNextBookmark();
241 void menuGotoPreviousBookmark();
243 void menuToggleBreakpoint();
244 void menuToggleEnableBreakpoint();
245 void menuEditBreakpoint();
246 void menuClearAllBreakpoints();
247 void menuGotoNextBreakPoint();
248 void menuGotoPreviousBreakPoint();
256 void menuUncomment();
258 void menuUnfoldAll();
259 void menuFoldUnfoldToplevel();
260 void menuFoldUnfoldAll();
262 void menuRunScript();
263 void menuRunSelection();
264 void menuDebugScript();
265 void menuStopScript();
267 void menuInsertCodec();
269 void pythonStateChanged(tPythonTransitions pyTransition);
270 void pythonDebugPositionChanged(QString filename,
int lineno);
273 void breakPointDelete(QString filename,
int lineNo,
int pyBpNumber);
276 void updateSyntaxCheck();
284 void marginClicked(
int margin,
int line, Qt::KeyboardModifiers state);
285 void copyAvailable(
const bool yes);
287 void classNavTimerElapsed();
289 void nrOfLinesChanged();
291 RetVal preShowContextMenuMargin();
292 RetVal preShowContextMenuEditor();
294 void fileSysWatcherFileChanged (
const QString & path );
295 void printPreviewRequested(QPrinter *printer);
298 class ItomQsciPrinter :
public QsciPrinter
301 ItomQsciPrinter(QPrinter::PrinterMode mode=QPrinter::ScreenResolution) : QsciPrinter(mode) {}
302 virtual void formatPage( QPainter &painter,
bool drawing, QRect &area,
int pagenr );
Class for managing status values (like errors or warning)
Definition: retVal.h:54
Definition: scriptEditorWidget.h:57
Definition: apiFunctionsGraph.cpp:39
Definition: classNavigatorItem.h:37
item of BreakPointModel
Definition: breakPointModel.h:43