- fix: Enum value defines is not correctly parsed.

- enhancement: Use differenct source file for each language in project templates
This commit is contained in:
Roy Qu 2023-02-21 20:35:41 +08:00
parent 3ede3e4ce6
commit f03c25a672
4 changed files with 34 additions and 22 deletions

View File

@ -1,7 +1,8 @@
Red Panda C++ Version 2.13 Red Panda C++ Version 2.14
- change: Remove all breakpoints of the current non-project file, when it is closed. - change: Remove all breakpoints of the current non-project file, when it is closed.
- fix: Enum value defines is not correctly parsed.
- enhancement: Use differenct source file for each language in project templates
Red Panda C++ Version 2.13 Red Panda C++ Version 2.13

View File

@ -1275,21 +1275,22 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
// if ctrl+clicked // if ctrl+clicked
if ((event->modifiers() == Qt::ControlModifier) if ((event->modifiers() == Qt::ControlModifier)
&& (event->button() == Qt::LeftButton)) { && (event->button() == Qt::LeftButton)) {
if (!mCurrentWord.isEmpty()) {
QSynedit::BufferCoord p; QSynedit::BufferCoord p;
if (mParser && pointToCharLine(event->pos(),p)) { if (mParser && pointToCharLine(event->pos(),p)) {
QString s = document()->getLine(p.line - 1); QString s = document()->getLine(p.line - 1);
if (mParser->isIncludeNextLine(s)) { if (mParser->isIncludeNextLine(s)) {
QString filename = mParser->getHeaderFileName(mFilename,s, true); QString filename = mParser->getHeaderFileName(mFilename,s, true);
pMainWindow->openFile(filename); pMainWindow->openFile(filename);
return; return;
} if (mParser->isIncludeLine(s)) { } if (mParser->isIncludeLine(s)) {
QString filename = mParser->getHeaderFileName(mFilename,s); QString filename = mParser->getHeaderFileName(mFilename,s);
pMainWindow->openFile(filename); pMainWindow->openFile(filename);
return; return;
} else if (mParser->enabled()) { } else if (mParser->enabled()) {
gotoDefinition(p); gotoDefinition(p);
return; return;
}
} }
} }
} }

View File

@ -5389,6 +5389,7 @@ int CppParser::indexOfNextPeriodOrSemicolon(int index, int endIndex)
switch(mTokenizer[index]->text[0].unicode()) { switch(mTokenizer[index]->text[0].unicode()) {
case ';': case ';':
case ',': case ',':
case '}':
return index; return index;
case '(': case '(':
index = mTokenizer[index]->matchIndex+1; index = mTokenizer[index]->matchIndex+1;

View File

@ -38,17 +38,26 @@ PTemplateUnit ProjectTemplate::unit(int index)
return PTemplateUnit(); return PTemplateUnit();
QString section = QString("Unit%1").arg(index); QString section = QString("Unit%1").arg(index);
PTemplateUnit unit = std::make_shared<TemplateUnit>(); PTemplateUnit unit = std::make_shared<TemplateUnit>();
unit->Source = fromByteArray(mIni->GetValue(toByteArray(section), "Source", "")); QString lang = pSettings->environment().language();
unit->Target = fromByteArray(mIni->GetValue(toByteArray(section), "Target", "")); if (!lang.isEmpty()) {
unit->CText = fromByteArray(mIni->GetValue(toByteArray(section), "C", "")); unit->Source = fromByteArray(mIni->GetValue(toByteArray(section), QString("Source[%1]").arg(lang).toUtf8(), ""));
unit->CppText = fromByteArray(mIni->GetValue(toByteArray(section), "Cpp", "")); unit->CText = fromByteArray(mIni->GetValue(toByteArray(section), QString("C[%1]").arg(lang).toUtf8(), ""));
unit->CppText = fromByteArray(mIni->GetValue(toByteArray(section), QString("Cpp[%1]").arg(lang).toUtf8(), ""));
}
if (unit->Source.isEmpty())
unit->Source = fromByteArray(mIni->GetValue(toByteArray(section), "Source", ""));
if (unit->CText.isEmpty())
unit->CText = fromByteArray(mIni->GetValue(toByteArray(section), "C", ""));
if (unit->CppText.isEmpty())
unit->CppText = fromByteArray(mIni->GetValue(toByteArray(section), "Cpp", ""));
if (unit->CppText.isEmpty()) if (unit->CppText.isEmpty())
unit->CppText = unit->CText; unit->CppText = unit->CText;
unit->CName = fromByteArray(mIni->GetValue(toByteArray(section), "CName", "")); unit->CName = fromByteArray(mIni->GetValue(toByteArray(section), "CName", ""));
unit->CppName = fromByteArray(mIni->GetValue(toByteArray(section), "CppName", "")); unit->CppName = fromByteArray(mIni->GetValue(toByteArray(section), "CppName", ""));
if (unit->CppName.isEmpty()) if (unit->CppName.isEmpty())
unit->CppName = unit->CName; unit->CppName = unit->CName;
unit->Target = fromByteArray(mIni->GetValue(toByteArray(section), "Target", ""));
return unit; return unit;
} }