Merge branch 'master' of github.com:royqh1979/RedPanda-CPP

# Conflicts:
#	NEWS.md
This commit is contained in:
royqh1979@gmail.com 2022-01-25 09:58:17 +08:00
commit 326d8ea5f7
28 changed files with 487 additions and 365 deletions

View File

@ -19,6 +19,14 @@ Red Panda C++ Version 0.13.3
- fix: project files' charset settings doesn't work correctly - fix: project files' charset settings doesn't work correctly
- enhancement: add exec charset option to compiler set settings - enhancement: add exec charset option to compiler set settings
- enhancement: delete to word begin /delete to word end - 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 Red Panda C++ Version 0.13.2
- fix: "delete and exit" button in the environtment / folder option page doesn't work correctly - fix: "delete and exit" button in the environtment / folder option page doesn't work correctly

View File

@ -43,7 +43,7 @@ PSynHighlighter HighlighterManager::getHighlighter(const QString &filename)
|| suffix == "CPP" || suffix =="H" || suffix == "c++" || suffix == "CPP" || suffix =="H" || suffix == "c++"
|| suffix == "h++") { || suffix == "h++") {
return getCppHighlighter(); return getCppHighlighter();
} else if (suffix == "vs" || suffix == "fs") { } else if (suffix == "vs" || suffix == "fs" || suffix == "frag") {
return getGLSLHighlighter(); return getGLSLHighlighter();
} }
} }

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,15 @@ AutolinkManager::AutolinkManager()
PAutolink AutolinkManager::getLink(const QString &header) const 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() void AutolinkManager::load()

View File

