diff --git a/Contributors.md b/Contributors.md index 1e7b64d4..d029170c 100644 --- a/Contributors.md +++ b/Contributors.md @@ -25,4 +25,10 @@ author: Alan-CRL ### Theme Contrast -author: Alan-CRL \ No newline at end of file +author: Alan-CRL + +## Color Schemes + +### Monokai + +author: СDev \ No newline at end of file diff --git a/NEWS.md b/NEWS.md index da8712c6..e7cad0f3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 - fix: Contents in class browser not correctly updated when close the last editor for project. diff --git a/RedPandaIDE/colorscheme.cpp b/RedPandaIDE/colorscheme.cpp index e5f7befb..fec118f7 100644 --- a/RedPandaIDE/colorscheme.cpp +++ b/RedPandaIDE/colorscheme.cpp @@ -40,6 +40,12 @@ PColorScheme ColorScheme::fromJson(const QJsonObject &json) 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; } @@ -483,6 +489,10 @@ void ColorManager::initItemDefines() QObject::tr("Reserve Word"), QObject::tr("Syntax"), true,true,true); + addDefine(SYNS_AttrReserveWord_Type, + QObject::tr("Reserve Word for Types"), + QObject::tr("Syntax"), + true,true,true); addDefine(SYNS_AttrSpace, QObject::tr("Space"), QObject::tr("Syntax"), @@ -719,6 +729,11 @@ void ColorManager::updateStatementColors(std::shared_ptrinsert(StatementKind::skKeyword,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); if (item) { diff --git a/RedPandaIDE/colorschemes/Intellij_Classic.scheme b/RedPandaIDE/colorschemes/Intellij_Classic.scheme index 3b2c6c8e..cd3a80d0 100644 --- a/RedPandaIDE/colorschemes/Intellij_Classic.scheme +++ b/RedPandaIDE/colorschemes/Intellij_Classic.scheme @@ -133,6 +133,13 @@ "strikeout": false, "underlined": false }, + "Reserve Word for Types": { + "bold": true, + "foreground": "#ff065cf0", + "italic": false, + "strikeout": false, + "underlined": false + }, "Illegal Char": { "bold": false, "foreground": "#ffff0000", diff --git a/RedPandaIDE/colorschemes/Monokai.scheme b/RedPandaIDE/colorschemes/Monokai.scheme new file mode 100644 index 00000000..f6448bda --- /dev/null +++ b/RedPandaIDE/colorschemes/Monokai.scheme @@ -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 + } +} diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index d0bb8b8a..c0efd09d 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1023,6 +1023,22 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to //selection 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()) || (attr == highlighter()->keywordAttribute()) || (attr->name() == SYNS_AttrPreprocessor) diff --git a/RedPandaIDE/parser/parserutils.h b/RedPandaIDE/parser/parserutils.h index ddce1ff2..ddcf7669 100644 --- a/RedPandaIDE/parser/parserutils.h +++ b/RedPandaIDE/parser/parserutils.h @@ -101,6 +101,7 @@ enum StatementKind { skBlock, skUserCodeSnippet, // user code template skKeyword, // keywords + skKeywordType, //keywords for type (for color management) skAlias }; diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index cdb1579c..88fb37f5 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -6159,6 +6159,10 @@ C Language standard (-std) + + Reserve Word for Types + + RegisterModel @@ -6274,7 +6278,7 @@ SearchDialog Dialog - Diálogo + Diálogo Text to Find: @@ -6282,7 +6286,7 @@ Replace with: - Substituir por: + Substituir por: Options: @@ -6334,31 +6338,31 @@ Direction: - Direção: + Direção: Forward - Avançar + Avançar Backward - Retroceder + Retroceder Where: - Onde: + Onde: Current File - Arquivo atual + Arquivo atual Files In Project - Arquivos no projeto + Arquivos no projeto Open Files - Arquivos abertos + Arquivos abertos Find @@ -6366,7 +6370,7 @@ Cancel - Cancelar + Cancelar Replace @@ -6429,11 +6433,11 @@ SearchInFileDialog Find - Procurar + Procurar Replace - Substituir + Substituir Find in files @@ -6463,6 +6467,54 @@ Continue Replace Continuar a substituir + + Dialog + Diálogo + + + Text to Find: + Texto a procurar: + + + Where: + Onde: + + + Current File + Arquivo atual + + + Files In Project + Arquivos no projeto + + + Open Files + Arquivos abertos + + + Options: + Opções: + + + Whole words only + Apenas palavras inteiras + + + Case Sensitive + Sensibilidade a maiúsculas/minúsculas + + + Regular Expression + Expressão regular + + + Cancel + + + + Search in Files + + SearchResultListModel diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index fd61e14b..9ec51fea 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -1325,10 +1325,10 @@ Are you really want to continue? - - - - + + + + Error 错误 @@ -1347,34 +1347,34 @@ Are you really want to continue? 文件%1已经被打开! - + The text to be copied exceeds count limit! 要复制的内容超过了行数限制! - + The text to be copied exceeds character limit! 要复制的内容超过了字符数限制! - + The text to be cut exceeds count limit! 要剪切的内容超过了行数限制! - + The text to be cut exceeds character limit! 要剪切的内容超过了字符数限制! - + Print Document 打印文档 - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 @@ -1383,27 +1383,27 @@ Are you really want to continue? 未找到符号'%1'! - + astyle not found 找不到astyle程序 - + Can't find astyle in "%1". 找不到astyle程序"%1". - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Readonly 只读 @@ -2820,150 +2820,150 @@ Are you really want to continue? 连续行的最大缩进空格数: - + Indentation 2 缩进2 - + Indent labels 缩进标签(label) - + Indent class blocks 缩进类定义(class) - + Indent namespaces 缩进命名空间定义(namespace) - + Indent class access modifiers 缩进类访问限制符('public','private'...) - + Indent after parenthesis '(' or assignment '=' 在括号'('或赋值号'='后缩进 - + Indent preprocessor conditional statements 缩进预处理条件指令('#if','#else',...) - + Indent multi-line preprocessor #define statements 缩进多行#define语句 - + Indent line comments that start in column one 缩进在第一列开始的行注释 - + Indent preprocessor blocks 缩进预处理代码段 - + Indent switch blocks 缩进switch语句 - + Indent cases 缩进case语句 - + Padding 1 填充1 - + Insert spaces around operators 在运算符周围插入空格 - + Insert spaces after commas 在逗号后插入空格 - + Insert spaces after parenthesis headers ('if','for',...) 在语句和括号间插入空格('if','for'...) - + Insert spaces around parenthesis on the outside only 在括号外侧加入空格 - + Insert spaces around parenthesis on the inside only 在括号内侧加入空格 - + Insert empty lines arround unrelated blocks 在代码段之间加入空行 - + Insert empty lines around all blocks Insert empy lines around all blocks 在所有代码段之间加入空格 - + Insert spaces around first parenthesis in a series on the out side only 在多层嵌套括号的最外侧加入空格 - + Insert spaces around parenthesis 在括号两侧加入空格 - + Padding 2 填充2 - + Remove all empty lines. It will NOT delete lines added by the padding options. 删除所有空行。不影响填充选项自动插入的空行。 - + Attach a pointer operator to its : 将指针运算符('*')放在: - + Remove all consecutive empty lines. It will NOT delete lines added by the padding options. 将连续的多个空行合并成一个。不影响填充选项自动插入的空行。 - - + + type(left) 类型侧(左侧) - + Fill empty lines with the white space of the previous lines. 使用前一行的缩进空格填充空行 - - + + middle 中间 @@ -2973,124 +2973,124 @@ Are you really want to continue? <html><head/><body><p>预定义排版方案说明</p></body></html> - - + + name(right) 名称侧(右侧) - + Remove unnecessary space adding around parenthesis 删除括号周围的多余空格 - + Attach a reference operator to its : 将引用运算符('&')放在: - - + + none 不变 - + Other 1 其它1 - + Break one line headers ('if','while','else'...) from the statement on the same line 对单行条件('if','while','else')语句分行 - + Add one line braces to unbraced one line conditional statements 用花括号括起单行条件体 - + Break braces before close headers ('else','catch"...) 对结束语句('else','catch')和它之前的花括号断行 - + Remove braces from a braced one line conditional statements 删除括起单行条件体语句的花括号 - + Break 'else if' statements into two lines 将'else if'语句断成两行 - + Add braces to unbraced one line conditional statements 对条件和条件体语句在同一行上的,删除括起条件体语句的花括号 - + Other 2 其它2 - + Attach return type to the function name in its declaration 将函数声明中的函数名和返回值类型放在同一行 - + Break return type from the function name in its declaration 将函数声明中的函数名和返回值类型断成两行 - + Break return type from the function name in its definition 将函数定义中的函数名和返回值类型断成两行 - + Attach return type to the function name in its definition 将函数定义中的函数名和返回值类型放在同一行 - + Don't break blocks residing completely on one line 不对同一行上的多个代码段断行 - + Don't break multimple statements residing on one line 不对同一行上的多条语句断行 - + Other 3 其它3 - + Place the logical conditional to the last on the previous line, when break lines 在断行时,将逻辑条件放在前一行的末尾 - + Close ending angle brackets on template definitions 关闭模板定义末尾的尖括号 - + Remove the leading '*' prefix on multi-line comments and indent the comment text one line indent. 删除多行注释前的'*'并缩进注释内容 - + Break lines exceeds 对超过指定长度的行断行 - + characters 字符 @@ -7604,7 +7604,7 @@ Are you really want to continue? 所有文件 - + Error @@ -7950,12 +7950,12 @@ Are you really want to continue? GB - + Can't open file '%1' for read 无法打开文件"%1"进行读取 - + Can't parse json file '%1' at offset %2! Error Code: %3 JSON文件"%1"在位置"%2"处无法解析!错误码:%3 @@ -7964,257 +7964,263 @@ Are you really want to continue? "%1"不是一个合法的颜色配置文件,无法解析! - + Can't parse json file '%1' is not a color scheme config file! - + Can't open file '%1' for write 无法打开文件"%1"写入内容 - + Can't Find the color scheme file %1! 找不到颜色配置文件%1! - - - + + + Can't remove the color scheme file %1! 删不掉颜色配置文件%1! - + Assembler 汇编 - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - + + + + Syntax 语法 - + Character 字符 - + Comment 注释 - + Class - + Float 浮点数 - + Function 函数 - + Gloabal Variable 全局变量 - + Hexadecimal Integer 十六进制数 - + Identifier 标识符 - + Illegal Char 非法字符 - + Local Variable 局部变量 - + Integer 整数 - + Octal Integer 八进制整数 - + Preprocessor 预处理指令 - + Reserve Word - 保留字(关键字) + 关键字 - + + Reserve Word for Types + 类型关键字 + + + Space 空格字符 - + String 字符串 - + Escape Sequences 转义序列 - + Symbol 符号 - + Variable 变量 - + Brace/Bracket/Parenthesis Level 1 1级括号 - + Brace/Bracket/Parenthesis Level 2 2级括号 - + Brace/Bracket/Parenthesis Level 3 3级括号 - + Brace/Bracket/Parenthesis Level 4 4级括号 - + Gutter 侧边栏 - - - + + + Editor 编辑器 - + Gutter Active Line 当前行侧边栏 - + Active Line 当前行 - + Breakpoint 断点 - + Active Breakpoint 活动断点 - + Fold Line 代码折叠线 - + Selection 选中文字 - + Editor Text 编辑器缺省 - + Current Highlighted Word 当前高亮单词 - - + + Syntax Check 语法检查 - + Warning 警告 - - + + Rename file '%1' to '%2' failed! 将文件'%1'改名为'%2'失败! - + Scheme '%1' already exists! 配置文件'%1'已经存在! - + default 缺省 @@ -8420,90 +8426,75 @@ Are you really want to continue? SearchDialog - Dialog - 对话框 + 对话框 - Text to Find: 要查找的关键字 - Replace with: - 替换为: + 替换为: - Options: 选项: - Case Sensitive 区分大小写 - Whole words only 整个单词 - Wrap Around 循环查找 - Regular Expression 正则表达式 - Prompt on replace 替换时提示 - Scope: 范围: - Global 全局 - Selection 选中文字 - Origin: 起点: - From cursor 从光标处 - Entire scope 整个范围 @@ -8528,50 +8519,41 @@ Are you really want to continue? 关闭 - Direction: - 方向 + 方向 - Forward - 向后 + 向后 - Backward - 向前 + 向前 - Where: - 在哪些文件中查找: + 在哪些文件中查找: - Current File - 当前文件 + 当前文件 - Files In Project - 项目中的文件 + 项目中的文件 - Open Files - 已打开的文件 + 已打开的文件 - Find 查找 - Cancel - 取消 + 取消 Find in files @@ -8626,12 +8608,73 @@ Are you really want to continue? SearchInFileDialog - Find - 查找 + Dialog + 对话框 + + Search in Files + 在文件中查找 + + + + Text to Find: + 要查找的内容: + + + + Where: + 在哪些文件中查找: + + + + Current File + 当前文件 + + + + Files In Project + 项目中的文件 + + + + Open Files + 已打开的文件 + + + + Options: + 选项: + + + + Whole words only + 整个单词 + + + + Case Sensitive + 区分大小写 + + + + Regular Expression + 正则表达式 + + + + Find + 查找 + + + Replace - 替换 + 替换 + + + + Cancel + 取消 Find in files diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index 51e7009d..ca4a2a47 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -5896,6 +5896,10 @@ C Language standard (-std) + + Reserve Word for Types + + RegisterModel @@ -6009,18 +6013,10 @@ SearchDialog - - Dialog - - Text to Find: - - Replace with: - - Options: @@ -6069,42 +6065,10 @@ Entire scope - - Direction: - - - - Forward - - - - Backward - - - - Where: - - - - Current File - - - - Files In Project - - - - Open Files - - Find - - Cancel - - Continue Search @@ -6142,6 +6106,61 @@ + + SearchInFileDialog + + Text to Find: + + + + Where: + + + + Current File + + + + Files In Project + + + + Open Files + + + + Options: + + + + Whole words only + + + + Case Sensitive + + + + Regular Expression + + + + Find + + + + Replace + + + + Cancel + + + + Search in Files + + + SearchResultListModel diff --git a/RedPandaIDE/widgets/searchinfiledialog.ui b/RedPandaIDE/widgets/searchinfiledialog.ui index 626b439b..1d564b31 100644 --- a/RedPandaIDE/widgets/searchinfiledialog.ui +++ b/RedPandaIDE/widgets/searchinfiledialog.ui @@ -11,7 +11,7 @@ - Dialog + Search in Files diff --git a/libs/qsynedit/qsynedit/Constants.h b/libs/qsynedit/qsynedit/Constants.h index 0387fb7d..c242893f 100644 --- a/libs/qsynedit/qsynedit/Constants.h +++ b/libs/qsynedit/qsynedit/Constants.h @@ -84,6 +84,7 @@ extern const QChar SoftBreakGlyph; #define SYNS_AttrHexadecimal "Hexadecimal" #define SYNS_AttrIcon "Icon Reference" #define SYNS_AttrIdentifier "Identifier" +#define SYNS_AttrReserveWord_Type "Reserve Word for Types" #define SYNS_AttrIllegalChar "Illegal Char" #define SYNS_AttrInclude "Include" #define SYNS_AttrIndicator "Indicator Area"