From 1504e6cb0479432471ff2a47966fc0a23925d351 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 4 Mar 2023 18:23:57 +0800 Subject: [PATCH] - enhancement: Show mousetip for numbers in the GNU assembly file. --- NEWS.md | 4 +- RedPandaIDE/debugger.cpp | 5 +- RedPandaIDE/editor.cpp | 52 +- RedPandaIDE/editor.h | 1 + RedPandaIDE/mainwindow.ui | 5 + RedPandaIDE/translations/RedPandaIDE_pt_BR.ts | 12 + RedPandaIDE/translations/RedPandaIDE_zh_CN.ts | 621 +++++++++--------- RedPandaIDE/translations/RedPandaIDE_zh_TW.ts | 12 + 8 files changed, 406 insertions(+), 306 deletions(-) diff --git a/NEWS.md b/NEWS.md index ba8b78d4..05836015 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,10 @@ Red Panda C++ Version 2.17 - enhancement: Add X86_64 AVX/AVX instruction descriptions to asm syntaxer. - - enhancement: Update to the newest x86 Assembly manual. + - enhancement: Update x86 Assembly manual link to the newest website. - enhancement: Add "New Text File" in the File menu + - enhancement: Add "address" in the memory view's mouse tip. + - enhancement: Show mousetip for numbers in the GNU assembly file. Red Panda C++ Version 2.16 diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index a7ae5324..3f4cc6ee 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -3166,7 +3166,10 @@ QVariant MemoryModel::data(const QModelIndex &index, int role) const return QString("%1").arg(line->datas[col],2,16,QChar('0')); } else if (role == Qt::ToolTipRole) { if (coldatas.count()) { - QString s =tr("dec: %1").arg(line->datas[col]) + QString s = + tr("addr: %1").arg(line->startAddress+col,0,16) + +"
" + +tr("dec: %1").arg(line->datas[col]) +"
" +tr("oct: %1").arg(line->datas[col],0,8) +"
" diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index e8d9f593..009d7606 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1882,6 +1882,15 @@ void Editor::onTooltipTimer() pError = issues->front(); } } + if (reason == TipType::Number) { + if (!syntaxer() || + (syntaxer()->language() != QSynedit::ProgrammingLanguage::Assembly + && syntaxer()->language() != QSynedit::ProgrammingLanguage::ATTAssembly + ) + ) { + reason=TipType::None; + } + } // Get subject bool isIncludeLine = false; @@ -1927,6 +1936,19 @@ void Editor::onTooltipTimer() case TipType::Error: s = pError->token; break; + case TipType::Number: + if (!mCompletionPopup->isVisible() + && !mHeaderCompletionPopup->isVisible()) { + QSynedit::PTokenAttribute attr; + int start; + if (getTokenAttriAtRowColEx(p,s,start,attr)) { + QString line=document()->getLine(p.line-1); + int idx=start-2; + if (idx>=0 && idxlanguage() == QSynedit::ProgrammingLanguage::Assembly + || syntaxer()->language() == QSynedit::ProgrammingLanguage::ATTAssembly) + ) { + qDebug()<" + +tr("dec: %1").arg(val,0,10); + } + } + break; case TipType::Keyword: if (pSettings->editor().enableIdentifierToolTips()) { if (syntaxer() && @@ -3854,6 +3902,8 @@ Editor::TipType Editor::getTipType(QPoint point, QSynedit::BufferCoord& pos) return TipType::Preprocessor; } else if (attr->tokenType() == QSynedit::TokenType::Identifier) { return TipType::Identifier; + } else if (attr->tokenType() == QSynedit::TokenType::Number) { + return TipType::Number; } else if (attr->tokenType() == QSynedit::TokenType::Keyword) { return TipType::Keyword; } diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index 90dd92ef..487b78a3 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -105,6 +105,7 @@ public: Identifier, // cursor hovers above identifier Selection, // cursor hovers above selection Keyword, + Number, None, // mouseover not allowed Error //Cursor hovers above error line/item; }; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index c125ea29..7901310b 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -439,6 +439,7 @@ + @@ -2398,6 +2399,10 @@ + + + :/icons/images/newlook24/052-next.png:/icons/images/newlook24/052-next.png + Run To Cursor diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index 01de805f..ff6a927a 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -1046,6 +1046,14 @@ Error Load File Erro ao carregar arquivo + + hex: %1 + + + + dec: %1 + + EditorAutoSaveWidget @@ -5138,6 +5146,10 @@ bin: %1 + + addr: %1 + + NewClassDialog diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index f6303513..fd14b847 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -1483,14 +1483,24 @@ Are you really want to continue? 要剪切的内容超过了字符数限制! - + + hex: %1 + 16进制: %1 + + + + dec: %1 + 十进制: %1 + + + Print Document 打印文档 - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 @@ -1499,27 +1509,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 只读 @@ -4243,8 +4253,8 @@ Are you really want to continue? 小熊猫C++ - - + + @@ -4268,8 +4278,8 @@ Are you really want to continue? 工具 - - + + Run 运行 @@ -4280,26 +4290,26 @@ Are you really want to continue? - - + + Project 项目 - - + + Watch 监视 - - + + Structure 结构 - - + + Files 文件 @@ -4309,68 +4319,68 @@ Are you really want to continue? - - - - + + + + Debug 调试 - + Evaluate: 求值 - + Debug Console 调试主控台 - + Call Stack 调用栈 - + Breakpoints 断点 - + Locals 局部变量 - - + + Search 查找 - + History: 历史: - + Search Again 重新查找 - + Replace with: 替换为: - + Replace 替换 - + Close 关闭 @@ -4404,71 +4414,71 @@ 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 选择输入文件 @@ -4492,47 +4502,47 @@ Are you really want to continue? 选择 - + F9 F9 - + F10 F10 - + Undo 恢复 - + Ctrl+Z Ctrl+Z - + Redo 重做 - + Ctrl+Y Ctrl+Y - + Cut 剪切 - + Ctrl+X Ctrl+X - + @@ -4540,85 +4550,85 @@ 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编码 @@ -4631,178 +4641,178 @@ Are you really want to continue? 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 期望输出 @@ -4831,524 +4841,524 @@ Are you really want to continue? 主工具栏 - + Compiler Set 编译器配置集 - + Explorer 管理器 - + Import FPS Problem Set 导入FPS试题集 - + Export FPS Problem Set 导出FPS试题集 - + Messages 消息 - + Open file in editors 在编辑器中打开文件 - + Choose Expected Output File 选择期望输出文件 - + Ignore Spaces 忽略空格 - + New C/C++ File 新建C/C++文件 - + 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 新建项目文件 - + Ctrl+F12 Ctrl+F12 - + F1 F1 - + New GAS File 新建GNU汇编文件 - + GNU Assembler Manual GNU汇编器手册 - + x86 Assembly Language Reference Manual X86汇编语言参考手册 - + IA-32 Assembly Language Reference Manual IA32汇编语言参考手册 - + Add Watchpoint... 添加变量断点... - + Add a watchpoint that's triggered when it's modified. 添加一个变量断点。当该变量的值被改动时程序暂停。 - + New Text File 新建文本文件 - + 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 Template... 新建模板... - + New Template from Project 从项目创建模板 - + Goto block start 跳转到代码段开始 - + Ctrl+Alt+Up Ctrl+Alt+Up - + Goto block end 跳转到代码段结束 - + Ctrl+Alt+Down Ctrl+Alt+Down - + Switch header/source 切换头文件/源文件 - + Switch Header/Source 切换头文件/源文件 - + Generate Assembly 生成汇编 - + Trim trailing spaces 删除行尾空格 - + Toggle Readonly 切换只读模式 - + Submit Issues 反馈与建议 - + Document 使用说明 @@ -5362,194 +5372,194 @@ Are you really want to continue? 新建文件 - + 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+] @@ -5558,50 +5568,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 新建头文件... @@ -5611,47 +5621,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 删除到行首 @@ -5660,27 +5670,27 @@ Are you really want to continue? C/C++参考 - + EGE Manual EGE图形库手册 - + Add Bookmark 添加书签 - + Remove Bookmark 删除书签 - + Modify Bookmark Description 修改书签说明 - + Locate in Files View 在文件视图中定位 @@ -5689,7 +5699,7 @@ Are you really want to continue? 打开文件夹 - + Running Parameters... 运行参数... @@ -5944,9 +5954,9 @@ Are you really want to continue? 模板%1已存在。是否覆盖? - - - + + + @@ -6606,8 +6616,8 @@ Are you really want to continue? 第%1行 - - + + Choose Working Folder 选择工作文件夹 @@ -6988,26 +6998,31 @@ Are you really want to continue? MemoryModel - + + addr: %1 + 地址: %1 + + + dec: %1 十进制: %1 - + oct: %1 - 八进制: %1 + 八进制: %1 hex: %1 16进制: %1 - + bin: %1 二进制: %1 - + ascii: '%1' ASCII字符: '%1' diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index 710f0e02..48e76531 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -927,6 +927,14 @@ Error Load File + + hex: %1 + + + + dec: %1 + + EditorAutoSaveWidget @@ -4891,6 +4899,10 @@ bin: %1 + + addr: %1 + + NewClassDialog