comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexerpo.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 QsciLexerPO 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 QSCILEXERPO_H
22 #define QSCILEXERPO_H
23
24 #include <QObject>
25
26 #include <Qsci/qsciglobal.h>
27 #include <Qsci/qscilexer.h>
28
29
30 //! \brief The QsciLexerPO class encapsulates the Scintilla PO lexer.
31 class QSCINTILLA_EXPORT QsciLexerPO : public QsciLexer
32 {
33 Q_OBJECT
34
35 public:
36 //! This enum defines the meanings of the different styles used by the
37 //! PO lexer.
38 enum {
39 //! The default.
40 Default = 0,
41
42 //! A comment.
43 Comment = 1,
44
45 //! A message identifier.
46 MessageId = 2,
47
48 //! The text of a message identifier.
49 MessageIdText = 3,
50
51 //! A message string.
52 MessageString = 4,
53
54 //! The text of a message string.
55 MessageStringText = 5,
56
57 //! A message context.
58 MessageContext = 6,
59
60 //! The text of a message context.
61 MessageContextText = 7,
62
63 //! The "fuzzy" flag.
64 Fuzzy = 8,
65
66 //! A programmer comment.
67 ProgrammerComment = 9,
68
69 //! A reference.
70 Reference = 10,
71
72 //! A flag.
73 Flags = 11,
74
75 //! A message identifier text end-of-line.
76 MessageIdTextEOL = 12,
77
78 //! A message string text end-of-line.
79 MessageStringTextEOL = 13,
80
81 //! A message context text end-of-line.
82 MessageContextTextEOL = 14
83 };
84
85 //! Construct a QsciLexerPO with parent \a parent. \a parent is typically
86 //! the QsciScintilla instance.
87 QsciLexerPO(QObject *parent = 0);
88
89 //! Destroys the QsciLexerPO instance.
90 virtual ~QsciLexerPO();
91
92 //! Returns the name of the language.
93 const char *language() const;
94
95 //! Returns the name of the lexer. Some lexers support a number of
96 //! languages.
97 const char *lexer() const;
98
99 //! Returns the foreground colour of the text for style number \a style.
100 //!
101 //! \sa defaultPaper()
102 QColor defaultColor(int style) const;
103
104 //! Returns the font for style number \a style.
105 QFont defaultFont(int style) const;
106
107 //! Returns the descriptive name for style number \a style. If the
108 //! style is invalid for this language then an empty QString is returned.
109 //! This is intended to be used in user preference dialogs.
110 QString description(int style) const;
111
112 //! Causes all properties to be refreshed by emitting the propertyChanged()
113 //! signal as required.
114 void refreshProperties();
115
116 //! Returns true if multi-line comment blocks can be folded.
117 //!
118 //! \sa setFoldComments()
119 bool foldComments() const;
120
121 //! Returns true if trailing blank lines are included in a fold block.
122 //!
123 //! \sa setFoldCompact()
124 bool foldCompact() const;
125
126 public slots:
127 //! If \a fold is true then multi-line comment blocks can be folded.
128 //! The default is false.
129 //!
130 //! \sa foldComments()
131 virtual void setFoldComments(bool fold);
132
133 //! If \a fold is true then trailing blank lines are included in a fold
134 //! block. The default is true.
135 //!
136 //! \sa foldCompact()
137 virtual void setFoldCompact(bool fold);
138
139 protected:
140 //! The lexer's properties are read from the settings \a qs. \a prefix
141 //! (which has a trailing '/') should be used as a prefix to the key of
142 //! each setting. true is returned if there is no error.
143 //!
144 bool readProperties(QSettings &qs,const QString &prefix);
145
146 //! The lexer's properties are written to the settings \a qs.
147 //! \a prefix (which has a trailing '/') should be used as a prefix to
148 //! the key of each setting. true is returned if there is no error.
149 //!
150 bool writeProperties(QSettings &qs,const QString &prefix) const;
151
152 private:
153 void setCommentProp();
154 void setCompactProp();
155
156 bool fold_comments;
157 bool fold_compact;
158
159 QsciLexerPO(const QsciLexerPO &);
160 QsciLexerPO &operator=(const QsciLexerPO &);
161 };
162
163 #endif