- fix: wrong font size of exported RTF file
- fix: correct tokenize statements like "using ::memcpy";
This commit is contained in:
parent
d45c0b87b3
commit
54592276c8
3
NEWS.md
3
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 delete contents in column mode on lines that has wide-chars
|
||||||
- fix: error when create folder in files view
|
- fix: error when create folder in files view
|
||||||
- fix: "ok" button should be disabled when no template selected in new project dialog
|
- 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
|
- 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
|
Red Panda C++ Version 0.14.5
|
||||||
- fix: the "gnu c++ 20" option in compiler set options is wrong
|
- fix: the "gnu c++ 20" option in compiler set options is wrong
|
||||||
|
|
|
@ -1271,11 +1271,11 @@ Are you really want to continue?</oldsource>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="258"/>
|
<location filename="editor.cpp" line="258"/>
|
||||||
<location filename="editor.cpp" line="337"/>
|
<location filename="editor.cpp" line="338"/>
|
||||||
<location filename="editor.cpp" line="1241"/>
|
<location filename="editor.cpp" line="1245"/>
|
||||||
<location filename="editor.cpp" line="1246"/>
|
<location filename="editor.cpp" line="1250"/>
|
||||||
<location filename="editor.cpp" line="1264"/>
|
<location filename="editor.cpp" line="1268"/>
|
||||||
<location filename="editor.cpp" line="1269"/>
|
<location filename="editor.cpp" line="1273"/>
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<translation>错误</translation>
|
<translation>错误</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -1289,34 +1289,34 @@ Are you really want to continue?</oldsource>
|
||||||
<translation>另存为</translation>
|
<translation>另存为</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="1242"/>
|
<location filename="editor.cpp" line="1246"/>
|
||||||
<source>The text to be copied exceeds count limit!</source>
|
<source>The text to be copied exceeds count limit!</source>
|
||||||
<translation>要复制的内容超过了行数限制!</translation>
|
<translation>要复制的内容超过了行数限制!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="1247"/>
|
<location filename="editor.cpp" line="1251"/>
|
||||||
<source>The text to be copied exceeds character limit!</source>
|
<source>The text to be copied exceeds character limit!</source>
|
||||||
<translation>要复制的内容超过了字符数限制!</translation>
|
<translation>要复制的内容超过了字符数限制!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="1265"/>
|
<location filename="editor.cpp" line="1269"/>
|
||||||
<source>The text to be cut exceeds count limit!</source>
|
<source>The text to be cut exceeds count limit!</source>
|
||||||
<translation>要剪切的内容超过了行数限制!</translation>
|
<translation>要剪切的内容超过了行数限制!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="1270"/>
|
<location filename="editor.cpp" line="1274"/>
|
||||||
<source>The text to be cut exceeds character limit!</source>
|
<source>The text to be cut exceeds character limit!</source>
|
||||||
<translation>要剪切的内容超过了字符数限制!</translation>
|
<translation>要剪切的内容超过了字符数限制!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="2693"/>
|
<location filename="editor.cpp" line="2697"/>
|
||||||
<source>Print Document</source>
|
<source>Print Document</source>
|
||||||
<translation>打印文档</translation>
|
<translation>打印文档</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="3290"/>
|
<location filename="editor.cpp" line="3302"/>
|
||||||
<location filename="editor.cpp" line="3329"/>
|
<location filename="editor.cpp" line="3341"/>
|
||||||
<location filename="editor.cpp" line="3383"/>
|
<location filename="editor.cpp" line="3395"/>
|
||||||
<source>Ctrl+click for more info</source>
|
<source>Ctrl+click for more info</source>
|
||||||
<translation>Ctrl+单击以获取更多信息</translation>
|
<translation>Ctrl+单击以获取更多信息</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -1325,27 +1325,27 @@ Are you really want to continue?</oldsource>
|
||||||
<translation type="vanished">未找到符号'%1'!</translation>
|
<translation type="vanished">未找到符号'%1'!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="4118"/>
|
<location filename="editor.cpp" line="4130"/>
|
||||||
<source>astyle not found</source>
|
<source>astyle not found</source>
|
||||||
<translation>找不到astyle程序</translation>
|
<translation>找不到astyle程序</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="4119"/>
|
<location filename="editor.cpp" line="4131"/>
|
||||||
<source>Can't find astyle in "%1".</source>
|
<source>Can't find astyle in "%1".</source>
|
||||||
<translation>找不到astyle程序"%1".</translation>
|
<translation>找不到astyle程序"%1".</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="4269"/>
|
<location filename="editor.cpp" line="4281"/>
|
||||||
<source>Break point condition</source>
|
<source>Break point condition</source>
|
||||||
<translation>断点条件</translation>
|
<translation>断点条件</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="4270"/>
|
<location filename="editor.cpp" line="4282"/>
|
||||||
<source>Enter the condition of the breakpoint:</source>
|
<source>Enter the condition of the breakpoint:</source>
|
||||||
<translation>输入当前断点的生效条件:</translation>
|
<translation>输入当前断点的生效条件:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="4485"/>
|
<location filename="editor.cpp" line="4497"/>
|
||||||
<source>Readonly</source>
|
<source>Readonly</source>
|
||||||
<translation>只读</translation>
|
<translation>只读</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -5473,7 +5473,7 @@ Are you really want to continue?</oldsource>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="3612"/>
|
<location filename="mainwindow.cpp" line="3612"/>
|
||||||
<source>New Folder %1</source>
|
<source>New Folder %1</source>
|
||||||
<translation type="unfinished">新建文件夹%1</translation>
|
<translation>新建文件夹%1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="3623"/>
|
<location filename="mainwindow.cpp" line="3623"/>
|
||||||
|
@ -6071,8 +6071,8 @@ Are you really want to continue?</oldsource>
|
||||||
<translation>项目%1</translation>
|
<translation>项目%1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="widgets/newprojectdialog.cpp" line="143"/>
|
<location filename="widgets/newprojectdialog.cpp" line="145"/>
|
||||||
<location filename="widgets/newprojectdialog.cpp" line="164"/>
|
<location filename="widgets/newprojectdialog.cpp" line="166"/>
|
||||||
<source>Default</source>
|
<source>Default</source>
|
||||||
<translation>缺省</translation>
|
<translation>缺省</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -6767,32 +6767,40 @@ Are you really want to continue?</oldsource>
|
||||||
<context>
|
<context>
|
||||||
<name>ProjectTemplate</name>
|
<name>ProjectTemplate</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="projecttemplate.cpp" line="89"/>
|
<location filename="projecttemplate.cpp" line="91"/>
|
||||||
<source>Read failed.</source>
|
<source>Read failed.</source>
|
||||||
<translation>读取失败.</translation>
|
<translation>读取失败.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="projecttemplate.cpp" line="90"/>
|
<location filename="projecttemplate.cpp" line="92"/>
|
||||||
<source>Can't read template file '%1'.</source>
|
<source>Can't read template file '%1'.</source>
|
||||||
<translation>无法读取模板文件'%1'.</translation>
|
<translation>无法读取模板文件'%1'.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="projecttemplate.cpp" line="96"/>
|
<location filename="projecttemplate.cpp" line="98"/>
|
||||||
|
<source>Can't Open Template</source>
|
||||||
|
<translation>无法打开模板</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="projecttemplate.cpp" line="99"/>
|
||||||
|
<source>Can't open template file '%1' for read.</source>
|
||||||
|
<translation>无法读取模板文件"%1"</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
<source>Template not exist</source>
|
<source>Template not exist</source>
|
||||||
<translation>模板不存在</translation>
|
<translation type="vanished">模板不存在</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="projecttemplate.cpp" line="97"/>
|
|
||||||
<source>Template file '%1' doesn't exist.</source>
|
<source>Template file '%1' doesn't exist.</source>
|
||||||
<translation>模板文件'%1'不存在.</translation>
|
<translation type="vanished">模板文件'%1'不存在.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="projecttemplate.cpp" line="105"/>
|
<location filename="projecttemplate.cpp" line="107"/>
|
||||||
<source>Old version template</source>
|
<source>Old version template</source>
|
||||||
<translation>旧版本模板</translation>
|
<translation>旧版本模板</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="projecttemplate.cpp" line="106"/>
|
<location filename="projecttemplate.cpp" line="108"/>
|
||||||
<source>Template file '%1' has version '%2', which is unsupported.</source>
|
<source>Template file '%1' has version '%2', which is unsupported.</source>
|
||||||
<translation>已不再支持模板文件'%1'的版本(%2)。</translation>
|
<translation>已不再支持模板文件'%1'的版本(%2)。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -7569,12 +7577,12 @@ Are you really want to continue?</oldsource>
|
||||||
<translation>无标题</translation>
|
<translation>无标题</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="parser/cppparser.cpp" line="980"/>
|
<location filename="parser/cppparser.cpp" line="991"/>
|
||||||
<source>constructor</source>
|
<source>constructor</source>
|
||||||
<translation>构造函数</translation>
|
<translation>构造函数</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="parser/cppparser.cpp" line="987"/>
|
<location filename="parser/cppparser.cpp" line="998"/>
|
||||||
<source>destructor</source>
|
<source>destructor</source>
|
||||||
<translation>析构函数</translation>
|
<translation>析构函数</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
@ -3022,6 +3022,11 @@ void Editor::completionInsert(bool appendFunc)
|
||||||
|
|
||||||
// if we are inserting a function,
|
// if we are inserting a function,
|
||||||
if (appendFunc) {
|
if (appendFunc) {
|
||||||
|
if (statement->kind == StatementKind::skAlias) {
|
||||||
|
PStatement newStatement = mParser->findAliasedStatement(statement);
|
||||||
|
if (newStatement)
|
||||||
|
statement = newStatement;
|
||||||
|
}
|
||||||
if (statement->kind == StatementKind::skFunction
|
if (statement->kind == StatementKind::skFunction
|
||||||
|| statement->kind == StatementKind::skConstructor
|
|| statement->kind == StatementKind::skConstructor
|
||||||
|| statement->kind == StatementKind::skDestructor
|
|| statement->kind == StatementKind::skDestructor
|
||||||
|
|
|
@ -334,6 +334,8 @@ QPixmap IconsManager::getPixmapForStatement(PStatement statement)
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_KEYWORD));
|
return *(pIconsManager->getPixmap(IconsManager::PARSER_KEYWORD));
|
||||||
case StatementKind::skUserCodeSnippet:
|
case StatementKind::skUserCodeSnippet:
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_CODE_SNIPPET));
|
return *(pIconsManager->getPixmap(IconsManager::PARSER_CODE_SNIPPET));
|
||||||
|
case StatementKind::skAlias:
|
||||||
|
return *(pIconsManager->getPixmap(IconsManager::PARSER_TYPE));
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,6 +478,17 @@ PStatement CppParser::findStatementOf(const QString &fileName, const QStringList
|
||||||
return findStatementOf(fileName,expression,findAndScanBlockAt(fileName,line));
|
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 CppParser::findStatementStartingFrom(const QString &fileName, const QString &phrase, const PStatement& startScope)
|
||||||
{
|
{
|
||||||
PStatement scopeStatement = startScope;
|
PStatement scopeStatement = startScope;
|
||||||
|
@ -1802,7 +1813,8 @@ PStatement CppParser::getTypeDef(const PStatement& statement,
|
||||||
|| statement->kind == StatementKind::skEnumType
|
|| statement->kind == StatementKind::skEnumType
|
||||||
|| statement->kind == StatementKind::skEnumClassType) {
|
|| statement->kind == StatementKind::skEnumClassType) {
|
||||||
return statement;
|
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
|
if (statement->type == aType) // prevent infinite loop
|
||||||
return statement;
|
return statement;
|
||||||
PStatement result = findTypeDefinitionOf(fileName,statement->type, statement->parentScope.lock());
|
PStatement result = findTypeDefinitionOf(fileName,statement->type, statement->parentScope.lock());
|
||||||
|
@ -3218,9 +3230,9 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
//reduce memory usage
|
//reduce memory usage
|
||||||
mPreprocessor.clearResult();
|
mPreprocessor.clearResult();
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// StringsToFile(mPreprocessor.result(),"f:\\preprocess.txt");
|
// StringsToFile(mPreprocessor.result(),"z:\\preprocess.txt");
|
||||||
// mPreprocessor.dumpDefinesTo("f:\\defines.txt");
|
// mPreprocessor.dumpDefinesTo("z:\\defines.txt");
|
||||||
// mPreprocessor.dumpIncludesListTo("f:\\includes.txt");
|
// mPreprocessor.dumpIncludesListTo("z:\\includes.txt");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Tokenize the preprocessed buffer file
|
// Tokenize the preprocessed buffer file
|
||||||
|
@ -3239,9 +3251,9 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
//reduce memory usage
|
//reduce memory usage
|
||||||
internalClear();
|
internalClear();
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// mTokenizer.dumpTokens("f:\\tokens.txt");
|
// mTokenizer.dumpTokens("z:\\tokens.txt");
|
||||||
// mStatementList.dump("f:\\stats.txt");
|
// mStatementList.dump("z:\\stats.txt");
|
||||||
// mStatementList.dumpAll("f:\\all-stats.txt");
|
// mStatementList.dumpAll("z:\\all-stats.txt");
|
||||||
#endif
|
#endif
|
||||||
//reduce memory usage
|
//reduce memory usage
|
||||||
mTokenizer.reset();
|
mTokenizer.reset();
|
||||||
|
|
|
@ -73,6 +73,7 @@ public:
|
||||||
PStatement findStatementOf(const QString& fileName,
|
PStatement findStatementOf(const QString& fileName,
|
||||||
const QStringList& expression,
|
const QStringList& expression,
|
||||||
int line);
|
int line);
|
||||||
|
PStatement findAliasedStatement(const PStatement& statement);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief evaluate the expression
|
* @brief evaluate the expression
|
||||||
|
|
|
@ -193,11 +193,24 @@ QString CppTokenizer::getNextToken(bool /* bSkipParenthesis */, bool bSkipArray,
|
||||||
case '/':
|
case '/':
|
||||||
advance();
|
advance();
|
||||||
break;
|
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 ';':
|
case ';':
|
||||||
case ',':
|
case ',': //just return the brace or the ';'
|
||||||
case ':': //just return the brace or the ';'
|
|
||||||
countLines();
|
countLines();
|
||||||
result = *mCurrent;
|
result = *mCurrent;
|
||||||
advance();
|
advance();
|
||||||
|
@ -333,6 +346,7 @@ QString CppTokenizer::getWord(bool bSkipParenthesis, bool bSkipArray, bool bSkip
|
||||||
result+=QString(mCurrent,2);
|
result+=QString(mCurrent,2);
|
||||||
mCurrent+=2;
|
mCurrent+=2;
|
||||||
} else if ((*mCurrent == ':') && (*(mCurrent + 1) == ':')) {
|
} else if ((*mCurrent == ':') && (*(mCurrent + 1) == ':')) {
|
||||||
|
if (result != "using") {
|
||||||
result+=QString(mCurrent,2);
|
result+=QString(mCurrent,2);
|
||||||
mCurrent+=2;
|
mCurrent+=2;
|
||||||
// Append next token to this one
|
// Append next token to this one
|
||||||
|
@ -340,6 +354,7 @@ QString CppTokenizer::getWord(bool bSkipParenthesis, bool bSkipArray, bool bSkip
|
||||||
result += s;
|
result += s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ void SynExporter::SaveToFile(const QString &AFileName)
|
||||||
if (file.open(QIODevice::WriteOnly)) {
|
if (file.open(QIODevice::WriteOnly)) {
|
||||||
SaveToStream(file);
|
SaveToStream(file);
|
||||||
} else {
|
} 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ QString SynRTFExporter::GetHeader()
|
||||||
Result = Result + "{\\title " + mTitle + "}}" + lineBreak();
|
Result = Result + "{\\title " + mTitle + "}}" + lineBreak();
|
||||||
// if (mUseBackground)
|
// if (mUseBackground)
|
||||||
// Result = Result + { TODO } #13#10;
|
// 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)
|
if (mUseBackground)
|
||||||
Result = Result + QString("\\chshdng0\\chcbpat%1\\cb%2\\highlight%3 ")
|
Result = Result + QString("\\chshdng0\\chcbpat%1\\cb%2\\highlight%3 ")
|
||||||
.arg(GetColorIndex(mLastBG))
|
.arg(GetColorIndex(mLastBG))
|
||||||
|
|
Loading…
Reference in New Issue