diff --git a/NEWS.md b/NEWS.md index 1912ddfd..4d699c45 100644 --- a/NEWS.md +++ b/NEWS.md @@ -19,6 +19,14 @@ Red Panda C++ Version 0.13.3 - fix: project files' charset settings doesn't work correctly - enhancement: add exec charset option to compiler set settings - enhancement: delete to word begin /delete to word end + - fix: when open a file, all blank lines's indents are removed. + - fix: indent lines displayed at wrong position, when there are folded lines + - fix: if editor's active line color is disabled, caret's position may not be correct redrawn + - fix: insert code snippets will crash, if current compiler set's include dir list is not empty and lib dir list is empty + - fix: search around option can't be disabled + - enhancement: show a confirm dialog when search/replace around + - enhancement: auto zoom ui when screen's zoom factor changed (windows) + - enhancement: parser not called when open a file, if option "clean parser symbols when hidden" is turned on. Red Panda C++ Version 0.13.2 - fix: "delete and exit" button in the environtment / folder option page doesn't work correctly diff --git a/RedPandaIDE/HighlighterManager.cpp b/RedPandaIDE/HighlighterManager.cpp index 3a27b035..3d2489a4 100644 --- a/RedPandaIDE/HighlighterManager.cpp +++ b/RedPandaIDE/HighlighterManager.cpp @@ -43,7 +43,7 @@ PSynHighlighter HighlighterManager::getHighlighter(const QString &filename) || suffix == "CPP" || suffix =="H" || suffix == "c++" || suffix == "h++") { return getCppHighlighter(); - } else if (suffix == "vs" || suffix == "fs") { + } else if (suffix == "vs" || suffix == "fs" || suffix == "frag") { return getGLSLHighlighter(); } } diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm index 6fb3940a..be776f37 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 4dd712ba..4e8299eb 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -773,9 +773,8 @@ p, li { white-space: pre-wrap; } 链接时加入下列选项 - Add Charset arguments when calling the compiler - 编译时自动加入字符编码选项 + 编译时自动加入字符编码选项 @@ -807,6 +806,12 @@ p, li { white-space: pre-wrap; } Remove 删除 + + + Convert Executable's Charset as + Convert Executable's Charset + 将可执行文件中的字符串转码为 + Statically link libraries @@ -902,12 +907,12 @@ p, li { white-space: pre-wrap; } 选择性能分析器 - + Confirm 确认 - + Red Panda C++ will clear current compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Are you really want to continue? Red Panda C++ will clear current compiler list and search for compilers in the following locations: '%1' @@ -916,50 +921,50 @@ Are you really want to continue? 小熊猫C++ 将会清除现有的编译器配置列表,然后在下列文件夹中搜索编译器:<br/> '%1'<br/> '%2'<br />你确定要继续吗? - + ANSI ANSI - + UTF-8 UTF-8 - + Red Panda C++ will clear current compiler list and search for compilers in the the PATH. <br />Are you really want to continue? 小熊猫C++ 将会清除现有的编译器配置列表,然后在PATH路径中搜索gcc编译器.<br />你确定要继续吗? - - + + Failed 失败 - - + + Can't find any compiler. 找不到编译器 - - + + Compiler Set Name 编译器配置名称 - + Name 名称 - + Compiler Set Folder 编译器所在文件夹 - + New name 新名称 @@ -1262,45 +1267,45 @@ Are you really want to continue? 要剪切的内容超过了字符数限制! - + Print Document 打印文档 - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 - - + + Symbol '%1' not found! 未找到符号'%1'! - + astyle not found 找不到astyle程序 - + Can't find astyle in "%1". 找不到astyle程序"%1". - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Readonly 只读 @@ -3219,7 +3224,7 @@ Are you really want to continue? - + @@ -3229,54 +3234,54 @@ Are you really want to continue? 编译器 - - + + Compile Log 编译日志 - + File 文件 - + Tools 工具 - - + + Run 运行 - + Edit 编辑 - - + + Project 项目 - + Watch 监视 - + Structure 结构 - + Files 文件 @@ -3285,85 +3290,85 @@ 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 窗口 @@ -3381,249 +3386,249 @@ 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 单步进入 - + Problem Set 试题集 @@ -3662,560 +3667,581 @@ Are you really want to continue? 载入试题集 - + 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 视图 - + Tool Windows 工具窗口 - + Main 主工具栏 - + Compiler Set 编译器配置集 - - + + 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 跳转到声明处 - + 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 在终端中打开 - + 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参考手册 - + Tool Window Bars 工具窗口栏 - + 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 + Insert Line 插入行 - + 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 删除到行首 @@ -4224,38 +4250,38 @@ Are you really want to continue? C/C++参考 - + EGE Manual EGE图形库手册 - + Add Bookmark 添加书签 - + Remove Bookmark 删除书签 - + Modify Bookmark Description 修改书签说明 - + Locate in Files View 在文件视图中定位 - + Open Folder 打开文件夹 - + Running Parameters... 运行参数... @@ -6006,6 +6032,26 @@ Are you really want to continue? Cannot find the %1 "%2" 无法找到%1程序"%2" + + + C Compiler + C编译器 + + + + C++ Compiler + C++编译器 + + + + Maker + 构建程序(Make) + + + + Debugger + 调试器 + C options @@ -6072,7 +6118,7 @@ Are you really want to continue? 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? @@ -6171,34 +6217,34 @@ Are you really want to continue? 只生成汇编代码(-S) - - + + Confirm 确认 - + The following problems were found during validation of compiler set "%1": 在验证编译器设置"%1"时遇到了下列问题: - + Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths? 是否让小熊猫C++删除这些配置,并尝试重新建立配置? - + Leaving those directories will lead to problems during compilation.<br /><br />Unless you know exactly what you're doing, it is recommended that you click Yes. 如果仍然保留这些设置,可能会导致编译错误。<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 @@ -6223,13 +6269,13 @@ Are you really want to continue? C++包含文件 - + No - + Yes @@ -6732,7 +6778,7 @@ Are you really want to continue? - + Replace 替换 @@ -6742,10 +6788,36 @@ Are you really want to continue? 在文件中替换 - + + Continue Search + Search Around + 继续查找 + + + + + End of file has been reached. + End of file has been reached. + 已到达文件结尾。 + + + + + Do you want to continue from file's beginning? + Do you want to start from beginning? + 是否从文件开头继续? + + + Replace this occurrence of ''%1''? 替换这里的"%1"? + + + Continue Replace + Replace Around + 继续替换 + SearchResultListModel @@ -7347,7 +7419,7 @@ Are you really want to continue? 无法读取文件'%1'! - + Can't open file '%1' for save! 无法写入文件'%2'! diff --git a/RedPandaIDE/autolinkmanager.cpp b/RedPandaIDE/autolinkmanager.cpp index c7d8c421..cff90af0 100644 --- a/RedPandaIDE/autolinkmanager.cpp +++ b/RedPandaIDE/autolinkmanager.cpp @@ -32,7 +32,15 @@ AutolinkManager::AutolinkManager() PAutolink AutolinkManager::getLink(const QString &header) const { - return mLinks.value(header,PAutolink()); + PAutolink link = mLinks.value(header,PAutolink()); + if (link) + return link; + foreach (QString key, mLinks.keys()) { + if (header.endsWith("/"+key, PATH_SENSITIVITY)) { + return mLinks.value(key); + } + } + return PAutolink(); } void AutolinkManager::load() diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index 055e5857..be4fbaec 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -534,11 +534,10 @@ QString Compiler::parseFileIncludesForAutolink( PCppParser& parser) { QString result; - QString baseName = extractFileName(filename); if (parsedFiles.contains(filename)) return result; parsedFiles.insert(filename); - PAutolink autolink = pAutolinkManager->getLink(baseName); + PAutolink autolink = pAutolinkManager->getLink(filename); if (autolink) { result += ' '+autolink->linkOption; } diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 913e4a55..3b042902 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -100,11 +100,6 @@ Editor::Editor(QWidget *parent, const QString& filename, mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber()); } QFileInfo fileInfo(mFilename); - if (mParentPageControl!=nullptr) { - mParentPageControl->addTab(this,""); - updateCaption(); - } - PSynHighlighter highlighter; if (!isNew) { loadFile(); @@ -134,7 +129,6 @@ Editor::Editor(QWidget *parent, const QString& filename, && mParser && (mParser->isSystemHeaderFile(mFilename) || mParser->isProjectHeaderFile(mFilename))) { this->setModified(false); setReadOnly(true); - updateCaption(); } mCompletionPopup = pMainWindow->completionPopup(); @@ -180,6 +174,10 @@ Editor::Editor(QWidget *parent, const QString& filename, resetBreakpoints(); } mStatementColors = pMainWindow->statementColors(); + if (mParentPageControl!=nullptr) { + mParentPageControl->addTab(this,""); + updateCaption(); + } } Editor::~Editor() { @@ -524,12 +522,6 @@ void Editor::wheelEvent(QWheelEvent *event) { void Editor::focusInEvent(QFocusEvent *event) { SynEdit::focusInEvent(event); - if (mParser) { - connect(mParser.get(), - &CppParser::onEndParsing, - this, - &SynEdit::invalidate); - } pMainWindow->updateAppTitle(); pMainWindow->updateEditorActions(); pMainWindow->updateStatusbarForLineCol(); @@ -540,12 +532,6 @@ void Editor::focusInEvent(QFocusEvent *event) void Editor::focusOutEvent(QFocusEvent *event) { SynEdit::focusOutEvent(event); - if (mParser) { - disconnect(mParser.get(), - &CppParser::onEndParsing, - this, - &SynEdit::invalidate); - } //pMainWindow->updateClassBrowserForEditor(nullptr); pMainWindow->updateStatusbarForLineCol(); pMainWindow->updateForStatusbarModeInfo(); @@ -1195,6 +1181,40 @@ void Editor::closeEvent(QCloseEvent *) pMainWindow->functionTip()->hide(); } +void Editor::showEvent(QShowEvent */*event*/) +{ + if (pSettings->codeCompletion().clearWhenEditorHidden() + && !inProject()) { + initParser(); + } + if (mParser) { + connect(mParser.get(), + &CppParser::onEndParsing, + this, + &SynEdit::invalidate); + } + if (pSettings->codeCompletion().clearWhenEditorHidden() + && !inProject()) { + reparse(); + } + reparseTodo(); + setHideTime(QDateTime()); +} + +void Editor::hideEvent(QHideEvent */*event*/) +{ + if (mParser) { + disconnect(mParser.get(), + &CppParser::onEndParsing, + this, + &SynEdit::invalidate); + } + if (pSettings->codeCompletion().clearWhenEditorHidden() + && !inProject() && mParser) + mParser->reset(); + setHideTime(QDateTime::currentDateTime()); +} + void Editor::copyToClipboard() { if (pSettings->editor().copySizeLimit()) { @@ -3124,7 +3144,7 @@ QString Editor::getFileHint(const QString &s) return ""; } -QString Editor::getParserHint(const QStringList& expression,const QString &s, int line) +QString Editor::getParserHint(const QStringList& expression,const QString &/*s*/, int line) { // This piece of code changes the parser database, possibly making hints and code completion invalid... QString result; diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index e2a0247f..beef612c 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -372,6 +372,11 @@ protected: void mouseReleaseEvent(QMouseEvent *event) override; void inputMethodEvent(QInputMethodEvent *) override; void closeEvent(QCloseEvent *event) override; + + // QWidget interface +protected: + void showEvent(QShowEvent *event) override; + void hideEvent(QHideEvent *event) override; }; QString getWordAtPosition(SynEdit* editor, diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index 8121bc0f..a8bf6420 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "common.h" #include "colorscheme.h" @@ -60,7 +61,8 @@ bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray & /*eventType*/ } break; case WM_DPICHANGED: - //todo + setDesktopDpi(HIWORD(pMsg->wParam)); + pMainWindow->updateDPI(); break; } return false; @@ -159,6 +161,7 @@ int main(int argc, char *argv[]) //set default open folder QDir::setCurrent(pSettings->environment().defaultOpenFolder()); + setDesktopDpi(qApp->desktop()->logicalDpiY()); MainWindow mainWindow; pMainWindow = &mainWindow; diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 22ce6e38..2ecc9c9f 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -689,6 +689,11 @@ void MainWindow::setActiveBreakpoint(QString FileName, int Line, bool setFocus) } } +void MainWindow::updateDPI() +{ + applySettings(); +} + void MainWindow::updateAppTitle() { QString appName=tr("Red Panda C++"); @@ -949,8 +954,6 @@ void MainWindow::openFiles(const QStringList &files) auto end = finally([this] { this->mEditorList->endUpdate(); mOpenningFiles = false; - updateEditorParser(ui->EditorTabsLeft); - updateEditorParser(ui->EditorTabsRight); }); //Check if there is a project file in the list and open it for (const QString& file:files) { @@ -5217,39 +5220,6 @@ PSymbolUsageManager &MainWindow::symbolUsageManager() return mSymbolUsageManager; } -void MainWindow::updateEditorParser(QTabWidget* tabWidget) { - if (mOpenningFiles) - return; - Editor * editor = mEditorList->getEditor(-1,tabWidget); - if (pSettings->codeCompletion().clearWhenEditorHidden()) { - for (int i=0;icount();i++) { - Editor * e = (Editor*)(tabWidget->widget(i)); - if (!e->inProject()) { - if (e!=editor && e->parser() && !e->notParsed()) { - e->parser()->reset(); - } - } - } - } - if (editor && editor->parser() && editor->notParsed()) { - resetCppParser(editor->parser()); - editor->reparse(); - } -} - -void MainWindow::updateEditorHideTime(QTabWidget* tabWidget) { - Editor * editor = mEditorList->getEditor(-1,tabWidget); - for (int i=0;icount();i++) { - Editor * e = (Editor*)(tabWidget->widget(i)); - if (e!=editor) { - if (!e->hideTime().isValid()) - e->setHideTime(QDateTime::currentDateTime()); - } else { - e->setHideTime(QDateTime()); - } - } -} - void MainWindow::showHideInfosTab(QWidget *widget, bool show) { int idx = findTabIndex(ui->tabInfos,widget); @@ -5388,26 +5358,13 @@ void MainWindow::onEditorRenamed(const QString &oldFilename, const QString &newF void MainWindow::on_EditorTabsLeft_currentChanged(int) { - Editor * editor = mEditorList->getEditor(-1,ui->EditorTabsLeft); - if (editor) { - editor->reparseTodo(); - } - updateEditorParser(ui->EditorTabsLeft); - updateEditorHideTime(ui->EditorTabsLeft); } void MainWindow::on_EditorTabsRight_currentChanged(int) { - Editor * editor = mEditorList->getEditor(-1,ui->EditorTabsRight); - if (editor) { - editor->reparseTodo(); - } - updateEditorParser(ui->EditorTabsRight); - updateEditorHideTime(ui->EditorTabsRight); } - void MainWindow::on_tableTODO_doubleClicked(const QModelIndex &index) { PTodoItem item = mTodoModel.getItem(index); @@ -5417,7 +5374,6 @@ void MainWindow::on_tableTODO_doubleClicked(const QModelIndex &index) editor->setCaretPositionAndActivate(item->lineNo,item->ch+1); } } - } diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index fc1f0b29..ebb689ca 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -215,6 +215,7 @@ public slots: void onTodoParsing(const QString& filename, int lineNo, int ch, const QString& line); void onTodoParseFinished(); void setActiveBreakpoint(QString FileName, int Line, bool setFocus); + void updateDPI(); private: void prepareProjectForCompile(); @@ -242,8 +243,6 @@ private: void doCompileRun(RunType runType); void updateProblemCaseOutput(POJProblemCase problemCase); void applyCurrentProblemCaseChanges(); - void updateEditorParser(QTabWidget* tabWidget); - void updateEditorHideTime(QTabWidget* tabWidget); void showHideInfosTab(QWidget *widget, bool show); void showHideMessagesTab(QWidget *widget, bool show); void prepareTabInfosData(); diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 6e60382a..6086f79a 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -266,14 +266,8 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPosVisible, BufferCoord value) if (mCaretY != value.Line) { int oldCaretY = mCaretY; mCaretY = value.Line; - if (mActiveLineColor.isValid()) { - invalidateLine(mCaretY); - invalidateLine(oldCaretY); - } - if (mGutter.activeLineTextColor().isValid()) { - invalidateGutterLine(mCaretY); - invalidateGutterLine(oldCaretY); - } + invalidateLine(mCaretY); + invalidateLine(oldCaretY); mStatusChanges.setFlag(SynStatusChange::scCaretY); } // Call UpdateLastCaretX before DecPaintLock because the event handler it @@ -4761,7 +4755,7 @@ void SynEdit::doSetSelText(const QString &Value) } int SynEdit::searchReplace(const QString &sSearch, const QString &sReplace, SynSearchOptions sOptions, PSynSearchBase searchEngine, - SynSearchMathedProc matchedCallback) + SynSearchMathedProc matchedCallback, SynSearchConfirmAroundProc confirmAroundCallback) { if (!searchEngine) return 0; @@ -4923,9 +4917,10 @@ int SynEdit::searchReplace(const QString &sSearch, const QString &sReplace, SynS ptCurrent.Line--; else ptCurrent.Line++; - if ( - ((ptCurrent.Line < ptStart.Line) || (ptCurrent.Line > ptEnd.Line)) - && bFromCursor){ + if (((ptCurrent.Line < ptStart.Line) || (ptCurrent.Line > ptEnd.Line)) + && bFromCursor && sOptions.testFlag(ssoWrapAround)){ + if (confirmAroundCallback && !confirmAroundCallback()) + break; //search start from cursor, search has finished but no result founds bFromCursor = false; ptStart.Char = 1; diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index 542db9f3..d30f1210 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -147,6 +147,7 @@ using SynPaintProc = std::function; // SynFontStyles& style, QColor& foreground, QColor& background)>; using SynSearchMathedProc = std::function; +using SynSearchConfirmAroundProc = std::function; class SynEdit; using PSynEdit = std::shared_ptr; @@ -244,7 +245,8 @@ public: void setSelText(const QString& text); int searchReplace(const QString& sSearch, const QString& sReplace, SynSearchOptions options, - PSynSearchBase searchEngine, SynSearchMathedProc matchedCallback = nullptr); + PSynSearchBase searchEngine, SynSearchMathedProc matchedCallback = nullptr, + SynSearchConfirmAroundProc confirmAroundCallback = nullptr); int maxScrollWidth() const; int maxScrollHeight() const; diff --git a/RedPandaIDE/qsynedit/TextBuffer.cpp b/RedPandaIDE/qsynedit/TextBuffer.cpp index c5196e8a..4ca7f828 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.cpp +++ b/RedPandaIDE/qsynedit/TextBuffer.cpp @@ -556,18 +556,25 @@ void SynEditStringList::loadFromFile(const QString& filename, const QByteArray& } internalClear(); while (true) { + if (line.endsWith("\r\n")) { + line.remove(line.length()-2,2); + } else if (line.endsWith("\r")) { + line.remove(line.length()-1,1); + } else if (line.endsWith("\n")){ + line.remove(line.length()-1,1); + } if (allAscii) { allAscii = isTextAllAscii(line); } if (allAscii) { - addItem(trimRight(QString::fromLatin1(line))); + addItem(QString::fromLatin1(line)); } else { QString newLine = codec->toUnicode(line.constData(),line.length(),&state); if (state.invalidChars>0) { needReread = true; break; } - addItem(trimRight(newLine)); + addItem(newLine); } if (file.atEnd()){ break; @@ -600,7 +607,14 @@ void SynEditStringList::loadFromFile(const QString& filename, const QByteArray& QString line; internalClear(); while (textStream.readLineInto(&line)) { - addItem(trimRight(line)); + if (line.endsWith("\r\n")) { + line.remove(line.length()-2,2); + } else if (line.endsWith("\r")) { + line.remove(line.length()-1,1); + } else if (line.endsWith("\n")){ + line.remove(line.length()-1,1); + } + addItem(line); } emit inserted(0,mList.count()); } diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index 23a69019..fb633f9e 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -723,7 +723,7 @@ void SynEditTextPainter::PaintFoldAttributes() if (vLine > edit->mLines->count() && edit->mLines->count() > 0) break; // Set vertical coord - Y = (vLine - edit->mTopLine) * edit->mTextHeight; // limit inside clip rect + Y = (cRow - edit->mTopLine) * edit->mTextHeight; // limit inside clip rect if (edit->mTextHeight % 2 == 1 && vLine % 2 == 0) { Y++; } diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index b2b09137..60e05332 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1591,22 +1591,22 @@ bool Settings::CompilerSet::validateExes(QString &msg) msg =""; if (!fileExists(mCCompiler)) { msg += QObject::tr("Cannot find the %1 \"%2\"") - .arg("C Compiler") + .arg(QObject::tr("C Compiler")) .arg(mCCompiler); } if (!fileExists(mCppCompiler)) { msg += QObject::tr("Cannot find the %1 \"%2\"") - .arg("C++ Compiler") + .arg(QObject::tr("C++ Compiler")) .arg(mCppCompiler); } - if (!fileExists(mMake)) { + if (!mMake.isEmpty() && !fileExists(mMake)) { msg += QObject::tr("Cannot find the %1 \"%2\"") - .arg("Maker") + .arg(QObject::tr("Maker")) .arg(mMake); } if (!fileExists(mDebugger)) { msg += QObject::tr("Cannot find the %1 \"%2\"") - .arg("Maker") + .arg(QObject::tr("Debugger")) .arg(mDebugger); } if (!msg.isEmpty()) @@ -2533,22 +2533,27 @@ void Settings::CompilerSets::clearSets() void Settings::CompilerSets::findSets() { clearSets(); + QSet searched; #ifdef Q_OS_WIN addSets(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW32"+QDir::separator()+"bin"); addSets(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW64"+QDir::separator()+"bin"); + searched.insert(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW32"+QDir::separator()+"bin"); + searched.insert(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW64"+QDir::separator()+"bin"); #endif + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString path = env.value("PATH"); QStringList pathList = path.split(PATH_SEPARATOR); - QSet searched; foreach (const QString& s, pathList){ if (searched.contains(s)) continue;; searched.insert(s); - if (s!="/bin") // /bin/gcc is symbolic link to /usr/bin/gcc + if (s!="/bin") { // /bin/gcc is symbolic link to /usr/bin/gcc addSets(s); + } } + } void Settings::CompilerSets::saveSets() diff --git a/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp b/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp index 08ddb91e..5a8a535f 100644 --- a/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp +++ b/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp @@ -59,7 +59,6 @@ CompilerSetOptionWidget::~CompilerSetOptionWidget() void CompilerSetOptionWidget::init() { - ui->cbEncoding->setVisible(false); ui->cbEncodingDetails->setVisible(false); ui->cbEncoding->clear(); ui->cbEncoding->addItem(tr("ANSI"),ENCODING_SYSTEM_DEFAULT); @@ -144,7 +143,6 @@ static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSet ui->txtResourceCompiler->setText(pSet->resourceCompiler()); ui->txtProfiler->setText(pSet->profiler()); - ui->cbEncoding->setVisible(pSet->autoAddCharsetParams()); if (pSet->execCharset() == ENCODING_AUTO_DETECT || pSet->execCharset() == ENCODING_SYSTEM_DEFAULT || pSet->execCharset() == ENCODING_UTF8) { diff --git a/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui b/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui index 19fa4142..9fcb6130 100644 --- a/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui +++ b/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui @@ -138,7 +138,7 @@ - Add Charset arguments when calling the compiler + Convert Executable's Charset as diff --git a/RedPandaIDE/settingsdialog/editorcodecompletionwidget.cpp b/RedPandaIDE/settingsdialog/editorcodecompletionwidget.cpp index eb05e37e..9e35d2a6 100644 --- a/RedPandaIDE/settingsdialog/editorcodecompletionwidget.cpp +++ b/RedPandaIDE/settingsdialog/editorcodecompletionwidget.cpp @@ -50,6 +50,7 @@ void EditorCodeCompletionWidget::doLoad() ui->chkIgnoreCases->setChecked(pSettings->codeCompletion().ignoreCase()); ui->chkAppendFunc->setChecked(pSettings->codeCompletion().appendFunc()); ui->chkShowCodeIns->setChecked(pSettings->codeCompletion().showCodeIns()); + ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden()); ui->spinMinCharRequired->setValue(pSettings->codeCompletion().minCharRequired()); } @@ -74,6 +75,7 @@ void EditorCodeCompletionWidget::doSave() pSettings->codeCompletion().setShowCodeIns(ui->chkShowCodeIns->isChecked()); pSettings->codeCompletion().setMinCharRequired(ui->spinMinCharRequired->value()); + pSettings->codeCompletion().setClearWhenEditorHidden(ui->chkClearWhenEditorHidden->isChecked()); pSettings->codeCompletion().save(); } diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index 66c5baf4..10b14c9e 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -825,7 +825,7 @@ QString parseMacros(const QString &s) // Only provide the first lib dir if (compilerSet->defaultLibDirs().count()>0) - result.replace("", localizePath(compilerSet->defaultCppIncludeDirs().front())); + result.replace("", localizePath(compilerSet->defaultLibDirs().front())); else result.replace("",""); } @@ -1001,12 +1001,12 @@ QString localizePath(const QString &path) float pointToPixel(float point) { - return point * qApp->desktop()->logicalDpiY() / 72; + return point * desktopDpi() / 72; } float pixelToPoint(float pixel) { - return pixel * 72 / qApp->desktop()->logicalDpiY(); + return pixel * 72 / desktopDpi(); } @@ -1076,9 +1076,12 @@ QStringList splitProcessCommand(const QString &cmd) return result; } +static float saved_desktop_dpi = -1; float desktopDpi() { - return qApp->desktop()->logicalDpiY(); + if (saved_desktop_dpi<1) + saved_desktop_dpi = qApp->desktop()->logicalDpiY(); + return saved_desktop_dpi; } qulonglong stringToHex(const QString &str, qulonglong defaultValue) @@ -1089,3 +1092,8 @@ qulonglong stringToHex(const QString &str, qulonglong defaultValue) return value; return defaultValue; } + +void setDesktopDpi(float dpi) +{ + saved_desktop_dpi = dpi; +} diff --git a/RedPandaIDE/utils.h b/RedPandaIDE/utils.h index fee53bab..de920531 100644 --- a/RedPandaIDE/utils.h +++ b/RedPandaIDE/utils.h @@ -232,6 +232,8 @@ class CppParser; void resetCppParser(std::shared_ptr parser, int compilerSetIndex=-1); float desktopDpi(); +void setDesktopDpi(float dpi); + float pointToPixel(float point); float pixelToPoint(float pixel); diff --git a/RedPandaIDE/widgets/searchdialog.cpp b/RedPandaIDE/widgets/searchdialog.cpp index fb42d035..a84485bf 100644 --- a/RedPandaIDE/widgets/searchdialog.cpp +++ b/RedPandaIDE/widgets/searchdialog.cpp @@ -250,7 +250,15 @@ void SearchDialog::on_btnExecute_clicked() if (actionType == SearchAction::Find) { Editor *e = pMainWindow->editorList()->getEditor(); if (e!=nullptr) { - findCount+=execute(e,ui->cbFind->currentText(),""); + findCount+=execute(e,ui->cbFind->currentText(),"",nullptr, + [](){ + return QMessageBox::question(pMainWindow, + tr("Continue Search"), + tr("End of file has been reached. ") + +tr("Do you want to continue from file's beginning?"), + QMessageBox::Yes|QMessageBox::No, + QMessageBox::Yes) == QMessageBox::Yes; + }); } } else if (actionType == SearchAction::Replace) { Editor *e = pMainWindow->editorList()->getEditor(); @@ -279,6 +287,14 @@ void SearchDialog::on_btnExecute_clicked() } else { return SynSearchAction::ReplaceAll; } + }, + [](){ + return QMessageBox::question(pMainWindow, + tr("Continue Replace"), + tr("End of file has been reached. ") + +tr("Do you want to continue from file's beginning?"), + QMessageBox::Yes|QMessageBox::No, + QMessageBox::Yes) == QMessageBox::Yes; }); } @@ -376,7 +392,9 @@ void SearchDialog::on_btnExecute_clicked() } } -int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString &sReplace, SynSearchMathedProc matchCallback) +int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString &sReplace, + SynSearchMathedProc matchCallback, + SynSearchConfirmAroundProc confirmAroundCallback) { if (editor==nullptr) return 0; @@ -398,7 +416,7 @@ int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString } return editor->searchReplace(sSearch, sReplace, mSearchOptions, - mSearchEngine, matchCallback); + mSearchEngine, matchCallback, confirmAroundCallback); } std::shared_ptr SearchDialog::batchFindInEditor(SynEdit *e, const QString& filename,const QString &keyword) diff --git a/RedPandaIDE/widgets/searchdialog.h b/RedPandaIDE/widgets/searchdialog.h index 5d88ded0..260c0067 100644 --- a/RedPandaIDE/widgets/searchdialog.h +++ b/RedPandaIDE/widgets/searchdialog.h @@ -61,7 +61,9 @@ private slots: void on_btnExecute_clicked(); private: int execute(SynEdit* editor, const QString& sSearch, - const QString& sReplace, SynSearchMathedProc matchCallback = nullptr); + const QString& sReplace, + SynSearchMathedProc matchCallback = nullptr, + SynSearchConfirmAroundProc confirmAroundCallback = nullptr); std::shared_ptr batchFindInEditor(SynEdit * editor,const QString& filename, const QString& keyword); private: Ui::SearchDialog *ui; diff --git a/packages/debian/changelog b/packages/debian/changelog index 913747cf..46595c61 100644 --- a/packages/debian/changelog +++ b/packages/debian/changelog @@ -1,3 +1,9 @@ +redpanda-cpp (0.13.3-1) unstable; urgency=medium + + * Update to 0.13.3 + + -- Roy Qu (瞿华) Mon, 24 Jan 2022 21:50:00 +0800 + redpanda-cpp (0.13.2-1) unstable; urgency=medium * Update to 0.13.2 diff --git a/windows/installer-scripts/redpanda-i686-nocompiler.nsi b/windows/installer-scripts/redpanda-i686-nocompiler.nsi index ae93fa74..272564ed 100644 --- a/windows/installer-scripts/redpanda-i686-nocompiler.nsi +++ b/windows/installer-scripts/redpanda-i686-nocompiler.nsi @@ -2,7 +2,7 @@ # Startup !include "config32.nsh" -!define FINALNAME "RedPanda.C++.32bit.${DEVCPP_VERSION}.No.Compiler.Setup.exe" +!define FINALNAME "RedPanda.C++.${DEVCPP_VERSION}.win32.No.Compiler.Setup.exe" !define DISPLAY_NAME "Red Panda C++ 32bit ${DEVCPP_VERSION}" !include "MUI2.nsh" diff --git a/windows/installer-scripts/redpanda-i686.nsi b/windows/installer-scripts/redpanda-i686.nsi index fbe40f68..7217a43e 100644 --- a/windows/installer-scripts/redpanda-i686.nsi +++ b/windows/installer-scripts/redpanda-i686.nsi @@ -3,7 +3,7 @@ !include "config32.nsh" !define COMPILERFOLDER "MinGW32" -!define FINALNAME "RedPanda.C++.32bit.${DEVCPP_VERSION}.${COMPILERNAME}.Setup.exe" +!define FINALNAME "RedPanda.C++.${DEVCPP_VERSION}.win32.${COMPILERNAME}.Setup.exe" !define DISPLAY_NAME "Red Panda C++ 32 bit ${DEVCPP_VERSION}" !include "MUI2.nsh" diff --git a/windows/installer-scripts/redpanda-nocompiler.nsi b/windows/installer-scripts/redpanda-nocompiler.nsi index 1a6e0a3b..1ab78745 100644 --- a/windows/installer-scripts/redpanda-nocompiler.nsi +++ b/windows/installer-scripts/redpanda-nocompiler.nsi @@ -2,7 +2,7 @@ # Startup !include "config.nsh" -!define FINALNAME "RedPanda.C++.${DEVCPP_VERSION}.No.Compiler.Setup.exe" +!define FINALNAME "RedPanda.C++.${DEVCPP_VERSION}.win64.No.Compiler.Setup.exe" !define DISPLAY_NAME "Red Panda C++ ${DEVCPP_VERSION}" !include "MUI2.nsh" diff --git a/windows/installer-scripts/redpanda-x64.nsi b/windows/installer-scripts/redpanda-x64.nsi index 43def0dc..6fde0fe8 100644 --- a/windows/installer-scripts/redpanda-x64.nsi +++ b/windows/installer-scripts/redpanda-x64.nsi @@ -3,7 +3,7 @@ !include "config.nsh" !define COMPILERFOLDER "MinGW64" -!define FINALNAME "RedPanda.C++.${DEVCPP_VERSION}.${COMPILERNAME}.Setup.exe" +!define FINALNAME "RedPanda.C++.${DEVCPP_VERSION}.win64.${COMPILERNAME}.Setup.exe" !define DISPLAY_NAME "Red Panda C++ ${DEVCPP_VERSION}" !include "MUI2.nsh"