@ -534,11 +534,10 @@ QString Compiler::parseFileIncludesForAutolink(
PCppParser& parser) PCppParser& parser)
{ {
QString result; QString result;
QString baseName = extractFileName(filename);
if (parsedFiles.contains(filename)) if (parsedFiles.contains(filename))
return result; return result;
parsedFiles.insert(filename); parsedFiles.insert(filename);
PAutolink autolink = pAutolinkManager->getLink(baseName); PAutolink autolink = pAutolinkManager->getLink(filename);
if (autolink) { if (autolink) {
result += ' '+autolink->linkOption; result += ' '+autolink->linkOption;
} }

View File

@ -100,11 +100,6 @@ Editor::Editor(QWidget *parent, const QString& filename,
mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber()); mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber());
} }
QFileInfo fileInfo(mFilename); QFileInfo fileInfo(mFilename);
if (mParentPageControl!=nullptr) {
mParentPageControl->addTab(this,"");
updateCaption();
}
PSynHighlighter highlighter; PSynHighlighter highlighter;
if (!isNew) { if (!isNew) {
loadFile(); loadFile();
@ -134,7 +129,6 @@ Editor::Editor(QWidget *parent, const QString& filename,
&& mParser && (mParser->isSystemHeaderFile(mFilename) || mParser->isProjectHeaderFile(mFilename))) { && mParser && (mParser->isSystemHeaderFile(mFilename) || mParser->isProjectHeaderFile(mFilename))) {
this->setModified(false); this->setModified(false);
setReadOnly(true); setReadOnly(true);
updateCaption();
} }
mCompletionPopup = pMainWindow->completionPopup(); mCompletionPopup = pMainWindow->completionPopup();
@ -180,6 +174,10 @@ Editor::Editor(QWidget *parent, const QString& filename,
resetBreakpoints(); resetBreakpoints();
} }
mStatementColors = pMainWindow->statementColors(); mStatementColors = pMainWindow->statementColors();
if (mParentPageControl!=nullptr) {
mParentPageControl->addTab(this,"");
updateCaption();
}
} }
Editor::~Editor() { Editor::~Editor() {
@ -524,12 +522,6 @@ void Editor::wheelEvent(QWheelEvent *event) {
void Editor::focusInEvent(QFocusEvent *event) void Editor::focusInEvent(QFocusEvent *event)
{ {
SynEdit::focusInEvent(event); SynEdit::focusInEvent(event);
if (mParser) {
connect(mParser.get(),
&CppParser::onEndParsing,
this,
&SynEdit::invalidate);
}
pMainWindow->updateAppTitle(); pMainWindow->updateAppTitle();
pMainWindow->updateEditorActions(); pMainWindow->updateEditorActions();
pMainWindow->updateStatusbarForLineCol(); pMainWindow->updateStatusbarForLineCol();
@ -540,12 +532,6 @@ void Editor::focusInEvent(QFocusEvent *event)
void Editor::focusOutEvent(QFocusEvent *event) void Editor::focusOutEvent(QFocusEvent *event)
{ {
SynEdit::focusOutEvent(event); SynEdit::focusOutEvent(event);
if (mParser) {
disconnect(mParser.get(),
&CppParser::onEndParsing,
this,
&SynEdit::invalidate);
}
//pMainWindow->updateClassBrowserForEditor(nullptr); //pMainWindow->updateClassBrowserForEditor(nullptr);
pMainWindow->updateStatusbarForLineCol(); pMainWindow->updateStatusbarForLineCol();
pMainWindow->updateForStatusbarModeInfo(); pMainWindow->updateForStatusbarModeInfo();
@ -1195,6 +1181,40 @@ void Editor::closeEvent(QCloseEvent *)
pMainWindow->functionTip()->hide(); 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() void Editor::copyToClipboard()
{ {
if (pSettings->editor().copySizeLimit()) { if (pSettings->editor().copySizeLimit()) {
@ -3124,7 +3144,7 @@ QString Editor::getFileHint(const QString &s)
return ""; 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... // This piece of code changes the parser database, possibly making hints and code completion invalid...
QString result; QString result;

View File

@ -372,6 +372,11 @@ protected:
void mouseReleaseEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override;
void inputMethodEvent(QInputMethodEvent *) override; void inputMethodEvent(QInputMethodEvent *) override;
void closeEvent(QCloseEvent *event) override; void closeEvent(QCloseEvent *event) override;
// QWidget interface
protected:
void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;
}; };
QString getWordAtPosition(SynEdit* editor, QString getWordAtPosition(SynEdit* editor,

View File

@ -25,6 +25,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QStringList> #include <QStringList>
#include <QAbstractNativeEventFilter> #include <QAbstractNativeEventFilter>
#include <QDesktopWidget>
#include <QDir> #include <QDir>
#include "common.h" #include "common.h"
#include "colorscheme.h" #include "colorscheme.h"
@ -60,7 +61,8 @@ bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray & /*eventType*/
} }
break; break;
case WM_DPICHANGED: case WM_DPICHANGED:
//todo setDesktopDpi(HIWORD(pMsg->wParam));
pMainWindow->updateDPI();
break; break;
} }
return false; return false;
@ -159,6 +161,7 @@ int main(int argc, char *argv[])
//set default open folder //set default open folder
QDir::setCurrent(pSettings->environment().defaultOpenFolder()); QDir::setCurrent(pSettings->environment().defaultOpenFolder());
setDesktopDpi(qApp->desktop()->logicalDpiY());
MainWindow mainWindow; MainWindow mainWindow;
pMainWindow = &mainWindow; pMainWindow = &mainWindow;

View File

@ -689,6 +689,11 @@ void MainWindow::setActiveBreakpoint(QString FileName, int Line, bool setFocus)
} }
} }
void MainWindow::updateDPI()
{
applySettings();
}
void MainWindow::updateAppTitle() void MainWindow::updateAppTitle()
{ {
QString appName=tr("Red Panda C++"); QString appName=tr("Red Panda C++");
@ -949,8 +954,6 @@ void MainWindow::openFiles(const QStringList &files)
auto end = finally([this] { auto end = finally([this] {
this->mEditorList->endUpdate(); this->mEditorList->endUpdate();
mOpenningFiles = false; mOpenningFiles = false;
updateEditorParser(ui->EditorTabsLeft);
updateEditorParser(ui->EditorTabsRight);
}); });
//Check if there is a project file in the list and open it //Check if there is a project file in the list and open it
for (const QString& file:files) { for (const QString& file:files) {
@ -5217,39 +5220,6 @@ PSymbolUsageManager &MainWindow::symbolUsageManager()
return mSymbolUsageManager; return mSymbolUsageManager;
} }
void MainWindow::updateEditorParser(QTabWidget* tabWidget) {
if (mOpenningFiles)
return;
Editor * editor = mEditorList->getEditor(-1,tabWidget);
if (pSettings->codeCompletion().clearWhenEditorHidden()) {
for (int i=0;i<tabWidget->count();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;i<tabWidget->count();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) void MainWindow::showHideInfosTab(QWidget *widget, bool show)
{ {
int idx = findTabIndex(ui->tabInfos,widget); 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) 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) 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) void MainWindow::on_tableTODO_doubleClicked(const QModelIndex &index)
{ {
PTodoItem item = mTodoModel.getItem(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); editor->setCaretPositionAndActivate(item->lineNo,item->ch+1);
} }
} }
} }

View File

@ -215,6 +215,7 @@ public slots:
void onTodoParsing(const QString& filename, int lineNo, int ch, const QString& line); void onTodoParsing(const QString& filename, int lineNo, int ch, const QString& line);
void onTodoParseFinished(); void onTodoParseFinished();
void setActiveBreakpoint(QString FileName, int Line, bool setFocus); void setActiveBreakpoint(QString FileName, int Line, bool setFocus);
void updateDPI();
private: private:
void prepareProjectForCompile(); void prepareProjectForCompile();
@ -242,8 +243,6 @@ private:
void doCompileRun(RunType runType); void doCompileRun(RunType runType);
void updateProblemCaseOutput(POJProblemCase problemCase); void updateProblemCaseOutput(POJProblemCase problemCase);
void applyCurrentProblemCaseChanges(); void applyCurrentProblemCaseChanges();
void updateEditorParser(QTabWidget* tabWidget);
void updateEditorHideTime(QTabWidget* tabWidget);
void showHideInfosTab(QWidget *widget, bool show); void showHideInfosTab(QWidget *widget, bool show);
void showHideMessagesTab(QWidget *widget, bool show); void showHideMessagesTab(QWidget *widget, bool show);
void prepareTabInfosData(); void prepareTabInfosData();

View File

@ -266,14 +266,8 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPosVisible, BufferCoord value)
if (mCaretY != value.Line) { if (mCaretY != value.Line) {
int oldCaretY = mCaretY; int oldCaretY = mCaretY;
mCaretY = value.Line; mCaretY = value.Line;
if (mActiveLineColor.isValid()) { invalidateLine(mCaretY);
invalidateLine(mCaretY); invalidateLine(oldCaretY);
invalidateLine(oldCaretY);
}
if (mGutter.activeLineTextColor().isValid()) {
invalidateGutterLine(mCaretY);
invalidateGutterLine(oldCaretY);
}
mStatusChanges.setFlag(SynStatusChange::scCaretY); mStatusChanges.setFlag(SynStatusChange::scCaretY);
} }
// Call UpdateLastCaretX before DecPaintLock because the event handler it // 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, int SynEdit::searchReplace(const QString &sSearch, const QString &sReplace, SynSearchOptions sOptions, PSynSearchBase searchEngine,
SynSearchMathedProc matchedCallback) SynSearchMathedProc matchedCallback, SynSearchConfirmAroundProc confirmAroundCallback)
{ {
if (!searchEngine) if (!searchEngine)
return 0; return 0;
@ -4923,9 +4917,10 @@ int SynEdit::searchReplace(const QString &sSearch, const QString &sReplace, SynS
ptCurrent.Line--; ptCurrent.Line--;
else else
ptCurrent.Line++; ptCurrent.Line++;
if ( if (((ptCurrent.Line < ptStart.Line) || (ptCurrent.Line > ptEnd.Line))
((ptCurrent.Line < ptStart.Line) || (ptCurrent.Line > ptEnd.Line)) && bFromCursor && sOptions.testFlag(ssoWrapAround)){
&& bFromCursor){ if (confirmAroundCallback && !confirmAroundCallback())
break;
//search start from cursor, search has finished but no result founds //search start from cursor, search has finished but no result founds
bFromCursor = false; bFromCursor = false;
ptStart.Char = 1; ptStart.Char = 1;

View File

@ -147,6 +147,7 @@ using SynPaintProc = std::function<void(const QPaintDevice& paintDevice )>;
// SynFontStyles& style, QColor& foreground, QColor& background)>; // SynFontStyles& style, QColor& foreground, QColor& background)>;
using SynSearchMathedProc = std::function<SynSearchAction(const QString& sSearch, using SynSearchMathedProc = std::function<SynSearchAction(const QString& sSearch,
const QString& sReplace, int Line, int ch, int wordLen)>; const QString& sReplace, int Line, int ch, int wordLen)>;
using SynSearchConfirmAroundProc = std::function<bool ()>;
class SynEdit; class SynEdit;
using PSynEdit = std::shared_ptr<SynEdit>; using PSynEdit = std::shared_ptr<SynEdit>;
@ -244,7 +245,8 @@ public:
void setSelText(const QString& text); void setSelText(const QString& text);
int searchReplace(const QString& sSearch, const QString& sReplace, SynSearchOptions options, 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 maxScrollWidth() const;
int maxScrollHeight() const; int maxScrollHeight() const;

View File

@ -556,18 +556,25 @@ void SynEditStringList::loadFromFile(const QString& filename, const QByteArray&
} }
internalClear(); internalClear();
while (true) { 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) { if (allAscii) {
allAscii = isTextAllAscii(line); allAscii = isTextAllAscii(line);
} }
if (allAscii) { if (allAscii) {
addItem(trimRight(QString::fromLatin1(line))); addItem(QString::fromLatin1(line));
} else { } else {
QString newLine = codec->toUnicode(line.constData(),line.length(),&state); QString newLine = codec->toUnicode(line.constData(),line.length(),&state);
if (state.invalidChars>0) { if (state.invalidChars>0) {
needReread = true; needReread = true;
break; break;
} }
addItem(trimRight(newLine)); addItem(newLine);
} }
if (file.atEnd()){ if (file.atEnd()){
break; break;
@ -600,7 +607,14 @@ void SynEditStringList::loadFromFile(const QString& filename, const QByteArray&
QString line; QString line;
internalClear(); internalClear();
while (textStream.readLineInto(&line)) { 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()); emit inserted(0,mList.count());
} }

View File

@ -723,7 +723,7 @@ void SynEditTextPainter::PaintFoldAttributes()
if (vLine > edit->mLines->count() && edit->mLines->count() > 0) if (vLine > edit->mLines->count() && edit->mLines->count() > 0)
break; break;
// Set vertical coord // 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) { if (edit->mTextHeight % 2 == 1 && vLine % 2 == 0) {
Y++; Y++;
} }

View File

@ -1591,22 +1591,22 @@ bool Settings::CompilerSet::validateExes(QString &msg)
msg =""; msg ="";
if (!fileExists(mCCompiler)) { if (!fileExists(mCCompiler)) {
msg += QObject::tr("Cannot find the %1 \"%2\"") msg += QObject::tr("Cannot find the %1 \"%2\"")
.arg("C Compiler") .arg(QObject::tr("C Compiler"))
.arg(mCCompiler); .arg(mCCompiler);
} }
if (!fileExists(mCppCompiler)) { if (!fileExists(mCppCompiler)) {
msg += QObject::tr("Cannot find the %1 \"%2\"") msg += QObject::tr("Cannot find the %1 \"%2\"")
.arg("C++ Compiler") .arg(QObject::tr("C++ Compiler"))
.arg(mCppCompiler); .arg(mCppCompiler);
} }
if (!fileExists(mMake)) { if (!mMake.isEmpty() && !fileExists(mMake)) {
msg += QObject::tr("Cannot find the %1 \"%2\"") msg += QObject::tr("Cannot find the %1 \"%2\"")
.arg("Maker") .arg(QObject::tr("Maker"))
.arg(mMake); .arg(mMake);
} }
if (!fileExists(mDebugger)) { if (!fileExists(mDebugger)) {
msg += QObject::tr("Cannot find the %1 \"%2\"") msg += QObject::tr("Cannot find the %1 \"%2\"")
.arg("Maker") .arg(QObject::tr("Debugger"))
.arg(mDebugger); .arg(mDebugger);
} }
if (!msg.isEmpty()) if (!msg.isEmpty())
@ -2533,22 +2533,27 @@ void Settings::CompilerSets::clearSets()
void Settings::CompilerSets::findSets() void Settings::CompilerSets::findSets()
{ {
clearSets(); clearSets();
QSet<QString> searched;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
addSets(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW32"+QDir::separator()+"bin"); addSets(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW32"+QDir::separator()+"bin");
addSets(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW64"+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 #endif
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString path = env.value("PATH"); QString path = env.value("PATH");
QStringList pathList = path.split(PATH_SEPARATOR); QStringList pathList = path.split(PATH_SEPARATOR);
QSet<QString> searched;
foreach (const QString& s, pathList){ foreach (const QString& s, pathList){
if (searched.contains(s)) if (searched.contains(s))
continue;; continue;;
searched.insert(s); 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); addSets(s);
}
} }
} }
void Settings::CompilerSets::saveSets() void Settings::CompilerSets::saveSets()

View File

@ -59,7 +59,6 @@ CompilerSetOptionWidget::~CompilerSetOptionWidget()
void CompilerSetOptionWidget::init() void CompilerSetOptionWidget::init()
{ {
ui->cbEncoding->setVisible(false);
ui->cbEncodingDetails->setVisible(false); ui->cbEncodingDetails->setVisible(false);
ui->cbEncoding->clear(); ui->cbEncoding->clear();
ui->cbEncoding->addItem(tr("ANSI"),ENCODING_SYSTEM_DEFAULT); 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->txtResourceCompiler->setText(pSet->resourceCompiler());
ui->txtProfiler->setText(pSet->profiler()); ui->txtProfiler->setText(pSet->profiler());
ui->cbEncoding->setVisible(pSet->autoAddCharsetParams());
if (pSet->execCharset() == ENCODING_AUTO_DETECT if (pSet->execCharset() == ENCODING_AUTO_DETECT
|| pSet->execCharset() == ENCODING_SYSTEM_DEFAULT || pSet->execCharset() == ENCODING_SYSTEM_DEFAULT
|| pSet->execCharset() == ENCODING_UTF8) { || pSet->execCharset() == ENCODING_UTF8) {

View File

@ -138,7 +138,7 @@
<item> <item>
<widget class="QCheckBox" name="chkAutoAddCharset"> <widget class="QCheckBox" name="chkAutoAddCharset">
<property name="text"> <property name="text">
<string>Add Charset arguments when calling the compiler</string> <string>Convert Executable's Charset as</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -50,6 +50,7 @@ void EditorCodeCompletionWidget::doLoad()
ui->chkIgnoreCases->setChecked(pSettings->codeCompletion().ignoreCase()); ui->chkIgnoreCases->setChecked(pSettings->codeCompletion().ignoreCase());
ui->chkAppendFunc->setChecked(pSettings->codeCompletion().appendFunc()); ui->chkAppendFunc->setChecked(pSettings->codeCompletion().appendFunc());
ui->chkShowCodeIns->setChecked(pSettings->codeCompletion().showCodeIns()); ui->chkShowCodeIns->setChecked(pSettings->codeCompletion().showCodeIns());
ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden());
ui->spinMinCharRequired->setValue(pSettings->codeCompletion().minCharRequired()); ui->spinMinCharRequired->setValue(pSettings->codeCompletion().minCharRequired());
} }
@ -74,6 +75,7 @@ void EditorCodeCompletionWidget::doSave()
pSettings->codeCompletion().setShowCodeIns(ui->chkShowCodeIns->isChecked()); pSettings->codeCompletion().setShowCodeIns(ui->chkShowCodeIns->isChecked());
pSettings->codeCompletion().setMinCharRequired(ui->spinMinCharRequired->value()); pSettings->codeCompletion().setMinCharRequired(ui->spinMinCharRequired->value());
pSettings->codeCompletion().setClearWhenEditorHidden(ui->chkClearWhenEditorHidden->isChecked());
pSettings->codeCompletion().save(); pSettings->codeCompletion().save();
} }

View File

@ -825,7 +825,7 @@ QString parseMacros(const QString &s)
// Only provide the first lib dir // Only provide the first lib dir
if (compilerSet->defaultLibDirs().count()>0) if (compilerSet->defaultLibDirs().count()>0)
result.replace("<LIB>", localizePath(compilerSet->defaultCppIncludeDirs().front())); result.replace("<LIB>", localizePath(compilerSet->defaultLibDirs().front()));
else else
result.replace("<LIB>",""); result.replace("<LIB>","");
} }
@ -1001,12 +1001,12 @@ QString localizePath(const QString &path)
float pointToPixel(float point) float pointToPixel(float point)
{ {
return point * qApp->desktop()->logicalDpiY() / 72; return point * desktopDpi() / 72;
} }
float pixelToPoint(float pixel) 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; return result;
} }
static float saved_desktop_dpi = -1;
float desktopDpi() 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) qulonglong stringToHex(const QString &str, qulonglong defaultValue)
@ -1089,3 +1092,8 @@ qulonglong stringToHex(const QString &str, qulonglong defaultValue)
return value; return value;
return defaultValue; return defaultValue;
} }
void setDesktopDpi(float dpi)
{
saved_desktop_dpi = dpi;
}

