comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexertcl.h @ 31537:5ceb4bfcdb0f stable

add tools and files for updating the gui's language files for translation * libgui/languages/build_ts/README.md: readme for updating language files * libgui/languages/build_ts/octave-qsci: QScintilla source files for languages without translation provided by QScintilla * libgui/languages/build_ts/octave-qt: Qt source files for languages without translation provided by Qt
author Torsten Lilge <ttl-octave@mailbox.org>
date Thu, 24 Nov 2022 06:48:25 +0100
parents
children dd5ece3664ed
comparison
equal deleted inserted replaced
31535:4b80982e0af8 31537:5ceb4bfcdb0f
1 // This defines the interface to the QsciLexerTCL class.
2 //
3 // Copyright (c) 2019 Riverbank Computing Limited <info@riverbankcomputing.com>
4 //
5 // This file is part of QScintilla.
6 //
7 // This file may be used under the terms of the GNU General Public License
8 // version 3.0 as published by the Free Software Foundation and appearing in
9 // the file LICENSE included in the packaging of this file. Please review the
10 // following information to ensure the GNU General Public License version 3.0
11 // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 //
13 // If you do not wish to use this file under the terms of the GPL version 3.0
14 // then you may purchase a commercial license. For more information contact
15 // info@riverbankcomputing.com.
16 //
17 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19
20
21 #ifndef QSCILEXERTCL_H
22 #define QSCILEXERTCL_H
23
24 #include <QObject>
25
26 #include <Qsci/qsciglobal.h>
27 #include <Qsci/qscilexer.h>
28
29
30 //! \brief The QsciLexerTCL class encapsulates the Scintilla TCL lexer.
31 class QSCINTILLA_EXPORT QsciLexerTCL : public QsciLexer
32 {
33 Q_OBJECT
34
35 public:
36 //! This enum defines the meanings of the different styles used by the TCL
37 //! lexer.
38 enum {
39 //! The default.
40 Default = 0,
41
42 //! A comment.
43 Comment = 1,
44
45 //! A comment line.
46 CommentLine = 2,
47
48 //! A number.
49 Number = 3,
50
51 //! A quoted keyword.
52 QuotedKeyword = 4,
53
54 //! A quoted string.
55 QuotedString = 5,
56
57 //! An operator.
58 Operator = 6,
59
60 //! An identifier
61 Identifier = 7,
62
63 //! A substitution.
64 Substitution = 8,
65
66 //! A substitution starting with a brace.
67 SubstitutionBrace = 9,
68
69 //! A modifier.
70 Modifier = 10,
71
72 //! Expand keyword (defined in keyword set number 5).
73 ExpandKeyword = 11,
74
75 //! A TCL keyword (defined in keyword set number 1).
76 TCLKeyword = 12,
77
78 //! A Tk keyword (defined in keyword set number 2).
79 TkKeyword = 13,
80
81 //! An iTCL keyword (defined in keyword set number 3).
82 ITCLKeyword = 14,
83
84 //! A Tk command (defined in keyword set number 4).
85 TkCommand = 15,
86
87 //! A keyword defined in keyword set number 6. The class must be
88 //! sub-classed and re-implement keywords() to make use of this style.
89 KeywordSet6 = 16,
90
91 //! A keyword defined in keyword set number 7. The class must be
92 //! sub-classed and re-implement keywords() to make use of this style.
93 KeywordSet7 = 17,
94
95 //! A keyword defined in keyword set number 8. The class must be
96 //! sub-classed and re-implement keywords() to make use of this style.
97 KeywordSet8 = 18,
98
99 //! A keyword defined in keyword set number 9. The class must be
100 //! sub-classed and re-implement keywords() to make use of this style.
101 KeywordSet9 = 19,
102
103 //! A comment box.
104 CommentBox = 20,
105
106 //! A comment block.
107 CommentBlock = 21
108 };
109
110 //! Construct a QsciLexerTCL with parent \a parent. \a parent is
111 //! typically the QsciScintilla instance.
112 QsciLexerTCL(QObject *parent = 0);
113
114 //! Destroys the QsciLexerTCL instance.
115 virtual ~QsciLexerTCL();
116
117 //! Returns the name of the language.
118 const char *language() const;
119
120 //! Returns the name of the lexer. Some lexers support a number of
121 //! languages.
122 const char *lexer() const;
123
124 //! \internal Returns the style used for braces for brace matching.
125 int braceStyle() const;
126
127 //! Returns the foreground colour of the text for style number \a style.
128 //!
129 //! \sa defaultPaper()
130 QColor defaultColor(int style) const;
131
132 //! Returns the end-of-line fill for style number \a style.
133 bool defaultEolFill(int style) const;
134
135 //! Returns the font for style number \a style.
136 QFont defaultFont(int style) const;
137
138 //! Returns the background colour of the text for style number \a style.
139 //!
140 //! \sa defaultColor()
141 QColor defaultPaper(int style) const;
142
143 //! Returns the set of keywords for the keyword set \a set recognised
144 //! by the lexer as a space separated string.
145 const char *keywords(int set) const;
146
147 //! Returns the descriptive name for style number \a style. If the style
148 //! is invalid for this language then an empty QString is returned. This
149 //! is intended to be used in user preference dialogs.
150 QString description(int style) const;
151
152 //! Causes all properties to be refreshed by emitting the
153 //! propertyChanged() signal as required.
154 void refreshProperties();
155
156 //! If \a fold is true then multi-line comment blocks can be folded. The
157 //! default is false.
158 //!
159 //! \sa foldComments()
160 void setFoldComments(bool fold);
161
162 //! Returns true if multi-line comment blocks can be folded.
163 //!
164 //! \sa setFoldComments()
165 bool foldComments() const {return fold_comments;}
166
167 protected:
168 //! The lexer's properties are read from the settings \a qs. \a prefix
169 //! (which has a trailing '/') should be used as a prefix to the key of
170 //! each setting. true is returned if there is no error.
171 //!
172 bool readProperties(QSettings &qs,const QString &prefix);
173
174 //! The lexer's properties are written to the settings \a qs.
175 //! \a prefix (which has a trailing '/') should be used as a prefix to
176 //! the key of each setting. true is returned if there is no error.
177 //!
178 bool writeProperties(QSettings &qs,const QString &prefix) const;
179
180 private:
181 void setCommentProp();
182
183 bool fold_comments;
184
185 QsciLexerTCL(const QsciLexerTCL &);
186 QsciLexerTCL &operator=(const QsciLexerTCL &);
187 };
188
189 #endif