diff --git a/NEWS.md b/NEWS.md index a00c9b35..77e56d47 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,10 @@ Red Panda C++ Version 1.1.5 - enhancement: double clicking a non-text file in the project's view, will open it with external program - fix: correctly update the start postion of selection after code completion - enhancement: add a demo template for raylib/rdrawing predefined colors + - enhancement: add select current word command in the Selection menu + - change: add Selection menu + - enhancement: add memory view rows/columns settings in the settings dialog -> debugger -> general panel + - enhancement: add "Go to Line..." in the Code menu Red Panda C++ Version 1.1.4 diff --git a/RedPandaIDE/RedPandaIDE_pt.ts b/RedPandaIDE/RedPandaIDE_pt.ts index 4f185d83..bc1efddf 100644 --- a/RedPandaIDE/RedPandaIDE_pt.ts +++ b/RedPandaIDE/RedPandaIDE_pt.ts @@ -784,6 +784,18 @@ Show disassembly code in blend mode + + Memory View + + + + Memory View Rows + + + + Memory View Columns + + Debugger @@ -4496,6 +4508,26 @@ untitled%1 + + Selection + + + + Select Word + + + + Go to Line... + + + + Go to Line + + + + Line + + NewClassDialog diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index c6f7c999..3f79395b 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -188,17 +188,17 @@ p, li { white-space: pre-wrap; } BacktraceModel - + Function 函数 - + Filename 文件名 - + Line @@ -244,37 +244,37 @@ p, li { white-space: pre-wrap; } BreakpointModel - + Filename 文件名 - + Line - + Condition 条件 - + Save file '%1' failed. 保存文件'%1'失败。 - + Can't open file '%1' for write. 无法写入文件'%1'. - + Error in json file '%1':%2 : %3 JSON文件'%1':%2中存在错误:%3 - + Can't open file '%1' for read. 无法读取文件'%1'. @@ -1110,7 +1110,22 @@ Are you really want to continue? 显示详细调试器日志 - + + Memory View + 内存视图 + + + + Memory View Rows + 内存视图行数 + + + + Memory View Columns + 内存视图列数 + + + Show CPU Window when signal received 程序收到信号停止时缺省打开CPU窗口 @@ -1119,17 +1134,17 @@ Are you really want to continue? 在调试主控台中显示gdb输出注解 - + Autosave 自动保存 - + Autosave breakpoints 自动保存断点 - + Autosave watches 自动保存监视 @@ -1138,27 +1153,27 @@ Are you really want to continue? 反汇编代码样式 - + CPU Window CPU信息窗口 - + Disassembly Coding Style: 反汇编代码样式 - + Intel Intel - + AT&&T AT&&T - + Show disassembly code in blend mode 以混合模式显示反汇编代码 @@ -1224,7 +1239,7 @@ Are you really want to continue? 无法在"%1"找到gdb server - + Execute to evaluate 执行以求值 @@ -1233,22 +1248,22 @@ Are you really want to continue? 不在当前语境中 - + Compile 编译 - + Source file is more recent than executable. 源文件比程序文件新。 - + Recompile? 重新编译? - + Signal "%1" Received: 收到信号"%1": @@ -1319,9 +1334,9 @@ Are you really want to continue? 打印文档 - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 @@ -1330,27 +1345,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 只读 @@ -3840,13 +3855,13 @@ Are you really want to continue? 小熊猫C++ - - + + - + Issues 编译器 @@ -3865,8 +3880,8 @@ Are you really want to continue? 工具 - - + + Run 运行 @@ -3876,27 +3891,27 @@ Are you really want to continue? 编辑 - - - + + + Project 项目 - - + + Watch 监视 - - + + Structure 结构 - - + + Files 文件 @@ -3905,69 +3920,69 @@ Are you really want to continue? 资源 - - - - - + + + + + Debug 调试 - + Evaluate: 求值 - + Debug Console 调试主控台 - + Call Stack 调用栈 - + Breakpoints 断点 - + Locals 局部变量 - - - + + + Search 查找 - + History: 历史: - + Search Again 重新查找 - + Replace with: 替换为: - + Replace 替换 - + Close 关闭 @@ -3977,13 +3992,13 @@ Are you really want to continue? 运行 - - + + Code 代码 - + Window 窗口 @@ -4001,133 +4016,138 @@ Are you really want to continue? 新建 - + Ctrl+N Ctrl+N - + Open... 打开... - + Ctrl+O Ctrl+O - + Save 保存 - + Ctrl+S Ctrl+S - + Save As... 另存为... - + Save As 另存为 - + Save All 全部保存 - + Ctrl+Shift+S Ctrl+Shift+S - + Options 选项 - - - + + + Compile 编译 - - + + Tools Output 工具输出 - - + + Choose Input File 选择输入文件 - + ... ... - + Tool Panels 工具面板 - + Git Git - + + Selection + 选择 + + + F9 F9 - + F10 F10 - + Undo 恢复 - + Ctrl+Z Ctrl+Z - + Redo 重做 - + Ctrl+Y Ctrl+Y - + Cut 剪切 - + Ctrl+X Ctrl+X - + @@ -4135,279 +4155,279 @@ Are you really want to continue? 复制 - + Ctrl+C Ctrl+C - + Paste 粘贴 - + Ctrl+V Ctrl+V - + Select All 选择全部 - + Ctrl+A Ctrl+A - + Indent 缩进 - + UnIndent 取消缩进 - + Toggle Comment 切换注释 - + Ctrl+/ Ctrl+/ - + Collapse All 全部收起 - + Uncollapse All 全部展开 - + Encode in ANSI 使用ANSI编码 - + Encode in UTF-8 使用UTF-8编码 - + Auto Detect 自动检测 - + Convert to ANSI 转换为ANSI编码 - + Convert to UTF-8 转换为UTF-8编码 - - + + Compile & Run 编译运行 - + F11 F11 - - + + Rebuild All 全部重编译 - + F12 F12 - + Stop Execution 停止执行 - + F6 F6 - + F5 F5 - + Step Over 单步跳过 - + F7 F7 - + Step Into 单步进入 - - - + + + Problem Set 试题集 - - - + + + New Problem Set 新建试题集 - - + + Add Problem 添加试题 - - + + Remove Problem 删除试题 - - - + + + Save Problem Set 保存试题集 - - - + + + Load Problem Set 载入试题集 - + Memory 内存 - + Address Expression: Address: 地址表达式: - + Cancel 取消 - - + + TODO TODO - - + + Bookmark 书签 - - - + + + Problem 试题 - - + + Add Probem Case 添加试题案例 - - + + Remove Problem Case Remove Problem Set 删除试题集 - - + + Open Anwser Source File 打开答案源代码文件 - - + + Run All Cases Run Current Case 运行所有案例 - + Problem Cases Validation Options 测试案例验证选项 - + %v/%m %v/%m - + Output 输出 - + Input 输入 - + Expected 期望输出 - + Help 帮助 - + Refactor 重构 - + View 视图 @@ -4416,583 +4436,593 @@ Are you really want to continue? 工具窗口 - + Main 主工具栏 - + Compiler Set 编译器配置集 - + Explorer 管理器 - + Messages 消息 - + Ignore Spaces 忽略空格 - - + + New Source File 新建源代码文件 - + Tab Tab - + Shift+Tab Shift+Tab - + F8 F8 - + Step Out 单步跳出 - + Ctrl+F8 Ctrl+F8 - + Run To Cursor 执行到光标处 - + Ctrl+F5 Ctrl+F5 - + Continue 继续执行 - + F4 F4 - + Add Watch... 添加监视 - + View CPU Window... 打开CPU信息窗口... - + Exit 退出 - + Find... 查找... - + Ctrl+F Ctrl+F - + Find in Files... 在文件中查找... - + Ctrl+Shift+F Ctrl+Shift+F - + Replace... 替换 - + Ctrl+R Ctrl+R - + Find Next 查找下一个 - + F3 F3 - + Find Previous 查找前一个 - + Shift+F3 Shift+F3 - + Remove Watch 删除监视值 - + Remove All Watches Remove All 删除全部监视值 - + Modify Watch... 修改监视值 - + Reformat Code 对代码重新排版 - + Ctrl+Shift+A Ctrl+Shift+A - + Go back 前一次编辑位置 - + Ctrl+Alt+Left Ctrl+Alt+Left - + Forward 后一次编辑位置 - + Ctrl+Alt+Right Ctrl+Alt+Right - + Ctrl+W Ctrl+W - + Close All 全部关闭 - + Ctrl+Shift+W Ctrl+Shift+W - + Maximize Editor 最大化编辑器 - + Ctrl+F11 Ctrl+F11 - + Next 下一窗口 - + Ctrl+Tab Ctrl+Tab - + Previous 前一窗口 - + Ctrl+Shift+Tab Ctrl+Shift+Tab - + Toggle breakpoint 切换断点 - + Ctrl+F4 Ctrl+F4 - - + + Clear all breakpoints 删除所有断点 - + Breakpoint property... 设置断点条件... - + Goto Declaration 跳转到声明处 - + Ctrl+Shift+G Ctrl+Shift+G - + Goto Definition 跳转到定义处 - + Ctrl+G Ctrl+G - + Find references 查找符号的引用 - + Open containing folder 打开所在的文件夹 - + Ctrl+B Ctrl+B - + Open a terminal here 打开命令行窗口 - + File Properties... 文件属性... - + Close Project 关闭项目 - + Project options 项目属性 - + New Project... 新建项目... - - + + New Project File 新建项目文件 - + F1 F1 - + Move Selection Up 向上移动选中的行 - + Ctrl+Shift+Up Ctrl+Shift+Up - + Move Selection Down 向下移动选中的行 - + Ctrl+Shift+Down Ctrl+Shift+Down - + Convert to UTF-8 BOM 转换为UTF-8 BOM编码 - + Encode in UTF-8 BOM 使用UTF-8 BOM编码 - + Compiler Options... 编译器选项... - + Toggle Explorer Panel 切换管理器面板 - + Ctrl+F9 Ctrl+F9 - + Toggle Messages Panel 切换消息面板 - + Ctrl+F10 Ctrl+F10 - + Raylib Manual Raylib教程 + + + Select Word + 选中当前单词 + + + + Go to Line... + 跳转到行... + New File 新建文件 - + Add to project... 添加到项目... - + Remove from project 从项目删除 - + View Makefile 查看Makefile - + Clean 清理构建文件 - + Open Folder in Explorer 在浏览器中打开 - + Open In Terminal 在终端中打开 - + About 关于 - - + + Rename Symbol 重命名符号 - + Shift+F6 Shift+F6 - + Print... 打印... - + Ctrl+P Ctrl+P - - + + Export As RTF 导出为RTF - - + + Export As HTML 导出为HTML - + Move To Other View 移动到其他视图 - + Ctrl+M Ctrl+M - - + + C++ Reference C++参考手册 - + C Reference C参考手册 - + Show Tool Panels 显示全部工具面板 - + Create Git Repository Create Repository 创建Git仓库 - + Commit 提交(Commit) - + Revert 撤销(Revert) - + Reset 回滚(Reset) - + Add Files 添加文件 - + Restore 还原(Restore) - + Website 官方网站 - + Branch/Switch 分支切换(Switch) - + Merge 合并(Merge) - - + + Show Log Log 显示日志(Log) - + Remotes... 远程仓库... - + Fetch 取回(Fetch) - + Pull 拉取(Pull) - + Push 推送(Push) - + Hide Non Support Files 隐藏不支持的文件 - + Toggle Block Comment 切换块注释 - + Alt+Shift+A Alt+Shift+A - + Match Bracket 匹配当前括号 - + Ctrl+] Ctrl+] @@ -5001,50 +5031,50 @@ Are you really want to continue? 工具窗口栏 - + Status Bar 状态栏 - + Ctrl+Backspace Ctrl+Backspace - + Interrupt 中断 - - + + Delete To Word Begin 删除到单词开头 - + Ctrl+Shift+B Ctrl+Shift+B - + Delete to Word End 删除到单词结尾 - + Ctrl+Shift+E Ctrl+Shift+E - + New Class... Add Class... 新建类... - - + + New Header... New Header 新建头文件... @@ -5054,47 +5084,47 @@ Are you really want to continue? 插入行 - + Delete Line 删除当前行 - + Ctrl+D Ctrl+D - + Duplicate Line 复制当前行 - + Ctrl+E Ctrl+E - + Delete Word 删除当前单词 - + Ctrl+Shift+D Ctrl+Shift+D - + Delete to EOL 删除到行尾 - + Ctrl+Del Ctrl+Del - + Delete to BOL 删除到行首 @@ -5103,27 +5133,27 @@ Are you really want to continue? C/C++参考 - + EGE Manual EGE图形库手册 - + Add Bookmark 添加书签 - + Remove Bookmark 删除书签 - + Modify Bookmark Description 修改书签说明 - + Locate in Files View 在文件视图中定位 @@ -5132,7 +5162,7 @@ Are you really want to continue? 打开文件夹 - + Running Parameters... 运行参数... @@ -5356,9 +5386,19 @@ Are you really want to continue? 全部复制 - - - + + Go to Line + 跳转到行 + + + + Line + + + + + + @@ -5377,7 +5417,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -5451,15 +5491,15 @@ Are you really want to continue? - - + + Bookmark Description 书签描述 - - + + Description: 描述: @@ -5589,7 +5629,7 @@ Are you really want to continue? - + Delete 删除 @@ -5683,7 +5723,7 @@ Are you really want to continue? - + Do you want to save it? 需要保存吗? @@ -5707,7 +5747,7 @@ Are you really want to continue? - + Save Error 保存失败 @@ -5747,104 +5787,104 @@ 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'? - + 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 选择期望输出文件 @@ -5854,61 +5894,61 @@ Are you really want to continue? 第%1行 - - - + + + 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! 提交信息不能为空! @@ -5917,53 +5957,53 @@ 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 添加到项目 @@ -5978,75 +6018,75 @@ Are you really want to continue? 本操作会删除此试题的所有案例。 - + 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 @@ -6066,7 +6106,7 @@ Are you really want to continue? - + Error 错误 @@ -6131,7 +6171,7 @@ Are you really want to continue? - + Confirm Convertion 确认转换 @@ -6139,7 +6179,7 @@ Are you really want to continue? - + 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 />你确定要继续吗? @@ -6154,18 +6194,18 @@ Are you really want to continue? 输入监视表达式 - + Parsing file %1 of %2: "%3" (%1/%2)正在解析文件"%3" - - + + Done parsing %1 files in %2 seconds 完成%1个文件的解析,用时%2秒 - + (%1 files per second) (每秒%1个文件) @@ -7449,7 +7489,7 @@ Are you really want to continue? 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? @@ -7558,23 +7598,23 @@ Are you really want to continue? 只生成汇编代码(-S) - - + + Confirm 确认 - + The following problems were found during validation of compiler set "%1": 在验证编译器设置"%1"时遇到了下列问题: - + Leaving those directories will lead to problems during compilation. 在配置中保留这些文件夹可能会导致编译出错。 - + Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths? 是否让小熊猫C++删除这些配置,并尝试重新建立配置? @@ -7583,13 +7623,13 @@ Are you really want to continue? 如果仍然保留这些设置,可能会导致编译错误。<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 @@ -7976,12 +8016,12 @@ Are you really want to continue? RegisterModel - + Register 寄存器 - + Value @@ -8409,14 +8449,14 @@ Are you really want to continue? 性能 - + Compiler Set 编译器配置集 - + Compiler @@ -8428,7 +8468,7 @@ Are you really want to continue? 自动链接 - + @@ -8504,15 +8544,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 @@ -8994,49 +9034,49 @@ Are you really want to continue? WatchModel - + Save file '%1' failed. 保存文件'%1'失败。 - + Can't open file '%1' for write. 无法写入文件'%1'. - + Error in json file '%1':%2 : %3 JSON文件'%1':%2中存在错误:%3 - - + + Execute to evaluate 执行以求值 - - + + Not Valid 在当前作用域中无效 - + Can't open file '%1' for read. 无法读取文件'%1'. - + Expression 表达式 - + Type 类型 - + Value diff --git a/RedPandaIDE/RedPandaIDE_zh_TW.ts b/RedPandaIDE/RedPandaIDE_zh_TW.ts index 97ad747d..2fc23e9e 100644 --- a/RedPandaIDE/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/RedPandaIDE_zh_TW.ts @@ -784,6 +784,18 @@ Show disassembly code in blend mode + + Memory View + + + + Memory View Rows + + + + Memory View Columns + + Debugger @@ -4496,6 +4508,26 @@ untitled%1 + + Selection + + + + Select Word + + + + Go to Line... + + + + Go to Line + + + + Line + + NewClassDialog diff --git a/RedPandaIDE/compiler/compilerinfo.cpp b/RedPandaIDE/compiler/compilerinfo.cpp index b106d2a1..2ff153a2 100644 --- a/RedPandaIDE/compiler/compilerinfo.cpp +++ b/RedPandaIDE/compiler/compilerinfo.cpp @@ -267,3 +267,17 @@ bool GCCCompilerInfo::forceUTF8InDebugger() { return false; } + +GCCUTF8CompilerInfo::GCCUTF8CompilerInfo():CompilerInfo(COMPILER_GCC_UTF8) +{ +} + +bool GCCUTF8CompilerInfo::supportConvertingCharset() +{ + return true; +} + +bool GCCUTF8CompilerInfo::forceUTF8InDebugger() +{ + return true; +} diff --git a/RedPandaIDE/compiler/compilerinfo.h b/RedPandaIDE/compiler/compilerinfo.h index de4cc80e..302cb418 100644 --- a/RedPandaIDE/compiler/compilerinfo.h +++ b/RedPandaIDE/compiler/compilerinfo.h @@ -7,6 +7,7 @@ #include #define COMPILER_CLANG "Clang" #define COMPILER_GCC "GCC" +#define COMPILER_GCC_UTF8 "GCC_UTF8" #define CC_CMD_OPT_ANSI "cc_cmd_opt_ansi" #define CC_CMD_OPT_NO_ASM "cc_cmd_opt_no_asm" @@ -122,6 +123,13 @@ public: bool forceUTF8InDebugger() override; }; +class GCCUTF8CompilerInfo: public CompilerInfo{ +public: + GCCUTF8CompilerInfo(); + bool supportConvertingCharset() override; + bool forceUTF8InDebugger() override; +}; + #endif // COMPILERINFO_H diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index f602db68..595d6b27 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -235,7 +235,11 @@ void Debugger::refreshAll() refreshWatchVars(); sendCommand("-stack-list-variables", "--all-values"); if (memoryModel()->startAddress()>0) - sendCommand("-data-read-memory",QString("%1 x 1 8 8 ").arg(memoryModel()->startAddress())); + sendCommand("-data-read-memory",QString("%1 x 1 %2 %3 ") + .arg(memoryModel()->startAddress()) + .arg(pSettings->debugger().memoryViewRows()) + .arg(pSettings->debugger().memoryViewColumns()) + ); } RegisterModel *Debugger::registerModel() const @@ -2509,6 +2513,7 @@ MemoryModel::MemoryModel(int dataPerLine, QObject *parent): void MemoryModel::updateMemory(const QStringList &value) { + int maxDataPerLine=-1; QRegExp delimiter("(\\s+)"); QList newModel; for (int i=0;istartAddress = stringToHex(dataLst[0],isOk); if (isOk) { + if (dataLst.length()-1>maxDataPerLine) + maxDataPerLine = dataLst.length()-1; for (int j=1;j0 && newModel.count()== mLines.count() && - newModel[0]->startAddress == mLines[0]->startAddress) { + newModel[0]->startAddress == mLines[0]->startAddress && + maxDataPerLine==mDataPerLine) { for (int i=0;i0) + mDataPerLine=maxDataPerLine; mLines = newModel; endResetModel(); } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 13f4f9c8..d00e6d72 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -454,6 +454,7 @@ void MainWindow::updateEditorActions() ui->actionRemove_Bookmark->setEnabled(false); ui->actionModify_Bookmark_Description->setEnabled(false); + ui->actionGo_to_Line->setEnabled(false); ui->actionLocate_in_Files_View->setEnabled(false); } else { ui->actionAuto_Detect->setEnabled(true); @@ -505,6 +506,7 @@ void MainWindow::updateEditorActions() ui->actionRemove_Bookmark->setEnabled(e->hasBookmark(line)); ui->actionModify_Bookmark_Description->setEnabled(e->hasBookmark(line)); + ui->actionGo_to_Line->setEnabled(true); ui->actionLocate_in_Files_View->setEnabled(!e->isNew()); } @@ -4040,6 +4042,8 @@ void MainWindow::onEditorContextMenu(const QPoint& pos) menu.addAction(ui->actionRemove_Bookmark); menu.addAction(ui->actionModify_Bookmark_Description); menu.addSeparator(); + menu.addAction(ui->actionGo_to_Line); + menu.addSeparator(); menu.addAction(ui->actionFile_Properties); //these actions needs parser @@ -4058,6 +4062,8 @@ void MainWindow::onEditorContextMenu(const QPoint& pos) menu.addAction(ui->actionAdd_bookmark); menu.addAction(ui->actionRemove_Bookmark); menu.addAction(ui->actionModify_Bookmark_Description); + menu.addSeparator(); + menu.addAction(ui->actionGo_to_Line); } ui->actionLocate_in_Files_View->setEnabled(!editor->isNew()); ui->actionBreakpoint_property->setEnabled(editor->hasBreakpoint(line)); @@ -5227,7 +5233,11 @@ void MainWindow::onDebugMemoryAddressInput() if (!s.isEmpty()) { // connect(mDebugger, &Debugger::memoryExamineReady, // this, &MainWindow::onMemoryExamineReady); - mDebugger->sendCommand("-data-read-memory",QString("%1 x 1 8 8 ").arg(s)); + mDebugger->sendCommand("-data-read-memory",QString("%1 x 1 %2 %3 ") + .arg(s) + .arg(pSettings->debugger().memoryViewRows()) + .arg(pSettings->debugger().memoryViewColumns()) + ); } } @@ -8015,3 +8025,28 @@ void MainWindow::on_actionRaylib_Manual_triggered() } } + +void MainWindow::on_actionSelect_Word_triggered() +{ + Editor* e=mEditorList->getEditor(); + if (e) { + e->selectWord(); + } +} + + +void MainWindow::on_actionGo_to_Line_triggered() +{ + Editor* e=mEditorList->getEditor(); + if (!e) + return; + bool ok; + int lineNo=QInputDialog::getInt(e,tr("Go to Line"),tr("Line"), + e->caretY(),1,e->document()->count(), + 1,&ok); + if (ok && lineNo!=e->caretY()) { + e->setCaretPosition(lineNo,1); + e->setFocus(); + } +} + diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 966cc5e0..d9a28648 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -695,6 +695,10 @@ private slots: void on_actionRaylib_Manual_triggered(); + void on_actionSelect_Word_triggered(); + + void on_actionGo_to_Line_triggered(); + private: Ui::MainWindow *ui; EditorList *mEditorList; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 7003ec6f..d9a09a5e 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -182,7 +182,6 @@ - @@ -193,8 +192,6 @@ - - @@ -223,6 +220,7 @@ + @@ -323,8 +321,19 @@ + + + Selection + + + + + + + + @@ -3168,6 +3177,16 @@ Raylib Manual + + + Select Word + + + + + Go to Line... + + diff --git a/RedPandaIDE/qsynedit/KeyStrokes.cpp b/RedPandaIDE/qsynedit/KeyStrokes.cpp index ea99faa2..4996cf38 100644 --- a/RedPandaIDE/qsynedit/KeyStrokes.cpp +++ b/RedPandaIDE/qsynedit/KeyStrokes.cpp @@ -189,15 +189,16 @@ void SynEditKeyStrokes::resetDefaults() add(SynEditorCommand::ecScrollDown, Qt::Key_Down, Qt::ControlModifier); add(SynEditorCommand::ecLeft, Qt::Key_Left, Qt::NoModifier); add(SynEditorCommand::ecSelLeft, Qt::Key_Left, Qt::ShiftModifier); - add(SynEditorCommand::ecSelLeft, Qt::Key_Left, Qt::ShiftModifier | Qt::AltModifier); add(SynEditorCommand::ecWordLeft, Qt::Key_Left, Qt::ControlModifier); add(SynEditorCommand::ecSelWordLeft, Qt::Key_Left, Qt::ShiftModifier|Qt::ControlModifier); add(SynEditorCommand::ecRight, Qt::Key_Right, Qt::NoModifier); add(SynEditorCommand::ecSelRight, Qt::Key_Right, Qt::ShiftModifier); - add(SynEditorCommand::ecSelRight, Qt::Key_Right, Qt::ShiftModifier | Qt::AltModifier); add(SynEditorCommand::ecWordRight, Qt::Key_Right, Qt::ControlModifier); add(SynEditorCommand::ecSelWordRight, Qt::Key_Right, Qt::ShiftModifier|Qt::ControlModifier); +// add(SynEditorCommand::ecExpandSelection, Qt::Key_Right, Qt::ShiftModifier|Qt::AltModifier); +// add(SynEditorCommand::ecShrinkSelection, Qt::Key_Left, Qt::ShiftModifier | Qt::AltModifier); + add(SynEditorCommand::ecPageDown, Qt::Key_PageDown, Qt::NoModifier); add(SynEditorCommand::ecSelPageDown, Qt::Key_PageDown, Qt::ShiftModifier); add(SynEditorCommand::ecPageBottom, Qt::Key_PageDown, Qt::ControlModifier); diff --git a/RedPandaIDE/qsynedit/KeyStrokes.h b/RedPandaIDE/qsynedit/KeyStrokes.h index e7808444..a7157e46 100644 --- a/RedPandaIDE/qsynedit/KeyStrokes.h +++ b/RedPandaIDE/qsynedit/KeyStrokes.h @@ -91,6 +91,8 @@ enum class SynEditorCommand { ecCopy = 201, // Copy selection to clipboard ecSelWord = 202, ecSelectAll = 203, // Select entire contents of editor, cursor to end + ecExpandSelection = 204, // expand selection + ecShrinkSelection = 205, // shrink selection ecScrollUp = 211, // Scroll up one line leaving cursor position unchanged. ecScrollDown = 212, // Scroll down one line leaving cursor position unchanged. diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index adab86d1..72ec0126 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -367,84 +367,84 @@ int SynEdit::maxScrollWidth() const return std::max(maxLen-mCharsInWindow+1, 1); } -bool SynEdit::getHighlighterAttriAtRowCol(const BufferCoord &XY, QString &Token, PSynHighlighterAttribute &Attri) +bool SynEdit::getHighlighterAttriAtRowCol(const BufferCoord &pos, QString &token, PSynHighlighterAttribute &attri) { - SynHighlighterTokenType TmpType; - int TmpKind, TmpStart; - return getHighlighterAttriAtRowColEx(XY, Token, TmpType, TmpKind,TmpStart, Attri); + SynHighlighterTokenType tmpType; + int tmpKind, tmpStart; + return getHighlighterAttriAtRowColEx(pos, token, tmpType, tmpKind,tmpStart, attri); } -bool SynEdit::getHighlighterAttriAtRowCol(const BufferCoord &XY, QString &Token, bool &tokenFinished, SynHighlighterTokenType &TokenType, PSynHighlighterAttribute &Attri) +bool SynEdit::getHighlighterAttriAtRowCol(const BufferCoord &pos, QString &token, bool &tokenFinished, SynHighlighterTokenType &tokenType, PSynHighlighterAttribute &attri) { - int PosX, PosY, endPos, Start; - QString Line; - PosY = XY.line - 1; - if (mHighlighter && (PosY >= 0) && (PosY < mDocument->count())) { - Line = mDocument->getString(PosY); - if (PosY == 0) { + int posX, posY, endPos, start; + QString line; + posY = pos.line - 1; + if (mHighlighter && (posY >= 0) && (posY < mDocument->count())) { + line = mDocument->getString(posY); + if (posY == 0) { mHighlighter->resetState(); } else { - mHighlighter->setState(mDocument->ranges(PosY-1)); + mHighlighter->setState(mDocument->ranges(posY-1)); } - mHighlighter->setLine(Line, PosY); - PosX = XY.ch; - if ((PosX > 0) && (PosX <= Line.length())) { + mHighlighter->setLine(line, posY); + posX = pos.ch; + if ((posX > 0) && (posX <= line.length())) { while (!mHighlighter->eol()) { - Start = mHighlighter->getTokenPos() + 1; - Token = mHighlighter->getToken(); - endPos = Start + Token.length()-1; - if ((PosX >= Start) && (PosX <= endPos)) { - Attri = mHighlighter->getTokenAttribute(); - if (PosX == endPos) + start = mHighlighter->getTokenPos() + 1; + token = mHighlighter->getToken(); + endPos = start + token.length()-1; + if ((posX >= start) && (posX <= endPos)) { + attri = mHighlighter->getTokenAttribute(); + if (posX == endPos) tokenFinished = mHighlighter->getTokenFinished(); else tokenFinished = false; - TokenType = mHighlighter->getTokenType(); + tokenType = mHighlighter->getTokenType(); return true; } mHighlighter->next(); } } } - Token = ""; - Attri = PSynHighlighterAttribute(); + token = ""; + attri = PSynHighlighterAttribute(); tokenFinished = false; return false; } -bool SynEdit::getHighlighterAttriAtRowColEx(const BufferCoord &XY, QString &Token, SynHighlighterTokenType &TokenType, SynTokenKind &TokenKind, int &Start, PSynHighlighterAttribute &Attri) +bool SynEdit::getHighlighterAttriAtRowColEx(const BufferCoord &pos, QString &token, SynHighlighterTokenType &tokenType, SynTokenKind &tokenKind, int &start, PSynHighlighterAttribute &attri) { - int PosX, PosY, endPos; - QString Line; - PosY = XY.line - 1; - if (mHighlighter && (PosY >= 0) && (PosY < mDocument->count())) { - Line = mDocument->getString(PosY); - if (PosY == 0) { + int posX, posY, endPos; + QString line; + posY = pos.line - 1; + if (mHighlighter && (posY >= 0) && (posY < mDocument->count())) { + line = mDocument->getString(posY); + if (posY == 0) { mHighlighter->resetState(); } else { - mHighlighter->setState(mDocument->ranges(PosY-1)); + mHighlighter->setState(mDocument->ranges(posY-1)); } - mHighlighter->setLine(Line, PosY); - PosX = XY.ch; - if ((PosX > 0) && (PosX <= Line.length())) { + mHighlighter->setLine(line, posY); + posX = pos.ch; + if ((posX > 0) && (posX <= line.length())) { while (!mHighlighter->eol()) { - Start = mHighlighter->getTokenPos() + 1; - Token = mHighlighter->getToken(); - endPos = Start + Token.length()-1; - if ((PosX >= Start) && (PosX <= endPos)) { - Attri = mHighlighter->getTokenAttribute(); - TokenKind = mHighlighter->getTokenKind(); - TokenType = mHighlighter->getTokenType(); + start = mHighlighter->getTokenPos() + 1; + token = mHighlighter->getToken(); + endPos = start + token.length()-1; + if ((posX >= start) && (posX <= endPos)) { + attri = mHighlighter->getTokenAttribute(); + tokenKind = mHighlighter->getTokenKind(); + tokenType = mHighlighter->getTokenType(); return true; } mHighlighter->next(); } } } - Token = ""; - Attri = PSynHighlighterAttribute(); - TokenKind = 0; - TokenType = SynHighlighterTokenType::Default; + token = ""; + attri = PSynHighlighterAttribute(); + tokenKind = 0; + tokenType = SynHighlighterTokenType::Default; return false; } @@ -1514,24 +1514,38 @@ void SynEdit::setSelWord() setWordBlock(caretXY()); } -void SynEdit::setWordBlock(BufferCoord Value) +void SynEdit::setWordBlock(BufferCoord value) { // if (mOptions.testFlag(eoScrollPastEol)) // Value.Char = // else // Value.Char = std::max(Value.Char, 1); - Value.line = minMax(Value.line, 1, mDocument->count()); - Value.ch = std::max(Value.ch, 1); - QString TempString = mDocument->getString(Value.line - 1); //needed for CaretX = LineLength +1 - if (Value.ch > TempString.length()) { - internalSetCaretXY(BufferCoord{TempString.length()+1, Value.line}); + value.line = minMax(value.line, 1, mDocument->count()); + value.ch = std::max(value.ch, 1); + QString TempString = mDocument->getString(value.line - 1); //needed for CaretX = LineLength +1 + if (value.ch > TempString.length()) { + internalSetCaretXY(BufferCoord{TempString.length()+1, value.line}); return; } - BufferCoord v_WordStart = wordStartEx(Value); - BufferCoord v_WordEnd = wordEndEx(Value); - if ((v_WordStart.line == v_WordEnd.line) && (v_WordStart.ch < v_WordEnd.ch)) - setCaretAndSelection(v_WordEnd, v_WordStart, v_WordEnd); + BufferCoord vWordStart = wordStartEx(value); + BufferCoord vWordEnd = wordEndEx(value); + if ((vWordStart.line == vWordEnd.line) && (vWordStart.ch < vWordEnd.ch)) + setCaretAndSelection(vWordEnd, vWordStart, vWordEnd); +} + +void SynEdit::doExpandSelection(const BufferCoord &pos) +{ + if (selAvail()) { + //todo + } else { + setWordBlock(pos); + } +} + +void SynEdit::doShrinkSelection(const BufferCoord &pos) +{ + //todo } int SynEdit::findCommentStartLine(int searchStartLine) @@ -5834,6 +5848,12 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData) case SynEditorCommand::ecSelectAll: doSelectAll(); break; + case SynEditorCommand::ecExpandSelection: + doExpandSelection(caretXY()); + break; + case SynEditorCommand::ecShrinkSelection: + doShrinkSelection(caretXY()); + break; case SynEditorCommand::ecDeleteLastChar: doDeleteLastChar(); break; @@ -6332,7 +6352,7 @@ void SynEdit::mouseDoubleClickEvent(QMouseEvent *event) QAbstractScrollArea::mouseDoubleClickEvent(event); QPoint ptMouse = event->pos(); if (ptMouse.x() >= mGutterWidth + 2) { - setWordBlock(caretXY()); + setSelWord(); mStateFlags.setFlag(SynStateFlag::sfDblClicked); } } diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index 1e871e84..e6a9ecd6 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -227,6 +227,7 @@ public: BufferCoord wordEndEx(const BufferCoord& XY); BufferCoord prevWordPos(); BufferCoord prevWordPosEx(const BufferCoord& XY); + void commandProcessor(SynEditorCommand Command, QChar AChar = QChar(), void * pData = nullptr); //Caret void showCaret(); @@ -256,14 +257,14 @@ public: int maxScrollWidth() const; int maxScrollHeight() const; - bool getHighlighterAttriAtRowCol(const BufferCoord& XY, QString& Token, - PSynHighlighterAttribute& Attri); - bool getHighlighterAttriAtRowCol(const BufferCoord& XY, QString& Token, - bool& tokenFinished, SynHighlighterTokenType& TokenType, - PSynHighlighterAttribute& Attri); - bool getHighlighterAttriAtRowColEx(const BufferCoord& XY, QString& Token, - SynHighlighterTokenType& TokenType, SynTokenKind &TokenKind, int &Start, - PSynHighlighterAttribute& Attri); + bool getHighlighterAttriAtRowCol(const BufferCoord& pos, QString& token, + PSynHighlighterAttribute& attri); + bool getHighlighterAttriAtRowCol(const BufferCoord& pos, QString& token, + bool& tokenFinished, SynHighlighterTokenType& tokenType, + PSynHighlighterAttribute& attri); + bool getHighlighterAttriAtRowColEx(const BufferCoord& pos, QString& token, + SynHighlighterTokenType& tokenType, SynTokenKind &tokenKind, int &start, + PSynHighlighterAttribute& attri); void beginUndoBlock(); void endUndoBlock(); @@ -287,6 +288,9 @@ public: virtual void selectAll() { commandProcessor(SynEditorCommand::ecSelectAll); } + virtual void selectWord() { + commandProcessor(SynEditorCommand::ecSelWord); + } virtual void tab() { commandProcessor(SynEditorCommand::ecTab);} virtual void shifttab() { commandProcessor(SynEditorCommand::ecShiftTab);} virtual void toggleComment() { commandProcessor(SynEditorCommand::ecToggleComment);} @@ -566,7 +570,10 @@ private: void deleteFromTo(const BufferCoord& start, const BufferCoord& end); void setSelWord(); - void setWordBlock(BufferCoord Value); + void setWordBlock(BufferCoord value); + + void doExpandSelection(const BufferCoord& pos); + void doShrinkSelection(const BufferCoord& pos); int calcIndentSpaces(int line, const QString& lineText, bool addIndent); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 7de1a441..9f8675b9 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1974,6 +1974,14 @@ void Settings::CompilerSet::setProperties(const QString &binDir) delimPos2++; mVersion = output.mid(delimPos1,delimPos2-delimPos1); +// //fix for mingw64 gcc +// double versionValue; +// bool ok; +// versionValue = mVersion.toDouble(&ok); +// if (ok && versionValue>=12) { +// mCompilerType=COMPILER_GCC_UTF8; +// } + // Find compiler builder delimPos1 = delimPos2; while ((delimPos1 < output.length()) && !(output[delimPos1] == '(')) @@ -3376,6 +3384,26 @@ void Settings::Debugger::setGDBServerPort(int newGDBServerPort) mGDBServerPort = newGDBServerPort; } +int Settings::Debugger::memoryViewRows() const +{ + return mMemoryViewRows; +} + +void Settings::Debugger::setMemoryViewRows(int newMemoryViewRows) +{ + mMemoryViewRows = newMemoryViewRows; +} + +int Settings::Debugger::memoryViewColumns() const +{ + return mMemoryViewColumns; +} + +void Settings::Debugger::setMemoryViewColumns(int newMemoryViewColumns) +{ + mMemoryViewColumns = newMemoryViewColumns; +} + bool Settings::Debugger::autosaveBreakpoints() const { return mAutosaveBreakpoints; @@ -3433,6 +3461,8 @@ void Settings::Debugger::doSave() saveValue("open_cpu_info_when_signaled",mOpenCPUInfoWhenSignaled); saveValue("use_gdb_server", mUseGDBServer); saveValue("gdb_server_port",mGDBServerPort); + saveValue("memory_view_rows",mMemoryViewRows); + saveValue("memory_view_columns",mMemoryViewColumns); } @@ -3461,6 +3491,8 @@ void Settings::Debugger::doLoad() mUseGDBServer = boolValue("use_gdb_server", true); #endif mGDBServerPort = intValue("gdb_server_port",41234); + mMemoryViewRows = intValue("memory_view_rows",8); + mMemoryViewColumns = intValue("memory_view_columns",8); } Settings::History::History(Settings *settings):_Base(settings, SETTING_HISTORY) diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 88210f6e..2da80028 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -1135,6 +1135,12 @@ public: int GDBServerPort() const; void setGDBServerPort(int newGDBServerPort); + int memoryViewRows() const; + void setMemoryViewRows(int newMemoryViewRows); + + int memoryViewColumns() const; + void setMemoryViewColumns(int newMemoryViewColumns); + private: bool mEnableDebugConsole; bool mShowDetailLog; @@ -1151,6 +1157,8 @@ public: bool mOpenCPUInfoWhenSignaled; bool mUseGDBServer; int mGDBServerPort; + int mMemoryViewRows; + int mMemoryViewColumns; // _Base interface protected: diff --git a/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp b/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp index c19eca89..427647de 100644 --- a/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp @@ -55,6 +55,8 @@ void DebugGeneralWidget::doLoad() ui->grpUseGDBServer->setChecked(pSettings->debugger().useGDBServer()); #endif ui->spinGDBServerPort->setValue(pSettings->debugger().GDBServerPort()); + ui->spinMemoryViewRows->setValue(pSettings->debugger().memoryViewRows()); + ui->spinMemoryViewColumns->setValue(pSettings->debugger().memoryViewColumns()); } void DebugGeneralWidget::doSave() @@ -76,6 +78,8 @@ void DebugGeneralWidget::doSave() pSettings->debugger().setUseGDBServer(ui->grpUseGDBServer->isChecked()); #endif pSettings->debugger().setGDBServerPort(ui->spinGDBServerPort->value()); + pSettings->debugger().setMemoryViewRows(ui->spinMemoryViewRows->value()); + pSettings->debugger().setMemoryViewColumns(ui->spinMemoryViewColumns->value()); pSettings->debugger().save(); pMainWindow->updateDebuggerSettings(); } diff --git a/RedPandaIDE/settingsdialog/debuggeneralwidget.ui b/RedPandaIDE/settingsdialog/debuggeneralwidget.ui index 28a4d4fd..3d157511 100644 --- a/RedPandaIDE/settingsdialog/debuggeneralwidget.ui +++ b/RedPandaIDE/settingsdialog/debuggeneralwidget.ui @@ -7,7 +7,7 @@ 0 0 704 - 563 + 774 @@ -197,6 +197,120 @@ + + + + Memory View + + + + 7 + + + 7 + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Memory View Rows + + + + + + + 1 + + + 999 + + + 8 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Memory View Columns + + + + + + + 1 + + + 8 + + + + + + + Qt::Horizontal + + + + 437 + 20 + + + + + + + + + + @@ -220,19 +334,19 @@ - - - - Show CPU Window when signal received - - - CPU Window + + + + Show CPU Window when signal received + + +