From 96aa83604035476521e12e296fc5e98a7f21df67 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 18 Feb 2023 12:54:28 +0800 Subject: [PATCH] - enhancement: Auto create project custom executable folder if not existing. --- NEWS.md | 3 +-- RedPandaIDE/compiler/projectcompiler.cpp | 6 +++-- RedPandaIDE/editor.cpp | 3 +++ libs/qsynedit/qsynedit/qsynedit.cpp | 30 ++++++++++++++---------- libs/qsynedit/qsynedit/qsynedit.h | 4 ++-- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/NEWS.md b/NEWS.md index 41a85348..db7c7e6f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -41,8 +41,7 @@ Red Panda C++ Version 2.12 - enhancement: If executable doesn't have symbol table, inform user and stop. - enhancement: If breakpoint is setted but executable doesn't have debug info ,inform user and stop. - enhancement: If current compiler set has "strip addition infos(-s)" enabled, inform user and stop. - - + - enhancement: Auto create project custom executable folder if not existing. Red Panda C++ Version 2.11 diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index fdf934f4..f3261465 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -35,7 +35,6 @@ void ProjectCompiler::buildMakeFile() //we are using custom make file, don't overwrite it if (mProject->options().useCustomMakefile && !mProject->options().customMakefile.isEmpty()) return; - switch(mProject->options().type) { case ProjectType::StaticLib: createStaticMakeFile(); @@ -95,7 +94,10 @@ void ProjectCompiler::newMakeFile(QFile& file) if (!mProject->options().objectOutput.isEmpty()) { QDir(mProject->directory()).mkpath(mProject->options().objectOutput); } - + // Create executable output directory + if (!mProject->options().exeOutput.isEmpty()) { + QDir(mProject->directory()).mkpath(mProject->options().exeOutput); + } // Write more information to the log file than before log(tr("Building makefile...")); log("--------"); diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 3f2e7b27..d7dacc2e 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -623,6 +623,9 @@ void Editor::wheelEvent(QWheelEvent *event) { if ( (event->modifiers() & Qt::ControlModifier)!=0) { int size = pSettings->editor().fontSize(); int oldSize = size; + if ( (mWheelAccumulatedDelta>0 &&event->angleDelta().y()<0) + || (mWheelAccumulatedDelta<0 &&event->angleDelta().y()>0)) + mWheelAccumulatedDelta=0; mWheelAccumulatedDelta+=event->angleDelta().y(); while (mWheelAccumulatedDelta>=120) { mWheelAccumulatedDelta-=120; diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index f8b1203f..7722a790 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -45,8 +45,8 @@ namespace QSynedit { QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent), mEditingCount{0}, mDropped{false}, - mWheelAccumlatedDeltaX{0}, - mWheelAccumlatedDeltaY{0} + mWheelAccumulatedDeltaX{0}, + mWheelAccumulatedDeltaY{0} { mCharWidth=1; mTextHeight = 1; @@ -6346,23 +6346,29 @@ void QSynEdit::leaveEvent(QEvent *) void QSynEdit::wheelEvent(QWheelEvent *event) { if (event->modifiers() == Qt::ShiftModifier) { - mWheelAccumlatedDeltaX+=event->angleDelta().y(); - while (mWheelAccumlatedDeltaX>=120) { - mWheelAccumlatedDeltaX-=120; + if ( (mWheelAccumulatedDeltaX>0 &&event->angleDelta().y()<0) + || (mWheelAccumulatedDeltaX<0 &&event->angleDelta().y()>0)) + mWheelAccumulatedDeltaX=0; + mWheelAccumulatedDeltaX+=event->angleDelta().y(); + while (mWheelAccumulatedDeltaX>=120) { + mWheelAccumulatedDeltaX-=120; horizontalScrollBar()->setValue(horizontalScrollBar()->value()-mMouseWheelScrollSpeed); } - while (mWheelAccumlatedDeltaX<=-120) { - mWheelAccumlatedDeltaX+=120; + while (mWheelAccumulatedDeltaX<=-120) { + mWheelAccumulatedDeltaX+=120; horizontalScrollBar()->setValue(horizontalScrollBar()->value()+mMouseWheelScrollSpeed); } } else { - mWheelAccumlatedDeltaY+=event->angleDelta().y(); - while (mWheelAccumlatedDeltaY>=120) { - mWheelAccumlatedDeltaY-=120; + if ( (mWheelAccumulatedDeltaY>0 &&event->angleDelta().y()<0) + || (mWheelAccumulatedDeltaY<0 &&event->angleDelta().y()>0)) + mWheelAccumulatedDeltaY=0; + mWheelAccumulatedDeltaY+=event->angleDelta().y(); + while (mWheelAccumulatedDeltaY>=120) { + mWheelAccumulatedDeltaY-=120; verticalScrollBar()->setValue(verticalScrollBar()->value()-mMouseWheelScrollSpeed); } - while (mWheelAccumlatedDeltaY<=-120) { - mWheelAccumlatedDeltaY+=120; + while (mWheelAccumulatedDeltaY<=-120) { + mWheelAccumulatedDeltaY+=120; verticalScrollBar()->setValue(verticalScrollBar()->value()+mMouseWheelScrollSpeed); } } diff --git a/libs/qsynedit/qsynedit/qsynedit.h b/libs/qsynedit/qsynedit/qsynedit.h index 20b079a7..94c2fc42 100644 --- a/libs/qsynedit/qsynedit/qsynedit.h +++ b/libs/qsynedit/qsynedit/qsynedit.h @@ -744,8 +744,8 @@ private: BufferCoord mDragSelBeginSave; BufferCoord mDragSelEndSave; bool mDropped; - int mWheelAccumlatedDeltaX; - int mWheelAccumlatedDeltaY; + int mWheelAccumulatedDeltaX; + int mWheelAccumulatedDeltaY; friend class QSynEditPainter;