diff --git a/NEWS.md b/NEWS.md
index 1d5a67c8..035bbde8 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -24,7 +24,10 @@ Red Panda C++ Version 1.0.0
- fix: error when delete contents in column mode on lines that has wide-chars
- fix: error when create folder in files view
- fix: "ok" button should be disabled when no template selected in new project dialog
+ - fix: saveas an openned project file shouldn't be treated as rename
- enhancement: auto add parentheis when complete function like MARCOs
+ - fix: wrong font size of exported RTF file
+ - fix: correct tokenize statements like "using ::memcpy";
Red Panda C++ Version 0.14.5
- fix: the "gnu c++ 20" option in compiler set options is wrong
diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts
index e2dcb9e4..b76c3fa4 100644
--- a/RedPandaIDE/RedPandaIDE_zh_CN.ts
+++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts
@@ -1271,11 +1271,11 @@ Are you really want to continue?
-
-
-
-
-
+
+
+
+
+
错误
@@ -1289,34 +1289,34 @@ Are you really want to continue?
另存为
-
+
要复制的内容超过了行数限制!
-
+
要复制的内容超过了字符数限制!
-
+
要剪切的内容超过了行数限制!
-
+
要剪切的内容超过了字符数限制!
-
+
打印文档
-
-
-
+
+
+
Ctrl+单击以获取更多信息
@@ -1325,27 +1325,27 @@ Are you really want to continue?
未找到符号'%1'!
-
+
找不到astyle程序
-
+
找不到astyle程序"%1".
-
+
断点条件
-
+
输入当前断点的生效条件:
-
+
只读
@@ -5473,7 +5473,7 @@ Are you really want to continue?
- 新建文件夹%1
+ 新建文件夹%1
@@ -6071,8 +6071,8 @@ Are you really want to continue?
项目%1
-
-
+
+
缺省
@@ -6767,32 +6767,40 @@ Are you really want to continue?
ProjectTemplate
-
+
读取失败.
-
+
无法读取模板文件'%1'.
-
+
+
+ 无法打开模板
+
+
+
+
+ 无法读取模板文件"%1"
+
+
- 模板不存在
+ 模板不存在
-
- 模板文件'%1'不存在.
+ 模板文件'%1'不存在.
-
+
旧版本模板
-
+
已不再支持模板文件'%1'的版本(%2)。
@@ -7569,12 +7577,12 @@ Are you really want to continue?
无标题
-
+
构造函数
-
+
析构函数
diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp
index 5d75c88f..497d7a78 100644
--- a/RedPandaIDE/editor.cpp
+++ b/RedPandaIDE/editor.cpp
@@ -3022,6 +3022,11 @@ void Editor::completionInsert(bool appendFunc)
// if we are inserting a function,
if (appendFunc) {
+ if (statement->kind == StatementKind::skAlias) {
+ PStatement newStatement = mParser->findAliasedStatement(statement);
+ if (newStatement)
+ statement = newStatement;
+ }
if (statement->kind == StatementKind::skFunction
|| statement->kind == StatementKind::skConstructor
|| statement->kind == StatementKind::skDestructor
diff --git a/RedPandaIDE/iconsmanager.cpp b/RedPandaIDE/iconsmanager.cpp
index a802d7c4..b7eea624 100644
--- a/RedPandaIDE/iconsmanager.cpp
+++ b/RedPandaIDE/iconsmanager.cpp
@@ -334,6 +334,8 @@ QPixmap IconsManager::getPixmapForStatement(PStatement statement)
return *(pIconsManager->getPixmap(IconsManager::PARSER_KEYWORD));
case StatementKind::skUserCodeSnippet:
return *(pIconsManager->getPixmap(IconsManager::PARSER_CODE_SNIPPET));
+ case StatementKind::skAlias:
+ return *(pIconsManager->getPixmap(IconsManager::PARSER_TYPE));
default:
break;
}
diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp
index e1ef3359..8dc15de2 100644
--- a/RedPandaIDE/parser/cppparser.cpp
+++ b/RedPandaIDE/parser/cppparser.cpp
@@ -478,6 +478,17 @@ PStatement CppParser::findStatementOf(const QString &fileName, const QStringList
return findStatementOf(fileName,expression,findAndScanBlockAt(fileName,line));
}
+PStatement CppParser::findAliasedStatement(const PStatement &statement)
+{
+ QMutexLocker locker(&mMutex);
+ if (mParsing)
+ return PStatement();
+ if (!statement)
+ return PStatement();
+ return findTypeDefinitionOf(statement->fileName,statement->type, statement->parentScope.lock());
+
+}
+
PStatement CppParser::findStatementStartingFrom(const QString &fileName, const QString &phrase, const PStatement& startScope)
{
PStatement scopeStatement = startScope;
@@ -1802,7 +1813,8 @@ PStatement CppParser::getTypeDef(const PStatement& statement,
|| statement->kind == StatementKind::skEnumType
|| statement->kind == StatementKind::skEnumClassType) {
return statement;
- } else if (statement->kind == StatementKind::skTypedef) {
+ } else if (statement->kind == StatementKind::skTypedef
+ || statement->kind == StatementKind::skAlias) {
if (statement->type == aType) // prevent infinite loop
return statement;
PStatement result = findTypeDefinitionOf(fileName,statement->type, statement->parentScope.lock());
@@ -3218,9 +3230,9 @@ void CppParser::internalParse(const QString &fileName)
//reduce memory usage
mPreprocessor.clearResult();
#ifdef QT_DEBUG
-// StringsToFile(mPreprocessor.result(),"f:\\preprocess.txt");
-// mPreprocessor.dumpDefinesTo("f:\\defines.txt");
-// mPreprocessor.dumpIncludesListTo("f:\\includes.txt");
+// StringsToFile(mPreprocessor.result(),"z:\\preprocess.txt");
+// mPreprocessor.dumpDefinesTo("z:\\defines.txt");
+// mPreprocessor.dumpIncludesListTo("z:\\includes.txt");
#endif
// Tokenize the preprocessed buffer file
@@ -3239,9 +3251,9 @@ void CppParser::internalParse(const QString &fileName)
//reduce memory usage
internalClear();
#ifdef QT_DEBUG
-// mTokenizer.dumpTokens("f:\\tokens.txt");
-// mStatementList.dump("f:\\stats.txt");
-// mStatementList.dumpAll("f:\\all-stats.txt");
+// mTokenizer.dumpTokens("z:\\tokens.txt");
+// mStatementList.dump("z:\\stats.txt");
+// mStatementList.dumpAll("z:\\all-stats.txt");
#endif
//reduce memory usage
mTokenizer.reset();
diff --git a/RedPandaIDE/parser/cppparser.h b/RedPandaIDE/parser/cppparser.h
index 05d140f9..9278fa7a 100644
--- a/RedPandaIDE/parser/cppparser.h
+++ b/RedPandaIDE/parser/cppparser.h
@@ -73,6 +73,7 @@ public:
PStatement findStatementOf(const QString& fileName,
const QStringList& expression,
int line);
+ PStatement findAliasedStatement(const PStatement& statement);
/**
* @brief evaluate the expression
diff --git a/RedPandaIDE/parser/cpptokenizer.cpp b/RedPandaIDE/parser/cpptokenizer.cpp
index f4d35aa1..e3b56d81 100644
--- a/RedPandaIDE/parser/cpptokenizer.cpp
+++ b/RedPandaIDE/parser/cpptokenizer.cpp
@@ -193,11 +193,24 @@ QString CppTokenizer::getNextToken(bool /* bSkipParenthesis */, bool bSkipArray,
case '/':
advance();
break;
+ case ':':
+ if (*(mCurrent + 1) == ':') {
+ countLines();
+ mCurrent+=2;
+ // Append next token to this one
+ result = "::"+getWord(true, bSkipArray, bSkipBlock);
+ done = true;
+ } else {
+ countLines();
+ result = *mCurrent;
+ advance();
+ done = true;
+ }
+ break;
case '{':
case '}':
case ';':
- case ',':
- case ':': //just return the brace or the ';'
+ case ',': //just return the brace or the ';'
countLines();
result = *mCurrent;
advance();
@@ -333,11 +346,13 @@ QString CppTokenizer::getWord(bool bSkipParenthesis, bool bSkipArray, bool bSkip
result+=QString(mCurrent,2);
mCurrent+=2;
} else if ((*mCurrent == ':') && (*(mCurrent + 1) == ':')) {
- result+=QString(mCurrent,2);
- mCurrent+=2;
- // Append next token to this one
- QString s = getWord(bSkipParenthesis, bSkipArray, bSkipBlock);
- result += s;
+ if (result != "using") {
+ result+=QString(mCurrent,2);
+ mCurrent+=2;
+ // Append next token to this one
+ QString s = getWord(bSkipParenthesis, bSkipArray, bSkipBlock);
+ result += s;
+ }
}
}
return result;
diff --git a/RedPandaIDE/qsynedit/exporter/synexporter.cpp b/RedPandaIDE/qsynedit/exporter/synexporter.cpp
index f03a8f6d..3ee20c71 100644
--- a/RedPandaIDE/qsynedit/exporter/synexporter.cpp
+++ b/RedPandaIDE/qsynedit/exporter/synexporter.cpp
@@ -132,7 +132,7 @@ void SynExporter::SaveToFile(const QString &AFileName)
if (file.open(QIODevice::WriteOnly)) {
SaveToStream(file);
} else {
- throw FileError(QObject::tr("Can't open file '%1' to write!"));
+ throw FileError(QObject::tr("Can't open file '%1' to write!").arg(AFileName));
}
}
diff --git a/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp b/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp
index 632c6e00..0d28dcbc 100644
--- a/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp
+++ b/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp
@@ -156,7 +156,7 @@ QString SynRTFExporter::GetHeader()
Result = Result + "{\\title " + mTitle + "}}" + lineBreak();
// if (mUseBackground)
// Result = Result + { TODO } #13#10;
- Result = Result + QString("\\deflang1033\\pard\\plain\\f0\\fs%1 ").arg(2 * mFont.pointSize());
+ Result = Result + QString("\\deflang1033\\pard\\plain\\f0\\fs%1 ").arg((int)(2 * pixelToPoint(mFont.pixelSize())));
if (mUseBackground)
Result = Result + QString("\\chshdng0\\chcbpat%1\\cb%2\\highlight%3 ")
.arg(GetColorIndex(mLastBG))