View File

@ -232,6 +232,8 @@ class CppParser;
void resetCppParser(std::shared_ptr<CppParser> parser, int compilerSetIndex=-1); void resetCppParser(std::shared_ptr<CppParser> parser, int compilerSetIndex=-1);
float desktopDpi(); float desktopDpi();
void setDesktopDpi(float dpi);
float pointToPixel(float point); float pointToPixel(float point);
float pixelToPoint(float pixel); float pixelToPoint(float pixel);

View File

@ -250,7 +250,15 @@ void SearchDialog::on_btnExecute_clicked()
if (actionType == SearchAction::Find) { if (actionType == SearchAction::Find) {
Editor *e = pMainWindow->editorList()->getEditor(); Editor *e = pMainWindow->editorList()->getEditor();
if (e!=nullptr) { 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) { } else if (actionType == SearchAction::Replace) {
Editor *e = pMainWindow->editorList()->getEditor(); Editor *e = pMainWindow->editorList()->getEditor();
@ -279,6 +287,14 @@ void SearchDialog::on_btnExecute_clicked()
} else { } else {
return SynSearchAction::ReplaceAll; 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) if (editor==nullptr)
return 0; return 0;
@ -398,7 +416,7 @@ int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString
} }
return editor->searchReplace(sSearch, sReplace, mSearchOptions, return editor->searchReplace(sSearch, sReplace, mSearchOptions,
mSearchEngine, matchCallback); mSearchEngine, matchCallback, confirmAroundCallback);
} }
std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(SynEdit *e, const QString& filename,const QString &keyword) std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(SynEdit *e, const QString& filename,const QString &keyword)

