23#ifndef SCRIPTEDITORWIDGET_H
24#define SCRIPTEDITORWIDGET_H
26#include "../models/breakPointModel.h"
28#include "abstractCodeEditorWidget.h"
29#include "../codeEditor/panels/foldingPanel.h"
30#include "../codeEditor/panels/checkerBookmarkPanel.h"
31#include "../codeEditor/panels/breakpointPanel.h"
32#include "../codeEditor/modes/errorLineHighlight.h"
33#include "../codeEditor/modes/pyGotoAssignment.h"
34#include "../codeEditor/modes/pyDocstringGenerator.h"
35#include "../codeEditor/modes/wordHoverTooltip.h"
36#include "../codeEditor/panels/lineNumber.h"
37#include "../codeEditor/codeCheckerItem.h"
38#include "../codeEditor/pyCodeFormatter.h"
39#include "../codeEditor/pyCodeReferenceRenamer.h"
42#include <qfilesystemwatcher.h>
48#include <qmetaobject.h>
49#include <qsharedpointer.h>
50#include <qregularexpression.h>
51#include "../models/outlineItem.h"
52#include "../models/bookmarkModel.h"
53#include "../helper/IOHelper.h"
54#include "../ui/dialogScriptCharsetEncoding.h"
56#include <QtPrintSupport/qprinter.h>
73 QList<int> bookmarkLines;
90Q_DECLARE_METATYPE(QList<ito::ScriptEditorStorage>)
92Q_DECLARE_METATYPE(QList<ito::GoBackNavigationItem>)
106 RetVal saveFile(
bool askFirst =
true);
107 RetVal saveAsFile(
bool askFirst =
true);
109 RetVal openFile(
const QString &fileName,
bool ignorePresentDocument =
false, QWidget *parent =
nullptr);
111 bool keepIndentationOnPaste()
const;
112 void setKeepIndentationOnPaste(
bool value);
114 inline QString getFilename()
const {
return m_filename; }
115 inline bool hasNoFilename()
const {
return m_filename.isNull(); }
116 inline int getUID()
const {
return m_uid; }
117 bool getCanCopy()
const;
118 inline QString getUntitledName()
const {
return tr(
"Untitled%1").arg(m_uid); }
120 RetVal setCursorPosAndEnsureVisible(
const int line,
bool errorMessageClick =
false,
bool showSelectedCallstackLine =
false);
121 RetVal showLineAndHighlightWord(
const int line,
const QString &highlightedText, Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive);
138 QSharedPointer<OutlineItem>
parseOutline(
bool forceParsing =
false)
const;
142 bool currentLineCanHaveDocstring()
const;
147 void replaceOccurencesInCurrentScript(
const QString &newValue,
const QVector<ito::FileRenameItem> &renameItems);
149 static QString filenameFromUID(
int UID,
bool &found);
153 bool canInsertFromMimeData(
const QMimeData *source)
const;
154 void insertFromMimeData(
const QMimeData *source);
156 void dropEvent(QDropEvent *event);
157 void dragEnterEvent(QDragEnterEvent *event);
158 void dragLeaveEvent(QDragLeaveEvent *event);
159 virtual void loadSettings();
160 bool event(QEvent *event);
161 void mouseReleaseEvent(QMouseEvent *event);
162 void mousePressEvent(QMouseEvent *event);
163 void keyPressEvent(QKeyEvent *event);
165 virtual void contextMenuAboutToShow(
int contextMenuLine);
167 void reportGoBackNavigationCursorMovement(
const CursorPosition &cursor,
const QString &origin)
const;
169 void replaceSelectionAndKeepBookmarksAndBreakpoints(QTextCursor &cursor,
const QString &newString);
170 QVector<int> compareTexts(
const QString &oldText,
const QString &newText);
180 markerBookmarkAndPyBug = markerBookmark | markerPyBug
186 bool lineAcceptsBPs(
int line);
188 RetVal changeFilename(
const QString &newFilename);
190 IOHelper::CharsetEncodingItem guessEncoding(
const QByteArray &content)
const;
192 void changeFileSaveEncoding(
const IOHelper::CharsetEncodingItem &encoding);
194 QFileSystemWatcher *m_pFileSysWatcher;
197 bool m_codeCheckerEnabled;
204 std::map<QString,QAction*> m_editorMenuActions;
220 bool m_keepIndentationOnPaste;
237 bool m_charsetDefined;
238 bool m_charsetEncodingAutoGuess;
240 QSharedPointer<FoldingPanel> m_foldingPanel;
241 QSharedPointer<CheckerBookmarkPanel> m_checkerBookmarkPanel;
242 QSharedPointer<BreakpointPanel> m_breakpointPanel;
243 QSharedPointer<ErrorLineHighlighterMode> m_errorLineHighlighterMode;
244 QSharedPointer<LineNumberPanel> m_lineNumberPanel;
245 QSharedPointer<PyGotoAssignmentMode> m_pyGotoAssignmentMode;
246 QSharedPointer<WordHoverTooltipMode> m_wordHoverTooltipMode;
247 QSharedPointer<PyDocstringGeneratorMode> m_pyDocstringGeneratorMode;
250 static int currentMaximumUID;
256 bool m_outlineTimerEnabled;
259 mutable bool m_outlineDirty;
265 void parseOutlineRecursive(QSharedPointer<OutlineItem> &parent)
const;
266 QSharedPointer<OutlineItem> checkBlockForOutlineItem(
int startLineIdx,
int endLineIdx)
const;
269 void pythonRunFile(QString filename);
270 void pythonRunSelection(QString selectionText);
271 void pythonDebugFile(QString filename);
273 void marginChanged();
274 void outlineModelChanged(
ScriptEditorWidget *editor, QSharedPointer<OutlineItem> rootItem);
276 void tabChangeRequested();
277 void findSymbolsShowRequested();
290 void menuUncomment();
293 void menuUnfoldAll();
294 void menuFoldUnfoldToplevel();
295 void menuFoldUnfoldAll();
297 void menuRunScript();
298 void menuRunSelection();
299 void menuDebugScript();
300 void menuStopScript();
302 void menuPyCodeFormatting();
303 bool menuPyCodeReferenceRenaming();
304 void menuGenerateDocstring();
305 void menuScriptCharsetEncoding();
307 void pythonStateChanged(tPythonTransitions pyTransition);
308 void pythonDebugPositionChanged(QString filename,
int lineno);
319 void toggleBookmarkRequested(
int line);
324 RetVal toggleEnableBreakpoint(
int line);
325 RetVal editBreakpoint(
int line);
326 RetVal clearAllBreakpoints();
327 RetVal gotoNextBreakPoint();
328 RetVal gotoPreviousBreakPoint();
332 void copyAvailable(
const bool yes);
334 void outlineTimerElapsed();
336 void nrOfLinesChanged();
338 void fileSysWatcherFileChanged(
const QString &path);
339 void fileSysWatcherFileChangedStep2(
const QString &path);
340 void printPreviewRequested(QPrinter *printer);
342 void dumpFoldsToConsole(
bool);
343 void onCursorPositionChanged();
344 void onTextChanged();
345 void tabChangeRequest();
347 void pyCodeFormatterDone(
bool success, QString code);
model for management of all bookmarks. This model will be displayed by a viewer-widget in the main wi...
Definition bookmarkModel.h:65
model for management of all breakpoints. This model will be displayed by a viewer-widget in the main ...
Definition breakPointModel.h:69
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition textBlockUserData.h:56
Definition apiFunctionsGraph.cpp:40
item of BookmarkModel
Definition bookmarkModel.h:43
item of BreakPointModel
Definition breakPointModel.h:43
Definition codeEditor.h:344
Definition scriptEditorWidget.h:78
Definition pyGotoAssignment.h:56
Definition scriptEditorWidget.h:70