comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexertex.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 QsciLexerTeX 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 QSCILEXERTEX_H
22 #define QSCILEXERTEX_H
23
24 #include <QObject>
25
26 #include <Qsci/qsciglobal.h>
27 #include <Qsci/qscilexer.h>
28
29
30 //! \brief The QsciLexerTeX class encapsulates the Scintilla TeX lexer.
31 class QSCINTILLA_EXPORT QsciLexerTeX : public QsciLexer
32 {
33 Q_OBJECT
34
35 public:
36 //! This enum defines the meanings of the different styles used by the
37 //! TeX lexer.
38 enum {
39 //! The default.
40 Default = 0,
41
42 //! A special.
43 Special = 1,
44
45 //! A group.
46 Group = 2,
47
48 //! A symbol.
49 Symbol = 3,
50
51 //! A command.
52 Command = 4,
53
54 //! Text.
55 Text = 5
56 };
57
58 //! Construct a QsciLexerTeX with parent \a parent. \a parent is typically
59 //! the QsciScintilla instance.
60 QsciLexerTeX(QObject *parent = 0);
61
62 //! Destroys the QsciLexerTeX instance.
63 virtual ~QsciLexerTeX();
64
65 //! Returns the name of the language.
66 const char *language() const;
67
68 //! Returns the name of the lexer. Some lexers support a number of
69 //! languages.
70 const char *lexer() const;
71
72 //! Returns the string of characters that comprise a word.
73 const char *wordCharacters() const;
74
75 //! Returns the foreground colour of the text for style number \a style.
76 QColor defaultColor(int style) const;
77
78 //! Returns the set of keywords for the keyword set \a set recognised
79 //! by the lexer as a space separated string.
80 const char *keywords(int set) const;
81
82 //! Returns the descriptive name for style number \a style. If the
83 //! style is invalid for this language then an empty QString is returned.
84 //! This is intended to be used in user preference dialogs.
85 QString description(int style) const;
86
87 //! Causes all properties to be refreshed by emitting the
88 //! propertyChanged() signal as required.
89 void refreshProperties();
90
91 //! If \a fold is true then multi-line comment blocks can be folded. The
92 //! default is false.
93 //!
94 //! \sa foldComments()
95 void setFoldComments(bool fold);
96
97 //! Returns true if multi-line comment blocks can be folded.
98 //!
99 //! \sa setFoldComments()
100 bool foldComments() const {return fold_comments;}
101
102 //! If \a fold is true then trailing blank lines are included in a fold
103 //! block. The default is true.
104 //!
105 //! \sa foldCompact()
106 void setFoldCompact(bool fold);
107
108 //! Returns true if trailing blank lines are included in a fold block.
109 //!
110 //! \sa setFoldCompact()
111 bool foldCompact() const {return fold_compact;}
112
113 //! If \a enable is true then comments are processed as TeX source
114 //! otherwise they are ignored. The default is false.
115 //!
116 //! \sa processComments()
117 void setProcessComments(bool enable);
118
119 //! Returns true if comments are processed as TeX source.
120 //!
121 //! \sa setProcessComments()
122 bool processComments() const {return process_comments;}
123
124 //! If \a enable is true then \\if<unknown> processed is processed as a
125 //! command. The default is true.
126 //!
127 //! \sa processIf()
128 void setProcessIf(bool enable);
129
130 //! Returns true if \\if<unknown> is processed as a command.
131 //!
132 //! \sa setProcessIf()
133 bool processIf() const {return process_if;}
134
135 protected:
136 //! The lexer's properties are read from the settings \a qs. \a prefix
137 //! (which has a trailing '/') should be used as a prefix to the key of
138 //! each setting. true is returned if there is no error.
139 //!
140 bool readProperties(QSettings &qs, const QString &prefix);
141
142 //! The lexer's properties are written to the settings \a qs.
143 //! \a prefix (which has a trailing '/') should be used as a prefix to
144 //! the key of each setting. true is returned if there is no error.
145 //!
146 bool writeProperties(QSettings &qs, const QString &prefix) const;
147
148 private:
149 void setCommentProp();
150 void setCompactProp();
151 void setProcessCommentsProp();
152 void setAutoIfProp();
153
154 bool fold_comments;
155 bool fold_compact;
156 bool process_comments;
157 bool process_if;
158
159 QsciLexerTeX(const QsciLexerTeX &);
160 QsciLexerTeX &operator=(const QsciLexerTeX &);
161 };
162
163 #endif