View File

@ -61,7 +61,9 @@ private slots:
void on_btnExecute_clicked(); void on_btnExecute_clicked();
private: private:
int execute(SynEdit* editor, const QString& sSearch, 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<SearchResultTreeItem> batchFindInEditor(SynEdit * editor,const QString& filename, const QString& keyword); std::shared_ptr<SearchResultTreeItem> batchFindInEditor(SynEdit * editor,const QString& filename, const QString& keyword);
private: private:
Ui::SearchDialog *ui; Ui::SearchDialog *ui;

View File

@ -1,3 +1,9 @@
redpanda-cpp (0.13.3-1) unstable; urgency=medium
* Update to 0.13.3
-- Roy Qu (瞿华) <royqh1979@gmail.com> Mon, 24 Jan 2022 21:50:00 +0800
redpanda-cpp (0.13.2-1) unstable; urgency=medium redpanda-cpp (0.13.2-1) unstable; urgency=medium
* Update to 0.13.2 * Update to 0.13.2

View File

@ -2,7 +2,7 @@
# Startup # Startup
!include "config32.nsh" !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}" !define DISPLAY_NAME "Red Panda C++ 32bit ${DEVCPP_VERSION}"
!include "MUI2.nsh" !include "MUI2.nsh"

View File

@ -3,7 +3,7 @@
!include "config32.nsh" !include "config32.nsh"
!define COMPILERFOLDER "MinGW32" !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}" !define DISPLAY_NAME "Red Panda C++ 32 bit ${DEVCPP_VERSION}"
!include "MUI2.nsh" !include "MUI2.nsh"

View File

@ -2,7 +2,7 @@
# Startup # Startup
!include "config.nsh" !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}" !define DISPLAY_NAME "Red Panda C++ ${DEVCPP_VERSION}"
!include "MUI2.nsh" !include "MUI2.nsh"

View File

@ -3,7 +3,7 @@
!include "config.nsh" !include "config.nsh"
!define COMPILERFOLDER "MinGW64" !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}" !define DISPLAY_NAME "Red Panda C++ ${DEVCPP_VERSION}"
!include "MUI2.nsh" !include "MUI2.nsh"