Merge branch 'master' of github.com:royqh1979/RedPanda-CPP

This commit is contained in:
Roy Qu 2024-04-15 16:40:00 +08:00
commit a485dac4cd
17 changed files with 157 additions and 117 deletions

View File

@ -138,6 +138,12 @@ Red Panda C++ Version 2.27
- enhancement: Auto hide Project menu if no project openning. - enhancement: Auto hide Project menu if no project openning.
- fix: Toggle breakpoint by shortcut may use wrong line. - fix: Toggle breakpoint by shortcut may use wrong line.
- fix: Size of the icons in problem and problem set panel are not correct. - fix: Size of the icons in problem and problem set panel are not correct.
- fix: Shouldn't consider preceeding '&'/'*' when popping completion suggest list for variable members.
- fix: Positions of current matching parenthesis not correctly updated.
- fix: Can't show correct completion info for vars declared with template parameters ending with ">>".
- enhancement: Auto type induction for "std::make_shared"/"std::make_unique".
- enhancement: sdcc project compiler: compile source file in subfolders.
- fix: project options -> compiler set -> static link & auto convert charset options not correctly loaded.
Red Panda C++ Version 2.26 Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors. - enhancement: Code suggestion for embedded std::vectors.

View File

@ -173,10 +173,11 @@ void CompilerInfo::prepareCompilerOptions()
addOption(CC_CMD_OPT_WARNING_AS_ERROR, QObject::tr("Make all warnings into errors (-Werror)"), groupName, true, true, false, "-Werror"); addOption(CC_CMD_OPT_WARNING_AS_ERROR, QObject::tr("Make all warnings into errors (-Werror)"), groupName, true, true, false, "-Werror");
addOption(CC_CMD_OPT_ABORT_ON_ERROR , QObject::tr("Abort compilation on first error (-Wfatal-errors)"), groupName, true, true, false, "-Wfatal-errors"); addOption(CC_CMD_OPT_ABORT_ON_ERROR , QObject::tr("Abort compilation on first error (-Wfatal-errors)"), groupName, true, true, false, "-Wfatal-errors");
sl.clear(); sl.clear();
sl.append(QPair<QString,QString>("Normal","")); sl.append(QPair<QString,QString>("Normal","protector"));
sl.append(QPair<QString,QString>("Strong","-strong")); sl.append(QPair<QString,QString>("Explicit","protector-explicit"));
sl.append(QPair<QString,QString>("All","-all")); sl.append(QPair<QString,QString>("Strong","protector-strong"));
addOption(CC_CMD_OPT_STACK_PROTECTOR , QObject::tr("Check for stack smashing attacks (-fstack-protector)"), groupName, false, false, true, "-fstack-protector", CompilerOptionType::Choice, sl); sl.append(QPair<QString,QString>("All","protector-all"));
addOption(CC_CMD_OPT_STACK_PROTECTOR , QObject::tr("Check for stack smashing attacks (-fstack-protector)"), groupName, false, false, true, "-fstack-", CompilerOptionType::Choice, sl);
sl.clear(); sl.clear();
sl.append(QPair<QString,QString>("Address","address")); sl.append(QPair<QString,QString>("Address","address"));
sl.append(QPair<QString,QString>("Hwaddress","hwaddress")); sl.append(QPair<QString,QString>("Hwaddress","hwaddress"));

View File

@ -265,6 +265,7 @@ void ProjectCompiler::writeMakeDefines(QFile &file, bool &genModuleDef)
writeln(file, "WINDRES = " + escapeArgumentForMakefileVariableValue(windres, true)); writeln(file, "WINDRES = " + escapeArgumentForMakefileVariableValue(windres, true));
#endif #endif
writeln(file, "RM = " CLEAN_PROGRAM); writeln(file, "RM = " CLEAN_PROGRAM);
writeln(file, "CD = " CD_PROGRAM);
// compiler flags // compiler flags
writeln(file, "LIBS = " + escapeArgumentsForMakefileVariableValue(libraryArguments)); writeln(file, "LIBS = " + escapeArgumentsForMakefileVariableValue(libraryArguments));

View File

@ -169,6 +169,7 @@ void SDCCProjectCompiler::writeMakeDefines(QFile &file)
writeln(file, "BIN_ARG = " + escapeArgumentForMakefileVariableValue(executable, false)); writeln(file, "BIN_ARG = " + escapeArgumentForMakefileVariableValue(executable, false));
writeln(file, "CFLAGS = $(INCS) " + escapeArgumentsForMakefileVariableValue(cCompileArguments)); writeln(file, "CFLAGS = $(INCS) " + escapeArgumentsForMakefileVariableValue(cCompileArguments));
writeln(file, "RM = " CLEAN_PROGRAM); writeln(file, "RM = " CLEAN_PROGRAM);
writeln(file, "CD = " CD_PROGRAM);
writeln(file); writeln(file);
} }
@ -195,7 +196,7 @@ void SDCCProjectCompiler::writeMakeIncludes(QFile &file)
void SDCCProjectCompiler::writeMakeClean(QFile &file) void SDCCProjectCompiler::writeMakeClean(QFile &file)
{ {
writeln(file, "clean: clean-custom"); writeln(file, "clean: clean-custom");
writeln(file, QString("\t-$(RM) $(CLEANOBJ) > %1 2>&1").arg(NULL_FILE)); writeln(file, QString("\t-$(RM) $(CLEANOBJ) >%1 2>&1||:").arg(NULL_FILE));
writeln(file); writeln(file);
} }
@ -256,6 +257,7 @@ void SDCCProjectCompiler::writeMakeObjFilesRules(QFile &file)
writeln(file, objStr); writeln(file, objStr);
// Write custom build command // Write custom build command
if (unit->overrideBuildCmd() && !unit->buildCmd().isEmpty()) { if (unit->overrideBuildCmd() && !unit->buildCmd().isEmpty()) {
QString BuildCmd = unit->buildCmd(); QString BuildCmd = unit->buildCmd();
BuildCmd.replace("<CRTAB>", "\n\t"); BuildCmd.replace("<CRTAB>", "\n\t");
@ -263,7 +265,15 @@ void SDCCProjectCompiler::writeMakeObjFilesRules(QFile &file)
// Or roll our own // Or roll our own
} else { } else {
if (fileType==FileType::CSource) { if (fileType==FileType::CSource) {
if(mProject->options().folderForObjFiles.isEmpty()) {
writeln(file, "\t$(CC) $(CFLAGS) -c " + escapeArgumentForMakefileRecipe(shortFileName, false)); writeln(file, "\t$(CC) $(CFLAGS) -c " + escapeArgumentForMakefileRecipe(shortFileName, false));
}else{
QString fullObjDir = includeTrailingPathDelimiter(mProject->options().folderForObjFiles);
QString relativeObjDir = extractRelativePath(mProject->directory(),fullObjDir);
QString objfile=extractRelativePath(generateAbsolutePath(mProject->directory(),relativeObjDir),unit->fileName());
writeln(file, "\t$(CD) "+ localizePath(relativeObjDir)+" && $(CC) $(CFLAGS) -c " + localizePath(objfile));
}
} }
} }
} }

View File

@ -1859,6 +1859,12 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes)
if (changes.testFlag(QSynedit::StatusChange::CaretX) if (changes.testFlag(QSynedit::StatusChange::CaretX)
|| changes.testFlag(QSynedit::StatusChange::CaretY)) { || changes.testFlag(QSynedit::StatusChange::CaretY)) {
if (pSettings->editor().highlightMathingBraces()) {
invalidateLine(mHighlightCharPos1.line);
invalidateLine(mHighlightCharPos2.line);
}
mHighlightCharPos1 = QSynedit::BufferCoord{0,0};
mHighlightCharPos2 = QSynedit::BufferCoord{0,0};
if (mTabStopBegin >=0) { if (mTabStopBegin >=0) {
if (mTabStopY==caretY()) { if (mTabStopY==caretY()) {
if (mLineAfterTabStop.isEmpty()) { if (mLineAfterTabStop.isEmpty()) {
@ -1885,10 +1891,6 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes)
} }
} }
} else if (!selAvail() && pSettings->editor().highlightMathingBraces()){ } else if (!selAvail() && pSettings->editor().highlightMathingBraces()){
invalidateLine(mHighlightCharPos1.line);
invalidateLine(mHighlightCharPos2.line);
mHighlightCharPos1 = QSynedit::BufferCoord{0,0};
mHighlightCharPos2 = QSynedit::BufferCoord{0,0};
// Is there a bracket char before us? // Is there a bracket char before us?
int lineLength = lineText().length(); int lineLength = lineText().length();
int ch = caretX() - 2; int ch = caretX() - 2;
@ -2341,6 +2343,10 @@ QStringList Editor::getOwnerExpressionAndMemberAtPositionForCompletion(
QStringList &memberExpression) QStringList &memberExpression)
{ {
QStringList expression = getExpressionAtPosition(pos); QStringList expression = getExpressionAtPosition(pos);
// *(Deference) and &(Address-of) has low precedence than '.'/'->',
// so don't includes them in the owner expression in comletion calculation
while (!expression.isEmpty() && (expression.front()=='*' || expression.front()=='&'))
expression.pop_front();
return getOwnerExpressionAndMember(expression,memberOperator,memberExpression); return getOwnerExpressionAndMember(expression,memberOperator,memberExpression);
} }

View File

@ -4108,8 +4108,18 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic,
if(aliasStatement) { if(aliasStatement) {
if (aliasStatement->typeStatement) { if (aliasStatement->typeStatement) {
addedVar->type = aliasStatement->typeStatement->fullName; addedVar->type = aliasStatement->typeStatement->fullName;
if (!addedVar->type.endsWith(">")) if (!aliasStatement->templateParams.isEmpty()) {
if (!addedVar->type.endsWith(">")) {
addedVar->type += aliasStatement->templateParams; addedVar->type += aliasStatement->templateParams;
} else {
QString type = addedVar->type;
int pos = type.indexOf('<');
if (pos>=0) {
type = type.left(pos);
addedVar->type = type + aliasStatement->templateParams;
}
}
}
if (aliasStatement->typeStatement if (aliasStatement->typeStatement
&& STLIterators.contains(aliasStatement->typeStatement->command) && STLIterators.contains(aliasStatement->typeStatement->command)
&& !aliasStatement->templateParams.isEmpty()) { && !aliasStatement->templateParams.isEmpty()) {
@ -4686,7 +4696,7 @@ PEvalStatement CppParser::doEvalExpression(const QString& fileName,
} }
return result; return result;
} else } else
return doEvalPointerArithmetic( return doEvalArithmeticOperation(
fileName, fileName,
phraseExpression, phraseExpression,
pos, pos,
@ -4695,7 +4705,7 @@ PEvalStatement CppParser::doEvalExpression(const QString& fileName,
freeScoped); freeScoped);
} }
PEvalStatement CppParser::doEvalPointerArithmetic(const QString &fileName, const QStringList &phraseExpression, int &pos, const PStatement &scope, const PEvalStatement &previousResult, bool freeScoped) const PEvalStatement CppParser::doEvalArithmeticOperation(const QString &fileName, const QStringList &phraseExpression, int &pos, const PStatement &scope, const PEvalStatement &previousResult, bool freeScoped) const
{ {
if (pos>=phraseExpression.length()) if (pos>=phraseExpression.length())
return PEvalStatement(); return PEvalStatement();
@ -4755,7 +4765,7 @@ PEvalStatement CppParser::doEvalPointerToMembers(
if (pos>=phraseExpression.length()) if (pos>=phraseExpression.length())
return PEvalStatement(); return PEvalStatement();
//find the start scope statement //find the start scope statement
PEvalStatement currentResult = doEvalCCast( PEvalStatement currentResult = doEvalTypeCast(
fileName, fileName,
phraseExpression, phraseExpression,
pos, pos,
@ -4771,7 +4781,7 @@ PEvalStatement CppParser::doEvalPointerToMembers(
|| phraseExpression[pos]=="->*")) { || phraseExpression[pos]=="->*")) {
pos++; pos++;
currentResult = currentResult =
doEvalCCast( doEvalTypeCast(
fileName, fileName,
phraseExpression, phraseExpression,
pos, pos,
@ -4788,7 +4798,7 @@ PEvalStatement CppParser::doEvalPointerToMembers(
return currentResult; return currentResult;
} }
PEvalStatement CppParser::doEvalCCast(const QString &fileName, PEvalStatement CppParser::doEvalTypeCast(const QString &fileName,
const QStringList &phraseExpression, const QStringList &phraseExpression,
int &pos, int &pos,
const PStatement& scope, const PStatement& scope,
@ -4799,8 +4809,9 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName,
return PEvalStatement(); return PEvalStatement();
PEvalStatement result; PEvalStatement result;
if (phraseExpression[pos]=="*") { if (phraseExpression[pos]=="*") {
//deference
pos++; //skip "*" pos++; //skip "*"
result = doEvalCCast( result = doEvalTypeCast(
fileName, fileName,
phraseExpression, phraseExpression,
pos, pos,
@ -4862,8 +4873,9 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName,
result->pointerLevel--; result->pointerLevel--;
} }
} else if (phraseExpression[pos]=="&") { } else if (phraseExpression[pos]=="&") {
//Address-of
pos++; //skip "&" pos++; //skip "&"
result = doEvalCCast( result = doEvalTypeCast(
fileName, fileName,
phraseExpression, phraseExpression,
pos, pos,
@ -4875,8 +4887,9 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName,
} }
} else if (phraseExpression[pos]=="++" } else if (phraseExpression[pos]=="++"
|| phraseExpression[pos]=="--") { || phraseExpression[pos]=="--") {
// Prefix increment and decrement
pos++; //skip "++" or "--" pos++; //skip "++" or "--"
result = doEvalCCast( result = doEvalTypeCast(
fileName, fileName,
phraseExpression, phraseExpression,
pos, pos,
@ -4884,6 +4897,7 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName,
previousResult, previousResult,
freeScoped); freeScoped);
} else if (phraseExpression[pos]=="(") { } else if (phraseExpression[pos]=="(") {
//Type Cast
//parse //parse
int startPos = pos; int startPos = pos;
pos++; pos++;
@ -4904,7 +4918,7 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName,
pos++; // skip ")" pos++; // skip ")"
// qDebug()<<"parse type cast exp"; // qDebug()<<"parse type cast exp";
//it's a type cast //it's a type cast
result = doEvalCCast(fileName, result = doEvalTypeCast(fileName,
phraseExpression, phraseExpression,
pos, pos,
scope, scope,
@ -4930,11 +4944,6 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName,
scope, scope,
previousResult, previousResult,
freeScoped); freeScoped);
// if (result) {
// qDebug()<<pos<<(int)result->kind<<result->baseType;
// } else {
// qDebug()<<"!!!!!!!!!!!not found";
// }
return result; return result;
} }
@ -4963,8 +4972,10 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
if (!result) if (!result)
break; break;
if (phraseExpression[pos]=="++" || phraseExpression[pos]=="--") { if (phraseExpression[pos]=="++" || phraseExpression[pos]=="--") {
//Suffix/postfix increment and decrement
pos++; //just skip it pos++; //just skip it
} else if (phraseExpression[pos] == "(") { } else if (phraseExpression[pos] == "(") {
// Function call
if (result->kind == EvalStatementKind::Type) { if (result->kind == EvalStatementKind::Type) {
doSkipInExpression(phraseExpression,pos,"(",")"); doSkipInExpression(phraseExpression,pos,"(",")");
result->kind = EvalStatementKind::Variable; result->kind = EvalStatementKind::Variable;
@ -5025,11 +5036,13 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
result = PEvalStatement(); result = PEvalStatement();
} }
} else if (phraseExpression[pos] == "{") { } else if (phraseExpression[pos] == "{") {
// Varaible Initialization
if (result->kind == EvalStatementKind::Type) { if (result->kind == EvalStatementKind::Type) {
doSkipInExpression(phraseExpression,pos,"{","}"); doSkipInExpression(phraseExpression,pos,"{","}");
result->kind = EvalStatementKind::Variable; result->kind = EvalStatementKind::Variable;
} }
} else if (phraseExpression[pos] == "[") { } else if (phraseExpression[pos] == "[") {
//Array subscripting
//skip to "]" //skip to "]"
doSkipInExpression(phraseExpression,pos,"[","]"); doSkipInExpression(phraseExpression,pos,"[","]");
if (result->kind == EvalStatementKind::Type) { if (result->kind == EvalStatementKind::Type) {
@ -5079,6 +5092,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
} }
} }
} else if (phraseExpression[pos] == ".") { } else if (phraseExpression[pos] == ".") {
//Structure and union member access
pos++; pos++;
lastResult = result; lastResult = result;
result = doEvalScopeResolution( result = doEvalScopeResolution(
@ -5089,6 +5103,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
result, result,
false); false);
} else if (phraseExpression[pos] == "->") { } else if (phraseExpression[pos] == "->") {
// Structure and union member access through pointer
pos++; pos++;
if (result->pointerLevel==0) { if (result->pointerLevel==0) {
// iterator // iterator
@ -5374,13 +5389,17 @@ PEvalStatement CppParser::doEvalTerm(const QString &fileName,
pos++; pos++;
} }
result->pointerLevel = pointerLevel; result->pointerLevel = pointerLevel;
} else if (result && result->kind == EvalStatementKind::Function
&& pos<phraseExpression.length()
&& phraseExpression[pos]=='<') {
result->templateParams = "";
int oldPos = pos;
doSkipInExpression(phraseExpression,pos,"<",">");
for(int i=oldPos;i<pos;i++) {
result->templateParams+=phraseExpression[i];
}
} }
} }
// qDebug()<<pos<<" term end";
// if (!result) {
// qDebug()<<"not found !!!!";
// }
return result; return result;
} }
@ -5693,10 +5712,13 @@ PEvalStatement CppParser::doCreateEvalFunction(
int pointerLevel=0; int pointerLevel=0;
QString templateParams; QString templateParams;
PStatement typeStatement; PStatement typeStatement;
QString type = funcStatement->type;
if (funcStatement->fullName == "std::make_unique")
type = "unique_ptr";
PStatement effetiveTypeStatement = doParseEvalTypeInfo( PStatement effetiveTypeStatement = doParseEvalTypeInfo(
fileName, fileName,
funcStatement->parentScope.lock(), funcStatement->parentScope.lock(),
funcStatement->type, type,
baseType, baseType,
typeStatement, typeStatement,
pointerLevel, pointerLevel,
@ -5799,6 +5821,8 @@ PStatement CppParser::doParseEvalTypeInfo(
templateLevel++; templateLevel++;
} else if (token == ">") { } else if (token == ">") {
templateLevel--; templateLevel--;
} else if (token == ">>") {
templateLevel-=2;
} }
templateParams += token; templateParams += token;
} }
@ -6587,9 +6611,18 @@ QStringList CppParser::splitExpression(const QString &expr)
for(int i=0;i<lines.length();i++) { for(int i=0;i<lines.length();i++) {
syntaxer.setLine(lines[i],i+1); syntaxer.setLine(lines[i],i+1);
while(!syntaxer.eol()) { while(!syntaxer.eol()) {
if (syntaxer.getTokenAttribute()->tokenType()!=QSynedit::TokenType::Comment QSynedit::TokenType tokenType = syntaxer.getTokenAttribute()->tokenType();
&& syntaxer.getTokenAttribute()->tokenType()!=QSynedit::TokenType::Space) QString token = syntaxer.getToken();
result.append(syntaxer.getToken()); if (tokenType == QSynedit::TokenType::Operator) {
if ( token == ">>" ) {
result.append(">");
result.append(">");
} else {
result.append(token);
}
} else if (tokenType!=QSynedit::TokenType::Comment
&& tokenType!=QSynedit::TokenType::Space)
result.append(token);
syntaxer.next(); syntaxer.next();
} }
} }

View File

@ -325,13 +325,15 @@ private:
bool freeScoped, bool freeScoped,
bool expandMacros) const; bool expandMacros) const;
PEvalStatement doEvalPointerArithmetic( /* add + / minus - */
PEvalStatement doEvalArithmeticOperation(
const QString& fileName, const QString& fileName,
const QStringList& phraseExpression, const QStringList& phraseExpression,
int &pos, int &pos,
const PStatement& scope, const PStatement& scope,
const PEvalStatement& previousResult, const PEvalStatement& previousResult,
bool freeScoped) const; bool freeScoped) const;
/* Pointer to members .* / ->* */
PEvalStatement doEvalPointerToMembers( PEvalStatement doEvalPointerToMembers(
const QString& fileName, const QString& fileName,
const QStringList& phraseExpression, const QStringList& phraseExpression,
@ -339,13 +341,19 @@ private:
const PStatement& scope, const PStatement& scope,
const PEvalStatement& previousResult, const PEvalStatement& previousResult,
bool freeScoped) const; bool freeScoped) const;
PEvalStatement doEvalCCast(
/*
* Dereference * / Address-of & / Type Cast / Prefix increment and decrement
* */
PEvalStatement doEvalTypeCast(
const QString& fileName, const QString& fileName,
const QStringList& phraseExpression, const QStringList& phraseExpression,
int &pos, int &pos,
const PStatement& scope, const PStatement& scope,
const PEvalStatement& previousResult, const PEvalStatement& previousResult,
bool freeScoped) const; bool freeScoped) const;
PEvalStatement doEvalMemberAccess( PEvalStatement doEvalMemberAccess(
const QString& fileName, const QString& fileName,
const QStringList& phraseExpression, const QStringList& phraseExpression,

View File

@ -45,7 +45,7 @@ function main()
PaletteButtonDisabled = "#efefef", PaletteButtonDisabled = "#efefef",
PaletteButtonTextDisabled = "#bebebe", PaletteButtonTextDisabled = "#bebebe",
PaletteHighlight = "#688DB2", PaletteHighlight = "#688DB2",
PaletteHighlightedText = "#000000", PaletteHighlightedText = "#ffffff",
}, },
} }
end end

View File

@ -44,10 +44,10 @@ void ProjectCompilerWidget::refreshOptions()
ui->tabOptions->resetUI(pSet,mOptions); ui->tabOptions->resetUI(pSet,mOptions);
ui->chkStaticLink->setChecked(pSet->staticLink()); ui->chkStaticLink->setChecked(mStaticLink);
ui->chkAddCharset->setChecked(pSet->autoAddCharsetParams()); ui->chkAddCharset->setChecked(mAddCharset);
QByteArray execEncoding = pMainWindow->project()->options().execEncoding; QByteArray execEncoding = mExecCharset;
if (execEncoding == ENCODING_AUTO_DETECT if (execEncoding == ENCODING_AUTO_DETECT
|| execEncoding == ENCODING_SYSTEM_DEFAULT || execEncoding == ENCODING_SYSTEM_DEFAULT
|| execEncoding == ENCODING_UTF8) { || execEncoding == ENCODING_UTF8) {
@ -75,11 +75,12 @@ void ProjectCompilerWidget::doLoad()
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex()); Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
if (mOptions.isEmpty() && pSet) if (mOptions.isEmpty() && pSet)
mOptions = pSet->compileOptions(); mOptions = pSet->compileOptions();
mStaticLink = pMainWindow->project()->options().staticLink;
mAddCharset = pMainWindow->project()->options().addCharset;
mExecCharset = pMainWindow->project()->options().execEncoding;
ui->cbCompilerSet->blockSignals(true); ui->cbCompilerSet->blockSignals(true);
ui->cbCompilerSet->setCurrentIndex(pMainWindow->project()->options().compilerSet); ui->cbCompilerSet->setCurrentIndex(pMainWindow->project()->options().compilerSet);
ui->cbCompilerSet->blockSignals(false); ui->cbCompilerSet->blockSignals(false);
ui->chkAddCharset->setChecked(pMainWindow->project()->options().addCharset);
ui->chkStaticLink->setChecked(pMainWindow->project()->options().staticLink);
refreshOptions(); refreshOptions();
} }
@ -99,6 +100,10 @@ void ProjectCompilerWidget::doSave()
} else { } else {
pMainWindow->project()->options().execEncoding = ui->cbEncoding->currentData().toString().toLocal8Bit(); pMainWindow->project()->options().execEncoding = ui->cbEncoding->currentData().toString().toLocal8Bit();
} }
mOptions = pMainWindow->project()->options().compilerOptions;
mStaticLink = pMainWindow->project()->options().staticLink;
mAddCharset = pMainWindow->project()->options().addCharset;
mExecCharset = pMainWindow->project()->options().execEncoding;
pMainWindow->project()->saveOptions(); pMainWindow->project()->saveOptions();
} }
@ -169,6 +174,10 @@ void ProjectCompilerWidget::on_cbCompilerSet_currentIndexChanged(int index)
return; return;
} }
mOptions = pSet->compileOptions(); mOptions = pSet->compileOptions();
mStaticLink = pSet->staticLink();
mAddCharset = pSet->autoAddCharsetParams();
mExecCharset = pSet->execCharset().toUtf8();
setSettingsChanged(); setSettingsChanged();
//project->saveOptions(); //project->saveOptions();
} }

View File

@ -37,6 +37,9 @@ private:
private: private:
Ui::ProjectCompilerWidget *ui; Ui::ProjectCompilerWidget *ui;
QMap<QString,QString> mOptions; QMap<QString,QString> mOptions;
bool mStaticLink;
bool mAddCharset;
QByteArray mExecCharset;
// SettingsWidget interface // SettingsWidget interface
protected: protected:

View File

@ -30,6 +30,7 @@
#define MAKE_PROGRAM "mingw32-make.exe" #define MAKE_PROGRAM "mingw32-make.exe"
#define WINDRES_PROGRAM "windres.exe" #define WINDRES_PROGRAM "windres.exe"
#define CLEAN_PROGRAM "del /q /f" #define CLEAN_PROGRAM "del /q /f"
#define CD_PROGRAM "cd /d"
#define CPP_PROGRAM "cpp.exe" #define CPP_PROGRAM "cpp.exe"
#define GIT_PROGRAM "git.exe" #define GIT_PROGRAM "git.exe"
#define CLANG_PROGRAM "clang.exe" #define CLANG_PROGRAM "clang.exe"
@ -50,6 +51,7 @@
#define WINDRES_PROGRAM "" #define WINDRES_PROGRAM ""
#define GPROF_PROGRAM "gprof" #define GPROF_PROGRAM "gprof"
#define CLEAN_PROGRAM "rm -rf" #define CLEAN_PROGRAM "rm -rf"
#define CD_PROGRAM "cd"
#define CPP_PROGRAM "cpp" #define CPP_PROGRAM "cpp"
#define GIT_PROGRAM "git" #define GIT_PROGRAM "git"
#define CLANG_PROGRAM "clang" #define CLANG_PROGRAM "clang"

View File

@ -1125,7 +1125,6 @@ void QSynEditPainter::paintLines()
if (mIsCurrentLine && mEdit->mInputPreeditString.length()>0) { if (mIsCurrentLine && mEdit->mInputPreeditString.length()>0) {
int startPos = mEdit->mSyntaxer->getTokenPos()+1; int startPos = mEdit->mSyntaxer->getTokenPos()+1;
int endPos = mEdit->mSyntaxer->getTokenPos() + sToken.length(); int endPos = mEdit->mSyntaxer->getTokenPos() + sToken.length();
//qDebug()<<startPos<<":"<<endPos<<" - "+sToken+" - "<<edit->mCaretX<<":"<<edit->mCaretX+edit->mInputPreeditString.length();
if (!(endPos < mEdit->mCaretX if (!(endPos < mEdit->mCaretX
|| startPos >= mEdit->mCaretX+mEdit->mInputPreeditString.length())) { || startPos >= mEdit->mCaretX+mEdit->mInputPreeditString.length())) {
if (!preeditAttr) { if (!preeditAttr) {
@ -1200,7 +1199,7 @@ void QSynEditPainter::paintLines()
glyphStartCharList, glyphStartCharList,
oldLen, oldLen,
sLine.length(), sLine.length(),
calculateGlyphPositions, true,
glyphStartPositionsList, glyphStartPositionsList,
tokenWidth); tokenWidth);
tokenLeft += tokenWidth; tokenLeft += tokenWidth;

View File

@ -5380,11 +5380,6 @@ int QSynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList
sLeftSide += QString(pos.ch - 1 - sLeftSide.length(),' '); sLeftSide += QString(pos.ch - 1 - sLeftSide.length(),' ');
} }
sRightSide = line.mid(pos.ch - 1); sRightSide = line.mid(pos.ch - 1);
// if (mUndoing) {
// SpaceCount = 0;
// } else {
// SpaceCount = leftSpaces(sLeftSide);
// }
int caretY=pos.line; int caretY=pos.line;
// step1: insert the first line of Value into current line // step1: insert the first line of Value into current line
if (text.length()>1) { if (text.length()>1) {
@ -5406,14 +5401,7 @@ int QSynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList
// step2: insert remaining lines of Value // step2: insert remaining lines of Value
for (int i=1;i<text.length();i++) { for (int i=1;i<text.length();i++) {
bool notInComment = true; bool notInComment = true;
// if (mHighlighter) {
// notInComment = !mHighlighter->isCommentNotFinished(
// mHighlighter->getRangeState().state)
// && !mHighlighter->isStringNotFinished(
// mHighlighter->getRangeState().state);
// }
caretY=pos.line+i; caretY=pos.line+i;
// mStatusChanges.setFlag(SynStatusChange::scCaretY);
if (text[i].isEmpty()) { if (text[i].isEmpty()) {
if (i==text.length()-1) { if (i==text.length()-1) {
str = sRightSide; str = sRightSide;

View File

@ -449,30 +449,26 @@ public:
void setBackgroundColor(const QColor &newBackgroundColor); void setBackgroundColor(const QColor &newBackgroundColor);
bool isEmpty(); bool isEmpty();
int mouseSelectionScrollSpeed() const;
void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed);
ScrollStyle scrollBars() const;
void setScrollBars(ScrollStyle newScrollBars);
double lineSpacingFactor() const;
void setLineSpacingFactor(double newLineSpacingFactor);
const QDateTime &lastModifyTime() const;
const PFormatter &formatter() const;
void setFormatter(const PFormatter &newFormatter);
signals: signals:
void linesDeleted(int FirstLine, int Count); void linesDeleted(int FirstLine, int Count);
void linesInserted(int FirstLine, int Count); void linesInserted(int FirstLine, int Count);
void changed(); void changed();
// void chainUndoAdded();
// void chainRedoAdded();
// void chainLinesChanging();
// void chainLinesChanged();
// void chainListCleared();
// void chainListDeleted(int Index, int Count);
// void chainListInserted(int Index, int Count);
// void chainListPutted(int Index, int Count);
// void filesDropped(int X,int Y, const QStringList& AFiles);
void gutterClicked(Qt::MouseButton button, int x, int y, int line); void gutterClicked(Qt::MouseButton button, int x, int y, int line);
// void imeInputed(const QString& s);
// void contextHelp(const QString& word);
void statusChanged(StatusChanges changes); void statusChanged(StatusChanges changes);
void fontChanged(); void fontChanged();
void tabSizeChanged(); void tabSizeChanged();
protected: protected:
@ -727,11 +723,6 @@ private:
StatusChanges mStatusChanges; StatusChanges mStatusChanges;
int mLastKey; int mLastKey;
Qt::KeyboardModifiers mLastKeyModifiers; Qt::KeyboardModifiers mLastKeyModifiers;
//fSearchEngine: TSynEditSearchCustom;
//fHookedCommandHandlers: TList;
//fKbdHandler: TSynEditKbdHandler;
// fFocusList: TList;
// fPlugins: TList;
QTimer* mScrollTimer; QTimer* mScrollTimer;
PSynEdit fChainedEditor; PSynEdit fChainedEditor;
@ -740,20 +731,7 @@ private:
bool mIsScrolling; bool mIsScrolling;
int mOptionLock; // lock counter to prevent recalculate glyph widths while change settings; int mOptionLock; // lock counter to prevent recalculate glyph widths while change settings;
bool mUndoing; bool mUndoing;
// event handlers
// ProcessCommandProc mOnCommandProcessed;
// MouseCursorProc mOnMouseCursor;
// PaintProc mOnPaint;
// SynPreparePaintHighlightTokenProc mOnPaintHighlightToken;
// ProcessCommandProc mOnProcessingCommand;
// ProcessCommandProc mOnProcessingUserCommand;
// SynSpecialLineColorsProc mOnSpecialLineColors;
// SynEditingAreasProc mOnEditingAreas;
// SynGutterGetTextProc mOnGutterGetText;
// SynTGutterPaintProc mOnGutterPaint;
int mGutterWidth; int mGutterWidth;
//caret blink related //caret blink related
int m_blinkTimerId; int m_blinkTimerId;
int m_blinkStatus; int m_blinkStatus;
@ -802,20 +780,6 @@ protected:
public: public:
QVariant inputMethodQuery(Qt::InputMethodQuery property) const override; QVariant inputMethodQuery(Qt::InputMethodQuery property) const override;
int mouseSelectionScrollSpeed() const;
void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed);
ScrollStyle scrollBars() const;
void setScrollBars(ScrollStyle newScrollBars);
double lineSpacingFactor() const;
void setLineSpacingFactor(double newLineSpacingFactor);
const QDateTime &lastModifyTime() const;
const PFormatter &formatter() const;
void setFormatter(const PFormatter &newFormatter);
protected: protected:
void dragEnterEvent(QDragEnterEvent *event) override; void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override; void dropEvent(QDropEvent *event) override;

View File

@ -7,7 +7,7 @@ arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64' 'riscv64')
url="https://github.com/royqh1979/$_pkgname" url="https://github.com/royqh1979/$_pkgname"
license=('GPL3') license=('GPL3')
depends=(qt5-base qt5-svg gcc gdb) depends=(qt5-base qt5-svg gcc gdb)
makedepends=(qt5-tools) makedepends=(qt5-tools imagemagick librsvg)
optdepends=( optdepends=(
'clang: C/C++ compiler (alternative)' 'clang: C/C++ compiler (alternative)'
) )
@ -42,4 +42,13 @@ package() {
cd redpanda-build cd redpanda-build
make INSTALL_ROOT="$pkgdir" install make INSTALL_ROOT="$pkgdir" install
for size in 16 22 24 32 36 48 64 72 96 128 192 256 512; do
mkdir -p "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps"
magick convert \
-background none \
"$pkgdir/usr/share/icons/hicolor/scalable/apps/redpandaide.svg" \
-resize ${size}x${size} \
"$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/redpandaide.png"
done
} }

View File

@ -12,9 +12,11 @@ cd $DEBIAN_DIR
pwd pwd
oldver=`head changelog -n 1 | sed -r 's/^redpanda-cpp\s\((.*)-(.*)\)\s.*$/\1/g'` oldver=`head changelog -n 1 | sed -r 's/^redpanda-cpp\s\((.*)-(.*)\)\s.*$/\1/g'`
count=`head changelog -n 1 | sed -r 's/^redpanda-cpp\s\((.*)-(.*)\)\s.*$/\2/g'` count=`head changelog -n 1 | sed -r 's/^redpanda-cpp\s\((.*)-(.*)\)\s.*$/\2/g'`
echo $oldver echo "Old version: $oldver"
if [ "$oldver" != "$ver" ]; then if [ "$oldver" != "$ver" ]; then
echo "Upgrade to $ver"
tmpfile=$(mktemp) tmpfile=$(mktemp)
now=`date -R` now=`date -R`
echo "redpanda-cpp ($ver-1) unstable; urgency=medium" >> $tmpfile echo "redpanda-cpp ($ver-1) unstable; urgency=medium" >> $tmpfile

View File

@ -131,8 +131,8 @@ Section "$(SectionMainName)" SectionMain
!endif !endif
; Write required paths ; Write required paths
SetOutPath $INSTDIR\Templates SetOutPath $INSTDIR\templates
File /nonfatal /r "Templates\*" File /nonfatal /r "templates\*"
SectionEnd SectionEnd
@ -440,8 +440,7 @@ Section "Uninstall"
Delete "$INSTDIR\OpenConsole.exe" Delete "$INSTDIR\OpenConsole.exe"
Delete "$INSTDIR\compiler_hint.lua" Delete "$INSTDIR\compiler_hint.lua"
RMDir /r "$INSTDIR\Lang" RMDir /r "$INSTDIR\templates"
RMDir /r "$INSTDIR\Templates"
RMDir /r "$INSTDIR\mingw32" RMDir /r "$INSTDIR\mingw32"
RMDir /r "$INSTDIR\mingw64" RMDir /r "$INSTDIR\mingw64"
RMDir /r "$INSTDIR\llvm-mingw" RMDir /r "$INSTDIR\llvm-mingw"