diff --git a/NEWS.md b/NEWS.md index a40760f2..632b63d5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,6 +17,7 @@ Red Panda C++ Version 0.13.3 - enhancement: highlighter for GLSL (OpenGL Shading Language) - add a new template for raylib shader apps - fix: project files' charset settings doesn't work correctly + - enhancement: add exec charset option to compiler set settings Red Panda C++ Version 0.13.2 - fix: "delete and exit" button in the environtment / folder option page doesn't work correctly diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index 7bfe6f19..4dd712ba 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -299,113 +299,113 @@ p, li { white-space: pre-wrap; } CharsetInfoManager - - - + + + Arabic 阿拉伯语系 - - - - + + + + Greek 希腊语系 - - - - + + + + Baltic 巴尔干语系 - - - - - - - + + + + + + + Western Europe 西欧语言 - - + + Central Europe 中欧语言 - - - - - + + + + - + + Cyrillic 西里尔语系 - - - - + + + + Turkish 土耳其语系 - - + + Northern Europe 北欧语系 - - - + + + Hebrew 希伯来语 - + Thai 泰语 - - + + Japanese 日语 - - - + + + Chinese 中文 - - + + Korean 韩语 - + Vietnamese 越南语 - + Eastern Europe 东欧语系 - + Celtic 凯尔特语系 @@ -572,7 +572,7 @@ p, li { white-space: pre-wrap; } [说明] - + The compiler process for '%1' failed to start. 无法启动编译器进程'%1'。 @@ -581,27 +581,27 @@ p, li { white-space: pre-wrap; } 无法启动编译进程。 - + The compiler process crashed after starting successfully. 编译进程启动后崩溃。 - + The last waitFor...() function timed out. waitFor()函数等待超时。 - + An error occurred when attempting to write to the compiler process. 在向编译进程输入内容时出错。 - + An error occurred when attempting to read from the compiler process. 在从编译进程读取内容时出错。 - + An unknown error occurred. 发生了未知错误。 @@ -688,6 +688,16 @@ p, li { white-space: pre-wrap; } Strings in the program might be wrongly processed. 程序中的文字内容可能无法被正确处理和显示。 + + + Can't find Console Pauser + 找不到Console Pauser程序 + + + + Console Pauser "%1" doesn't exists! + 找不到Console Pauser程序"%1"! + CompilerSetDirectoriesWidget @@ -737,13 +747,13 @@ p, li { white-space: pre-wrap; } 编译器配置方案 - - - - - - - + + + + + + + ... ... @@ -753,17 +763,17 @@ p, li { white-space: pre-wrap; } 基本选项 - + Add the following arguments when calling the compiler 编译时加入下列选项: - + Add the following arguments when calling the linker 链接时加入下列选项 - + Add Charset arguments when calling the compiler 编译时自动加入字符编码选项 @@ -798,62 +808,62 @@ p, li { white-space: pre-wrap; } 删除 - + Statically link libraries 静态链接所有库 - + Settings 编译/链接选项 - + Directories 文件夹 - + Programs 程序 - + TextLabel 选项 - + gdb gdb - + gdb server gdb server - + Resource Compiler(windres) 资源编辑器(winres) - + C++ Compiler(g++) C++编译器(g++) - + Choose C++ Compiler 选择C++编译器 - + Choose C Compiler 选择C编译器 - + C Compiler(gcc) C编译器(gcc) @@ -862,42 +872,42 @@ p, li { white-space: pre-wrap; } 调试器(gdb) - + Profiler(gprof) 性能分析器(gprof) - + make - + Choose make 选择make - + Choose Debugger 选择调试器 - + Choose Resource Compiler 选择资源编译器 - + Choose Profiler 选择性能分析器 - + Confirm 确认 - + Red Panda C++ will clear current compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Are you really want to continue? Red Panda C++ will clear current compiler list and search for compilers in the following locations: '%1' @@ -906,40 +916,50 @@ Are you really want to continue? 小熊猫C++ 将会清除现有的编译器配置列表,然后在下列文件夹中搜索编译器:<br/> '%1'<br/> '%2'<br />你确定要继续吗? - + + ANSI + ANSI + + + + UTF-8 + UTF-8 + + + Red Panda C++ will clear current compiler list and search for compilers in the the PATH. <br />Are you really want to continue? 小熊猫C++ 将会清除现有的编译器配置列表,然后在PATH路径中搜索gcc编译器.<br />你确定要继续吗? - - + + Failed 失败 - - + + Can't find any compiler. 找不到编译器 - - + + Compiler Set Name 编译器配置名称 - + Name 名称 - + Compiler Set Folder 编译器所在文件夹 - + New name 新名称 @@ -1205,10 +1225,10 @@ Are you really want to continue? - - - - + + + + Error 错误 @@ -1222,65 +1242,65 @@ Are you really want to continue? 另存为 - + 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+单击以获取更多信息 - - + + Symbol '%1' not found! 未找到符号'%1'! - + astyle not found 找不到astyle程序 - + Can't find astyle in "%1". 找不到astyle程序"%1". - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Readonly 只读 @@ -2136,7 +2156,7 @@ Are you really want to continue? ExecutableRunner - + The runner process '%1' failed to start. The runner process failed to start. 无法启动程序运行进程'%1'。 @@ -2146,17 +2166,17 @@ Are you really want to continue? 程序运行进程启动后崩溃。 - + The last waitFor...() function timed out. waitFor()函数等待超时。 - + An error occurred when attempting to write to the runner process. 在向程序运行进程写入内容时出错。 - + An error occurred when attempting to read from the runner process. 在从程序运行进程读取内容时出错。 @@ -3200,11 +3220,11 @@ Are you really want to continue? - - - - - + + + + + Issues 编译器 @@ -3280,7 +3300,7 @@ Are you really want to continue? - + Debug Console 调试主控台 @@ -3414,8 +3434,8 @@ Are you really want to continue? - - + + Compile 编译 @@ -3461,8 +3481,8 @@ Are you really want to continue? - - + + Copy 复制 @@ -3473,7 +3493,7 @@ Are you really want to continue? - + Paste 粘贴 @@ -3484,7 +3504,7 @@ Are you really want to continue? - + Select All 选择全部 @@ -3611,7 +3631,7 @@ Are you really want to continue? - + New Problem Set 新建试题集 @@ -3630,14 +3650,14 @@ Are you really want to continue? - + Save Problem Set 保存试题集 - + Load Problem Set 载入试题集 @@ -3977,7 +3997,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -4078,7 +4098,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -4099,13 +4119,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -4230,7 +4250,7 @@ Are you really want to continue? - + Open Folder 打开文件夹 @@ -4240,7 +4260,7 @@ Are you really want to continue? 运行参数... - + File Encoding 文件编码 @@ -4305,156 +4325,156 @@ Are you really want to continue? 覆写 - + Close project 关闭项目 - + Are you sure you want to close %1? 你确定要关闭'%1'吗? - - + + Confirm 确认 - - - + + + Source file is not compiled. 源文件尚未编译。 - - + + Compile now? 现在编译? - - + + Source file is more recent than executable. 源文件比可执行程序新。 - + Recompile now? 重新编译? - + No compiler set 无编译器设置 - + No compiler set is configured. 没有配置编译器设置。 - + Can't start debugging. 无法启动调试器 - - + + Enable debugging 启用调试参数 - - + + You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.<BR /><BR />Do you want to correct this now? 当前编译设置中未启用调试选项(-g3),或启用了信息剥除选项(-s)<br /><br/>是否纠正这一问题? - + Project not built 项目尚未构建 - + Project hasn't been built. Build it now? 项目尚未构建。是否构建? - + Host applcation missing 宿主程序不存在 - + DLL project needs a host application to run. 动态链接库(DLL)需要一个宿主程序来运行。 - + But it's missing. 但它不存在。 - + Host application not exists 宿主程序不存在 - + Host application file '%1' doesn't exist. 宿主程序'%1'不存在。 - + Recompile? 重新编译? - - + + Save last open info error 保存上次打开信息失败 - + Can't remove old last open information file '%1' 无法删除旧上次打开信息文件'%1' - + Can't save last open info file '%1' 无法保存上次打开信息文件'%1' - + Load last open info error 载入上次打开信息失败 - + Can't load last open info file '%1' 无法载入上次打开信息文件'%1' - + Open Source File 打开源代码文件 - + Show detail debug logs 显示详细调试器日志 - + Copy all 全部复制 - - + + Clear 清除 @@ -4470,7 +4490,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -4491,68 +4511,68 @@ Are you really want to continue? 或者选择使用其他的网络端口。 - - + + Rebuild Project 重新构建项目 - - + + Project has been modified, do you want to rebuild it? 项目已经被修改过,是否需要重新构建? - + Auto Save Error 自动保存出错 - + Auto save "%1" to "%2" failed:%3 自动保存"%1"到"%2"失败:%3 - + Properties... 试题属性... - + Set Problem Set Name 设置试题集名称 - + Problem Set Name: 试题集名称: - + Remove 删除 - + Remove All Bookmarks 删除全部书签 - + Modify Description 修改描述 - - - + + + Bookmark Description 书签描述 - - - + + + Description: 描述: @@ -4561,240 +4581,240 @@ Are you really want to continue? 在调试主控台中显示调试器输出 - + Remove this search 清除这次搜索 - + Clear all searches 删除所有搜索 - + Breakpoint condition... 断点条件... - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Remove All Breakpoints Remove all breakpoints 删除所有断点 - + Remove Breakpoint 删除当前断点 - + Rename File 重命名文件 - - + + Add Folder 添加文件夹 - + New folder 新文件夹 - + Folder name: 文件夹: - + Rename Folder 重命名 - + Remove Folder 删除文件夹 - + Sort By Type 按类型排序 - + Sort alphabetically 按名称排序 - + Show inherited members 显示继承的成员 - + Goto declaration 跳转到声明处 - + Goto definition 跳转到定义处 - + Open in Editor 在编辑器中打开 - + Open in External Program 使用外部程序打开 - + Open in Terminal 在终端中打开 - + Open in Windows Explorer 在Windows浏览器中打开 - + Character sets 字符集 - + %1 files autosaved 已自动保存%1个文件 - + Set answer to... 设置答案源代码... - + select other file... 选择其他文件... - + Select Answer Source File 选择答案源代码文件 - + C/C++Source Files (*.c *.cpp *.cc *.cxx) C/C++Source Files (*.c *.cpp *.cc *.cxx C/C++源代码文件 (*.c *.cpp *.cc *.cxx) - + Save project 保存项目 - + The project '%1' has modifications. 项目'%1'有改动。 - - + + Do you want to save it? 需要保存吗? - - + + File Changed 文件已发生变化 - + New Project File? 新建项目文件? - + Do you want to add the new file to the project? 您是否要将新建的文件加入项目? - - - - + + + + Save Error 保存失败 - + Change Project Compiler Set 改变项目编译器配置集 - + Change the project's compiler set will lose all custom compiler set options. 改变项目的编译器配置集会导致所有的自定义编译器选项被重置。 - + Do you really want to do that? 你真的想要做那些吗? - + Do you really want to clear all breakpoints in this file? 您真的要清除该文件的所有断点吗? - + New project 新建项目 - + Close %1 and start new project? 关闭'%1'以打开新项目? - + Folder not exist 文件夹不存在 - + Folder '%1' doesn't exist. Create it now? 文件夹'%1'不存在。是否创建? - + Can't create folder 无法创建文件夹 - + Failed to create folder '%1'. 创建文件夹'%1'失败。 - + Save new project as @@ -4803,125 +4823,125 @@ Are you really want to continue? 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Remove file 删除文件 - + Remove the file from disk? 同时从硬盘上删除文件? - + untitled 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 - + Red Panda C++ project file (*.dev) 小熊猫C++项目文件(*.dev) - + Rename Error 重命名出错 - + Symbol '%1' is defined in system header. 符号'%1'在系统头文件中定义,无法修改。 - + New Name 新名称 - - + + Replace Error 替换出错 - + Can't open file '%1' for replace! 无法打开文件'%1'进行替换! - + Contents has changed since last search! 内容和上次查找时不一致。 - + Rich Text Format Files (*.rtf) RTF格式文件 (*.rtf) - + HTML Files (*.html) HTML文件 (*.html) - + The current problem set is not empty. 当前的试题集不是空的。 - + Problem %1 试题%1 - - + + Problem Set Files (*.pbs) 试题集文件 (*.pbs) - + Load Error 载入失败 - - + + Problem Case %1 试题案例%1 @@ -4932,15 +4952,15 @@ Are you really want to continue? - - - - - - - - - + + + + + + + + + Error 错误 @@ -4950,75 +4970,75 @@ Are you really want to continue? 项目历史 - + File '%1' was changed. 磁盘文件'%1'已被修改。 - + Reload its content from disk? 是否重新读取它的内容? - + File '%1' was removed. 磁盘文件'%1'已被删除。 - + Keep it open? 是否保持它在小熊猫C++中打开的编辑窗口? - + Open 打开 - + Compile Failed 编译失败 - + Run Failed 运行失败 - - + + Confirm Convertion 确认转换 - - + + The editing file will be saved using %1 encoding. <br />This operation can't be reverted. <br />Are you sure to continue? 当前编辑器中的文件将会使用%1编码保存。<br />这项操作无法被撤回。<br />你确定要继续吗? - + New Watch Expression 新监视表达式 - + Enter Watch Expression (it is recommended to use 'this->' for class members): 输入监视表达式 - + Parsing file %1 of %2: "%3" (%1/%2)正在解析文件"%3" - - + + Done parsing %1 files in %2 seconds 完成%1个文件的解析,用时%2秒 - + (%1 files per second) (每秒%1个文件) @@ -5165,68 +5185,68 @@ Are you really want to continue? 无法保存文件'%1'. - + Error Load File 载入文件错误 - + File Exists 文件已存在 - + File '%1' is already in the project 文件'%1'已在项目中 - + Project Updated 项目已升级 - + Your project was succesfully updated to a newer file format! 已成功将项目升级到新的格式 - + If something has gone wrong, we kept a backup-file: '%1'... 旧项目文件备份在'%1'。 - + Settings need update 设置需要更新 - + The compiler settings format of Red Panda C++ has changed. The compiler settings format of Dev-C++ has changed. 小熊猫C++的编译器设置格式已发生改变。 - + Please update your settings at Project >> Project Options >> Compiler and save your project. 请在项目 >> 项目属性 >> 编译器设置中修改您的设置并保存您的项目 - + Compiler not found 未找到编译器 - + The compiler set you have selected for this project, no longer exists. 您为该项目设置的编译器不存在。 - + It will be substituted by the global compiler set. 它将会被全局编译器设置代替。 - + Developed using the Red Panda C++ IDE Developed using the Red Panda Dev-C++ IDE 使用小熊猫C++编辑器开发 @@ -5283,37 +5303,37 @@ Are you really want to continue? 无法写入文件'%1'! - + - Resource File: %1 - 资源文件: %1 - + Compiling project changes... 正在编译项目修改... - + - Project Filename: %1 - 项目文件名: %1 - + - Compiler Set Name: %1 - 编译器配置: %1 - + Processing makefile: 正在处理makefile... - + - makefile processer: %1 - makefile处理器: %1 - + - Command: %1 %2 - 命令: %1 %2 @@ -5455,12 +5475,12 @@ Are you really want to continue? 自定义构建命令 - + Auto detect 自动检测 - + ANSI ANSI @@ -5469,7 +5489,7 @@ Are you really want to continue? ANSI - + UTF-8 @@ -5567,24 +5587,24 @@ Are you really want to continue? 共%1个文件[%2个源程序文件,%3个头文件,%4个资源文件,%5个其他文件] - + Can't remove old icon file 无法删除旧图标文件 - + Can't remove old icon file '%1' 无法删除旧图标文件'%1' - + Select icon file 选择图标文件 - - Icon Files (*.ico) - 图标文件 (*.ico) + + Image Files (*.ico *.png *.jpg) + 图像文件 (*.ico *.png *.jpg) @@ -5633,24 +5653,24 @@ Are you really want to continue? ProjectModel - + File exists 文件已存在 - + File '%1' already exists. Delete it now? 文件'%1'已存在。是否删除? - - + + Remove failed 删除失败 - - + + Failed to remove file '%1' 无法删除文件'%1' @@ -5949,180 +5969,180 @@ Are you really want to continue? 无法载入自动链接设置 - - - - + + + + The following %1 directories don't exist: 下列%1文件夹不存在: - - + + binary 二进制 - + No %1 directories have been specified. 未指定%1文件夹 - + C include C包含 - - + + C++ include C++包含 - - - - + + + + Cannot find the %1 "%2" 无法找到%1程序"%2" - + C options C语言选项 - + Support all ANSI standard C programs (-ansi) 支持所有ANSI标准C程序(-ansi) - + Do not recognize asm,inline or typeof as a keyword (-fno-asm) 不支持将asm、inline和typeof作为关键字(-fno-asm) - + Imitate traditional C preprocessors (-traditional-cpp) 模仿传统C预处理器行为(-traditional-cpp) - + Code Generation 代码生成 - + Optimize for the following machine (-march) 生成特定机器的专用指令(-march) - + Optimize less, while maintaining full compatibility (-tune) 完整兼容特定机器,较少优化(-tune) - + Enable use of specific instructions (-mx) 启用特定指令集(-mx) - + Optimization level (-Ox) 优化级别(-Ox) - + Compile with the following pointer size (-mx) 使用下列指针大小编译(-mx) - + Language standard (-std) 语言标准(-std) - + Profile 性能分析 - + Generate debugging information (-g3) 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? - + Generate profiling info for analysis (-pg) 生成性能分析信息(-pg) - + Warnings 代码警告 - + Inhibit all warning messages (-w) 忽略所有警告信息(-w) - + Show most warnings (-Wall) 启用常见问题警告(-Wall) - + Show some more warnings (-Wextra) 启用更多问题警告(-Wextra) - + Check ISO C/C++/C++0x conformance (-pedantic) 检查ISO C/C++/C++0x语法一致性(-pedantic) - + Only check the code for syntax errors (-fsyntax-only) 只进行语法检查(不编译)(-fsyntax-only) - + Make all warnings into errors (-Werror) 将警告作为错误处理(-Werror) - + Abort compilation on first error (-Wfatal-errors) 遇到第一个错误后立即中止编译(-Wfatal-errors) - + Linker 链接器 - + Link an Objective C program (-lobjc) 链接Objective-C程序 (-lobjc) - + Do not use standard system libraries (-nostdlib) 不使用标准库和系统启动文件(-nostdlib) - + Do not create a console window (-mwindows) 不产生控制台窗口(-mwindows) - + Strip executable (-s) 剥除附加信息(-s) @@ -6131,91 +6151,91 @@ Are you really want to continue? 链接Ojbective C程序(-lobjc) - + Output 输出 - + Put comments in generated assembly code (-fverbose-asm) 在生成的汇编代码中加入注释(-fverbose-asm) - + Use pipes instead of temporary files during compilation (-pipe) 编译时使用管道而不是临时文件(-pipe) - + Do not assemble, compile and generate the assemble code (-S) 只生成汇编代码(-S) - - + + Confirm 确认 - + The following problems were found during validation of compiler set "%1": 在验证编译器设置"%1"时遇到了下列问题: - + Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths? 是否让小熊猫C++删除这些配置,并尝试重新建立配置? - + Leaving those directories will lead to problems during compilation.<br /><br />Unless you know exactly what you're doing, it is recommended that you click Yes. 如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果, - - + + Compiler set not configuared. 未配置编译器设置。 - + Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? 您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2 - + Binaries 二进制文件 - + Libraries 库文件 - + C Includes C包含文件 - + C++ Includes C++包含文件 - + No - + Yes - + untitled 无标题 @@ -6226,22 +6246,22 @@ Are you really want to continue? 下标"%1"越界 - + bytes 字节 - + KB KB - + MB MB - + GB GB @@ -6613,12 +6633,12 @@ Are you really want to continue? 整个单词 - + Wrap Around 循环查找 - + Regular Expression 正则表达式 @@ -6695,7 +6715,7 @@ Are you really want to continue? - + Find 查找 @@ -6711,8 +6731,8 @@ Are you really want to continue? - - + + Replace 替换 @@ -6722,7 +6742,7 @@ Are you really want to continue? 在文件中替换 - + Replace this occurrence of ''%1''? 替换这里的"%1"? @@ -6986,7 +7006,7 @@ Are you really want to continue? 自动链接 - + @@ -7062,15 +7082,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 @@ -7169,12 +7189,12 @@ Are you really want to continue? SettingsWidget - + Load Error 载入失败 - + Save Error 保存失败 diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index a2da0f1b..055e5857 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -282,6 +282,8 @@ QString Compiler::getCharsetArgument(const QByteArray& encoding) if (compilerSet()->autoAddCharsetParams() && encoding != ENCODING_ASCII && compilerSet()->compilerType()!="Clang") { QString encodingName; + QString execEncodingName; + QString compilerSetExecCharset = compilerSet()->execCharset(); QString systemEncodingName=pCharsetInfoManager->getDefaultSystemEncoding(); if (encoding == ENCODING_SYSTEM_DEFAULT) { encodingName = systemEncodingName; @@ -290,8 +292,14 @@ QString Compiler::getCharsetArgument(const QByteArray& encoding) } else { encodingName = encoding; } + if (compilerSetExecCharset == ENCODING_SYSTEM_DEFAULT + || compilerSetExecCharset.isEmpty()) { + execEncodingName = systemEncodingName; + } else { + execEncodingName = compilerSetExecCharset; + } result += QString(" -finput-charset=%1 -fexec-charset=%2") - .arg(encodingName,systemEncodingName); + .arg(encodingName, execEncodingName); } return result; } diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index d3d3fef9..913e4a55 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1631,6 +1631,16 @@ void Editor::deleteWord() ExecuteCommand(SynEditorCommand::ecDeleteWord,QChar(),nullptr); } +void Editor::deleteToWordStart() +{ + ExecuteCommand(SynEditorCommand::ecDeleteWordStart,QChar(),nullptr); +} + +void Editor::deleteToWordEnd() +{ + ExecuteCommand(SynEditorCommand::ecDeleteWordEnd,QChar(),nullptr); +} + void Editor::deleteLine() { ExecuteCommand(SynEditorCommand::ecDeleteLine,QChar(),nullptr); diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index de3997ed..e2a0247f 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -205,6 +205,8 @@ public: bool notParsed(); void insertLine(); void deleteWord(); + void deleteToWordStart(); + void deleteToWordEnd(); void deleteLine(); void duplicateLine(); void deleteToEOL(); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 535bf76c..22ce6e38 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -6160,3 +6160,21 @@ void MainWindow::on_actionInterrupt_triggered() mDebugger->interrupt(); } } + +void MainWindow::on_actionDelete_Last_Word_triggered() +{ + Editor *e=mEditorList->getEditor(); + if (e) { + e->deleteToWordStart(); + } +} + + +void MainWindow::on_actionDelete_to_Word_End_triggered() +{ + Editor *e=mEditorList->getEditor(); + if (e) { + e->deleteToWordEnd(); + } +} + diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index d0c7d868..fc1f0b29 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -557,6 +557,10 @@ private slots: void on_actionInterrupt_triggered(); + void on_actionDelete_Last_Word_triggered(); + + void on_actionDelete_to_Word_End_triggered(); + private: Ui::MainWindow *ui; EditorList *mEditorList; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 0cc17bcf..f53d6e81 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -540,7 +540,6 @@ - 50 false @@ -1395,7 +1394,7 @@ 0 0 1114 - 26 + 25 @@ -1469,6 +1468,8 @@ + + @@ -2675,6 +2676,25 @@ Interrupt + + + Delete To Word Begin + + + Delete To Word Begin + + + Ctrl+Shift+B + + + + + Delete to Word End + + + Ctrl+Shift+E + + diff --git a/RedPandaIDE/qsynedit/KeyStrokes.cpp b/RedPandaIDE/qsynedit/KeyStrokes.cpp index 43c9951e..78879b5a 100644 --- a/RedPandaIDE/qsynedit/KeyStrokes.cpp +++ b/RedPandaIDE/qsynedit/KeyStrokes.cpp @@ -217,7 +217,7 @@ void SynEditKeyStrokes::resetDefaults() add(SynEditorCommand::ecDeleteChar, Qt::Key_Delete, Qt::NoModifier); add(SynEditorCommand::ecDeleteLastChar, Qt::Key_Backspace, Qt::NoModifier); add(SynEditorCommand::ecDeleteLastChar, Qt::Key_Backspace, Qt::ShiftModifier); - add(SynEditorCommand::ecDeleteLastWord, Qt::Key_Backspace, Qt::ControlModifier); + add(SynEditorCommand::ecDeleteWordStart, Qt::Key_Backspace, Qt::ControlModifier); add(SynEditorCommand::ecUndo, Qt::Key_Backspace, Qt::AltModifier); add(SynEditorCommand::ecRedo, Qt::Key_Backspace, Qt::AltModifier|Qt::ShiftModifier); add(SynEditorCommand::ecLineBreak, Qt::Key_Return, Qt::NoModifier); diff --git a/RedPandaIDE/qsynedit/KeyStrokes.h b/RedPandaIDE/qsynedit/KeyStrokes.h index e021bbe2..4e8d4bda 100644 --- a/RedPandaIDE/qsynedit/KeyStrokes.h +++ b/RedPandaIDE/qsynedit/KeyStrokes.h @@ -135,8 +135,8 @@ enum class SynEditorCommand { ecDeleteLastChar = 501, // Delete last char (i.e. backspace key) ecDeleteChar = 502, // Delete char at cursor (i.e. delete key) - ecDeleteWord = 503, // Delete from cursor to end of word - ecDeleteLastWord = 504, // Delete from cursor to start of word + ecDeleteWordEnd = 503, // Delete from cursor to end of word + ecDeleteWordStart = 504, // Delete from cursor to start of word ecDeleteBOL = 505, // Delete from cursor to beginning of line ecDeleteEOL = 506, // Delete from cursor to end of line ecDeleteLine = 507, // Delete current line @@ -148,6 +148,7 @@ enum class SynEditorCommand { ecMoveSelUp = 513, // Move selection up ecMoveSelDown = 514, // Move selection down ecImeStr = 550, // Insert character(s) from IME + ecDeleteWord = 551, // Delete current Word ecUndo = 601, // Perform undo if available ecRedo = 602, // Perform redo if available diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 617ade1c..6e60382a 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -1373,8 +1373,8 @@ BufferCoord SynEdit::wordEndEx(const BufferCoord &XY) // valid line? if ((CY >= 1) && (CY <= mLines->count())) { QString Line = mLines->getString(CY - 1); - if (CX <= Line.length() && CX-2>=0) { - if (isWordChar(Line[CX - 2])) + if (CX <= Line.length() && CX-1>=0) { + if (isWordChar(Line[CX - 1])) CX = StrScanForNonWordChar(Line, CX); if (CX == 0) CX = Line.length() + 1; @@ -2022,12 +2022,27 @@ void SynEdit::doDeleteToEOL() deleteFromTo(caretXY(),BufferCoord{lineText().length()+1,mCaretY}); } -void SynEdit::doDeleteLastWord() +void SynEdit::doDeleteToWordStart() { if (mReadOnly) return; - BufferCoord start = prevWordPos(); - BufferCoord end = wordEndEx(start); + BufferCoord start = wordStart(); + BufferCoord end = caretXY(); + if (start==end) { + start = prevWordPos(); + } + deleteFromTo(start,end); +} + +void SynEdit::doDeleteToWordEnd() +{ + if (mReadOnly) + return; + BufferCoord start = caretXY(); + BufferCoord end = wordEnd(); + if (start == end) { + end = wordEndEx(nextWordPos()); + } deleteFromTo(start,end); } @@ -5099,8 +5114,8 @@ int SynEdit::insertTextByNormalMode(const QString &Value) sLeftSide = GetLeftSpacing(calcIndentSpaces(caretY,s,true),true); } Str = sLeftSide + s; - } - Str = Value.mid(0, P - Start); + } else + Str = sLeftSide + Value.mid(0, P - Start); properSetLine(caretY - 1, Str); mLines->insertLines(caretY, CountLines(Value,P)); } else { @@ -5426,8 +5441,11 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData) case SynEditorCommand::ecDeleteEOL: doDeleteToEOL(); break; - case SynEditorCommand::ecDeleteLastWord: - doDeleteLastWord(); + case SynEditorCommand::ecDeleteWordStart: + doDeleteToWordStart(); + break; + case SynEditorCommand::ecDeleteWordEnd: + doDeleteToWordEnd(); break; case SynEditorCommand::ecDeleteBOL: doDeleteFromBOL(); diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index 5ddfb7c4..542db9f3 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -553,7 +553,8 @@ private: void doDeleteCurrentChar(); void doDeleteWord(); void doDeleteToEOL(); - void doDeleteLastWord(); + void doDeleteToWordStart(); + void doDeleteToWordEnd(); void doDeleteFromBOL(); void doDeleteLine(); void doSelecteLine(); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 8240c5d0..b2b09137 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1387,6 +1387,7 @@ void Settings::Editor::setTabToSpaces(bool tabToSpaces) Settings::CompilerSet::CompilerSet(const QString& compilerFolder): mAutoAddCharsetParams(true), + mExecCharset(ENCODING_SYSTEM_DEFAULT), mStaticLink(true) { if (!compilerFolder.isEmpty()) { @@ -2307,14 +2308,14 @@ QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const return result.trimmed(); } -const QString &Settings::CompilerSet::execCharser() const +const QString &Settings::CompilerSet::execCharset() const { - return mExecCharser; + return mExecCharset; } -void Settings::CompilerSet::setExecCharser(const QString &newExecCharser) +void Settings::CompilerSet::setExecCharset(const QString &newExecCharset) { - mExecCharser = newExecCharser; + mExecCharset = newExecCharset; } const QString &Settings::CompilerSet::debugServer() const @@ -2760,7 +2761,7 @@ void Settings::CompilerSets::saveSet(int index) mSettings->mSettings.setValue("customLinkParams", pSet->customLinkParams()); mSettings->mSettings.setValue("AddCharset", pSet->autoAddCharsetParams()); mSettings->mSettings.setValue("StaticLink", pSet->staticLink()); - mSettings->mSettings.setValue("ExecCharser", pSet->execCharser()); + mSettings->mSettings.setValue("ExecCharset", pSet->execCharset()); // Misc. properties mSettings->mSettings.setValue("DumpMachine", pSet->dumpMachine()); @@ -2820,13 +2821,16 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index) pSet->setIniOptions(mSettings->mSettings.value("Options").toByteArray()); // Save extra 'general' options - pSet->setUseCustomCompileParams(mSettings->mSettings.value("useCustomCompileParams").toBool()); + pSet->setUseCustomCompileParams(mSettings->mSettings.value("useCustomCompileParams", false).toBool()); pSet->setCustomCompileParams(mSettings->mSettings.value("customCompileParams").toString()); - pSet->setUseCustomLinkParams(mSettings->mSettings.value("useCustomLinkParams").toBool()); + pSet->setUseCustomLinkParams(mSettings->mSettings.value("useCustomLinkParams", false).toBool()); pSet->setCustomLinkParams(mSettings->mSettings.value("customLinkParams").toString()); - pSet->setAutoAddCharsetParams(mSettings->mSettings.value("AddCharset").toBool()); - pSet->setStaticLink(mSettings->mSettings.value("StaticLink").toBool()); - pSet->setExecCharser(mSettings->mSettings.value("ExecCharser").toString()); + pSet->setAutoAddCharsetParams(mSettings->mSettings.value("AddCharset", true).toBool()); + pSet->setStaticLink(mSettings->mSettings.value("StaticLink", false).toBool()); + pSet->setExecCharset(mSettings->mSettings.value("ExecCharset", ENCODING_SYSTEM_DEFAULT).toString()); + if (pSet->execCharset().isEmpty()) { + pSet->setExecCharset(ENCODING_SYSTEM_DEFAULT); + } pSet->setDumpMachine(mSettings->mSettings.value("DumpMachine").toString()); pSet->setVersion(mSettings->mSettings.value("Version").toString()); diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 62ff1c4d..baf87a47 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -1177,8 +1177,8 @@ public: int compilerSetType() const; void setCompilerSetType(int newCompilerSetType); - const QString &execCharser() const; - void setExecCharser(const QString &newExecCharser); + const QString &execCharset() const; + void setExecCharset(const QString &newExecCharset); private: // Initialization @@ -1225,7 +1225,7 @@ public: QString mCustomCompileParams; QString mCustomLinkParams; bool mAutoAddCharsetParams; - QString mExecCharser; + QString mExecCharset; bool mStaticLink; // Options diff --git a/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp b/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp index 60f451b7..08ddb91e 100644 --- a/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp +++ b/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp @@ -59,9 +59,9 @@ CompilerSetOptionWidget::~CompilerSetOptionWidget() void CompilerSetOptionWidget::init() { + ui->cbEncoding->setVisible(false); ui->cbEncodingDetails->setVisible(false); ui->cbEncoding->clear(); - ui->cbEncoding->addItem(tr("Auto detect"),ENCODING_AUTO_DETECT); ui->cbEncoding->addItem(tr("ANSI"),ENCODING_SYSTEM_DEFAULT); ui->cbEncoding->addItem(tr("UTF-8"),ENCODING_UTF8); foreach (const QString& langName, pCharsetInfoManager->languageNames()) { @@ -143,6 +143,26 @@ static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSet ui->txtGDBServer->setText(pSet->debugServer()); ui->txtResourceCompiler->setText(pSet->resourceCompiler()); ui->txtProfiler->setText(pSet->profiler()); + + ui->cbEncoding->setVisible(pSet->autoAddCharsetParams()); + if (pSet->execCharset() == ENCODING_AUTO_DETECT + || pSet->execCharset() == ENCODING_SYSTEM_DEFAULT + || pSet->execCharset() == ENCODING_UTF8) { + ui->cbEncoding->setCurrentText(pSet->execCharset()); + ui->cbEncodingDetails->clear(); + ui->cbEncodingDetails->setVisible(false); + } else { + QString encoding = pSet->execCharset(); + QString language = pCharsetInfoManager->findLanguageByCharsetName(encoding); + ui->cbEncoding->setCurrentText(language); + ui->cbEncodingDetails->setVisible(true); + ui->cbEncodingDetails->clear(); + QList infos = pCharsetInfoManager->findCharsetsByLanguageName(language); + foreach (const PCharsetInfo& info, infos) { + ui->cbEncodingDetails->addItem(info->name); + } + ui->cbEncodingDetails->setCurrentText(encoding); + } } void CompilerSetOptionWidget::doLoad() @@ -198,7 +218,6 @@ void CompilerSetOptionWidget::reloadCurrentCompilerSet() mLibDirWidget->setDirList(pSet->libDirs()); mCIncludeDirWidget->setDirList(pSet->CIncludeDirs()); mCppIncludeDirWidget->setDirList(pSet->CppIncludeDirs()); - } void CompilerSetOptionWidget::saveCurrentCompilerSet() @@ -226,6 +245,12 @@ void CompilerSetOptionWidget::saveCurrentCompilerSet() pSet->CIncludeDirs()=mCIncludeDirWidget->dirList(); pSet->CppIncludeDirs()=mCppIncludeDirWidget->dirList(); + if (ui->cbEncodingDetails->isVisible()) { + pSet->setExecCharset(ui->cbEncodingDetails->currentText()); + } else { + pSet->setExecCharset(ui->cbEncoding->currentText()); + } + //read values in the options widget QTabWidget* pTab = ui->optionTabs; for (int i=0;icount();i++) { @@ -324,3 +349,28 @@ void CompilerSetOptionWidget::updateIcons() pIconsManager->setIcon(ui->btnChooseProfiler, IconsManager::ACTION_FILE_OPEN_FOLDER); pIconsManager->setIcon(ui->btnChooseResourceCompiler, IconsManager::ACTION_FILE_OPEN_FOLDER); } + +void CompilerSetOptionWidget::on_cbEncoding_currentTextChanged(const QString &arg1) +{ + QString userData = ui->cbEncoding->currentData().toString(); + if (userData == ENCODING_AUTO_DETECT + || userData == ENCODING_SYSTEM_DEFAULT + || userData == ENCODING_UTF8) { + ui->cbEncodingDetails->setVisible(false); + ui->cbEncodingDetails->clear(); + } else { + ui->cbEncodingDetails->setVisible(true); + ui->cbEncodingDetails->clear(); + QList infos = pCharsetInfoManager->findCharsetsByLanguageName(userData); + foreach (const PCharsetInfo& info, infos) { + ui->cbEncodingDetails->addItem(info->name); + } + } +} + + +void CompilerSetOptionWidget::on_cbEncodingDetails_currentTextChanged(const QString &arg1) +{ + +} + diff --git a/RedPandaIDE/settingsdialog/compilersetoptionwidget.h b/RedPandaIDE/settingsdialog/compilersetoptionwidget.h index 4fbba03a..0c0d4b9b 100644 --- a/RedPandaIDE/settingsdialog/compilersetoptionwidget.h +++ b/RedPandaIDE/settingsdialog/compilersetoptionwidget.h @@ -61,6 +61,8 @@ private slots: void on_btnRemoveCompilerSet_pressed(); void updateIcons(); + void on_cbEncoding_currentTextChanged(const QString &arg1); + void on_cbEncodingDetails_currentTextChanged(const QString &arg1); }; #endif // COMPILERSETOPTIONWIDGET_H