From 164d766c7561dc0981a2136656a6d86881ee6c0a Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 30 Nov 2022 21:05:08 +0800 Subject: [PATCH] - enhancement: Disable "run" and "debug" actions when current project is static or dynamic library --- NEWS.md | 19 ++++++++++--------- RedPandaIDE/mainwindow.cpp | 36 +++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/NEWS.md b/NEWS.md index 9d8d815e..e55edbac 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,19 +1,20 @@ Red Panda C++ Version 2.5 - - enhancement: new color scheme Monokai (contributed by 小龙Dev(XiaoLoong@github)) - - enhancemnet: add "Reserve word for Types" item in color scheme - - enhancement: auto save / load problem set - - enhancement: project's custom compile include/lib/bin directory is under folder of the app, save them using the path relative to the app - - enhancement: slightly reduce memory usage + - enhancement: New color scheme Monokai (contributed by 小龙Dev(XiaoLoong@github)) + - enhancemnet: Add "Reserve word for Types" item in color scheme + - enhancement: Auto save / load problem set + - enhancement: Project's custom compile include/lib/bin directory is under folder of the app, save them using the path relative to the app + - enhancement: Slightly reduce memory usage - enhancement: Options -> editor -> custom C/C++ type keywords page - change: Default value of option "Editors share one code analyzer" is ON - change: Default value of option "Auto clear symbols in hidden editors" is OFF - - enhancement: show completion suggest for "namespace" after "using" + - enhancement: Show completion suggest for "namespace" after "using" - fix: MinGW-w64 gcc displayed as "MinGW GCC" - enhancement: Deduce type info for "auto" in some simple cases for stl containers. - - fix: crash when no semicolon or left brace after the keyword "namespace" - - fix: can't correctly show completion suggest for type with template parameters - - enhancement: show compltion suggest for std::pair::first and std::pair second + - fix: Crash when no semicolon or left brace after the keyword "namespace" + - fix: Can't correctly show completion suggest for type with template parameters + - enhancement: Show compltion suggest for std::pair::first and std::pair second + - enhancement: Disable "run" and "debug" actions when current project is static or dynamic library Red Panda C++ Version 2.4 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 14fbcdbe..49ee384b 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -645,17 +645,31 @@ void MainWindow::updateProjectActions() void MainWindow::updateCompileActions() { - bool hasProject = (mProject!=nullptr); - bool editorCanCompile = false; + bool forProject=false; + bool canCompile = false; + bool canRun = false; Editor * e = mEditorList->getEditor(); if (e) { - FileType fileType = getFileType(e->filename()); - if (fileType == FileType::CSource - || fileType == FileType::CppSource || e->isNew()) - editorCanCompile = true; + if (!e->inProject()) { + FileType fileType = getFileType(e->filename()); + if (fileType == FileType::CSource + || fileType == FileType::CppSource || e->isNew()) { + canCompile = true; + canRun = true; + } + } else { + forProject = (mProject!=nullptr); + } + } else { + forProject = (mProject!=nullptr); + } + if (forProject) { + canCompile = true; + canRun = (mProject->options().type !=ProjectType::DynamicLib) + && (mProject->options().type !=ProjectType::StaticLib); } if (mCompilerManager->compiling() || mCompilerManager->running() || mDebugger->executing() - || (!hasProject && !editorCanCompile) ) { + || (!canCompile)) { ui->actionCompile->setEnabled(false); ui->actionCompile_Run->setEnabled(false); ui->actionRun->setEnabled(false); @@ -664,11 +678,11 @@ void MainWindow::updateCompileActions() ui->btnRunAllProblemCases->setEnabled(false); } else { ui->actionCompile->setEnabled(true); - ui->actionCompile_Run->setEnabled(true); - ui->actionRun->setEnabled(true); + ui->actionCompile_Run->setEnabled(canRun); + ui->actionRun->setEnabled(canRun); ui->actionRebuild->setEnabled(true); - ui->actionDebug->setEnabled(true); - ui->btnRunAllProblemCases->setEnabled(true); + ui->actionDebug->setEnabled(canRun); + ui->btnRunAllProblemCases->setEnabled(canRun); } if (!mDebugger->executing()) { disableDebugActions();