diff --git a/NEWS.md b/NEWS.md index 01eebbce..fb5ae43d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -22,6 +22,8 @@ Red Panda C++ Version 0.13.3 - 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 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/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 c37a15bc..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 新名称 @@ -6027,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 @@ -6093,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编译器吗? @@ -6192,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 @@ -6244,13 +6269,13 @@ Are you really want to continue? C++包含文件 - + No - + Yes @@ -6753,7 +6778,7 @@ Are you really want to continue? - + Replace 替换 @@ -6763,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 @@ -7368,7 +7419,7 @@ Are you really want to continue? 无法读取文件'%1'! - + Can't open file '%1' for save! 无法写入文件'%2'! diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 7741f853..6086f79a 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -4755,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; @@ -4917,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/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index b083d499..fb633f9e 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -720,7 +720,6 @@ void SynEditTextPainter::PaintFoldAttributes() // Now loop through all the lines. The indices are valid for Lines. for (cRow = aFirstRow; cRow<=aLastRow;cRow++) { vLine = edit->rowToLine(cRow); - qDebug()< edit->mLines->count() && edit->mLines->count() > 0) break; // Set vertical coord 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 0757cec2..9fcb6130 100644 --- a/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui +++ b/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui @@ -138,7 +138,7 @@ - Convert Executable's Charset + Convert Executable's Charset as 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;