diff --git a/NEWS.md b/NEWS.md
index 7f94435a..81ff8896 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,6 +5,9 @@ Red Panda C++ Version 0.14.5
- fix: can't correctly set break conditions
- fix: crash when copy to non-c files
- fix: fonts in cpu window is not correctly set, when dpi changed
+ - enhancement: enable group undo
+ - enhancement: add option "hide symbols start with underscore" and "hide synbols start with two underscore"
+ - fix: can't rename project files that not openned in editor
Red Panda C++ Version 0.14.4
diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts
index e512d01d..8d623312 100644
--- a/RedPandaIDE/RedPandaIDE_zh_CN.ts
+++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts
@@ -1314,40 +1314,40 @@ Are you really want to continue?
打印文档
-
-
-
+
+
+
Ctrl+单击以获取更多信息
-
-
+
+
未找到符号'%1'!
-
+
找不到astyle程序
-
+
找不到astyle程序"%1".
-
+
断点条件
-
+
输入当前断点的生效条件:
-
+
只读
@@ -1558,22 +1558,34 @@ Are you really want to continue?
优先提示局部作用域中的符号
-
+
+
+ Hide symbols start with underline
+ 隐藏以下划线开头的符号
+
+
+
+
+ Hide symbols start with two underline
+ 隐藏以两个下划线开头的符号
+
+
+
优先提示经常使用的符号
-
+
清除使用数据
-
+
补全提示窗口宽度:
-
+
补全提示窗口高度:
@@ -3081,7 +3093,7 @@ Are you really want to continue?
- Linux封号花括号,所有条件语句条件花括号
+ Linux花括号,所有条件语句的分支加花括号
@@ -3762,11 +3774,11 @@ Are you really want to continue?
-
-
+
-
+
+
编译器
@@ -4189,7 +4201,7 @@ Are you really want to continue?
-
+
新建试题集
@@ -4208,14 +4220,14 @@ Are you really want to continue?
-
+
保存试题集
-
+
载入试题集
@@ -4554,7 +4566,7 @@ Are you really want to continue?
-
+
删除所有断点
@@ -4655,7 +4667,7 @@ Are you really want to continue?
-
+
重命名符号
@@ -4676,13 +4688,13 @@ Are you really want to continue?
-
+
导出为RTF
-
+
导出为HTML
@@ -5162,7 +5174,7 @@ Are you really want to continue?
-
+
试题集%1
@@ -5236,15 +5248,15 @@ Are you really want to continue?
-
-
+
+
书签描述
-
-
+
+
描述:
@@ -5365,7 +5377,7 @@ Are you really want to continue?
-
+
删除
@@ -5442,7 +5454,7 @@ Are you really want to continue?
-
+
需要保存吗?
@@ -5466,141 +5478,141 @@ Are you really want to continue?
-
+
保存失败
-
+
改变项目编译器配置集
-
+
改变项目的编译器配置集会导致所有的自定义编译器选项被重置。
-
+
你真的想要做那些吗?
-
+
您真的要清除该文件的所有断点吗?
-
+
新建项目
-
+
关闭'%1'以打开新项目?
-
+
文件夹不存在
-
+
文件夹'%1'不存在。是否创建?
-
+
无法创建文件夹
-
+
创建文件夹'%1'失败。
-
+
-
+
文件夹%1不是空的。
-
+
你真的要删除它吗?
-
+
无法提交
-
+
Git需要用信息进行提交。
-
+
选择工作文件夹
-
-
+
+
头文件已存在
-
-
+
+
头文件"%1"已存在!
-
+
源文件已存在!
-
+
源文件"%1"已存在!
-
+
无法提交!
-
+
下列文件处于冲突状态,请解决后重新添加和提交:
-
+
提交信息
-
+
提交信息:
-
+
提交失败
-
+
提交信息不能为空!
@@ -5609,125 +5621,125 @@ Are you really want to continue?
小熊猫Dev-C++项目文件 (*.dev)
-
+
新建项目失败
-
+
无法使用模板创建项目
-
+
删除文件
-
+
同时从硬盘上删除文件?
-
+
无标题
-
+
新的项目文件名
-
+
文件名:
-
+
文件已存在!
-
+
文件'%1'已经存在!
-
+
添加到项目
-
+
小熊猫C++项目文件(*.dev)
-
+
重命名出错
-
+
符号'%1'在系统头文件中定义,无法修改。
-
+
新名称
-
-
+
+
替换出错
-
+
无法打开文件'%1'进行替换!
-
+
内容和上次查找时不一致。
-
+
RTF格式文件 (*.rtf)
-
+
HTML文件 (*.html)
-
+
当前的试题集不是空的。
-
+
试题%1
-
-
+
+
试题集文件 (*.pbs)
-
+
载入失败
-
+
试题案例%1
@@ -5743,10 +5755,10 @@ Are you really want to continue?
-
-
-
-
+
+
+
+
错误
@@ -5798,50 +5810,50 @@ Are you really want to continue?
打开
-
+
编译失败
-
+
运行失败
-
-
+
+
确认转换
-
-
+
+
当前编辑器中的文件将会使用%1编码保存。<br />这项操作无法被撤回。<br />你确定要继续吗?
-
+
新监视表达式
-
+
输入监视表达式
-
+
(%1/%2)正在解析文件"%3"
-
-
+
+
完成%1个文件的解析,用时%2秒
-
+
(每秒%1个文件)
@@ -6582,16 +6594,24 @@ Are you really want to continue?
-
删除失败
-
无法删除文件'%1'
+
+
+
+ 改名失败
+
+
+
+
+ 无法将文件'%1'改名为'%2'
+
ProjectOutputWidget
@@ -6812,7 +6832,7 @@ Are you really want to continue?
QApplication
-
+
错误
@@ -6882,7 +6902,7 @@ Are you really want to continue?
无法写入配置文件夹"%1"
-
+
无法载入自动链接设置
@@ -7976,7 +7996,7 @@ Are you really want to continue?
自动链接
-
+
@@ -8052,15 +8072,15 @@ Are you really want to continue?
杂项
-
-
+
+
程序运行
-
+
试题集
diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp
index cebd9edf..e94662a8 100644
--- a/RedPandaIDE/editor.cpp
+++ b/RedPandaIDE/editor.cpp
@@ -2684,6 +2684,8 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete)
mCompletionPopup->setSortByScope(pSettings->codeCompletion().sortByScope());
mCompletionPopup->setShowKeywords(pSettings->codeCompletion().showKeywords());
mCompletionPopup->setShowCodeSnippets(pSettings->codeCompletion().showCodeIns());
+ mCompletionPopup->setHideSymbolsStartWithUnderline(pSettings->codeCompletion().hideSymbolsStartsWithUnderLine());
+ mCompletionPopup->setHideSymbolsStartWithTwoUnderline(pSettings->codeCompletion().hideSymbolsStartsWithTwoUnderLine());
if (pSettings->codeCompletion().showCodeIns()) {
mCompletionPopup->setCodeSnippets(pMainWindow->codeSnippetManager()->snippets());
}
@@ -4138,7 +4140,7 @@ void Editor::applySettings()
{
SynEditorOptions options = eoAltSetsColumnMode |
eoDragDropEditing | eoDropFiles | eoKeepCaretX | eoTabsToSpaces |
- eoRightMouseMovesCursor | eoScrollByOneLess | eoTabIndent | eoHideShowScrollbars;
+ eoRightMouseMovesCursor | eoScrollByOneLess | eoTabIndent | eoHideShowScrollbars | eoGroupUndo;
//options
options.setFlag(eoAutoIndent,pSettings->editor().autoIndent());
diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp
index 8def0b91..e6e1870a 100644
--- a/RedPandaIDE/main.cpp
+++ b/RedPandaIDE/main.cpp
@@ -37,12 +37,16 @@
#include "editorlist.h"
#include "widgets/choosethemedialog.h"
#include "thememanager.h"
+
#ifdef Q_OS_WIN
#include
#include
#include
#include
#include
+#include
+
+#include "widgets/cpudialog.h"
#endif
QString getSettingFilename(const QString& filepath, bool& firstRun);
@@ -124,12 +128,18 @@ bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray & /*eventType*/
}
break;
case WM_DPICHANGED:{
- int oldDPI = screenDPI();
- QEvent * dpiEvent = new QEvent(DPI_CHANGED_EVENT);
- qApp->postEvent(pMainWindow,dpiEvent);
- setScreenDPI(HIWORD(pMsg->wParam));
- int newDPI = screenDPI();
- pMainWindow->updateDPI(oldDPI,newDPI);
+ if (pMsg->hwnd == (HWND)pMainWindow->winId()) {
+ int oldDPI = screenDPI();
+ QEvent * dpiEvent = new QEvent(DPI_CHANGED_EVENT);
+ qApp->postEvent(pMainWindow,dpiEvent);
+ setScreenDPI(HIWORD(pMsg->wParam));
+ int newDPI = screenDPI();
+ pMainWindow->updateDPI(oldDPI,newDPI);
+ } else if (pMainWindow->cpuDialog() &&
+ (HWND)pMainWindow->cpuDialog()->winId() == pMsg->hwnd) {
+ int newDPI = HIWORD(pMsg->wParam);
+ pMainWindow->cpuDialog()->updateDPI(newDPI);
+ }
break;
}
case WM_USER_OPEN_FILE: {
@@ -243,13 +253,17 @@ int main(int argc, char *argv[])
} else if (!settingFilename.isEmpty() && firstRun)
openInSingleInstance = false;
if (openInSingleInstance) {
+ int openCount = 0;
while (true) {
if (tempFile.open(QFile::NewOnly))
break;
QThread::msleep(100);
+ openCount++;
+ if (openCount>100)
+ break;
}
- if (app.arguments().length()>=2) {
+ if (app.arguments().length()>=2 && openCount<100) {
#ifdef Q_OS_WIN
if (sendFilesToInstance()) {
tempFile.remove();
diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp
index d96d359e..39a72a4c 100644
--- a/RedPandaIDE/mainwindow.cpp
+++ b/RedPandaIDE/mainwindow.cpp
@@ -625,9 +625,6 @@ void MainWindow::applySettings()
for (QWidget* p:findChildren()) {
p->setFont(font);
}
- if (mCPUDialog!=nullptr) {
- mCPUDialog->resetEditorFont();
- }
if (pSettings->environment().useCustomIconSet()) {
QString customIconSetFolder = pSettings->dirs().config(Settings::Dirs::DataType::IconSet);
pIconsManager->prepareCustomIconSet(customIconSetFolder);
@@ -1844,7 +1841,7 @@ void MainWindow::showSearchPanel(bool showReplace)
void MainWindow::showCPUInfoDialog()
{
if (mCPUDialog==nullptr) {
- mCPUDialog = new CPUDialog(this);
+ mCPUDialog = new CPUDialog();
connect(mCPUDialog, &CPUDialog::closed, this, &MainWindow::cleanUpCPUDialog);
updateCompileActions();
}
@@ -4107,6 +4104,9 @@ void MainWindow::closeEvent(QCloseEvent *event) {
mCompilerManager->stopRun();
if (!mShouldRemoveAllSettings)
mSymbolUsageManager->save();
+
+ if (mCPUDialog!=nullptr)
+ cleanUpCPUDialog();
event->accept();
return;
}
@@ -4465,6 +4465,8 @@ void MainWindow::onOJProblemCaseNewOutputGetted(const QString &/* id */, const Q
void MainWindow::cleanUpCPUDialog()
{
+ disconnect(mCPUDialog,&CPUDialog::closed,
+ this,&MainWindow::cleanUpCPUDialog);
CPUDialog* ptr=mCPUDialog;
mCPUDialog=nullptr;
ptr->deleteLater();
diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp
index c8f07497..9344203b 100644
--- a/RedPandaIDE/project.cpp
+++ b/RedPandaIDE/project.cpp
@@ -2115,24 +2115,23 @@ bool ProjectModel::setData(const QModelIndex &index, const QVariant &value, int
}
// Target filename does not exist anymore. Do a rename
// change name in project file first (no actual file renaming on disk)
- mProject->saveUnitAs(idx,newName);
-
+ //save old file, if it is openned;
// remove old file from monitor list
pMainWindow->fileSystemWatcher()->removePath(oldName);
- // Finally, we can rename without issues
- if (!QFile::remove(oldName)){
+ if (!QFile::rename(oldName,newName)) {
QMessageBox::critical(pMainWindow,
- tr("Remove failed"),
- tr("Failed to remove file '%1'")
- .arg(oldName),
+ tr("Rename failed"),
+ tr("Failed to rename file '%1' to '%2'")
+ .arg(oldName,newName),
QMessageBox::Ok);
- mProject->saveUnitAs(idx,oldName);
return false;
}
+ mProject->saveUnitAs(idx,newName);
// Add new filename to file minitor
pMainWindow->fileSystemWatcher()->addPath(newName);
+
//suffix changed
if (mProject && mProject->modelType() == ProjectModelType::FileSystem
&& QFileInfo(oldName).suffix()!=QFileInfo(newName).suffix()) {
diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp
index 22540f55..f80d9b2f 100644
--- a/RedPandaIDE/qsynedit/SynEdit.cpp
+++ b/RedPandaIDE/qsynedit/SynEdit.cpp
@@ -2681,78 +2681,81 @@ void SynEdit::doAddChar(QChar AChar)
setSelLength(1);
}
- mUndoList->BeginBlock();
- doSetSelText(AChar);
- int oldCaretX=mCaretX-1;
- int oldCaretY=mCaretY;
- // auto
- if (mOptions.testFlag(eoAutoIndent)
- && mHighlighter
- && mHighlighter->getClass()==SynHighlighterClass::CppHighlighter
- && (oldCaretY<=mLines->count()) ) {
+ if (isIdentChar(AChar)) {
+ doSetSelText(AChar);
+ } else {
+ mUndoList->BeginBlock();
+ doSetSelText(AChar);
+ int oldCaretX=mCaretX-1;
+ int oldCaretY=mCaretY;
+ // auto
+ if (mOptions.testFlag(eoAutoIndent)
+ && mHighlighter
+ && mHighlighter->getClass()==SynHighlighterClass::CppHighlighter
+ && (oldCaretY<=mLines->count()) ) {
- //unindent if ':' at end of the line
- if (AChar == ':') {
- QString line = mLines->getString(oldCaretY-1);
- if (line.length() <= oldCaretX) {
- int indentSpaces = calcIndentSpaces(oldCaretY,line+":", true);
- if (indentSpaces != leftSpaces(line)) {
- QString newLine = GetLeftSpacing(indentSpaces,true) + trimLeft(line);
- mLines->putString(oldCaretY-1,newLine);
- internalSetCaretXY(BufferCoord{newLine.length()+2,oldCaretY});
- setBlockBegin(caretXY());
- setBlockEnd(caretXY());
- mUndoList->AddChange(
- SynChangeReason::crDelete,
- BufferCoord{1, oldCaretY},
- BufferCoord{line.length()+1, oldCaretY},
- line,
- SynSelectionMode::smNormal
- );
- mUndoList->AddChange(
- SynChangeReason::crInsert,
- BufferCoord{1, oldCaretY},
- BufferCoord{newLine.length()+1, oldCaretY},
- "",
- SynSelectionMode::smNormal
- );
+ //unindent if ':' at end of the line
+ if (AChar == ':') {
+ QString line = mLines->getString(oldCaretY-1);
+ if (line.length() <= oldCaretX) {
+ int indentSpaces = calcIndentSpaces(oldCaretY,line+":", true);
+ if (indentSpaces != leftSpaces(line)) {
+ QString newLine = GetLeftSpacing(indentSpaces,true) + trimLeft(line);
+ mLines->putString(oldCaretY-1,newLine);
+ internalSetCaretXY(BufferCoord{newLine.length()+2,oldCaretY});
+ setBlockBegin(caretXY());
+ setBlockEnd(caretXY());
+ mUndoList->AddChange(
+ SynChangeReason::crDelete,
+ BufferCoord{1, oldCaretY},
+ BufferCoord{line.length()+1, oldCaretY},
+ line,
+ SynSelectionMode::smNormal
+ );
+ mUndoList->AddChange(
+ SynChangeReason::crInsert,
+ BufferCoord{1, oldCaretY},
+ BufferCoord{newLine.length()+1, oldCaretY},
+ "",
+ SynSelectionMode::smNormal
+ );
+ }
}
- }
- } else if (AChar == '{' || AChar == '}' || AChar == '#') {
- //Reindent line when add '{' '}' and '#' at the beginning
- QString left = mLines->getString(oldCaretY-1).mid(0,oldCaretX-1);
- // and the first nonblank char is this new {
- if (left.trimmed().isEmpty()) {
- int indentSpaces = calcIndentSpaces(oldCaretY,AChar, true);
- if (indentSpaces != leftSpaces(left)) {
- QString right = mLines->getString(oldCaretY-1).mid(oldCaretX-1);
- QString newLeft = GetLeftSpacing(indentSpaces,true);
- mLines->putString(oldCaretY-1,newLeft+right);
- BufferCoord newCaretPos = BufferCoord{newLeft.length()+2,oldCaretY};
- internalSetCaretXY(newCaretPos);
- setBlockBegin(caretXY());
- setBlockEnd(caretXY());
- mUndoList->AddChange(
- SynChangeReason::crDelete,
- BufferCoord{1, oldCaretY},
- BufferCoord{left.length()+1, oldCaretY},
- left,
- SynSelectionMode::smNormal
- );
- mUndoList->AddChange(
- SynChangeReason::crInsert,
- BufferCoord{1, oldCaretY},
- BufferCoord{newLeft.length()+1, oldCaretY},
- "",
- SynSelectionMode::smNormal
- );
+ } else if (AChar == '{' || AChar == '}' || AChar == '#') {
+ //Reindent line when add '{' '}' and '#' at the beginning
+ QString left = mLines->getString(oldCaretY-1).mid(0,oldCaretX-1);
+ // and the first nonblank char is this new {
+ if (left.trimmed().isEmpty()) {
+ int indentSpaces = calcIndentSpaces(oldCaretY,AChar, true);
+ if (indentSpaces != leftSpaces(left)) {
+ QString right = mLines->getString(oldCaretY-1).mid(oldCaretX-1);
+ QString newLeft = GetLeftSpacing(indentSpaces,true);
+ mLines->putString(oldCaretY-1,newLeft+right);
+ BufferCoord newCaretPos = BufferCoord{newLeft.length()+2,oldCaretY};
+ internalSetCaretXY(newCaretPos);
+ setBlockBegin(caretXY());
+ setBlockEnd(caretXY());
+ mUndoList->AddChange(
+ SynChangeReason::crDelete,
+ BufferCoord{1, oldCaretY},
+ BufferCoord{left.length()+1, oldCaretY},
+ left,
+ SynSelectionMode::smNormal
+ );
+ mUndoList->AddChange(
+ SynChangeReason::crInsert,
+ BufferCoord{1, oldCaretY},
+ BufferCoord{newLeft.length()+1, oldCaretY},
+ "",
+ SynSelectionMode::smNormal
+ );
+ }
}
}
}
+ mUndoList->EndBlock();
}
- mUndoList->EndBlock();
-
//DoOnPaintTransient(ttAfter);
}
@@ -4779,11 +4782,13 @@ void SynEdit::setSelTextPrimitiveEx(SynSelectionMode PasteMode, const QString &V
void SynEdit::doSetSelText(const QString &Value)
{
- mUndoList->BeginBlock();
- auto action = finally([this]{
- mUndoList->EndBlock();
+ bool blockBeginned = false;
+ auto action = finally([this, &blockBeginned]{
+ if (blockBeginned)
+ mUndoList->EndBlock();
});
if (selAvail()) {
+ mUndoList->BeginBlock();
mUndoList->AddChange(
SynChangeReason::crDelete, mBlockBegin, mBlockEnd,
selText(), mActiveSelectionMode);
diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp
index 4c6364e3..4eb0a4c0 100644
--- a/RedPandaIDE/settings.cpp
+++ b/RedPandaIDE/settings.cpp
@@ -3606,6 +3606,26 @@ void Settings::CodeCompletion::setMinCharRequired(int newMinCharRequired)
mMinCharRequired = newMinCharRequired;
}
+bool Settings::CodeCompletion::hideSymbolsStartsWithTwoUnderLine() const
+{
+ return mHideSymbolsStartsWithTwoUnderLine;
+}
+
+void Settings::CodeCompletion::setHideSymbolsStartsWithTwoUnderLine(bool newHideSymbolsStartsWithTwoUnderLine)
+{
+ mHideSymbolsStartsWithTwoUnderLine = newHideSymbolsStartsWithTwoUnderLine;
+}
+
+bool Settings::CodeCompletion::hideSymbolsStartsWithUnderLine() const
+{
+ return mHideSymbolsStartsWithUnderLine;
+}
+
+void Settings::CodeCompletion::setHideSymbolsStartsWithUnderLine(bool newHideSymbolsStartsWithOneUnderLine)
+{
+ mHideSymbolsStartsWithUnderLine = newHideSymbolsStartsWithOneUnderLine;
+}
+
bool Settings::CodeCompletion::appendFunc() const
{
return mAppendFunc;
@@ -3732,6 +3752,8 @@ void Settings::CodeCompletion::doSave()
saveValue("show_code_ins",mShowCodeIns);
saveValue("clear_when_editor_hidden",mClearWhenEditorHidden);
saveValue("min_char_required",mMinCharRequired);
+ saveValue("hide_symbols_start_with_two_underline", mHideSymbolsStartsWithTwoUnderLine);
+ saveValue("hide_symbols_start_with_underline", mHideSymbolsStartsWithUnderLine);
}
@@ -3751,6 +3773,8 @@ void Settings::CodeCompletion::doLoad()
mAppendFunc = boolValue("append_func",true);
mShowCodeIns = boolValue("show_code_ins",true);
mMinCharRequired = intValue("min_char_required",1);
+ mHideSymbolsStartsWithTwoUnderLine = boolValue("hide_symbols_start_with_two_underline", true);
+ mHideSymbolsStartsWithUnderLine = boolValue("hide_symbols_start_with_underline", false);
bool doClear = true;
diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h
index 11a4ad1a..6f0f4059 100644
--- a/RedPandaIDE/settings.h
+++ b/RedPandaIDE/settings.h
@@ -602,6 +602,12 @@ public:
int minCharRequired() const;
void setMinCharRequired(int newMinCharRequired);
+ bool hideSymbolsStartsWithUnderLine() const;
+ void setHideSymbolsStartsWithUnderLine(bool newHideSymbolsStartsWithOneUnderLine);
+
+ bool hideSymbolsStartsWithTwoUnderLine() const;
+ void setHideSymbolsStartsWithTwoUnderLine(bool newHideSymbolsStartsWithTwoUnderLine);
+
private:
int mWidth;
int mHeight;
@@ -617,6 +623,8 @@ public:
bool mShowCodeIns;
bool mClearWhenEditorHidden;
int mMinCharRequired;
+ bool mHideSymbolsStartsWithTwoUnderLine;
+ bool mHideSymbolsStartsWithUnderLine;
// _Base interface
protected:
diff --git a/RedPandaIDE/settingsdialog/editorcodecompletionwidget.cpp b/RedPandaIDE/settingsdialog/editorcodecompletionwidget.cpp
index 9e35d2a6..51ca2221 100644
--- a/RedPandaIDE/settingsdialog/editorcodecompletionwidget.cpp
+++ b/RedPandaIDE/settingsdialog/editorcodecompletionwidget.cpp
@@ -51,6 +51,8 @@ void EditorCodeCompletionWidget::doLoad()
ui->chkAppendFunc->setChecked(pSettings->codeCompletion().appendFunc());
ui->chkShowCodeIns->setChecked(pSettings->codeCompletion().showCodeIns());
ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden());
+ ui->chkHideSymbolsStartWithTwoUnderline->setChecked(pSettings->codeCompletion().hideSymbolsStartsWithTwoUnderLine());
+ ui->chkHideSymbolsStartWithUnderline->setChecked(pSettings->codeCompletion().hideSymbolsStartsWithUnderLine());
ui->spinMinCharRequired->setValue(pSettings->codeCompletion().minCharRequired());
}
@@ -77,6 +79,9 @@ void EditorCodeCompletionWidget::doSave()
pSettings->codeCompletion().setClearWhenEditorHidden(ui->chkClearWhenEditorHidden->isChecked());
+ pSettings->codeCompletion().setHideSymbolsStartsWithTwoUnderLine(ui->chkHideSymbolsStartWithTwoUnderline->isChecked());
+ pSettings->codeCompletion().setHideSymbolsStartsWithUnderLine(ui->chkHideSymbolsStartWithUnderline->isChecked());
+
pSettings->codeCompletion().save();
}
diff --git a/RedPandaIDE/settingsdialog/editorcodecompletionwidget.ui b/RedPandaIDE/settingsdialog/editorcodecompletionwidget.ui
index 95e02252..dcec458a 100644
--- a/RedPandaIDE/settingsdialog/editorcodecompletionwidget.ui
+++ b/RedPandaIDE/settingsdialog/editorcodecompletionwidget.ui
@@ -146,6 +146,20 @@
+ -
+
+
+ Hide symbols start with underscore
+
+
+
+ -
+
+
+ Hide symbols start with two underscores
+
+
+
-
@@ -195,10 +209,16 @@
- 11
+ 0
- 11
+ 0
+
+
+ 0
+
+
+ 0
-
diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp
index 4b0bd02e..19291498 100644
--- a/RedPandaIDE/utils.cpp
+++ b/RedPandaIDE/utils.cpp
@@ -1142,3 +1142,8 @@ void copyFolder(const QString &fromDir, const QString &toDir)
}
+
+float pointToPixel(float point, float dpi)
+{
+ return point * dpi / 72;
+}
diff --git a/RedPandaIDE/utils.h b/RedPandaIDE/utils.h
index eec0816d..3de98a93 100644
--- a/RedPandaIDE/utils.h
+++ b/RedPandaIDE/utils.h
@@ -234,6 +234,7 @@ void resetCppParser(std::shared_ptr parser, int compilerSetIndex=-1);
int screenDPI();
void setScreenDPI(int dpi);
float pointToPixel(float point);
+float pointToPixel(float point, float dpi);
float pixelToPoint(float pixel);
void copyFolder(const QString &fromDir, const QString& toDir);
diff --git a/RedPandaIDE/widgets/codecompletionpopup.cpp b/RedPandaIDE/widgets/codecompletionpopup.cpp
index 1e679cee..ef440f38 100644
--- a/RedPandaIDE/widgets/codecompletionpopup.cpp
+++ b/RedPandaIDE/widgets/codecompletionpopup.cpp
@@ -53,6 +53,9 @@ CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
mShowCodeSnippets = true;
mIgnoreCase = false;
+
+ mHideSymbolsStartWithTwoUnderline = false;
+ mHideSymbolsStartWithUnderline = false;
}
CodeCompletionPopup::~CodeCompletionPopup()
@@ -382,6 +385,9 @@ void CodeCompletionPopup::filterList(const QString &member)
mCompletionStatementList.clear();
mCompletionStatementList.reserve(mFullCompletionStatementList.size());
+ bool hideSymbolsTwoUnderline = mHideSymbolsStartWithTwoUnderline && !member.startsWith("__") ;
+ bool hideSymbolsUnderline = mHideSymbolsStartWithUnderline && !member.startsWith("_") ;
+ int len = member.length();
foreach (const PStatement& statement, mFullCompletionStatementList) {
int matched = 0;
@@ -391,31 +397,37 @@ void CodeCompletionPopup::filterList(const QString &member)
int lastPos = -10;
int totalPos = 0;
statement->matchPositions.clear();
- foreach (const QChar& ch, member) {
- if (mIgnoreCase)
- pos = command.indexOf(ch,pos,Qt::CaseInsensitive);
- else
- pos = command.indexOf(ch,pos,Qt::CaseSensitive);
- if (pos<0) {
- break;
+ if (hideSymbolsTwoUnderline && statement->command.startsWith("__")) {
+
+ } else if (hideSymbolsUnderline && statement->command.startsWith("_")) {
+
+ } else {
+ foreach (const QChar& ch, member) {
+ if (mIgnoreCase)
+ pos = command.indexOf(ch,pos,Qt::CaseInsensitive);
+ else
+ pos = command.indexOf(ch,pos,Qt::CaseSensitive);
+ if (pos<0) {
+ break;
+ }
+ if (pos == lastPos+1) {
+ statement->matchPositions.last()->end++;
+ } else {
+ PStatementMathPosition matchPosition=std::make_shared();
+ matchPosition->start = pos;
+ matchPosition->end = pos+1;
+ statement->matchPositions.append(matchPosition);
+ }
+ if (ch==command[pos])
+ caseMatched++;
+ matched++;
+ totalPos += pos;
+ lastPos = pos;
+ pos+=1;
}
- if (pos == lastPos+1) {
- statement->matchPositions.last()->end++;
- } else {
- PStatementMathPosition matchPosition=std::make_shared();
- matchPosition->start = pos;
- matchPosition->end = pos+1;
- statement->matchPositions.append(matchPosition);
- }
- if (ch==command[pos])
- caseMatched++;
- matched++;
- totalPos += pos;
- lastPos = pos;
- pos+=1;
}
- if (mIgnoreCase && matched==member.length()) {
+ if (mIgnoreCase && matched== len) {
statement->caseMatched = caseMatched;
statement->matchPosTotal = totalPos;
if (member.length()>0) {
@@ -424,7 +436,7 @@ void CodeCompletionPopup::filterList(const QString &member)
} else
statement->firstMatchLength = 0;
mCompletionStatementList.append(statement);
- } else if (caseMatched == member.length()) {
+ } else if (caseMatched == len) {
statement->caseMatched = caseMatched;
statement->matchPosTotal = totalPos;
if (member.length()>0) {
@@ -799,6 +811,26 @@ bool CodeCompletionPopup::isIncluded(const QString &fileName)
return mIncludedFiles.contains(fileName);
}
+void CodeCompletionPopup::setHideSymbolsStartWithTwoUnderline(bool newHideSymbolsStartWithTwoUnderline)
+{
+ mHideSymbolsStartWithTwoUnderline = newHideSymbolsStartWithTwoUnderline;
+}
+
+bool CodeCompletionPopup::hideSymbolsStartWithTwoUnderline() const
+{
+ return mHideSymbolsStartWithTwoUnderline;
+}
+
+bool CodeCompletionPopup::hideSymbolsStartWithUnderline() const
+{
+ return mHideSymbolsStartWithUnderline;
+}
+
+void CodeCompletionPopup::setHideSymbolsStartWithUnderline(bool newHideSymbolsStartWithUnderline)
+{
+ mHideSymbolsStartWithUnderline = newHideSymbolsStartWithUnderline;
+}
+
const QString &CodeCompletionPopup::memberOperator() const
{
return mMemberOperator;
diff --git a/RedPandaIDE/widgets/codecompletionpopup.h b/RedPandaIDE/widgets/codecompletionpopup.h
index 6212159b..e05e879b 100644
--- a/RedPandaIDE/widgets/codecompletionpopup.h
+++ b/RedPandaIDE/widgets/codecompletionpopup.h
@@ -112,6 +112,11 @@ public:
bool useCppKeyword() const;
void setUseCppKeyword(bool newUseCppKeyword);
+ bool hideSymbolsStartWithUnderline() const;
+ void setHideSymbolsStartWithUnderline(bool newHideSymbolsStartWithUnderline);
+ bool hideSymbolsStartWithTwoUnderline() const;
+ void setHideSymbolsStartWithTwoUnderline(bool newHideSymbolsStartWithTwoUnderline);
+
const PStatement ¤tStatement() const;
void setCurrentStatement(const PStatement &newCurrentStatement);
const std::shared_ptr > >& colors() const;
@@ -160,6 +165,8 @@ private:
bool mIgnoreCase;
bool mSortByScope;
bool mUseCppKeyword;
+ bool mHideSymbolsStartWithUnderline;
+ bool mHideSymbolsStartWithTwoUnderline;
// QWidget interface
protected:
@@ -170,6 +177,7 @@ protected:
public:
bool event(QEvent *event) override;
const QString &memberOperator() const;
+
};
#endif // CODECOMPLETIONPOPUP_H
diff --git a/RedPandaIDE/widgets/cpudialog.cpp b/RedPandaIDE/widgets/cpudialog.cpp
index 46bd199f..b564b7c7 100644
--- a/RedPandaIDE/widgets/cpudialog.cpp
+++ b/RedPandaIDE/widgets/cpudialog.cpp
@@ -54,8 +54,7 @@ CPUDialog::CPUDialog(QWidget *parent) :
ui->txtCode->setForegroundColor(palette().color(QPalette::Text));
ui->txtCode->setBackgroundColor(palette().color(QPalette::Base));
}
-
- resetEditorFont();
+ resetEditorFont(screenDPI());
ui->lstRegister->setModel(pMainWindow->debugger()->registerModel());
ui->rdIntel->setChecked(pSettings->debugger().useIntelStyle());
@@ -98,6 +97,19 @@ void CPUDialog::updateButtonStates(bool enable)
ui->btnStepOverInstruction->setEnabled(enable);
}
+void CPUDialog::updateDPI(float dpi)
+{
+ QFont font(pSettings->environment().interfaceFont());
+ font.setPixelSize(pointToPixel(pSettings->environment().interfaceFontSize(),dpi));
+ font.setStyleStrategy(QFont::PreferAntialias);
+ setFont(font);
+ for (QWidget* p:findChildren()) {
+ if (p!=ui->txtCode)
+ p->setFont(font);
+ }
+ resetEditorFont(dpi);
+}
+
void CPUDialog::setDisassembly(const QString& file, const QString& funcName,const QStringList& lines)
{
ui->txtFunctionName->setText(QString("%1:%2").arg(file, funcName));
@@ -114,14 +126,14 @@ void CPUDialog::setDisassembly(const QString& file, const QString& funcName,cons
ui->txtCode->setCaretXYEx(true,BufferCoord{1,activeLine+1});
}
-void CPUDialog::resetEditorFont()
+void CPUDialog::resetEditorFont(float dpi)
{
QFont f=QFont(pSettings->editor().fontName());
- f.setPixelSize(pointToPixel(pSettings->editor().fontSize()));
+ f.setPixelSize(pointToPixel(pSettings->editor().fontSize(),dpi));
f.setStyleStrategy(QFont::PreferAntialias);
ui->txtCode->setFont(f);
QFont f2=QFont(pSettings->editor().nonAsciiFontName());
- f2.setPixelSize(pointToPixel(pSettings->editor().fontSize()));
+ f2.setPixelSize(pointToPixel(pSettings->editor().fontSize(),dpi));
f2.setStyleStrategy(QFont::PreferAntialias);
ui->txtCode->setFontForNonAscii(f2);
}
diff --git a/RedPandaIDE/widgets/cpudialog.h b/RedPandaIDE/widgets/cpudialog.h
index e66c2502..f5dc5018 100644
--- a/RedPandaIDE/widgets/cpudialog.h
+++ b/RedPandaIDE/widgets/cpudialog.h
@@ -33,8 +33,9 @@ public:
void updateInfo();
void updateButtonStates(bool enable);
public slots:
+ void updateDPI(float dpi);
void setDisassembly(const QString& file, const QString& funcName,const QStringList& lines);
- void resetEditorFont();
+ void resetEditorFont(float dpi);
signals:
void closed();
private: