GUI: selection/scroll improvements

now you can scroll left/right by dragging selection to the side edges
This commit is contained in:
tildearrow 2025-02-22 18:43:46 -05:00
parent f59cb23d9b
commit dd9983778b
4 changed files with 29 additions and 2 deletions

View file

@ -169,6 +169,7 @@ void FurnaceGUI::finishSelection() {
} }
selecting=false; selecting=false;
selectingFull=false; selectingFull=false;
mobilePatSel=false;
if (dragging) { if (dragging) {
if (dragSourceX==dragDestinationX && dragSourceY==dragDestinationY && dragSourceXFine==dragDestinationXFine) { if (dragSourceX==dragDestinationX && dragSourceY==dragDestinationY && dragSourceXFine==dragDestinationXFine) {

View file

@ -569,6 +569,12 @@ void FurnaceGUI::addScroll(int amount) {
haveHitBounds=false; haveHitBounds=false;
} }
void FurnaceGUI::addScrollX(int amount) {
float lineHeight=(patFont->FontSize+2*dpiScale);
nextAddScrollX=lineHeight*amount;
haveHitBounds=false;
}
void FurnaceGUI::setFileName(String name) { void FurnaceGUI::setFileName(String name) {
#ifdef _WIN32 #ifdef _WIN32
wchar_t ret[4096]; wchar_t ret[4096];
@ -3571,7 +3577,7 @@ void FurnaceGUI::pointUp(int x, int y, int button) {
} }
void FurnaceGUI::pointMotion(int x, int y, int xrel, int yrel) { void FurnaceGUI::pointMotion(int x, int y, int xrel, int yrel) {
if (selecting) { if (selecting && (!mobileUI || mobilePatSel)) {
// detect whether we have to scroll // detect whether we have to scroll
if (y<patWindowPos.y+2.0f*dpiScale) { if (y<patWindowPos.y+2.0f*dpiScale) {
addScroll(-1); addScroll(-1);
@ -3579,6 +3585,12 @@ void FurnaceGUI::pointMotion(int x, int y, int xrel, int yrel) {
if (y>patWindowPos.y+patWindowSize.y-2.0f*dpiScale) { if (y>patWindowPos.y+patWindowSize.y-2.0f*dpiScale) {
addScroll(1); addScroll(1);
} }
if (x<patWindowPos.x+(mobileUI?40.0f:4.0f)*dpiScale) {
addScrollX(-1);
}
if (x>patWindowPos.x+patWindowSize.x-(mobileUI?40.0f:4.0f)*dpiScale) {
addScrollX(1);
}
} }
if (macroDragActive || macroLoopDragActive || waveDragActive || sampleDragActive || orderScrollLocked) { if (macroDragActive || macroLoopDragActive || waveDragActive || sampleDragActive || orderScrollLocked) {
int distance=fabs((double)xrel); int distance=fabs((double)xrel);
@ -8546,6 +8558,7 @@ FurnaceGUI::FurnaceGUI():
dragMobileMenu(false), dragMobileMenu(false),
dragMobileEditButton(false), dragMobileEditButton(false),
wantGrooveListFocus(false), wantGrooveListFocus(false),
mobilePatSel(false),
lastAssetType(0), lastAssetType(0),
curWindow(GUI_WINDOW_NOTHING), curWindow(GUI_WINDOW_NOTHING),
nextWindow(GUI_WINDOW_NOTHING), nextWindow(GUI_WINDOW_NOTHING),

View file

@ -2366,6 +2366,7 @@ class FurnaceGUI {
bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI; bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
bool collapseWindow, demandScrollX, fancyPattern, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble; bool collapseWindow, demandScrollX, fancyPattern, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
bool keepLoopAlive, keepGrooveAlive, orderScrollLocked, orderScrollTolerance, dragMobileMenu, dragMobileEditButton, wantGrooveListFocus; bool keepLoopAlive, keepGrooveAlive, orderScrollLocked, orderScrollTolerance, dragMobileMenu, dragMobileEditButton, wantGrooveListFocus;
bool mobilePatSel;
unsigned char lastAssetType; unsigned char lastAssetType;
FurnaceGUIWindows curWindow, nextWindow, curWindowLast; FurnaceGUIWindows curWindow, nextWindow, curWindowLast;
std::atomic<FurnaceGUIWindows> curWindowThreadSafe; std::atomic<FurnaceGUIWindows> curWindowThreadSafe;
@ -2517,7 +2518,7 @@ class FurnaceGUI {
int bindSetTarget, bindSetTargetIdx, bindSetPrevValue; int bindSetTarget, bindSetTargetIdx, bindSetPrevValue;
bool bindSetActive, bindSetPending; bool bindSetActive, bindSetPending;
float nextScroll, nextAddScroll, orderScroll, orderScrollSlideOrigin; float nextScroll, nextAddScroll, nextAddScrollX, orderScroll, orderScrollSlideOrigin;
ImVec2 orderScrollRealOrigin; ImVec2 orderScrollRealOrigin;
ImVec2 dragMobileMenuOrigin; ImVec2 dragMobileMenuOrigin;
@ -3084,6 +3085,7 @@ class FurnaceGUI {
void enableSafeMode(); void enableSafeMode();
void updateScroll(int amount); void updateScroll(int amount);
void addScroll(int amount); void addScroll(int amount);
void addScrollX(int amount);
void setFileName(String name); void setFileName(String name);
void runBackupThread(); void runBackupThread();
void pushPartBlend(); void pushPartBlend();

View file

@ -154,6 +154,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
if (ImGui::IsItemActive() && CHECK_LONG_HOLD) { if (ImGui::IsItemActive() && CHECK_LONG_HOLD) {
ImGui::InhibitInertialScroll(); ImGui::InhibitInertialScroll();
NOTIFY_LONG_HOLD; NOTIFY_LONG_HOLD;
mobilePatSel=true;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
// for each column // for each column
@ -210,6 +211,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
if (ImGui::IsItemActive() && CHECK_LONG_HOLD) { if (ImGui::IsItemActive() && CHECK_LONG_HOLD) {
ImGui::InhibitInertialScroll(); ImGui::InhibitInertialScroll();
NOTIFY_LONG_HOLD; NOTIFY_LONG_HOLD;
mobilePatSel=true;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
@ -253,6 +255,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
if (ImGui::IsItemActive() && CHECK_LONG_HOLD) { if (ImGui::IsItemActive() && CHECK_LONG_HOLD) {
ImGui::InhibitInertialScroll(); ImGui::InhibitInertialScroll();
NOTIFY_LONG_HOLD; NOTIFY_LONG_HOLD;
mobilePatSel=true;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
@ -290,6 +293,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
if (ImGui::IsItemActive() && CHECK_LONG_HOLD) { if (ImGui::IsItemActive() && CHECK_LONG_HOLD) {
ImGui::InhibitInertialScroll(); ImGui::InhibitInertialScroll();
NOTIFY_LONG_HOLD; NOTIFY_LONG_HOLD;
mobilePatSel=true;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
@ -342,6 +346,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
if (ImGui::IsItemActive() && CHECK_LONG_HOLD) { if (ImGui::IsItemActive() && CHECK_LONG_HOLD) {
ImGui::InhibitInertialScroll(); ImGui::InhibitInertialScroll();
NOTIFY_LONG_HOLD; NOTIFY_LONG_HOLD;
mobilePatSel=true;
} }
// effect value // effect value
@ -371,6 +376,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
if (ImGui::IsItemActive() && CHECK_LONG_HOLD) { if (ImGui::IsItemActive() && CHECK_LONG_HOLD) {
ImGui::InhibitInertialScroll(); ImGui::InhibitInertialScroll();
NOTIFY_LONG_HOLD; NOTIFY_LONG_HOLD;
mobilePatSel=true;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
@ -465,6 +471,7 @@ void FurnaceGUI::drawPattern() {
ImGui::SetNextWindowScroll(ImVec2(-1.0f,nextScroll)); ImGui::SetNextWindowScroll(ImVec2(-1.0f,nextScroll));
nextScroll=-1.0f; nextScroll=-1.0f;
nextAddScroll=0.0f; nextAddScroll=0.0f;
nextAddScrollX=0.0f;
} }
ImDrawList* tdl=NULL; ImDrawList* tdl=NULL;
@ -480,6 +487,10 @@ void FurnaceGUI::drawPattern() {
nextScroll=-1.0f; nextScroll=-1.0f;
nextAddScroll=0.0f; nextAddScroll=0.0f;
} }
if (nextAddScrollX!=0.0f) {
ImGui::SetScrollX(ImGui::GetScrollX()+nextAddScrollX);
nextAddScrollX=0.0f;
}
ImGui::TableSetupScrollFreeze(1,1); ImGui::TableSetupScrollFreeze(1,1);
for (int i=0; i<chans; i++) { for (int i=0; i<chans; i++) {