- change: highlight whole #define statement using one color

- enhancement: don't highlight '\' as error
  - enhancement: hide add charset  option in project options dialog's compiler set page, when project compiler set is clang
  - fix: When generating project's makefile for clang, don't add -fexec-charset / -finput-charset command line options
This commit is contained in:
Roy Qu 2022-05-02 21:47:01 +08:00
parent d2a09dea24
commit 45744b43f0
8 changed files with 51 additions and 30 deletions

View File

@ -1,5 +1,9 @@
Red Panda C++ Version 1.0.7
- change: use Shift+Enter to break line
- change: highlight whole #define statement using one color
- enhancement: don't highlight '\' as error
- enhancement: hide add charset option in project options dialog's compiler set page, when project compiler set is clang
- fix: When generating project's makefile for clang, don't add -fexec-charset / -finput-charset command line options
Red Panda C++ Version 1.0.6
- fix: gcc compiler set name is not correct in Linux

View File

@ -10,7 +10,7 @@ isEmpty(APP_NAME) {
}
isEmpty(APP_VERSION) {
APP_VERSION=1.0.6
APP_VERSION=1.0.7
}

View File

@ -383,7 +383,6 @@ QString Compiler::getCCompileArguments(bool checkSyntax)
QString Compiler::getCppCompileArguments(bool checkSyntax)
{
return getCCompileArguments(checkSyntax);
QString result;
if (checkSyntax) {
result += " -fsyntax-only";

View File

@ -386,7 +386,7 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
// Or roll our own
} else {
QString encodingStr;
if (mProject->options().addCharset) {
if (compilerSet()->compilerType() != COMPILER_CLANG && mProject->options().addCharset) {
QByteArray defaultSystemEncoding = pCharsetInfoManager->getDefaultSystemEncoding();
if (unit->encoding() == ENCODING_AUTO_DETECT) {
Editor* editor = mProject->unitEditor(unit);

View File

@ -445,32 +445,36 @@ void SynEditCppHighlighter::directiveProc()
mRun+=1;
}
QString directive;
while (mLine[mRun]!=0 && isIdentChar(mLine[mRun])) {
directive+=mLine[mRun];
mRun+=1;
}
mRange.state = RangeState::rsUnknown;
// do {
// switch(mLine[mRun].unicode()) {
// case '/': //comment?
// switch (mLine[mRun+1].unicode()) {
// case '/': // is end of directive as well
// mRange.state = RangeState::rsUnknown;
// return;
// case '*': // might be embeded only
// mRange.state = RangeState::rsDirectiveComment;
// return;
// }
// break;
// case '\\': // yet another line?
// if (mLine[mRun+1] == 0) {
// mRun+=1;
// mRange.state = RangeState::rsMultiLineDirective;
// return;
// }
// break;
// }
// mRun+=1;
// } while (mLine[mRun]!=0);
if (directive == "define") {
do {
switch(mLine[mRun].unicode()) {
case '/': //comment?
switch (mLine[mRun+1].unicode()) {
case '/': // is end of directive as well
mRange.state = RangeState::rsUnknown;
return;
case '*': // might be embeded only
mRange.state = RangeState::rsDirectiveComment;
return;
}
break;
case '\\': // yet another line?
if (mLine[mRun+1] == 0) {
mRun+=1;
mRange.state = RangeState::rsMultiLineDirective;
return;
}
break;
}
mRun+=1;
} while (mLine[mRun]!=0);
} else
mRange.state = RangeState::rsUnknown;
}
void SynEditCppHighlighter::directiveEndProc()
@ -972,6 +976,13 @@ void SynEditCppHighlighter::slashProc()
}
}
void SynEditCppHighlighter::backSlashProc()
{
mTokenId = TokenKind::Symbol;
mExtTokenId = ExtTokenKind::BackSlash;
mRun+=1;
}
void SynEditCppHighlighter::spaceProc()
{
mRun += 1;
@ -1287,6 +1298,9 @@ void SynEditCppHighlighter::processChar()
case '!':
notSymbolProc();
break;
case '\\':
backSlashProc();
break;
case 0:
nullProc();
break;

View File

@ -53,7 +53,7 @@ class SynEditCppHighlighter: public SynHighlighter
RoundClose, RoundOpen, ScopeResolution, SemiColon, ShiftLeft,
ShiftLeftAssign, ShiftRight, ShiftRightAssign, SquareClose,
SquareOpen, Star, Subtract, SubtractAssign, Xor,
XorAssign
XorAssign, BackSlash
};
enum RangeState {
@ -130,6 +130,7 @@ private:
void roundOpenProc();
void semiColonProc();
void slashProc();
void backSlashProc();
void spaceProc();
void squareCloseProc();
void squareOpenProc();

View File

@ -37,6 +37,8 @@ void ProjectCompilerWidget::refreshOptions()
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
if (!pSet)
return;
ui->chkAddCharset->setVisible(pSet->compilerType()!=COMPILER_CLANG);
ui->chkAddCharset->setEnabled(pSet->compilerType()!=COMPILER_CLANG);
mOptions = pSet->iniOptions();
QTabWidget* pTab = ui->tabOptions;
while (pTab->count()>0) {
@ -111,7 +113,7 @@ void ProjectCompilerWidget::doLoad()
void ProjectCompilerWidget::doSave()
{
Settings::PCompilerSet pSet = pSettings->compilerSets().defaultSet();
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
if (!pSet)
return;
//read values in the options widget
@ -137,7 +139,8 @@ void ProjectCompilerWidget::doSave()
}
pMainWindow->project()->setCompilerSet(ui->cbCompilerSet->currentIndex());
pMainWindow->project()->options().compilerOptions = mOptions;
pMainWindow->project()->options().addCharset = ui->chkAddCharset->isChecked();
if (pSet->compilerType()!=COMPILER_CLANG)
pMainWindow->project()->options().addCharset = ui->chkAddCharset->isChecked();
pMainWindow->project()->options().staticLink = ui->chkStaticLink->isChecked();
pMainWindow->project()->saveOptions();
}

View File

@ -17,7 +17,7 @@ SUBDIRS += \
APP_NAME = RedPandaCPP
APP_VERSION = 1.0.6
APP_VERSION = 1.0.7
linux: {