diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-09-03 20:59:55 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-09-03 20:59:55 +0000 |
commit | 16b8817f9fc21f89cd989ebaa3910ab9198739ce (patch) | |
tree | 6965dc0d48bd8ea5e4cd379eac4bfbaec50c4d5d /utils/wpseditor | |
parent | c1c1383e235a85d504f476b25c0b41bbfe8d927c (diff) | |
download | rockbox-16b8817f9fc21f89cd989ebaa3910ab9198739ce.tar.gz rockbox-16b8817f9fc21f89cd989ebaa3910ab9198739ce.zip |
WPS editor:
* Order is important in highlighting rules!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18403 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/wpseditor')
-rw-r--r-- | utils/wpseditor/gui/src/qsyntaxer.cpp | 25 | ||||
-rw-r--r-- | utils/wpseditor/gui/src/qsyntaxer.h | 2 |
2 files changed, 13 insertions, 14 deletions
diff --git a/utils/wpseditor/gui/src/qsyntaxer.cpp b/utils/wpseditor/gui/src/qsyntaxer.cpp index fa2608be45..9c4cdd4653 100644 --- a/utils/wpseditor/gui/src/qsyntaxer.cpp +++ b/utils/wpseditor/gui/src/qsyntaxer.cpp | |||
@@ -6,24 +6,23 @@ QSyntaxer::QSyntaxer(QTextDocument *parent) | |||
6 | : QSyntaxHighlighter(parent) { | 6 | : QSyntaxHighlighter(parent) { |
7 | HighlightingRule rule; | 7 | HighlightingRule rule; |
8 | 8 | ||
9 | hrules["operator"].pattern = QRegExp("%[^\\| \n<\\?%]{1,2}"); | 9 | hrules[0].pattern = QRegExp("%[^\\| \n<\\?%]{1,2}"); |
10 | hrules["operator"].format.setFontWeight(QFont::Bold); | 10 | hrules[0].format.setFontWeight(QFont::Bold); |
11 | hrules["operator"].format.setForeground(Qt::darkBlue); | 11 | hrules[0].format.setForeground(Qt::darkBlue); |
12 | 12 | ||
13 | 13 | ||
14 | hrules["question"].pattern = QRegExp("%[\\?]{1}[^<]{1,2}"); | 14 | hrules[1].pattern = QRegExp("%[\\?]{1}[^<]{1,2}"); |
15 | hrules["question"].format.setForeground(Qt::darkMagenta); | 15 | hrules[1].format.setForeground(Qt::darkMagenta); |
16 | |||
17 | hrules["question2"].pattern = QRegExp("(<|>)"); | ||
18 | hrules["question2"].format.setForeground(Qt::red); | ||
19 | 16 | ||
17 | hrules[2].pattern = QRegExp("(<|>)"); | ||
18 | hrules[2].format.setForeground(Qt::red); | ||
20 | 19 | ||
21 | hrules["limiter"].pattern = QRegExp("\\|"); | 20 | hrules[3].pattern = QRegExp("\\|"); |
22 | hrules["limiter"].format.setForeground(Qt::darkRed); | 21 | hrules[3].format.setForeground(Qt::darkRed); |
23 | 22 | ||
24 | hrules["comment"].pattern = QRegExp("#[^\n]*"); | 23 | hrules[4].pattern = QRegExp("#[^\n]*"); |
25 | hrules["comment"].format.setForeground(Qt::darkGreen); | 24 | hrules[4].format.setForeground(Qt::darkGreen); |
26 | hrules["comment"].format.setFontItalic(true); | 25 | hrules[4].format.setFontItalic(true); |
27 | } | 26 | } |
28 | // | 27 | // |
29 | void QSyntaxer::highlightBlock(const QString &text) { | 28 | void QSyntaxer::highlightBlock(const QString &text) { |
diff --git a/utils/wpseditor/gui/src/qsyntaxer.h b/utils/wpseditor/gui/src/qsyntaxer.h index b85651cf69..893eac61a6 100644 --- a/utils/wpseditor/gui/src/qsyntaxer.h +++ b/utils/wpseditor/gui/src/qsyntaxer.h | |||
@@ -11,7 +11,7 @@ class QSyntaxer : public QSyntaxHighlighter { | |||
11 | QRegExp pattern; | 11 | QRegExp pattern; |
12 | QTextCharFormat format; | 12 | QTextCharFormat format; |
13 | }; | 13 | }; |
14 | QMap<QString,HighlightingRule> hrules; | 14 | QMap<int,HighlightingRule> hrules; |
15 | public: | 15 | public: |
16 | QSyntaxer(QTextDocument *parent = 0); | 16 | QSyntaxer(QTextDocument *parent = 0); |
17 | 17 | ||