From 32088a18d0cd6165cc1220fb8717c03c54455dba Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 6 Jan 2023 11:59:21 +0800 Subject: [PATCH] - change: Disable undo limit by default. --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 1 + RedPandaIDE/settings.cpp | 2 +- .../environmentperformancewidget.cpp | 37 +- .../environmentperformancewidget.ui | 67 ++- RedPandaIDE/translations/RedPandaIDE_pt_BR.ts | 12 + RedPandaIDE/translations/RedPandaIDE_zh_CN.ts | 405 +++++++++--------- RedPandaIDE/translations/RedPandaIDE_zh_TW.ts | 12 + 8 files changed, 316 insertions(+), 221 deletions(-) diff --git a/NEWS.md b/NEWS.md index b189007e..d92dc8c3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,6 +17,7 @@ Red Panda C++ Version 2.8 - enhancement: Print current selection can be used in the print dialog. - enhancement: Print syntax colored content. - enhancement: Correctly handle tab in the exported RTF. + - change: Disable undo limit by default. Red Panda C++ Version 2.7 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 8ecdc004..5cce39e6 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -2817,6 +2817,7 @@ void Editor::reparse(bool resetParser) return; if (!mParser->enabled()) return; + //mParser->setEnabled(pSettings->codeCompletion().enabled()); ParserLanguage language = mUseCppSyntax?ParserLanguage::CPlusPlus:ParserLanguage::C; if (!inProject()) { diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 9d9db9b1..9b53da5d 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1529,7 +1529,7 @@ void Settings::Editor::doLoad() mDefaultEncoding = value("default_encoding", ENCODING_UTF8).toByteArray(); mAutoDetectFileEncoding = boolValue("auto_detect_file_encoding",true); mUndoLimit = intValue("undo_limit",0); - mUndoMemoryUsage = intValue("undo_memory_usage", 10); + mUndoMemoryUsage = intValue("undo_memory_usage", 0); mAutoFormatWhenSaved = boolValue("auto_format_when_saved", false); mRemoveTrailingSpacesWhenSaved = boolValue("remove_trailing_spaces_when_saved",false); mParseTodos = boolValue("parse_todos",true); diff --git a/RedPandaIDE/settingsdialog/environmentperformancewidget.cpp b/RedPandaIDE/settingsdialog/environmentperformancewidget.cpp index 5cdfdcdc..576ed84c 100644 --- a/RedPandaIDE/settingsdialog/environmentperformancewidget.cpp +++ b/RedPandaIDE/settingsdialog/environmentperformancewidget.cpp @@ -33,26 +33,27 @@ EnvironmentPerformanceWidget::~EnvironmentPerformanceWidget() void EnvironmentPerformanceWidget::doLoad() { ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden()); -#ifdef Q_OS_WIN - MEMORYSTATUSEX statex; +//#ifdef Q_OS_WIN +// MEMORYSTATUSEX statex; - statex.dwLength = sizeof (statex); +// statex.dwLength = sizeof (statex); - GlobalMemoryStatusEx (&statex); - if (statex.ullTotalPhys < (long long int)2*1024*1024*1024) { - ui->chkClearWhenEditorHidden->setEnabled(false); - ui->chkClearWhenEditorHidden->setChecked(true); - pSettings->codeCompletion().setClearWhenEditorHidden(true); - pSettings->codeCompletion().save(); - } - if (statex.ullTotalPhys < (long long int)1024*1024*1024) { - ui->chkEditorsShareParser->setEnabled(false); - ui->chkEditorsShareParser->setChecked(true); - pSettings->codeCompletion().setShareParser(true); - pSettings->codeCompletion().save(); - } -#endif +// GlobalMemoryStatusEx (&statex); +// if (statex.ullTotalPhys < (long long int)2*1024*1024*1024) { +// ui->chkClearWhenEditorHidden->setEnabled(false); +// ui->chkClearWhenEditorHidden->setChecked(true); +// pSettings->codeCompletion().setClearWhenEditorHidden(true); +// pSettings->codeCompletion().save(); +// } +// if (statex.ullTotalPhys < (long long int)1024*1024*1024) { +// ui->chkEditorsShareParser->setEnabled(false); +// ui->chkEditorsShareParser->setChecked(true); +// pSettings->codeCompletion().setShareParser(true); +// pSettings->codeCompletion().save(); +// } +//#endif ui->chkEditorsShareParser->setChecked(pSettings->codeCompletion().shareParser()); + ui->spinMaxUndoMemory->setValue(pSettings->editor().undoMemoryUsage()); } void EnvironmentPerformanceWidget::doSave() @@ -61,4 +62,6 @@ void EnvironmentPerformanceWidget::doSave() pSettings->codeCompletion().setShareParser(ui->chkEditorsShareParser->isChecked()); pSettings->codeCompletion().save(); + pSettings->editor().setUndoMemoryUsage(ui->spinMaxUndoMemory->value()); + pSettings->editor().save(); } diff --git a/RedPandaIDE/settingsdialog/environmentperformancewidget.ui b/RedPandaIDE/settingsdialog/environmentperformancewidget.ui index a838b646..81e455e3 100644 --- a/RedPandaIDE/settingsdialog/environmentperformancewidget.ui +++ b/RedPandaIDE/settingsdialog/environmentperformancewidget.ui @@ -13,25 +13,76 @@ Form - + Reduce Memory Usage - - + + + + + Editors share one code parser + + + + Auto clear parsed symbols when editor hidden - - - - Editors share one code parser - + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Max undo memory for each editor: + + + + + + + MB + + + 100 + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index 80c0f008..f212a42d 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -1819,6 +1819,14 @@ Editors share one code parser + + Max undo memory for each editor: + + + + MB + MB + EnvironmentProgramsWidget @@ -4928,6 +4936,10 @@ Line: %1 Col: %2 Lines: %3 + + Newline + + NewClassDialog diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index 575da5df..8ee6ca60 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -1377,13 +1377,13 @@ Are you really want to continue? 失败 - - - - - - - + + + + + + + Error 错误 @@ -1392,44 +1392,44 @@ Are you really want to continue? 无法写入文件"%1" - + Save As 另存为 - + File %1 already openned! 文件%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+单击以获取更多信息 @@ -1438,27 +1438,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 只读 @@ -2457,12 +2457,22 @@ Are you really want to continue? 减少内存用量 - + Auto clear parsed symbols when editor hidden 自动清理被隐藏的编辑器中的符号表 - + + Max undo memory for each editor: + 每个编辑窗口的撤销功能内存上限 + + + + MB + MB + + + Editors share one code parser 编辑器共享同一个代码分析器 @@ -4107,11 +4117,11 @@ Are you really want to continue? - - - - - + + + + + Issues 编译器 @@ -4549,7 +4559,7 @@ Are you really want to continue? - + New Problem Set 新建试题集 @@ -4571,7 +4581,7 @@ Are you really want to continue? - + Save Problem Set 保存试题集 @@ -4579,7 +4589,7 @@ Are you really want to continue? - + Load Problem Set 载入试题集 @@ -4710,14 +4720,14 @@ Are you really want to continue? - + Import FPS Problem Set 导入FPS试题集 - + Export FPS Problem Set 导出FPS试题集 @@ -4954,7 +4964,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -5206,7 +5216,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -5227,13 +5237,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -5606,22 +5616,22 @@ Are you really want to continue? - - + + Wrong Compiler Settings 错误的编译器设置 - - + + Compiler is set not to generate executable. 编译器被设置为不生成可执行文件。 - + We need the executabe to run problem case. 我们需要可执行文件来运行试题案例。 @@ -5687,7 +5697,7 @@ Are you really want to continue? - + Please correct this before start debugging 请在调试前改正设置。 @@ -5730,7 +5740,7 @@ Are you really want to continue? - + Batch Set Cases 批量设置案例 @@ -5745,22 +5755,22 @@ Are you really want to continue? 全部复制 - + Go to Line 跳转到行 - + Line - + Template Exists 模板已存在 - + Template %1 already exists. Do you want to overwrite? 模板%1已存在。是否覆盖? @@ -5786,7 +5796,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -5834,12 +5844,12 @@ Are you really want to continue? 试题属性... - + Set Problem Set Name 设置试题集名称 - + Problem Set Name: 试题集名称: @@ -5859,16 +5869,16 @@ Are you really want to continue? 修改描述 - - - + + + Bookmark Description 书签描述 - - - + + + Description: 描述: @@ -5892,12 +5902,12 @@ Are you really want to continue? 断点条件... - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: @@ -5919,18 +5929,18 @@ Are you really want to continue? - + Add Folder 添加文件夹 - - + + New folder 新文件夹 - + Folder name: 文件夹: @@ -6036,7 +6046,7 @@ Are you really want to continue? - + New Folder 新建文件夹 @@ -6047,9 +6057,9 @@ Are you really want to continue? - - + + Delete 删除 @@ -6084,22 +6094,27 @@ Are you really want to continue? 转换为%1编码 - + + Newline + 换行符 + + + %1 files autosaved 已自动保存%1个文件 - + Set answer to... 设置答案源代码... - + select other file... 选择其他文件... - + Select Answer Source File 选择答案源代码文件 @@ -6108,17 +6123,17 @@ Are you really want to continue? 中止 - + FPS Problem Set Files (*.fps;*.xml) FPS试题集文件(*.fps;*.xml) - + FPS Problem Set Files (*.fps) FPS试题集文件(*.fps) - + Export Error 导出时出错 @@ -6128,7 +6143,7 @@ Are you really want to continue? C/C++源代码文件 (*.c *.cpp *.cc *.cxx) - + New Folder %1 新建文件夹%1 @@ -6141,68 +6156,68 @@ Are you really want to continue? 无标题%1 - + Do you really want to delete %1? 你真的要删除%1吗? - + Do you really want to delete %1 files? 你真的要删除%1个文件吗? - + 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? 你真的想要那么做吗? @@ -6211,12 +6226,12 @@ Are you really want to continue? 批量设置案例 - + Choose input files 选择输入数据文件 - + Input data files (*.in) 输入数据文件 (*.in) @@ -6225,78 +6240,78 @@ Are you really want to continue? 无标题%1 - + Modify Watch 修改监视表达式 - + Watch Expression 监视表达式 - + 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 - + Folder %1 is not empty. 文件夹%1不是空的。 - + Do you really want to delete it? 你真的要删除它吗? - + Change working folder 改变工作文件夹 - + File '%1' is not in the current working folder. File '%1' is not in the current working folder 文件'%1'不在当前工作文件夹中。 - + Do you want to change working folder to '%1'? 是否将工作文件夹改设为'%1'? @@ -6305,28 +6320,28 @@ Are you really want to continue? 正在删除试题... - + Can't Commit 无法提交 - + Git needs user info to commit. Git需要用信息进行提交。 - + Choose Input Data File 选择输入数据文件 - - + + All files (*.*) 所有文件 (*.*) - + Choose Expected Output Data File Choose Expected Input Data File 选择期望输出文件 @@ -6338,59 +6353,59 @@ Are you really want to continue? - + Choose Working Folder 选择工作文件夹 - - + + Header Exists 头文件已存在 - - + + Header file "%1" already exists! 头文件"%1"已存在! - + Source Exists 源文件已存在! - + Source file "%1" already exists! 源文件"%1"已存在! - + Can't commit! 无法提交! - + The following files are in conflicting: 下列文件处于冲突状态,请解决后重新添加和提交: - + Commit Message 提交信息 - + Commit Message: 提交信息: - + Commit Failed 提交失败 - + Commit message shouldn't be empty! 提交信息不能为空! @@ -6399,22 +6414,22 @@ Are you really want to continue? 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Remove file 删除文件 - + Remove the file from disk? 同时从硬盘上删除文件? @@ -6423,27 +6438,27 @@ Are you really want to continue? 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 @@ -6464,86 +6479,86 @@ Are you really want to continue? 请在工具栏中选择Debug编译器配置集,或者在“编译器配置集”设置的“编译/链接选项”页中<b>启用</b>“生成调试信息(-g3)”、<b>禁用</b>“剥除附件信息(-3)”。 - + C/C++ Source Files (*.c *.cpp *.cc *.cxx) C/C++源代码文件 (*.c *.cpp *.cc *.cxx) - + This operation will remove all cases for the current problem. 本操作会删除此试题的所有案例。 - + 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 @@ -6557,13 +6572,13 @@ Are you really want to continue? - - - - - - - + + + + + + + Error 错误 @@ -6584,85 +6599,85 @@ Are you really want to continue? 清除历史 - - + + Version Control 版本控制 - + 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个文件) @@ -7590,22 +7605,22 @@ 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 选择图标文件 - + Image Files (*.ico *.png *.jpg) 图像文件 (*.ico *.png *.jpg) @@ -9326,7 +9341,7 @@ Are you really want to continue? - + Compiler Set @@ -9335,7 +9350,7 @@ Are you really want to continue? - + Compiler @@ -9347,7 +9362,7 @@ Are you really want to continue? 自动链接 - + @@ -9424,15 +9439,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index a768d15d..49aa590b 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -1692,6 +1692,14 @@ Editors share one code parser + + Max undo memory for each editor: + + + + MB + + EnvironmentProgramsWidget @@ -4741,6 +4749,10 @@ Line: %1 Col: %2 Lines: %3 + + Newline + + NewClassDialog