diff --git a/NEWS.md b/NEWS.md index 47091fad..a8173f59 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,5 @@ Version 0.2 + - enhancement: function tips - enhancement: project support - enhancement: paint color editor use system palette's disabled group color - fix: add watch not work when there's no editor openned; diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm index 89a5daae..ccf431de 100644 Binary files a/RedPandaIDE/RedPandaIDE_zh_CN.qm and b/RedPandaIDE/RedPandaIDE_zh_CN.qm differ diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index bbed92c0..c8d7baaf 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -27,17 +27,17 @@ BacktraceModel - + Function 函数 - + Filename 文件名 - + Line @@ -45,17 +45,17 @@ BreakpointModel - + Filename 文件名 - + Line - + Condition 条件 @@ -92,7 +92,7 @@ ColorEdit - + NONE 无颜色 @@ -221,28 +221,28 @@ CompilerManager - - - - + + + + No compiler set 无编译器设置 - - - - + + + + No compiler set is configured. 没有配置编译器设置。 - - - - + + + + Can't start debugging. 无法启动调试器 @@ -573,28 +573,28 @@ Are you really want to continue? 找不到调试器程序"%1" - - + + Execute to evaluate 执行以求值 - + Not found in current context 不在当前语境中 - + Compile 编译 - + Source file is more recent than executable. 源文件比程序文件新。 - + Recompile? 重新编译? @@ -618,10 +618,10 @@ Are you really want to continue? - - - - + + + + Error 错误 @@ -636,50 +636,50 @@ 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! 要剪切的内容超过了字符数限制! - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 - - + + Symbol '%1' not found! 未找到符号'%1'! - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Readonly 只读 @@ -952,32 +952,37 @@ Are you really want to continue? 下划线 - + + Rainbow parenthesis + 彩虹括号 + + + Duplicate... 复制... - + Rename... 重命名... - + Restore to Default 删除自定义修改 - + Import Scheme... 导入配色... - + Export... 导出... - + Delete... 删除... @@ -987,55 +992,55 @@ Are you really want to continue? 背景色 - - - - - - - - + + + + + + + + Error 错误 - + Open 打开 - - + + Color Scheme Files (*.scheme) 配色方案文件 (*.scheme) - + '%1' is not a valid name for color scheme file. '%1'不是合法的配色方案文件名。 - + New scheme name 新方案名 - + '%1' is not a valid scheme name! '%1'不是合法的配色方案名! - + Save 保存 - + Confirm Delete Scheme 确认删除方案 - + Scheme '%1' will be deleted!<br />Do you really want to continue? 配色方案'%1'将会被删除!<br />您确认要继续吗? @@ -1230,7 +1235,7 @@ Are you really want to continue? 自动覆写匹配的符号 - + Remove symbol pairs when delete chars 在删除字符时自动删除配对的符号 @@ -1258,6 +1263,44 @@ Are you really want to continue? 在文件函数变化时检查 + + EditorTooltipsWidget + + + Form + 表单 + + + + Show function tips + 显示函数参数提示 + + + + Enable mouse hover tooltips + 启用鼠标悬停提示 + + + + Show syntax issue tooltips + 显示语法错误信息 + + + + Show full header filename tooltips + 显示头文件路径信息 + + + + Show identifier definition tooltips + 显示标识符定义信息 + + + + Show expression value tooltips when debugging + 调试时显示表达式的值 + + EnvironmentAppearenceWidget @@ -1345,6 +1388,31 @@ Are you really want to continue? Minimize IDE when running programs 在运行程序时自动最小化IDE + + + Parameters to pass to your program + 运行程序的命令行参数 + + + + Redirect input to the following file: + 将程序的标准输入重定向到下面的文件 + + + + Note: Debugger doesn't support this feature. + 注意:由于gdb的bug,调试时不支持该功能 + + + + Choose input file + 选择输入文件 + + + + All files (*.*) + 所有文件 (*.*) + FileCompiler @@ -2106,40 +2174,40 @@ Are you really want to continue? 小熊猫C++ - - + + Issues 编译器 - + Compile Log 编译日志 - + File 文件 - + Tools 工具 - - + + Run 运行 - + Edit 编辑 - + Project 项目 @@ -2149,12 +2217,12 @@ Are you really want to continue? 监视 - + Structure 结构 - + Files 文件 @@ -2163,95 +2231,92 @@ Are you really want to continue? 资源 - - - + + + + Debug 调试 - + Evaluate: 求值 - + Debug Console 调试主控台 - + Call Stack 调用栈 - + Breakpoints 断点 - + Locals 本地变量 - - + + Search 查找 - + History: 历史: - + Search Again 重新查找 - + Replace with: 替换为: - + Replace 替换 - + Close 关闭 - + Execute 运行 - + + Code 代码 - + Window 窗口 - - - - toolBar - 工具栏 + 工具栏 - toolBar_2 - 工具栏2 + 工具栏2 @@ -2259,542 +2324,553 @@ 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 编译 - + F9 F9 - + F10 F10 - + Undo 恢复 - + Ctrl+Z Ctrl+Z - + Redo 重做 - + Ctrl+Y Ctrl+Y - + Cut 剪切 - + Ctrl+X Ctrl+X - - + + Copy 复制 - + 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 单步进入 - - + + Main + 主工具栏 + + + + Compiler Set + 编译器配置集 + + + + New Source File 新建源代码文件 - + 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 清除全部监视 - + 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 跳转到声明处 - + Goto Definition 跳转到定义处 - + Find references 查找符号的引用 - + Open containing folder 打开所在的文件夹 - + Ctrl+B Ctrl+B - + Open a terminal here 打开命令行窗口 - + File Properties... 文件属性... - + Close Project 关闭项目 - + Project options 项目属性 - + New Project... 新建项目... - + New File 新建项目文件 - + Add to project... 添加到项目... - + Remove from project 从项目删除 - + View Makefile 查看Makefile - + Clean 清理构建文件 - + Open Folder in Explorer 在浏览器中打开 - + Open In Terminal 在终端中打开 @@ -2809,32 +2885,32 @@ Are you really want to continue? 文件历史 - - - - - - + + + + + + Debugging 正在调试 - - - - - - + + + + + + Running 正在运行 - - - - - - + + + + + + Compiling 正在编译 @@ -2843,255 +2919,292 @@ Are you really want to continue? 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 - + Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 - + Read Only 只读 - + Insert 插入 - + Overwrite 覆写 - + 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? 重新编译? - + Copy all 全部复制 - + Clear 清除 - + Remove this search 清除这次搜索 - + Clear all searches 删除所有搜索 - + Breakpoint condition... 断点条件... - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Remove all breakpoints 清除所有断点 - + Rename File 重命名文件 - - + + Add Folder 添加文件夹 - + New folder 新文件夹 - + Folder name: 文件夹: - + Rename Folder 重命名 - + Remove Folder 删除文件夹 - + %1 files autosaved 已自动保存%1个文件 - + Save project 保存项目 - + The project '%1' has modifications. 项目'%1'有改动。 - + Do you want to save it? 需要保存吗? - + 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 - + Red panda Dev-C++ project file (*.dev) 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Add to project 添加到项目 - - - - - - - - + + + + + + + + Error 错误 @@ -3101,75 +3214,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个文件) @@ -3226,87 +3339,87 @@ Are you really want to continue? Project - + File Not Found 未找到文件 - + Project file '%1' can't be found! 找不到项目文件'%1'! - + untitled 无标题 - + Can't save file 无法保存文件 - + Can't save file '%1' 无法保存文件'%1'. - + 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 Dev-C++ has changed. Dev-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 Dev-C++ IDE 使用小熊猫Dev-C++编辑器开发 @@ -3430,6 +3543,29 @@ Are you really want to continue? 自定义设置(仅对本项目生效) + + ProjectDLLHostWidget + + + Form + 表单 + + + + Host application for DLL: + DLL文件的宿主程序: + + + + Choose host application + 选择宿主程序 + + + + All files (*.*) + 所有文件 (*.*) + + ProjectDirectoriesWidget @@ -3631,6 +3767,11 @@ Are you really want to continue? Information about using a custom make file 关于自定义Makefile + + + Include the following files into the makefile: + 在Makefile中包含下列文件: + Custom makefile @@ -3645,24 +3786,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' @@ -3956,175 +4097,175 @@ 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) - + 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) @@ -4133,43 +4274,43 @@ 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"时遇到了下列问题: - + 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 @@ -4488,17 +4629,17 @@ Are you really want to continue? 缺省 - + Untitled 无标题 - + constructor 构造函数 - + destructor 析构函数 @@ -4518,17 +4659,17 @@ Are you really want to continue? RegisterModel - + Register 寄存器 - + Value(Hex) 值(HEX) - + Value(Dec) 值(DEC) @@ -4861,164 +5002,176 @@ Are you really want to continue? 取消 - + Appearence 外观 - + Environment 环境 - - + + Compiler Set 编译器配置集 - - + + Compiler 编译器 - + Auto Link 自动链接 - - - - - + + + + + General 通用 - - - - - - - - - + + + + + + + + + + Editor 编辑器 - + Font 字体 - + Copy & Export 复制/导出 - + Color 配色 - + Code Completion 代码补全 - + Symbol Completion 符号补全 - + Auto Syntax Checking 自动语法检查 - + + Tooltips + 信息提示 + + + Auto save 自动保存 - + Misc 杂项 - + Program Runner 程序运行 - + Debugger 调试器 - + Code Formatter 代码排版 - - - - - - - - - + + + + + + + + + + Project 项目 - + Files 文件 - + Custom Compile options 自定义编译选项 - + Directories 文件夹 - + Precompiled Header 预编译头文件 - + Makefile Makefile - + Output 输出 - + + DLL host + DLL宿主 + + + Version info 版本信息 - + Save Changes 保存修改 - + There are changes in the settings, do you want to save them before swtich to other page? 本页中有尚未保存的设置修改,是否保存后再切换到其他页? @@ -5069,8 +5222,8 @@ Are you really want to continue? SynEdit + - The highlighter seems to be in an infinite loop 高亮处理进入了死循环 @@ -5078,16 +5231,29 @@ Are you really want to continue? SynEditStringList - + Can't open file '%1' for read! 无法读取文件'%1'! - + Can't open file '%1' for save! 无法写入文件'%2'! + + WatchModel + + + Expression + 表达式 + + + + Value + + + editorgeneralwidget diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index ef94dbdc..e038ddae 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -464,6 +464,7 @@ void Editor::focusOutEvent(QFocusEvent *event) pMainWindow->updateEditorActions(); pMainWindow->updateStatusbarForLineCol(); pMainWindow->updateForStatusbarModeInfo(); + pMainWindow->functionTip()->hide(); } void Editor::keyPressEvent(QKeyEvent *event) @@ -1784,6 +1785,7 @@ void Editor::showCompletion(bool autoComplete) }); mCompletionPopup->setParser(mParser); mCompletionPopup->setUseCppKeyword(mUseCppSyntax); + pMainWindow->functionTip()->hide(); mCompletionPopup->show(); // Scan the current function body @@ -1842,6 +1844,7 @@ void Editor::showHeaderCompletion(bool autoComplete) if (word.lastIndexOf('"')>0 || word.lastIndexOf('>')>0) return; + pMainWindow->functionTip()->hide(); mHeaderCompletionPopup->show(); mHeaderCompletionPopup->setSearchLocal(word.startsWith('"')); word.remove(0,1); @@ -2246,6 +2249,10 @@ QString Editor::getHintForFunction(const PStatement &statement, const PStatement void Editor::updateFunctionTip() { + if (pMainWindow->completionPopup()->isVisible()) { + pMainWindow->functionTip()->hide(); + return; + } BufferCoord caretPos = caretXY(); ContentsCoord curPos = fromBufferCoord(caretPos); ContentsCoord cursorPos = curPos; @@ -2257,6 +2264,7 @@ void Editor::updateFunctionTip() // Stopping characters... QChar ch = *curPos; if (ch == '\0' || ch == ';') { + pMainWindow->functionTip()->hide(); return; // Opening brace, increase count } @@ -2299,14 +2307,17 @@ void Editor::updateFunctionTip() curPos += 1; } + //qDebug()<<"first pass:"<functionTip()->hide(); return; } ContentsCoord FFunctionEnd = curPos; int paramPos = 0; + bool paramPosFounded = false; // We've stopped at the ending ), start walking backwards )*here* with nBraces = -1 for (int i=0;ifunctionTip()->hide(); return; + } if (prevCh == '/' && ch == '*' ) { curPos -= 1; break; @@ -2331,8 +2344,9 @@ void Editor::updateFunctionTip() break;; } else if (ch == ',') { if (nBraces == 0) { - if (curPos <= cursorPos) { + if (curPos <= cursorPos && !paramPosFounded) { paramPos = nCommas; + paramPosFounded = true; } nCommas++; } @@ -2341,10 +2355,13 @@ void Editor::updateFunctionTip() if (curPos.atStart()) break; } - paramPos = nCommas - paramPos; + if (paramPosFounded) + paramPos = nCommas - paramPos; + //qDebug()<<"second pass:"<functionTip()->hide(); return; } @@ -2362,22 +2379,31 @@ void Editor::updateFunctionTip() } ContentsCoord prevPos = curPos-1; - if (prevPos.atStart()) + if (prevPos.atStart()) { + pMainWindow->functionTip()->hide(); return; + } // Get the name of the function we're about to show BufferCoord FuncStartXY = prevPos.toBufferCoord(); QString token; PSynHighlighterAttribute HLAttr; if (!getHighlighterAttriAtRowCol(FuncStartXY,token,HLAttr)) { + pMainWindow->functionTip()->hide(); return; } - if (HLAttr->name()!=SYNS_AttrIdentifier) + if (HLAttr->name()!=SYNS_AttrIdentifier) { + pMainWindow->functionTip()->hide(); return; + } BufferCoord pWordBegin, pWordEnd; QString s = getWordAtPosition(this, FuncStartXY, pWordBegin,pWordEnd, WordPurpose::wpInformation); +// qDebug()<functionTip()->tipCount()<=0) { + pMainWindow->functionTip()->hide(); return; } + // Position it at the top of the next line + QPoint p = rowColumnToPixels(displayXY()); + p+=QPoint(0,textHeight()+2); + pMainWindow->functionTip()->move(mapToGlobal(p)); pMainWindow->functionTip()->setFunctioFullName(s); pMainWindow->functionTip()->guessFunction(nCommas); @@ -2410,32 +2441,6 @@ void Editor::updateFunctionTip() paramPos ); pMainWindow->functionTip()->show(); -//// // get the current token position in the text -//// // this is where the prototype name usually starts -//// FTokenPos := CurPos - Length(S); - -//// Search for the best possible overload match according to comma count -//if (shoFindBestMatchingToolTip in FOptions) then - -// // Only do so when the user didn't select his own -// if not FCustomSelIndex then -// S := FindClosestToolTip(S, nCommas); - -//// Select the current one -//if (FSelIndex < FToolTips.Count) then -// S := FToolTips.Strings[FSelIndex]; - -//// set the hint caption -//Caption := Trim(S); - -//// we use the LookupEditor to get the highlighter-attributes -//// from. check the DrawAdvanced method! -//FLookupEditor.Text := Caption; -//FLookupEditor.Highlighter := FEditor.Highlighter; - -//// get the index of the current argument (where the cursor is) -//FCurParamIndex := GetCommaIndex(P, FFunctionStart + 1, CaretPos - 1); -//RethinkCoordAndActivate; } void Editor::setInProject(bool newInProject) diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 48ae4bcc..ae0ce024 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -926,7 +926,7 @@ - toolBar + Main @@ -947,7 +947,7 @@ - toolBar + Code TopToolBarArea @@ -962,7 +962,7 @@ - toolBar + Compile @@ -983,7 +983,7 @@ - toolBar + Debug @@ -1008,7 +1008,7 @@ - toolBar_2 + Compiler Set diff --git a/RedPandaIDE/parser/cpptokenizer.cpp b/RedPandaIDE/parser/cpptokenizer.cpp index 75957d04..ab556f3b 100644 --- a/RedPandaIDE/parser/cpptokenizer.cpp +++ b/RedPandaIDE/parser/cpptokenizer.cpp @@ -594,7 +594,6 @@ void CppTokenizer::advance() mCurrent++; break; case '\\': - if (isLineChar(*(mCurrent + 1))) skipSplitLine(); else diff --git a/RedPandaIDE/qsynedit/Types.cpp b/RedPandaIDE/qsynedit/Types.cpp index e6d91af9..19d93538 100644 --- a/RedPandaIDE/qsynedit/Types.cpp +++ b/RedPandaIDE/qsynedit/Types.cpp @@ -204,9 +204,10 @@ QChar ContentsCoord::operator*() const return QChar('\0'); } QString s = mEdit->lines()->getString(mLine-1); - if (mChar > s.length()+1 ) { + if (mChar >= s.length()+1 ) { return QChar('\n'); } + //qDebug()< +#include -FunctionTooltipWidget::FunctionTooltipWidget(QWidget *parent) : QWidget(parent) +FunctionTooltipWidget::FunctionTooltipWidget(QWidget *parent) : + QFrame(parent, Qt::ToolTip | Qt::WindowStaysOnTopHint | Qt::WindowDoesNotAcceptFocus) { - setWindowFlags(Qt::Popup); setFocusPolicy(Qt::NoFocus); mInfoLabel = new QLabel(this); mInfoLabel->setWordWrap(true); @@ -21,12 +22,17 @@ FunctionTooltipWidget::FunctionTooltipWidget(QWidget *parent) : QWidget(parent) mDownButton->setFixedSize(16, 16); mDownButton->setAutoRaise(true); - this->setLayout(new QHBoxLayout()); + layout()->setContentsMargins(0,0,0,0); + layout()->setSpacing(0); layout()->addWidget(mUpButton); layout()->addWidget(mTotalLabel); layout()->addWidget(mDownButton); layout()->addWidget(mInfoLabel); + connect(mUpButton,&QPushButton::clicked, + this,&FunctionTooltipWidget::previousTip); + connect(mDownButton,&QPushButton::clicked, + this,&FunctionTooltipWidget::nextTip); } void FunctionTooltipWidget::addTip(const QString &name, const QString& fullname, @@ -102,11 +108,23 @@ void FunctionTooltipWidget::updateTip() } text += "( "+displayList.join(", ") + ") "; } + if (mInfos.length()>1) { + mTotalLabel->setText(QString("%1/%2").arg(mInfoIndex+1).arg(mInfos.length())); + } + int width = mInfoLabel->fontMetrics().horizontalAdvance(text); + if (width > 400) { + mInfoLabel->setMinimumWidth(410); + } else { + mInfoLabel->setMinimumWidth(width); + } mInfoLabel->setText(text); } void FunctionTooltipWidget::guessFunction(int commas) { + if (mInfoIndex>=0 && mInfoIndexparams.count()>commas) + return; for (int i=0;iparams.count()>commas) { mInfoIndex = i; @@ -141,6 +159,8 @@ QStringList FunctionTooltipWidget::splitArgs(QString argStr) QString s = argStr.mid(paramStart,i-paramStart); s=s.trimmed(); if (!s.isEmpty()) { + if (s.endsWith(')')) + s.truncate(s.length()-1); result.append(s); } return result; @@ -164,6 +184,7 @@ int FunctionTooltipWidget::paramIndex() const void FunctionTooltipWidget::setParamIndex(int newParamIndex) { mParamIndex = newParamIndex; + updateTip(); } void FunctionTooltipWidget::closeEvent(QCloseEvent *) @@ -179,7 +200,8 @@ void FunctionTooltipWidget::showEvent(QShowEvent *) updateTip(); } -void FunctionTooltipWidget::hideEvent(QHideEvent *event) +void FunctionTooltipWidget::hideEvent(QHideEvent *) { mInfos.clear(); + mFunctioFullName = ""; } diff --git a/RedPandaIDE/widgets/functiontooltipwidget.h b/RedPandaIDE/widgets/functiontooltipwidget.h index 1c829352..d4d8f14f 100644 --- a/RedPandaIDE/widgets/functiontooltipwidget.h +++ b/RedPandaIDE/widgets/functiontooltipwidget.h @@ -14,7 +14,7 @@ struct FunctionInfo { using PFunctionInfo = std::shared_ptr; -class FunctionTooltipWidget : public QWidget +class FunctionTooltipWidget : public QFrame { Q_OBJECT public: