diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm index 9dc4db47..7a8c2151 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 e47fc441..4aff07aa 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -4,37 +4,37 @@ BacktraceModel - + Function - 函数 + 函数 - + Filename - 文件名 + 文件名 - + Line - + BreakpointModel - + Filename - 文件名 + 文件名 - + Line - + - + Condition - + 条件 @@ -42,22 +42,27 @@ CPU Info - + CPU信息 Disassemble - + 反汇编 AT&&T - + AT&&T Intel - + Intel + + + + Blend Mode + 混合模式 @@ -74,7 +79,7 @@ Clean before rebuild failed. - + 重编译前的清理准备工作失败! @@ -127,34 +132,34 @@ [说明] - + The compiler process failed to start. - + 无法启动编译进程。 - + 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. - + 发生了未知错误。 - Time Elasped: %1 secs @@ -167,19 +172,19 @@ No compiler set - + 无编译器设置 No compiler set is configured. - + 没有配置编译器设置。 Can't start debugging. - + 无法启动调试器 @@ -360,13 +365,13 @@ Are you really want to continue? Failed - + 失败 Can't find any compiler. - + 找不到编译器 @@ -395,52 +400,66 @@ Are you really want to continue? Form - 表单 + 表单 Debug Console - + 调试主控台 Font: - 字体: + 字体: Show only monospaced fonts - 只显示等宽字体 + 只显示等宽字体 Size: - 大小: + 大小: Show debug logs in the debug console - + 在调试主控台中显示调试器输出 Show full gdb annotations - + 在调试主控台中显示gdb输出注解 + + + Disassembly Coding Style + 反汇编代码样式 - Disassembly Coding Style - + CPU Window + CPU信息窗口 - + + Disassembly Coding Style: + 反汇编代码样式 + + + Intel - + Intel - + AT&&T - + AT&&T + + + + Show disassembly code in blend mode + 以混合模式显示反汇编代码 @@ -448,53 +467,53 @@ Are you really want to continue? No compiler set - + 无编译器设置 No compiler set is configured. - + 没有配置编译器设置。 Can't start debugging. - - - - - Debugger not exists - + 无法启动调试器 + Debugger not exists + 找不到调试器 + + + Can''t find debugger in : "%1" - + 找不到调试器程序"%1" - - + + Execute to evaluate - + 执行以求值 - + Not found in current context - + 不在当前语境中 - + Compile - 编译 + 编译 - + Source file is more recent than executable. - + 源文件比程序文件新。 - + Recompile? - + 重新编译? @@ -504,7 +523,7 @@ Are you really want to continue? 无标题 - + untitled%1 无标题%1 @@ -513,46 +532,58 @@ Are you really want to continue? 失败 - - - - - - - + + + + + + + Error - 错误 + 错误 - + File %1 is not writable! - + 无法写入文件"%1" - + Save As 另存为 - + 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+单击以获取更多信息 + + + + Readonly + 只读 + EditorClipboardWidget @@ -861,62 +892,62 @@ Are you really want to continue? Form - 表单 + 表单 Complete Symbols - + 符号补全 Details - + 详情 Complete Braces{} - + 补全花括号{} Complete Brackets [] - + 补全方括号[] Complete Parenthesis () - + 补全括号() Complete Multiline Comments /**/ - + 补全ANSI C风格注释/*和*/ Complete Single Quotations '' - + 补全单引号'' Complete Double Quotations "" - + 补全双引号"" Complete #include <> - + 补全#include语句中的<> Skip matching symbols while typing - + 自动覆写匹配的符号 Remove symbol pairs when delete chars - + 在删除字符时自动删除配对的符号 @@ -924,22 +955,22 @@ Are you really want to continue? Form - 表单 + 表单 Enable Auto Syntax Check - + 启用自动语法检查 Check when save/load file - + 在打开/保存文件时检查 Check when count of lines changed - + 在文件函数变化时检查 @@ -974,38 +1005,43 @@ Are you really want to continue? Font Size: 大小: + + + Simplified Chinese + 简体中文 + ExecutableRunner The runner process failed to start. - + 无法启动程序运行进程。 The runner process crashed after starting successfully. - + 程序运行进程启动后崩溃。 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. - + 在从程序运行进程读取内容时出错。 An unknown error occurred. - + 发生了未知错误。 @@ -1013,17 +1049,17 @@ Are you really want to continue? Form - 表单 + 表单 Pause console programs after return - + 程序返回时暂停 Minimize IDE when running programs - + 在运行程序时自动最小化IDE @@ -1059,7 +1095,7 @@ Are you really want to continue? The Compiler '%1' doesn't exists! - + 编译器程序"%1"不存在! @@ -1108,642 +1144,662 @@ Are you really want to continue? 小熊猫C++ - - + + Issues 编译器 - + Compile Log 编译日志 - + File 文件 - + Tools 工具 - - + + Run 运行 - + Edit 编辑 Project - + 项目 Watch - + 监视 Structure - + 结构 - + Files - + 文件 - + Resource - + 资源 - - - + + + Debug - + 调试 - + Evaluate: - + 求值 - + Debug Console - + 调试主控台 - + Call Stack - + 调用栈 - + Breakpoints - + 断点 - + Locals - - - - - - Search - - - - - History: - - - - - Search Again - - - - - Replace with: - - - - - Replace - - - - - Close - - - - - Execute - - - - - - - toolBar - + 本地变量 + - toolBar_2 - + Search + 查找 - + + History: + 历史: + + + + Search Again + 重新查找 + + + + Replace with: + 替换为: + + + + Replace + 替换 + + + + Close + 关闭 + + + + Execute + 执行 + + + + + + toolBar + 工具栏 + + + + toolBar_2 + 工具栏2 + + + New 新建 - + 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 + F11 - - + + Rebuild All - + 全部重编译 - + F12 - F12 + F12 - + Stop Execution - + 停止执行 - + F6 - F6 - - - - F5 - F5 - - - - Step Over - - - - - F7 - F7 - - - - Step Into - - - - - F8 - F8 - - - - Step Out - + F6 - Ctrl+F8 - + F5 + F5 - - Run To Cursor - + + Step Over + 单步跳过 - - Ctrl+F5 - + + F7 + F7 - - Continue - + + Step Into + 单步进入 - - F4 - F4 - - - - Add Watch... - + + F8 + F8 - View CPU Window... - + Step Out + 单步跳出 - - Exit - + + Ctrl+F8 + Ctrl+F8 - - Find... - + + Run To Cursor + 执行到光标处 - - Ctrl+F - + + Ctrl+F5 + Ctrl+F5 - - Find in Files... - + + Continue + 继续执行 - - Ctrl+Shift+F - + + F4 + F4 - - Replace... - + + Add Watch... + 添加监视 - Ctrl+R - + 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 + F3 - + Find Previous - + 查找前一个 - + Shift+F3 - + Shift+F3 - + File Encoding 文件编码 - + Recent Files - + 文件历史 - - + + Debugging - + 正在调试 - - + + Running - + 正在运行 - - + + Compiling - + 正在编译 - Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5 - 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 + 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 - + + Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5 + 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 + + + Read Only 只读 - + Insert 插入 - + Overwrite 覆写 - - + + 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/>是否纠正这一问题? - + Recompile? - + 重新编译? - - - - - - + + + + + + Error 错误 - + 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个文件) QApplication - + Error 错误 @@ -1751,12 +1807,12 @@ Are you really want to continue? QObject - + Save 保存 - + Save changes to %1? 将修改保存到"%1"? @@ -1791,73 +1847,83 @@ Are you really want to continue? - - + + Error 错误 - + Can't create configuration folder %1 无法创建配置文件夹"%1" - + Can't write to configuration file %1 无法写入配置文件夹"%1" - - - + + + The following %1 directories don't exist: - + 下列%1文件夹不存在: - - + + binary - + 二进制 - + No %1 directories have been specified. - + 未指定%1文件夹 - - C include - - - - - C++ include - + C include + C包含 - + - - - Cannot find the %1 "%2" - + C++ include + C++包含 - + + + + + Cannot find the %1 "%2" + 无法找到%1程序"%2" + + + C options C语言选项 - + Code Generation 代码生成 - + 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 @@ -1891,12 +1957,12 @@ Are you really want to continue? - + untitled 无标题 - + Index %1 out of range 下标"%1"越界 @@ -1908,7 +1974,7 @@ Are you really want to continue? Can't parse json file '%1' at offset %2! Error Code: %3 - JSON文件"%1"在位置"%2"处无法解析!错误码:%3 + JSON文件"%1"在位置"%2"处无法解析!错误码:%3 Can't parse json file '%1' is not a color schema config file! @@ -1917,7 +1983,7 @@ Are you really want to continue? Can't parse json file '%1' is not a color scheme config file! - + @@ -1927,14 +1993,14 @@ Are you really want to continue? Can't Find the color scheme file %1! - + 找不到颜色配置文件%1! Can't remove the color scheme file %1! - + 删不掉颜色配置文件%1! @@ -2139,12 +2205,12 @@ Are you really want to continue? Rename file '%1' to '%2' failed! - + 将文件'%1'改名为'%2'失败! Scheme '%1' already exists! - + 配置文件'%1'已经存在! @@ -2156,23 +2222,33 @@ Are you really want to continue? Untitled 无标题 + + + constructor + 构造函数 + + + + destructor + 析构函数 + RegisterModel - + Register - + 寄存器 - + Value(Hex) - + 值(HEX) - + Value(Dec) - + 值(DEC) @@ -2180,136 +2256,136 @@ Are you really want to continue? Dialog - + 对话框 Text to Find: - + 要查找的关键字 Replace with: - + 替换为: Options: - + 选项: Case Sensitive - + 区分大小写 Whole words only - + 整个单词 Regular Expression - + 正则表达式 Prompt on replace - + 替换时提示 Scope: - + 范围: Global - + 全局 Selection - 选中文字 + 选中文字 Origin: - + 起点: From cursor - + 从光标处 Entire scope - + 整个范围 Direction: - + 方向 Forward - + 向后 Backward - + 向前 Where: - + 在哪些文件中查找: Current File - + 当前文件 Files In Project - + 项目中的文件 Open Files - + 已打开的文件 Find - + 查找 Cancel - + 取消 Find in files - + 在文件中查找 Replace - + 替换 Replace this occurrence of ''%1''? - + 替换这里的"%1"? @@ -2317,17 +2393,17 @@ Are you really want to continue? Current File: - + 当前文件: Files In Project: - + 项目中的文件: Open Files: - + 打开的文件: @@ -2335,7 +2411,7 @@ Are you really want to continue? Line - + @@ -2344,163 +2420,164 @@ Are you really want to continue? Line - + Settings::CompilerSet - + 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) - + 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) - - - - - Compile with the following pointer size (-mx) - - - - - Language standard (-std) - + 优化级别(-Ox) - Generate debugging information (-g3) - - - - - Generate profiling info for analysis (-pg) - - - - - Warnings - - - - - Inhibit all warning messages (-w) - - - - - Show most warnings (-Wall) - - - - - Show some more warnings (-Wextra) - - - - - Check ISO C/C++/C++0x conformance (-pedantic) - - - - - Only check the code for syntax errors (-fsyntax-only) - - - - - Make all warnings into errors (-Werror) - - - - - Abort compilation on first error (-Wfatal-errors) - - - - - Linker - - - - - Link an Objective C program (-lobjc) - - - - - Do not use standard system libraries (-nostdlib) - - - - - Do not create a console window (-mwindows) - - - - - Strip executable (-s) - - - - - Link libraries statically (-static) - - - - - Output - + Compile with the following pointer size (-mx) + 使用下列指针大小编译(-mx) - -fverbose-asm - + Language standard (-std) + 语言标准(-std) - Use pipes instead of temporary files during compilation (-pipe) - + 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) + 链接Ojbective C程序(-lobjc) + + + + Do not use standard system libraries (-nostdlib) + 不使用标准库和系统启动文件(-nostdlib) + + + + Do not create a console window (-mwindows) + 不产生控制台窗口(-mwindows) + + + + Strip executable (-s) + 剥除附加信息(-s) + + + + Link libraries statically (-static) + 静态链接二进制库(-static) + + + + Output + 输出 + + + + -fverbose-asm + + + + + Use pipes instead of temporary files during compilation (-pipe) + 编译时使用管道而不是临时文件(-pipe) + + + Do not assemble, compile and generate the assemble code (-S) - + 只生成汇编代码(-S) Settings::CompilerSets - + + Confirm - 确认 + 确认 @@ -2585,22 +2662,22 @@ Are you really want to continue? Symbol Completion - + 补全符号 Auto Syntax Checking - + 自动语法检查 Program Runner - + 程序运行 Debugger - + 调试器 @@ -2618,64 +2695,64 @@ Are you really want to continue? Checking file syntax... - + 正在检查语法... - Filename: %1 - - 文件名: %1 + - 文件名: %1 - Compiler Set Name: %1 - - 编译器配置: %1 + - 编译器配置: %1 - + Can't find the compiler for file %1 - 找不到适合文件%1的编译器 + 找不到适合文件%1的编译器 - + The Compiler '%1' doesn't exists! - - - - - Processing %1 source file: - 正在处理%1源程序文件: + 编译器程序'%1'不存在! - %1 Compiler: %2 - %1编译器: %2 + Processing %1 source file: + 正在处理%1源程序文件: - + + %1 Compiler: %2 + %1编译器: %2 + + + Command: %1 %2 - 命令: %1 %2 + 命令: %1 %2 SynEdit - - + + The highlighter seems to be in an infinite loop - + 高亮处理进入了死循环 SynEditStringList - + Can't open file '%1' for read! - + 无法读取文件'%1'! - + Can't open file '%1' for save! - + 无法写入文件'%2'! @@ -2683,7 +2760,7 @@ Are you really want to continue? Form - 表单 + 表单 @@ -2748,32 +2825,32 @@ Are you really want to continue? Scroll - + 滚动条 Auto hide scroll bars - + 自动隐藏滚动条 Can scroll the last char to the left edge of the editor - + 可以将每行末尾字符滚动到编辑器最左侧 Can scroll the last line to the top edge of the editor - + 可以将最后一行滚动到编辑器最上方 Page Up/Down scrolls half a page - + 翻页键只滚动半页 Forces page scroll to be one line less - + 在滚动页时少滚动一行 diff --git a/RedPandaIDE/compiler/stdincompiler.cpp b/RedPandaIDE/compiler/stdincompiler.cpp index 5544c800..13b06022 100644 --- a/RedPandaIDE/compiler/stdincompiler.cpp +++ b/RedPandaIDE/compiler/stdincompiler.cpp @@ -28,6 +28,7 @@ bool StdinCompiler::prepareForCompile() QString strFileType; switch(fileType) { case FileType::CSource: + case FileType::CHeader: mArguments += " -x c - "; mArguments += getCCompileArguments(mOnlyCheckSyntax); mArguments += getCIncludeArguments(); @@ -35,6 +36,7 @@ bool StdinCompiler::prepareForCompile() mCompiler = compilerSet()->CCompiler(); break; case FileType::CppSource: + case FileType::CppHeader: mArguments += " -x c++ - "; mArguments += getCCompileArguments(mOnlyCheckSyntax); mArguments += getCIncludeArguments(); diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 83485534..aa645b6a 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -104,6 +104,12 @@ Editor::Editor(QWidget *parent, const QString& filename, } else { initParser(); } + + if (mParser->isSystemHeaderFile(filename) || mParser->isProjectHeaderFile(filename)) { + this->setModified(false); + setReadOnly(true); + updateCaption(); + } // mCompletionPopup = std::make_shared(); // mHeaderCompletionPopup = std::make_shared(); mCompletionPopup = pMainWindow->completionPopup(); @@ -116,6 +122,8 @@ Editor::Editor(QWidget *parent, const QString& filename, connect(this,&SynEdit::gutterClicked,this,&Editor::onGutterClicked); onStatusChanged(SynStatusChange::scOpenFile); + + setAttribute(Qt::WA_Hover,true); } Editor::~Editor() { @@ -557,12 +565,12 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to } - qDebug()<name()<<" - "<name()<<" - "<name() == SYNS_AttrIdentifier)) { BufferCoord p{aChar,line}; BufferCoord pBeginPos,pEndPos; QString s= getWordAtPosition(p, pBeginPos,pEndPos, WordPurpose::wpInformation); - qDebug()<findStatementOf(mFilename, s , p.Line); StatementKind kind = mParser->getKindOfStatement(statement); @@ -584,8 +592,8 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to bool Editor::event(QEvent *event) { - if (event->type() == QEvent::ToolTip) { - QHelpEvent *helpEvent = static_cast(event); + if (event->type() == QEvent::HoverEnter || event->type() == QEvent::HoverMove) { + QHoverEvent *helpEvent = static_cast(event); BufferCoord p; TipType reason = getTipType(helpEvent->pos(),p); PSyntaxIssue pError; @@ -634,12 +642,14 @@ bool Editor::event(QEvent *event) return true; } +// qDebug()<'') then s = s.trimmed(); if ((s == mCurrentWord) && (mCurrentTipType == reason)) { - QApplication* app = dynamic_cast(QApplication::instance()); - if (app->keyboardModifiers().testFlag(Qt::ControlModifier)) { +// QApplication* app = dynamic_cast(QApplication::instance()); +// if (app->keyboardModifiers().testFlag(Qt::ControlModifier)) { + if (helpEvent->modifiers() == Qt::ControlModifier) { setCursor(Qt::PointingHandCursor); } else { setCursor(Qt::ArrowCursor); @@ -680,22 +690,69 @@ bool Editor::event(QEvent *event) case TipType::Error: hint = getErrorHint(pError); } +// qDebug()<<"hint:"<(QApplication::instance()); - if (app->keyboardModifiers().testFlag(Qt::ControlModifier)) { + // QApplication* app = dynamic_cast(QApplication::instance()); + // if (app->keyboardModifiers().testFlag(Qt::ControlModifier)) { + if (helpEvent->modifiers() == Qt::ControlModifier) { setCursor(Qt::PointingHandCursor); } else { setCursor(Qt::ArrowCursor); } - QToolTip::showText(helpEvent->globalPos(),hint); + QToolTip::showText(mapToGlobal(helpEvent->pos()),hint); event->ignore(); } else { event->ignore(); } + return true; + } else if (event->type() == QEvent::HoverLeave) { + cancelHint(); + return true; + } else if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease ) { + if (!mCurrentWord.isEmpty()) { + QKeyEvent* keyEvent = dynamic_cast(event); + if (keyEvent->key() == Qt::Key_Control) { + QApplication* app = dynamic_cast(QApplication::instance()); + QHoverEvent* hoverEvent=new QHoverEvent(QEvent::HoverMove, + mapFromGlobal(QCursor::pos()), + mapFromGlobal(QCursor::pos()), + Qt::ControlModifier + ); + app->postEvent(this,hoverEvent); + } + } } return SynEdit::event(event); } +void Editor::mouseReleaseEvent(QMouseEvent *event) +{ + if (event->button() | Qt::LeftButton) { + mLastIdCharPressed = 0; + } + + // if ctrl+clicked + if ((event->modifiers() == Qt::ControlModifier) + && (event->button() == Qt::LeftButton)) { + + BufferCoord p; + if (PointToCharLine(event->pos(),p)) { + QString s = lines()->getString(p.Line - 1); + if (mParser->isIncludeLine(s)) { + QString filename = mParser->getHeaderFileName(mFilename,s); + Editor * e = pMainWindow->editorList()->getEditorByFilename(filename); + if (e) { + e->setCaretPositionAndActivate(1,1); + return; + } + } +// else +// MainForm.actGotoImplDeclEditorExecute(self); + } + } + SynEdit::mouseReleaseEvent(event); +} + void Editor::copyToClipboard() { if (pSettings->editor().copySizeLimit()) { @@ -1947,10 +2004,8 @@ QString Editor::getParserHint(const QString &s, int line) mFilename,line); } else if (statement->line>0) { QFileInfo fileInfo(statement->fileName); - result = mParser->prettyPrintStatement(statement,mFilename, line) + " - " + - QString(" %1 (%2) ") - .arg(fileInfo.fileName()) - .arg(statement->line) + result = mParser->prettyPrintStatement(statement,mFilename, line) + " - " + + QString("%1(%2)").arg(fileInfo.fileName()).arg(line) + tr("Ctrl+click for more info"); } else { // hard defines result = mParser->prettyPrintStatement(statement, mFilename); @@ -1999,10 +2054,9 @@ QString Editor::getHintForFunction(const PStatement &statement, const PStatement continue; if (!result.isEmpty()) result += "
"; - result = mParser->prettyPrintStatement(childStatement,filename,line) + " - " + - QString(" %1 (%2) ") - .arg(filename) - .arg(childStatement->line) + QFileInfo fileInfo(filename); + result = mParser->prettyPrintStatement(childStatement,filename,line) + " - " + + QString("%1(%2)").arg(fileInfo.fileName()).arg(line) + tr("Ctrl+click for more info"); } } @@ -2505,6 +2559,9 @@ void Editor::updateCaption(const QString& newCaption) { if (this->modified()) { caption.append("[*]"); } + if (this->readOnly()) { + caption.append("["+tr("Readonly")+"]"); + } mParentPageControl->setTabText(index,caption); } else { mParentPageControl->setTabText(index,newCaption); diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index 4dc18afc..aa03eeb0 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -243,6 +243,10 @@ protected: // QObject interface public: bool event(QEvent *event) override; + + // QWidget interface +protected: + void mouseReleaseEvent(QMouseEvent *event) override; }; #endif // EDITOR_H diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 5523d83f..a29a200c 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -349,6 +349,16 @@ void Settings::Editor::setSyntaxCheckWhenLineChanged(bool syntaxCheckWhenLineCha mSyntaxCheckWhenLineChanged = syntaxCheckWhenLineChanged; } +bool Settings::Editor::readOnlySytemHeader() const +{ + return mReadOnlySytemHeader; +} + +void Settings::Editor::setReadOnlySytemHeader(bool newReadOnlySytemHeader) +{ + mReadOnlySytemHeader = newReadOnlySytemHeader; +} + bool Settings::Editor::syntaxCheckWhenSave() const { return mSyntaxCheckWhenSave; @@ -722,6 +732,7 @@ void Settings::Editor::setAutoHideScrollbar(bool autoHideScrollbar) void Settings::Editor::doSave() { saveValue("default_encoding",mDefaultEncoding); + saveValue("readonly_system_header",mReadOnlySytemHeader); // indents saveValue("auto_indent", mAutoIndent); saveValue("add_indent", mAddIndent); @@ -798,6 +809,7 @@ void Settings::Editor::doSave() void Settings::Editor::doLoad() { mDefaultEncoding = value("default_encoding", ENCODING_SYSTEM_DEFAULT).toByteArray(); + mReadOnlySytemHeader = boolValue("readonly_system_header",true); // indents mAutoIndent = boolValue("auto_indent", true); mAddIndent = boolValue("add_indent", true); @@ -1996,7 +2008,6 @@ void Settings::CompilerSets::loadSets() } clearSets(); findSets(); - mDefaultIndex = mList.size()-1; pCurrentSet = defaultSet(); if (!pCurrentSet) { return; @@ -2433,3 +2444,155 @@ void Settings::History::doLoad() mOpenedFiles = stringListValue("opened_files"); mOpenedProjects =stringListValue("opened_projects"); } + +Settings::CodeCompletion::CodeCompletion(Settings *settings):_Base(settings, SETTING_CODE_COMPLETION) +{ + +} + +bool Settings::CodeCompletion::showCodeIns() const +{ + return mShowCodeIns; +} + +void Settings::CodeCompletion::setShowCodeIns(bool newShowCodeIns) +{ + mShowCodeIns = newShowCodeIns; +} + +bool Settings::CodeCompletion::appendFunc() const +{ + return mAppendFunc; +} + +void Settings::CodeCompletion::setAppendFunc(bool newAppendFunc) +{ + mAppendFunc = newAppendFunc; +} + +bool Settings::CodeCompletion::ignoreCase() const +{ + return mIgnoreCase; +} + +void Settings::CodeCompletion::setIgnoreCase(bool newIgnoreCase) +{ + mIgnoreCase = newIgnoreCase; +} + +bool Settings::CodeCompletion::showKeywords() const +{ + return mShowKeywords; +} + +void Settings::CodeCompletion::setShowKeywords(bool newShowKeywords) +{ + mShowKeywords = newShowKeywords; +} + +bool Settings::CodeCompletion::sortByScope() const +{ + return mSortByScope; +} + +void Settings::CodeCompletion::setSortByScope(bool newSortByScope) +{ + mSortByScope = newSortByScope; +} + +bool Settings::CodeCompletion::recordUsage() const +{ + return mRecordUsage; +} + +void Settings::CodeCompletion::setRecordUsage(bool newRecordUsage) +{ + mRecordUsage = newRecordUsage; +} + +bool Settings::CodeCompletion::showCompletionWhileInput() const +{ + return mShowCompletionWhileInput; +} + +void Settings::CodeCompletion::setShowCompletionWhileInput(bool newShowCompletionWhileInput) +{ + mShowCompletionWhileInput = newShowCompletionWhileInput; +} + +bool Settings::CodeCompletion::parseGlobalHeaders() const +{ + return mParseGlobalHeaders; +} + +void Settings::CodeCompletion::setParseGlobalHeaders(bool newParseGlobalHeaders) +{ + mParseGlobalHeaders = newParseGlobalHeaders; +} + +bool Settings::CodeCompletion::parseLocalHeaders() const +{ + return mParseLocalHeaders; +} + +void Settings::CodeCompletion::setParseLocalHeaders(bool newParseLocalHeaders) +{ + mParseLocalHeaders = newParseLocalHeaders; +} + +bool Settings::CodeCompletion::enabled() const +{ + return mEnabled; +} + +void Settings::CodeCompletion::setEnabled(bool newEnabled) +{ + mEnabled = newEnabled; +} + +int Settings::CodeCompletion::height() const +{ + return mHeight; +} + +void Settings::CodeCompletion::setHeight(int newHeight) +{ + mHeight = newHeight; +} + +int Settings::CodeCompletion::width() const +{ + return mWidth; +} + +void Settings::CodeCompletion::setWidth(int newWidth) +{ + mWidth = newWidth; +} + +void Settings::CodeCompletion::doSave() +{ + //Appearence + saveValue("width",mWidth); + saveValue("height",mHeight); + saveValue("enabled",mEnabled); + saveValue("parse_local_headers",mParseLocalHeaders); + saveValue("parse_global_headers",mParseGlobalHeaders); + saveValue("show_completion_while_input",mShowCompletionWhileInput); + saveValue("record_usage",mRecordUsage); + saveValue("sort_by_scope",mSortByScope); + saveValue("show_keywords",mShowKeywords); + saveValue("ignore_case",mIgnoreCase); + saveValue("append_func",mAppendFunc); + saveValue("show_code_ins",mShowCodeIns); +} + + +void Settings::CodeCompletion::doLoad() +{ + //Appearence + mTheme = stringValue("theme","dark"); + mInterfaceFont = stringValue("interface font","Segoe UI"); + mInterfaceFontSize = intValue("interface font size",10); + mLanguage = stringValue("language", QLocale::system().name()); +} diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index a2bd3dde..e1aec861 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -17,7 +17,8 @@ #define SETTING_ENVIRONMENT "Environment" #define SETTING_EXECUTOR "Executor" #define SETTING_DEBUGGER "Debugger" -#define SETTING_HISTORY "HISTORY" +#define SETTING_HISTORY "History" +#define SETTING_CODE_COMPLETION "CodeCompletion" #define SETTING_COMPILTER_SETS "CompilerSets" #define SETTING_COMPILTER_SETS_DEFAULT_INDEX "defaultIndex" #define SETTING_COMPILTER_SETS_COUNT "count" @@ -261,9 +262,13 @@ public: bool syntaxCheckWhenLineChanged() const; void setSyntaxCheckWhenLineChanged(bool syntaxCheckWhenLineChanged); + bool readOnlySytemHeader() const; + void setReadOnlySytemHeader(bool newReadOnlySytemHeader); + private: QByteArray mDefaultEncoding; //General + bool mReadOnlySytemHeader; // indents bool mAutoIndent; bool mAddIndent; @@ -371,6 +376,66 @@ public: void doLoad() override; }; + class CodeCompletion: public _Base { + public: + explicit CodeCompletion(Settings *settings); + int width() const; + void setWidth(int newWidth); + + int height() const; + void setHeight(int newHeight); + + bool enabled() const; + void setEnabled(bool newEnabled); + + bool parseLocalHeaders() const; + void setParseLocalHeaders(bool newParseLocalHeaders); + + bool parseGlobalHeaders() const; + void setParseGlobalHeaders(bool newParseGlobalHeaders); + + bool showCompletionWhileInput() const; + void setShowCompletionWhileInput(bool newShowCompletionWhileInput); + + bool recordUsage() const; + void setRecordUsage(bool newRecordUsage); + + bool sortByScope() const; + void setSortByScope(bool newSortByScope); + + bool showKeywords() const; + void setShowKeywords(bool newShowKeywords); + + bool ignoreCase() const; + void setIgnoreCase(bool newIgnoreCase); + + bool appendFunc() const; + void setAppendFunc(bool newAppendFunc); + + bool showCodeIns() const; + void setShowCodeIns(bool newShowCodeIns); + + private: + int mWidth; + int mHeight; + bool mEnabled; + bool mParseLocalHeaders; + bool mParseGlobalHeaders; + bool mShowCompletionWhileInput; + bool mRecordUsage; + bool mSortByScope; + bool mShowKeywords; + bool mIgnoreCase; + bool mAppendFunc; + bool mShowCodeIns; + + // _Base interface + protected: + void doSave() override; + void doLoad() override; + + }; + class History: public _Base { public: explicit History(Settings *settings); diff --git a/RedPandaIDE/settingsdialog/debuggeneralwidget.ui b/RedPandaIDE/settingsdialog/debuggeneralwidget.ui index 5c31b062..5256f55f 100644 --- a/RedPandaIDE/settingsdialog/debuggeneralwidget.ui +++ b/RedPandaIDE/settingsdialog/debuggeneralwidget.ui @@ -138,27 +138,6 @@ - - - - Disassembly Coding Style - - - - 11 - - - 11 - - - 11 - - - 11 - - - - diff --git a/RedPandaIDE/settingsdialog/editorsymbolcompletionwidget.ui b/RedPandaIDE/settingsdialog/editorsymbolcompletionwidget.ui index 1cc8a99a..1ab2862c 100644 --- a/RedPandaIDE/settingsdialog/editorsymbolcompletionwidget.ui +++ b/RedPandaIDE/settingsdialog/editorsymbolcompletionwidget.ui @@ -14,6 +14,19 @@ Form + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -138,19 +151,6 @@ - - - Qt::Vertical - - - - 20 - 40 - - - - - Remove symbol pairs when delete chars