itom
Loading...
Searching...
No Matches
textBlockUserData.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom.
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 itom is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17 General Public Licence for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with itom. If not, see <http://www.gnu.org/licenses/>.
21
22 Further hints:
23 ------------------------
24
25 This file belongs to the code editor of itom. The code editor is
26 in major parts a fork / rewritten version of the python-based source
27 code editor PyQode from Colin Duquesnoy and others
28 (see https://github.com/pyQode). PyQode itself is licensed under
29 the MIT License (MIT).
30
31 Some parts of the code editor of itom are also inspired by the
32 source code editor of the Spyder IDE (https://github.com/spyder-ide),
33 also licensed under the MIT License and developed by the Spyder Project
34 Contributors.
35
36*********************************************************************** */
37
38#ifndef TEXTBLOCKUSERDATA_H
39#define TEXTBLOCKUSERDATA_H
40
41#include <qstring.h>
42
43#include <QTextBlockUserData>
44#include <qpointer.h>
45#include "codeCheckerItem.h"
46
47namespace ito {
48
49class CodeEditor;
50
51/*
52Custom text block user data, mainly used to store checker messages and
53 markers.
54*/
55class TextBlockUserData : public QTextBlockUserData
56{
57public:
58
59 enum BreakpointType
60 {
61 TypeNoBp = 0,
62 TypeBp = 0x0001,
63 TypeBpEdit = 0x0002,
64 TypeFlagDisabled = 0x0004,
65 TypeBpDisabled = TypeBp | TypeFlagDisabled,
66 TypeBpEditDisabled = TypeBpEdit | TypeFlagDisabled
67 };
68
69 enum StyleType
70 {
71 StylePython,
72 StyleOutput,
73 StyleError
74 };
75
77 {
78 int colStart; // inclusive, zero-based
79 int colEnd; // inclusive, zero-based
80 QColor textColor;
81 QColor backgroundColor;
82 bool textBold; /* true: bold, false: do not change the default */
83 bool textUnderline; /* true: underline, false: do not change the default */
84 bool textItalic; /* true: italic, false: do not change the default */
85 };
86
88
89 virtual ~TextBlockUserData();
90
91 void removeCodeEditorRef();
92
93 //List of checker messages associated with the block.
94 QList<CodeCheckerItem> m_checkerMessages;
95
96 //List of markers draw by a marker panel.
97 QStringList m_markers;
98
99 BreakpointType m_breakpointType;
100
101 bool m_bookmark;
102
103 // this is only not nullptr, if special ansi text char formats have been encountered for parts of this text block
104 // if given, this must be sorted by anscending startcols
105 QSharedPointer<QList<AnsiTextCharFormat>> m_ansiTextCharFormats;
106
107 int m_currentLineIdx;
108
109 StyleType m_syntaxStyle;
110
111private:
112 QPointer<CodeEditor> m_codeEditor;
113};
114
115} //end namespace ito
116
117#endif
Definition codeEditor.h:110
Definition textBlockUserData.h:56
Definition apiFunctionsGraph.cpp:40
Definition textBlockUserData.h:77