From d6333af330c8db7db664cd390355da187e656148 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 13 Apr 2022 18:16:55 -0500 Subject: [PATCH] GUI: unreliable version of #63 --- src/gui/gui.cpp | 3 +++ src/gui/gui.h | 2 +- src/gui/pattern.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index fec3b6ed7..a63585e6b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -514,11 +514,13 @@ const char* FurnaceGUI::getSystemName(DivSystem which) { void FurnaceGUI::updateScroll(int amount) { float lineHeight=(patFont->FontSize+2*dpiScale); nextScroll=lineHeight*amount; + haveHitBounds=false; } void FurnaceGUI::addScroll(int amount) { float lineHeight=(patFont->FontSize+2*dpiScale); nextAddScroll=lineHeight*amount; + haveHitBounds=false; } void FurnaceGUI::setFileName(String name) { @@ -3618,6 +3620,7 @@ FurnaceGUI::FurnaceGUI(): scaleMax(100.0f), fadeMode(false), randomMode(false), + haveHitBounds(false), oldOrdersLen(0), sampleZoom(1.0), prevSampleZoom(1.0), diff --git a/src/gui/gui.h b/src/gui/gui.h index d9a15162d..c1a98c076 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1009,7 +1009,7 @@ class FurnaceGUI { int dummyRows, demandX; int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax; float scaleMax; - bool fadeMode, randomMode; + bool fadeMode, randomMode, haveHitBounds; int oldOrdersLen; DivOrders oldOrders; diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 166815145..fe471f15c 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -17,6 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #define _USE_MATH_DEFINES #include "gui.h" #include "../ta-log.h" @@ -652,6 +653,45 @@ void FurnaceGUI::drawPattern() { demandScrollX=false; } scrollX=ImGui::GetScrollX(); + + // overflow changes order + if (!e->isPlaying()) { + if (wheelY!=0) { + if (wheelY>0) { + if (ImGui::GetScrollY()<=0) { + logV("scroll %d",wheelY); + if (haveHitBounds) { + if (e->getOrder()>0) { + e->setOrder(e->getOrder()-1); + ImGui::SetScrollY(ImGui::GetScrollMaxY()); + updateScroll(e->song.patLen); + } + haveHitBounds=false; + } else { + haveHitBounds=true; + } + } else { + haveHitBounds=false; + } + } else { + if (ImGui::GetScrollY()>=ImGui::GetScrollMaxY()) { + logV("scroll %d",wheelY); + if (haveHitBounds) { + if (e->getOrder()song.ordersLen) { + e->setOrder(e->getOrder()+1); + ImGui::SetScrollY(0); + updateScroll(0); + } + haveHitBounds=false; + } else { + haveHitBounds=true; + } + } else { + haveHitBounds=false; + } + } + } + } ImGui::EndTable(); }