- enhancement: new color scheme Monokai (contributed by 小龙Dev)

- enhancemnet: add "Reserve word for Types" item in color scheme
This commit is contained in:
Roy Qu 2022-11-14 11:56:38 +08:00
parent ac23d89fbe
commit ed8b0a4c55
12 changed files with 669 additions and 240 deletions

View File

@ -26,3 +26,9 @@ author: Alan-CRL
### Theme Contrast ### Theme Contrast
author: Alan-CRL author: Alan-CRL
## Color Schemes
### Monokai
author: СÁúDev

View File

@ -1,3 +1,8 @@
Red Panda C++ Version 2.5
- enhancement: new color scheme Monokai (contributed by 小龙Dev)
- enhancemnet: add "Reserve word for Types" item in color scheme
Red Panda C++ Version 2.4 Red Panda C++ Version 2.4
- fix: Contents in class browser not correctly updated when close the last editor for project. - fix: Contents in class browser not correctly updated when close the last editor for project.

View File

@ -40,6 +40,12 @@ PColorScheme ColorScheme::fromJson(const QJsonObject &json)
scheme->mItems[key]=ColorSchemeItem::fromJson(json[key].toObject()); scheme->mItems[key]=ColorSchemeItem::fromJson(json[key].toObject());
} }
} }
//backward compatibility (for config files version < 2.5)
if (!scheme->mItems.contains(SYNS_AttrReserveWord_Type)
&& scheme->mItems.contains(SYNS_AttrIdentifier)) {
scheme->mItems.insert(SYNS_AttrReserveWord_Type,
ColorSchemeItem::fromJson(json[SYNS_AttrReservedWord].toObject()));
}
return scheme; return scheme;
} }
@ -483,6 +489,10 @@ void ColorManager::initItemDefines()
QObject::tr("Reserve Word"), QObject::tr("Reserve Word"),
QObject::tr("Syntax"), QObject::tr("Syntax"),
true,true,true); true,true,true);
addDefine(SYNS_AttrReserveWord_Type,
QObject::tr("Reserve Word for Types"),
QObject::tr("Syntax"),
true,true,true);
addDefine(SYNS_AttrSpace, addDefine(SYNS_AttrSpace,
QObject::tr("Space"), QObject::tr("Space"),
QObject::tr("Syntax"), QObject::tr("Syntax"),
@ -719,6 +729,11 @@ void ColorManager::updateStatementColors(std::shared_ptr<QHash<StatementKind, st
if (item) { if (item) {
statementColors->insert(StatementKind::skKeyword,item); statementColors->insert(StatementKind::skKeyword,item);
statementColors->insert(StatementKind::skUserCodeSnippet,item); statementColors->insert(StatementKind::skUserCodeSnippet,item);
statementColors->insert(StatementKind::skKeywordType,item);
}
item = getItem(schemeName, SYNS_AttrReserveWord_Type);
if (item) {
statementColors->insert(StatementKind::skKeywordType,item);
} }
item = getItem(schemeName, SYNS_AttrString); item = getItem(schemeName, SYNS_AttrString);
if (item) { if (item) {

View File

@ -133,6 +133,13 @@
"strikeout": false, "strikeout": false,
"underlined": false "underlined": false
}, },
"Reserve Word for Types": {
"bold": true,
"foreground": "#ff065cf0",
"italic": false,
"strikeout": false,
"underlined": false
},
"Illegal Char": { "Illegal Char": {
"bold": false, "bold": false,
"foreground": "#ffff0000", "foreground": "#ffff0000",

View File

@ -0,0 +1,264 @@
{
"Active Breakpoint": {
"background": "#ff33cccc",
"bold": false,
"foreground": "#ffffffff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Active Line": {
"background": "#ff323232",
"bold": false,
"italic": false,
"strikeout": false,
"underlined": false
},
"Assembler": {
"bold": false,
"foreground": "#ff79abff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Breakpoint": {
"bold": false,
"italic": false,
"strikeout": false,
"underlined": false
},
"Character": {
"bold": false,
"foreground": "#ffd25252",
"italic": false,
"strikeout": false,
"underlined": false
},
"Class": {
"bold": false,
"foreground": "#ff79abff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Comment": {
"bold": false,
"foreground": "#ff74705d",
"italic": false,
"strikeout": false,
"underlined": false
},
"Current Highlighted Word": {
"background": "#3c33cccc",
"bold": false,
"italic": false,
"strikeout": false,
"underlined": false
},
"Editor Text": {
"background": "#ff282923",
"bold": false,
"foreground": "#ffdddddd",
"italic": false,
"strikeout": false,
"underlined": false
},
"Error": {
"background": "#ffff2a55",
"bold": false,
"foreground": "#ffffffff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Escape sequences": {
"bold": false,
"foreground": "#ff7fb347",
"italic": false,
"strikeout": false,
"underlined": false
},
"Float": {
"bold": false,
"foreground": "#ff7fb347",
"italic": false,
"strikeout": false,
"underlined": false
},
"Fold Line": {
"bold": false,
"foreground": "#ffff9900",
"italic": false,
"strikeout": false,
"underlined": false
},
"Function": {
"bold": false,
"foreground": "#ff8dd300",
"italic": false,
"strikeout": false,
"underlined": false
},
"Global variable": {
"bold": false,
"foreground": "#ffbed6ff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Gutter": {
"background": "#ff323232",
"bold": false,
"foreground": "#ffd0d0d0",
"italic": false,
"strikeout": false,
"underlined": false
},
"Gutter Active Line": {
"bold": false,
"foreground": "#ffaaaaff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Hexadecimal": {
"bold": false,
"foreground": "#ff7fb347",
"italic": false,
"strikeout": false,
"underlined": false
},
"Identifier": {
"bold": false,
"foreground": "#ffffffff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Reserve Word for Types": {
"bold": false,
"foreground": "#ffffaaff",
"italic": true,
"strikeout": false,
"underlined": false
},
"Illegal Char": {
"bold": false,
"foreground": "#fff44747",
"italic": false,
"strikeout": false,
"underlined": false
},
"Indent Guide Line": {
"bold": false,
"foreground": "#ffc0c0c0",
"italic": false,
"strikeout": false,
"underlined": false
},
"Local Variable": {
"bold": false,
"foreground": "#ffffffff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Number": {
"bold": false,
"foreground": "#ffaaaaff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Octal": {
"bold": false,
"foreground": "#ff7fb347",
"italic": false,
"strikeout": false,
"underlined": false
},
"Preprocessor": {
"bold": false,
"foreground": "#ffff2a7f",
"italic": false,
"strikeout": false,
"underlined": false
},
"Reserved Word": {
"bold": false,
"foreground": "#ff00ffff",
"italic": true,
"strikeout": false,
"underlined": false
},
"Selected text": {
"background": "#3c55aaff",
"bold": false,
"italic": false,
"strikeout": false,
"underlined": false
},
"Space": {
"bold": false,
"foreground": "#ff505050",
"italic": false,
"strikeout": false,
"underlined": false
},
"String": {
"bold": false,
"foreground": "#ffe7db6a",
"italic": false,
"strikeout": false,
"underlined": false
},
"Symbol": {
"bold": false,
"foreground": "#ffffffff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Variable": {
"bold": false,
"foreground": "#ffffffff",
"italic": false,
"strikeout": false,
"underlined": false
},
"Warning": {
"bold": false,
"foreground": "#ffffaa00",
"italic": false,
"strikeout": false,
"underlined": false
},
"brace/parenthesis/bracket level 1": {
"bold": false,
"foreground": "#ffff2a7f",
"italic": false,
"strikeout": false,
"underlined": false
},
"brace/parenthesis/bracket level 2": {
"bold": false,
"foreground": "#ffffffff",
"italic": false,
"strikeout": false,
"underlined": false
},
"brace/parenthesis/bracket level 3": {
"bold": false,
"foreground": "#ffffffff",
"italic": false,
"strikeout": false,
"underlined": false
},
"brace/parenthesis/bracket level 4": {
"bold": false,
"foreground": "#ffbed6ff",
"italic": false,
"strikeout": false,
"underlined": false
}
}

View File

@ -1023,6 +1023,22 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
//selection //selection
if (highlighter() && attr) { if (highlighter() && attr) {
if (attr == highlighter()->keywordAttribute()) {
if (CppTypeKeywords.contains(token)) {
PColorSchemeItem item = mStatementColors->value(StatementKind::skKeywordType,PColorSchemeItem());
if (item) {
if (item->foreground().isValid())
foreground = item->foreground();
if (item->background().isValid())
background = item->background();
style.setFlag(QSynedit::FontStyle::fsBold,item->bold());
style.setFlag(QSynedit::FontStyle::fsItalic,item->italic());
style.setFlag(QSynedit::FontStyle::fsUnderline,item->underlined());
style.setFlag(QSynedit::FontStyle::fsStrikeOut,item->strikeout());
}
}
}
if (((attr == highlighter()->identifierAttribute()) if (((attr == highlighter()->identifierAttribute())
|| (attr == highlighter()->keywordAttribute()) || (attr == highlighter()->keywordAttribute())
|| (attr->name() == SYNS_AttrPreprocessor) || (attr->name() == SYNS_AttrPreprocessor)

View File

@ -101,6 +101,7 @@ enum StatementKind {
skBlock, skBlock,
skUserCodeSnippet, // user code template skUserCodeSnippet, // user code template
skKeyword, // keywords skKeyword, // keywords
skKeywordType, //keywords for type (for color management)
skAlias skAlias
}; };

View File

@ -6159,6 +6159,10 @@
<source>C Language standard (-std)</source> <source>C Language standard (-std)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Reserve Word for Types</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RegisterModel</name> <name>RegisterModel</name>
@ -6274,7 +6278,7 @@
<name>SearchDialog</name> <name>SearchDialog</name>
<message> <message>
<source>Dialog</source> <source>Dialog</source>
<translation>Diálogo</translation> <translation type="vanished">Diálogo</translation>
</message> </message>
<message> <message>
<source>Text to Find:</source> <source>Text to Find:</source>
@ -6282,7 +6286,7 @@
</message> </message>
<message> <message>
<source>Replace with:</source> <source>Replace with:</source>
<translation>Substituir por:</translation> <translation type="vanished">Substituir por:</translation>
</message> </message>
<message> <message>
<source>Options:</source> <source>Options:</source>
@ -6334,31 +6338,31 @@
</message> </message>
<message> <message>
<source>Direction:</source> <source>Direction:</source>
<translation>Direção:</translation> <translation type="vanished">Direção:</translation>
</message> </message>
<message> <message>
<source>Forward</source> <source>Forward</source>
<translation>Avançar</translation> <translation type="vanished">Avançar</translation>
</message> </message>
<message> <message>
<source>Backward</source> <source>Backward</source>
<translation>Retroceder</translation> <translation type="vanished">Retroceder</translation>
</message> </message>
<message> <message>
<source>Where:</source> <source>Where:</source>
<translation>Onde:</translation> <translation type="vanished">Onde:</translation>
</message> </message>
<message> <message>
<source>Current File</source> <source>Current File</source>
<translation>Arquivo atual</translation> <translation type="vanished">Arquivo atual</translation>
</message> </message>
<message> <message>
<source>Files In Project</source> <source>Files In Project</source>
<translation>Arquivos no projeto</translation> <translation type="vanished">Arquivos no projeto</translation>
</message> </message>
<message> <message>
<source>Open Files</source> <source>Open Files</source>
<translation>Arquivos abertos</translation> <translation type="vanished">Arquivos abertos</translation>
</message> </message>
<message> <message>
<source>Find</source> <source>Find</source>
@ -6366,7 +6370,7 @@
</message> </message>
<message> <message>
<source>Cancel</source> <source>Cancel</source>
<translation>Cancelar</translation> <translation type="vanished">Cancelar</translation>
</message> </message>
<message> <message>
<source>Replace</source> <source>Replace</source>
@ -6429,11 +6433,11 @@
<name>SearchInFileDialog</name> <name>SearchInFileDialog</name>
<message> <message>
<source>Find</source> <source>Find</source>
<translation type="obsolete">Procurar</translation> <translation type="unfinished">Procurar</translation>
</message> </message>
<message> <message>
<source>Replace</source> <source>Replace</source>
<translation type="obsolete">Substituir</translation> <translation type="unfinished">Substituir</translation>
</message> </message>
<message> <message>
<source>Find in files</source> <source>Find in files</source>
@ -6463,6 +6467,54 @@
<source>Continue Replace</source> <source>Continue Replace</source>
<translation type="obsolete">Continuar a substituir</translation> <translation type="obsolete">Continuar a substituir</translation>
</message> </message>
<message>
<source>Dialog</source>
<translation type="obsolete">Diálogo</translation>
</message>
<message>
<source>Text to Find:</source>
<translation type="unfinished">Texto a procurar:</translation>
</message>
<message>
<source>Where:</source>
<translation type="unfinished">Onde:</translation>
</message>
<message>
<source>Current File</source>
<translation type="unfinished">Arquivo atual</translation>
</message>
<message>
<source>Files In Project</source>
<translation type="unfinished">Arquivos no projeto</translation>
</message>
<message>
<source>Open Files</source>
<translation type="unfinished">Arquivos abertos</translation>
</message>
<message>
<source>Options:</source>
<translation type="unfinished">Opções:</translation>
</message>
<message>
<source>Whole words only</source>
<translation type="unfinished">Apenas palavras inteiras</translation>
</message>
<message>
<source>Case Sensitive</source>
<translation type="unfinished">Sensibilidade a maiúsculas/minúsculas</translation>
</message>
<message>
<source>Regular Expression</source>
<translation type="unfinished">Expressão regular</translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Search in Files</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SearchResultListModel</name> <name>SearchResultListModel</name>

File diff suppressed because it is too large Load Diff

View File

@ -5896,6 +5896,10 @@
<source>C Language standard (-std)</source> <source>C Language standard (-std)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Reserve Word for Types</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RegisterModel</name> <name>RegisterModel</name>
@ -6009,18 +6013,10 @@
</context> </context>
<context> <context>
<name>SearchDialog</name> <name>SearchDialog</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Text to Find:</source> <source>Text to Find:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Replace with:</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Options:</source> <source>Options:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -6069,42 +6065,10 @@
<source>Entire scope</source> <source>Entire scope</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Direction:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Forward</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Backward</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Where:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Current File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Files In Project</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Files</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Find</source> <source>Find</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Continue Search</source> <source>Continue Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -6142,6 +6106,61 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>SearchInFileDialog</name>
<message>
<source>Text to Find:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Where:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Current File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Files In Project</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Options:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Whole words only</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Case Sensitive</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Regular Expression</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Find</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Replace</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Search in Files</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>SearchResultListModel</name> <name>SearchResultListModel</name>
<message> <message>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Search in Files</string>
</property> </property>
<layout class="QVBoxLayout" name="dialogLayout"> <layout class="QVBoxLayout" name="dialogLayout">
<property name="spacing"> <property name="spacing">

View File

@ -84,6 +84,7 @@ extern const QChar SoftBreakGlyph;
#define SYNS_AttrHexadecimal "Hexadecimal" #define SYNS_AttrHexadecimal "Hexadecimal"
#define SYNS_AttrIcon "Icon Reference" #define SYNS_AttrIcon "Icon Reference"
#define SYNS_AttrIdentifier "Identifier" #define SYNS_AttrIdentifier "Identifier"
#define SYNS_AttrReserveWord_Type "Reserve Word for Types"
#define SYNS_AttrIllegalChar "Illegal Char" #define SYNS_AttrIllegalChar "Illegal Char"
#define SYNS_AttrInclude "Include" #define SYNS_AttrInclude "Include"
#define SYNS_AttrIndicator "Indicator Area" #define SYNS_AttrIndicator "Indicator Area"