Mercurial > octave
comparison libgui/languages/build_ts/octave-qsci/qscilexerdiff.cpp @ 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 module implements the QsciLexerDiff 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 #include "Qsci/qscilexerdiff.h" | |
22 | |
23 #include <qcolor.h> | |
24 #include <qfont.h> | |
25 #include <qsettings.h> | |
26 | |
27 | |
28 // The ctor. | |
29 QsciLexerDiff::QsciLexerDiff(QObject *parent) | |
30 : QsciLexer(parent) | |
31 { | |
32 } | |
33 | |
34 | |
35 // The dtor. | |
36 QsciLexerDiff::~QsciLexerDiff() | |
37 { | |
38 } | |
39 | |
40 | |
41 // Returns the language name. | |
42 const char *QsciLexerDiff::language() const | |
43 { | |
44 return "Diff"; | |
45 } | |
46 | |
47 | |
48 // Returns the lexer name. | |
49 const char *QsciLexerDiff::lexer() const | |
50 { | |
51 return "diff"; | |
52 } | |
53 | |
54 | |
55 // Return the string of characters that comprise a word. | |
56 const char *QsciLexerDiff::wordCharacters() const | |
57 { | |
58 return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"; | |
59 } | |
60 | |
61 | |
62 // Returns the foreground colour of the text for a style. | |
63 QColor QsciLexerDiff::defaultColor(int style) const | |
64 { | |
65 switch (style) | |
66 { | |
67 case Default: | |
68 return QColor(0x00,0x00,0x00); | |
69 | |
70 case Comment: | |
71 return QColor(0x00,0x7f,0x00); | |
72 | |
73 case Command: | |
74 return QColor(0x7f,0x7f,0x00); | |
75 | |
76 case Header: | |
77 return QColor(0x7f,0x00,0x00); | |
78 | |
79 case Position: | |
80 return QColor(0x7f,0x00,0x7f); | |
81 | |
82 case LineRemoved: | |
83 case AddingPatchRemoved: | |
84 case RemovingPatchRemoved: | |
85 return QColor(0x00,0x7f,0x7f); | |
86 | |
87 case LineAdded: | |
88 case AddingPatchAdded: | |
89 case RemovingPatchAdded: | |
90 return QColor(0x00,0x00,0x7f); | |
91 | |
92 case LineChanged: | |
93 return QColor(0x7f,0x7f,0x7f); | |
94 } | |
95 | |
96 return QsciLexer::defaultColor(style); | |
97 } | |
98 | |
99 | |
100 // Returns the user name of a style. | |
101 QString QsciLexerDiff::description(int style) const | |
102 { | |
103 switch (style) | |
104 { | |
105 case Default: | |
106 return tr("Default"); | |
107 | |
108 case Comment: | |
109 return tr("Comment"); | |
110 | |
111 case Command: | |
112 return tr("Command"); | |
113 | |
114 case Header: | |
115 return tr("Header"); | |
116 | |
117 case Position: | |
118 return tr("Position"); | |
119 | |
120 case LineRemoved: | |
121 return tr("Removed line"); | |
122 | |
123 case LineAdded: | |
124 return tr("Added line"); | |
125 | |
126 case LineChanged: | |
127 return tr("Changed line"); | |
128 | |
129 case AddingPatchAdded: | |
130 return tr("Added adding patch"); | |
131 | |
132 case RemovingPatchAdded: | |
133 return tr("Removed adding patch"); | |
134 | |
135 case AddingPatchRemoved: | |
136 return tr("Added removing patch"); | |
137 | |
138 case RemovingPatchRemoved: | |
139 return tr("Removed removing patch"); | |
140 } | |
141 | |
142 return QString(); | |
143 } |