- fix: restore caret position after reformat code
- enhancement: ask user to rebuild project, when run/debug the project and it has been modified - fix: correct set the enabled state of "delete line"/"insert line"/"delete word"/"delete to BOL"/"delete to EOL" menu items
This commit is contained in:
parent
dda0f82b4d
commit
cd1e20c2d7
3
NEWS.md
3
NEWS.md
|
@ -1,6 +1,9 @@
|
||||||
Version 0.9.3 For Dev-C++ 7 Beta
|
Version 0.9.3 For Dev-C++ 7 Beta
|
||||||
- fix: the count in the title of issues view isn't correct
|
- fix: the count in the title of issues view isn't correct
|
||||||
- fix: columns calculation not correct when paint lines containing chinese characters
|
- fix: columns calculation not correct when paint lines containing chinese characters
|
||||||
|
- fix: restore caret position after reformat code
|
||||||
|
- enhancement: ask user to rebuild project, when run/debug the project and it has been modified
|
||||||
|
- fix: correct set the enabled state of "delete line"/"insert line"/"delete word"/"delete to BOL"/"delete to EOL" menu items
|
||||||
|
|
||||||
Version 0.9.2 For Dev-C++ 7 Beta
|
Version 0.9.2 For Dev-C++ 7 Beta
|
||||||
- fix: gutter of the disassembly code control in the cpu info dialog is grayed
|
- fix: gutter of the disassembly code control in the cpu info dialog is grayed
|
||||||
|
|
|
@ -133,8 +133,8 @@ void CompilerManager::cleanProject(std::shared_ptr<Project> project)
|
||||||
mCompileIssueCount = 0;
|
mCompileIssueCount = 0;
|
||||||
ProjectCompiler* compiler = new ProjectCompiler(project,false,false);
|
ProjectCompiler* compiler = new ProjectCompiler(project,false,false);
|
||||||
compiler->setOnlyClean(true);
|
compiler->setOnlyClean(true);
|
||||||
mCompiler->setRebuild(false);
|
|
||||||
mCompiler = compiler;
|
mCompiler = compiler;
|
||||||
|
mCompiler->setRebuild(false);
|
||||||
connect(mCompiler, &Compiler::finished, mCompiler, &QObject::deleteLater);
|
connect(mCompiler, &Compiler::finished, mCompiler, &QObject::deleteLater);
|
||||||
connect(mCompiler, &Compiler::compileFinished, this, &CompilerManager::onCompileFinished);
|
connect(mCompiler, &Compiler::compileFinished, this, &CompilerManager::onCompileFinished);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
ProjectCompiler::ProjectCompiler(std::shared_ptr<Project> project, bool silent, bool onlyCheckSyntax):
|
ProjectCompiler::ProjectCompiler(std::shared_ptr<Project> project, bool silent, bool onlyCheckSyntax):
|
||||||
Compiler("",silent,onlyCheckSyntax)
|
Compiler("",silent,onlyCheckSyntax),
|
||||||
|
mOnlyClean(false)
|
||||||
{
|
{
|
||||||
setProject(project);
|
setProject(project);
|
||||||
}
|
}
|
||||||
|
@ -264,9 +265,9 @@ void ProjectCompiler::writeMakeClean(QFile &file)
|
||||||
{
|
{
|
||||||
writeln(file, "clean: clean-custom");
|
writeln(file, "clean: clean-custom");
|
||||||
if (mProject->options().type == ProjectType::DynamicLib)
|
if (mProject->options().type == ProjectType::DynamicLib)
|
||||||
writeln(file, "\t${RM} $(CLEANOBJ) $(BIN) $(DEF) $(STATIC)");
|
writeln(file, "\t${RM} $(CLEANOBJ) $(BIN) $(DEF) $(STATIC) > NUL 2>&1");
|
||||||
else
|
else
|
||||||
writeln(file, "\t${RM} $(CLEANOBJ) $(BIN)");
|
writeln(file, "\t${RM} $(CLEANOBJ) $(BIN) > NUL 2>&1");
|
||||||
writeln(file);
|
writeln(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +466,7 @@ bool ProjectCompiler::prepareForCompile()
|
||||||
mArguments = QString("-f \"%1\" clean").arg(extractRelativePath(
|
mArguments = QString("-f \"%1\" clean").arg(extractRelativePath(
|
||||||
mProject->directory(),
|
mProject->directory(),
|
||||||
mProject->makeFileName()));
|
mProject->makeFileName()));
|
||||||
} if (mRebuild) {
|
} else if (mRebuild) {
|
||||||
mArguments = QString("-f \"%1\" clean all").arg(extractRelativePath(
|
mArguments = QString("-f \"%1\" clean all").arg(extractRelativePath(
|
||||||
mProject->directory(),
|
mProject->directory(),
|
||||||
mProject->makeFileName()));
|
mProject->makeFileName()));
|
||||||
|
|
|
@ -3568,6 +3568,8 @@ void Editor::reformat()
|
||||||
pSettings->dirs().app(),
|
pSettings->dirs().app(),
|
||||||
args,
|
args,
|
||||||
content);
|
content);
|
||||||
|
int oldTopLine = topLine();
|
||||||
|
BufferCoord mOldCaret = caretXY();
|
||||||
|
|
||||||
selectAll();
|
selectAll();
|
||||||
SynEditorOptions oldOptions = getOptions();
|
SynEditorOptions oldOptions = getOptions();
|
||||||
|
@ -3575,6 +3577,8 @@ void Editor::reformat()
|
||||||
newOptions.setFlag(SynEditorOption::eoAutoIndent,false);
|
newOptions.setFlag(SynEditorOption::eoAutoIndent,false);
|
||||||
setOptions(newOptions);
|
setOptions(newOptions);
|
||||||
setSelText(QString::fromUtf8(newContent));
|
setSelText(QString::fromUtf8(newContent));
|
||||||
|
setCaretXY(mOldCaret);
|
||||||
|
setTopLine(oldTopLine);
|
||||||
setOptions(oldOptions);
|
setOptions(oldOptions);
|
||||||
reparse();
|
reparse();
|
||||||
checkSyntaxInBack();
|
checkSyntaxInBack();
|
||||||
|
|
|
@ -339,6 +339,12 @@ void MainWindow::updateEditorActions()
|
||||||
ui->actionUnIndent->setEnabled(false);
|
ui->actionUnIndent->setEnabled(false);
|
||||||
ui->actionUndo->setEnabled(false);
|
ui->actionUndo->setEnabled(false);
|
||||||
ui->actionUnfoldAll->setEnabled(false);
|
ui->actionUnfoldAll->setEnabled(false);
|
||||||
|
ui->actionDelete_Line->setEnabled(false);
|
||||||
|
ui->actionDelete_Word->setEnabled(false);
|
||||||
|
ui->actionDuplicate_Line->setEnabled(false);
|
||||||
|
ui->actionDelete_to_BOL->setEnabled(false);
|
||||||
|
ui->actionDelete_to_EOL->setEnabled(false);
|
||||||
|
|
||||||
ui->actionFind->setEnabled(false);
|
ui->actionFind->setEnabled(false);
|
||||||
ui->actionReplace->setEnabled(false);
|
ui->actionReplace->setEnabled(false);
|
||||||
ui->actionFind_Next->setEnabled(false);
|
ui->actionFind_Next->setEnabled(false);
|
||||||
|
@ -379,6 +385,11 @@ void MainWindow::updateEditorActions()
|
||||||
ui->actionToggleComment->setEnabled(!e->readOnly() && e->lines()->count()>0);
|
ui->actionToggleComment->setEnabled(!e->readOnly() && e->lines()->count()>0);
|
||||||
ui->actionUnIndent->setEnabled(!e->readOnly() && e->lines()->count()>0);
|
ui->actionUnIndent->setEnabled(!e->readOnly() && e->lines()->count()>0);
|
||||||
ui->actionUnfoldAll->setEnabled(e->lines()->count()>0);
|
ui->actionUnfoldAll->setEnabled(e->lines()->count()>0);
|
||||||
|
ui->actionDelete_Line->setEnabled(!e->readOnly() && e->lines()->count()>0);
|
||||||
|
ui->actionDelete_Word->setEnabled(!e->readOnly() && e->lines()->count()>0);
|
||||||
|
ui->actionDuplicate_Line->setEnabled(!e->readOnly() && e->lines()->count()>0);
|
||||||
|
ui->actionDelete_to_BOL->setEnabled(!e->readOnly() && e->lines()->count()>0);
|
||||||
|
ui->actionDelete_to_EOL->setEnabled(!e->readOnly() && e->lines()->count()>0);
|
||||||
|
|
||||||
ui->actionFind->setEnabled(true);
|
ui->actionFind->setEnabled(true);
|
||||||
ui->actionReplace->setEnabled(true);
|
ui->actionReplace->setEnabled(true);
|
||||||
|
@ -1079,30 +1090,14 @@ void MainWindow::checkSyntaxInBack(Editor *e)
|
||||||
mCompilerManager->checkSyntax(e->filename(),e->text(),
|
mCompilerManager->checkSyntax(e->filename(),e->text(),
|
||||||
e->fileEncoding() == ENCODING_ASCII, nullptr);
|
e->fileEncoding() == ENCODING_ASCII, nullptr);
|
||||||
}
|
}
|
||||||
// if not PrepareForCompile(cttStdin,True) then begin
|
|
||||||
// fCheckSyntaxInBack:=False;
|
|
||||||
// Exit;
|
|
||||||
// end;
|
|
||||||
// if e.InProject then begin
|
|
||||||
// if not assigned(MainForm.fProject) then
|
|
||||||
// Exit;
|
|
||||||
// fSyntaxChecker.Project := MainForm.fProject;
|
|
||||||
// end;
|
|
||||||
// fSyntaxChecker.CheckSyntax(True);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::compile(bool rebuild)
|
bool MainWindow::compile(bool rebuild)
|
||||||
{
|
{
|
||||||
CompileTarget target =getCompileTarget();
|
CompileTarget target =getCompileTarget();
|
||||||
if (target == CompileTarget::Project) {
|
if (target == CompileTarget::Project) {
|
||||||
if (!mProject->saveUnits())
|
if (mProject->modified())
|
||||||
return false;
|
mProject->saveAll();
|
||||||
// Check if saves have been succesful
|
|
||||||
for (int i=0; i<mEditorList->pageCount();i++) {
|
|
||||||
Editor * e= (*(mEditorList))[i];
|
|
||||||
if (e->inProject() && e->modified())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
clearIssues();
|
clearIssues();
|
||||||
|
|
||||||
// Increment build number automagically
|
// Increment build number automagically
|
||||||
|
@ -1209,6 +1204,18 @@ void MainWindow::runExecutable(RunType runType)
|
||||||
{
|
{
|
||||||
CompileTarget target =getCompileTarget();
|
CompileTarget target =getCompileTarget();
|
||||||
if (target == CompileTarget::Project) {
|
if (target == CompileTarget::Project) {
|
||||||
|
if (mProject->modified() &&
|
||||||
|
QMessageBox::question(
|
||||||
|
this,
|
||||||
|
tr("Rebuild Project"),
|
||||||
|
tr("Project has been modified, do you want to rebuild it?")
|
||||||
|
) == QMessageBox::Yes) {
|
||||||
|
mProject->saveAll();
|
||||||
|
mCompileSuccessionTask=std::make_shared<CompileSuccessionTask>();
|
||||||
|
mCompileSuccessionTask->type = CompileSuccessionTaskType::RunNormal;
|
||||||
|
compile();
|
||||||
|
return;
|
||||||
|
}
|
||||||
runExecutable(mProject->executable(),mProject->filename(),runType);
|
runExecutable(mProject->executable(),mProject->filename(),runType);
|
||||||
} else {
|
} else {
|
||||||
Editor * editor = mEditorList->getEditor();
|
Editor * editor = mEditorList->getEditor();
|
||||||
|
@ -1277,6 +1284,17 @@ void MainWindow::debug()
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (mProject->modified() &&
|
||||||
|
QMessageBox::question(
|
||||||
|
this,
|
||||||
|
tr("Compile Project"),
|
||||||
|
tr("Project has been modified, do you want to rebuild it?")
|
||||||
|
) == QMessageBox::Yes) {
|
||||||
|
mCompileSuccessionTask=std::make_shared<CompileSuccessionTask>();
|
||||||
|
mCompileSuccessionTask->type = CompileSuccessionTaskType::Debug;
|
||||||
|
compile();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Did we choose a host application for our DLL?
|
// Did we choose a host application for our DLL?
|
||||||
if (mProject->options().type == ProjectType::DynamicLib) {
|
if (mProject->options().type == ProjectType::DynamicLib) {
|
||||||
if (mProject->options().hostApplication.isEmpty()) {
|
if (mProject->options().hostApplication.isEmpty()) {
|
||||||
|
|
|
@ -2613,16 +2613,25 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete Line</string>
|
<string>Delete Line</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+D</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDuplicate_Line">
|
<action name="actionDuplicate_Line">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Duplicate Line</string>
|
<string>Duplicate Line</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+E</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDelete_Word">
|
<action name="actionDelete_Word">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete Word</string>
|
<string>Delete Word</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Shift+D</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDelete_to_EOL">
|
<action name="actionDelete_to_EOL">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
Loading…
Reference in New Issue