From 8e6ba922afbd742597f53bcbfcfd57e4c7d36c70 Mon Sep 17 00:00:00 2001 From: Person Date: Fri, 17 Jan 2020 18:58:51 -0800 Subject: [PATCH] =?UTF-8?q?--User=20changes=20=C2=A0-Duplicate=20xform=20w?= =?UTF-8?q?ill=20now=20only=20add=20the=20new=20xforms=20with=20xaos=20pre?= =?UTF-8?q?served=20if=20xaos=20is=20already=20being=20used=20in=20the=20f?= =?UTF-8?q?lame.=20Otherwise,=20they'll=20just=20be=20added=20normally.=20?= =?UTF-8?q?=20-This=20is=20a=20hybrid=20of=20the=20original=20behavior=20a?= =?UTF-8?q?nd=20the=20new=20behavior=20added=20a=20year=20or=20so=20ago.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Fractorium/Fractorium.cpp | 32 +++++++++++++++++--------- Source/Fractorium/Fractorium.ui | 2 +- Source/Fractorium/FractoriumXforms.cpp | 10 ++++++-- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/Source/Fractorium/Fractorium.cpp b/Source/Fractorium/Fractorium.cpp index 05c9989..b62c954 100644 --- a/Source/Fractorium/Fractorium.cpp +++ b/Source/Fractorium/Fractorium.cpp @@ -378,12 +378,14 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e) { auto combo = ui.CurrentXformCombo; bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier); + int times = 3; + int ftimes = 2; if (ke->key() >= Qt::Key_F1 && ke->key() <= Qt::Key_F32) { fcount++; - if (fcount >= 3) + if (fcount >= ftimes) { int val = ke->key() - (int)Qt::Key_F1; @@ -459,7 +461,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e) { xfupcount++; - if (xfupcount >= 3) + if (xfupcount >= times) { xfupcount = 0; combo->setCurrentIndex((index + 1) % combo->count()); @@ -472,7 +474,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e) { xfdncount++; - if (xfdncount >= 3) + if (xfdncount >= times) { xfdncount = 0; @@ -489,7 +491,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e) { wcount++; - if (wcount >= 3) + if (wcount >= times) { wcount = 0; m_Controller->MoveXforms(0, vdist, pre); @@ -501,7 +503,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e) { scount++; - if (scount >= 3) + if (scount >= times) { scount = 0; m_Controller->MoveXforms(0, -vdist, pre); @@ -513,7 +515,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e) { acount++; - if (acount >= 3) + if (acount >= times) { acount = 0; m_Controller->MoveXforms(-hdist, 0, pre); @@ -525,7 +527,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e) { dcount++; - if (dcount >= 3) + if (dcount >= times) { dcount = 0; m_Controller->MoveXforms(hdist, 0, pre); @@ -537,41 +539,49 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e) { qcount++; - if (qcount >= 3) + if (qcount >= times) { qcount = 0; m_Controller->RotateXformsByAngle(-rot, pre); } + + return true; } else if (ke->key() == Qt::Key_E) { ecount++; - if (ecount >= 3) + if (ecount >= times) { ecount = 0; m_Controller->RotateXformsByAngle(rot, pre); } + + return true; } else if (ke->key() == Qt::Key_G) { gcount++; - if (gcount >= 3) + if (gcount >= times) { gcount = 0; m_Controller->ScaleXforms(1 - grow, pre); } + + return true; } else if (ke->key() == Qt::Key_H) { hcount++; - if (hcount >= 3) + if (hcount >= times) { hcount = 0; m_Controller->ScaleXforms(1 + grow, pre); } + + return true; } } } diff --git a/Source/Fractorium/Fractorium.ui b/Source/Fractorium/Fractorium.ui index 7b2dd55..90771ed 100644 --- a/Source/Fractorium/Fractorium.ui +++ b/Source/Fractorium/Fractorium.ui @@ -3194,7 +3194,7 @@ - Duplicate selected xforms + <html><head/><body><p>Duplicate selected xforms.</p><p>If xaos is present in the flame, the new xforms will be added with existing xaos preserved, else they'll just be added normally.</p></body></html> diff --git a/Source/Fractorium/FractoriumXforms.cpp b/Source/Fractorium/FractoriumXforms.cpp index 5dc9a9c..38fb49b 100644 --- a/Source/Fractorium/FractoriumXforms.cpp +++ b/Source/Fractorium/FractoriumXforms.cpp @@ -208,6 +208,7 @@ void Fractorium::OnAddLinkedXformButtonClicked(bool checked) { m_Controller->Add /// /// Duplicate the specified xforms in the current ember, and set the last one as the current xform. +/// If xaos is present in the ember, the new xforms will be added with xaos preserved, else they'll just be added normally. /// Called when the duplicate xform button is clicked. /// Resets the rendering process. /// @@ -218,13 +219,18 @@ void FractoriumEmberController::DuplicateXform() bool forceFinal = m_Fractorium->HaveFinal(); vector> vec; vec.reserve(m_Ember.XformCount()); - UpdateXform([&] (Xform* xform, size_t xfindex, size_t selIndex) + UpdateXform([&](Xform* xform, size_t xfindex, size_t selIndex) { vec.push_back(*xform); }, eXformUpdate::UPDATE_SELECTED_EXCEPT_FINAL, false); Update([&]() { - AddXformsWithXaos(m_Ember, vec, true); + if (m_Ember.XaosPresent()) + AddXformsWithXaos(m_Ember, vec, true); + else + for (auto& it : vec) + m_Ember.AddXform(it); + int index = int(m_Ember.TotalXformCount(forceFinal) - (forceFinal ? 2 : 1));//Set index to the last item before final. FillXforms(index);//Handles xaos. });