From 44f1134875047456f0748b81eea85f7d9cd673af Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 4 May 2022 18:42:36 -0500 Subject: [PATCH] GUI: fix more issues - macro range is now 128 (it was 127 before) - fix #407 --- src/gui/gui.cpp | 14 ++++++++++++-- src/gui/insEdit.cpp | 18 +++++++++--------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index c94c8348a..f89e120f1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1750,8 +1750,11 @@ void FurnaceGUI::processDrags(int dragX, int dragY) { if (macroLoopDragLen>0) { int x=(dragX-macroLoopDragStart.x)*macroLoopDragLen/MAX(1,macroLoopDragAreaSize.x); if (x<0) x=0; - if (x>=macroLoopDragLen) x=-1; - x+=macroDragScroll; + if (x>=macroLoopDragLen) { + x=-1; + } else { + x+=macroDragScroll; + } *macroLoopDragTarget=x; } } @@ -2416,6 +2419,13 @@ bool FurnaceGUI::loop() { } wantCaptureKeyboard=ImGui::GetIO().WantTextInput; + + if (wantCaptureKeyboard) { + WAKE_UP; + } + if (ImGui::GetIO().MouseDown[0] || ImGui::GetIO().MouseDown[1] || ImGui::GetIO().MouseDown[2] || ImGui::GetIO().MouseDown[3] || ImGui::GetIO().MouseDown[4]) { + WAKE_UP; + } while (true) { midiLock.lock(); diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 0355e7fe7..8d3ea74a7 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1078,7 +1078,7 @@ void FurnaceGUI::drawGBEnv(unsigned char vol, unsigned char len, unsigned char s if (displayLoop) { \ ImGui::SetNextItemWidth(lenAvail); \ if (ImGui::InputScalar("##IMacroLen_" macroName,ImGuiDataType_U8,¯o.len,&_ONE,&_THREE)) { MARK_MODIFIED \ - if (macro.len>127) macro.len=127; \ + if (macro.len>128) macro.len=128; \ } \ if (macroMode) { \ bool modeVal=macro.mode; \ @@ -1178,7 +1178,7 @@ void FurnaceGUI::drawGBEnv(unsigned char vol, unsigned char len, unsigned char s if (displayLoop) { \ ImGui::SetNextItemWidth(lenAvail); \ if (ImGui::InputScalar("##IOPMacroLen_" #op macroName,ImGuiDataType_U8,¯o.len,&_ONE,&_THREE)) { MARK_MODIFIED \ - if (macro.len>127) macro.len=127; \ + if (macro.len>128) macro.len=128; \ } \ if (macroMode) { \ bool modeVal=macro.mode; \ @@ -1267,14 +1267,14 @@ if (ImGui::BeginTable("MacroSpace",2)) { \ ImGui::Dummy(ImVec2(120.0f*dpiScale,dpiScale)); \ ImGui::TableNextColumn(); \ float availableWidth=ImGui::GetContentRegionAvail().x-reservedSpace; \ - int totalFit=MIN(127,availableWidth/MAX(1,macroPointSize*dpiScale)); \ - if (macroDragScroll>127-totalFit) { \ - macroDragScroll=127-totalFit; \ + int totalFit=MIN(128,availableWidth/MAX(1,macroPointSize*dpiScale)); \ + if (macroDragScroll>128-totalFit) { \ + macroDragScroll=128-totalFit; \ } \ ImGui::SetNextItemWidth(availableWidth); \ - if (CWSliderInt("##MacroScroll",¯oDragScroll,0,127-totalFit,"")) { \ + if (CWSliderInt("##MacroScroll",¯oDragScroll,0,128-totalFit,"")) { \ if (macroDragScroll<0) macroDragScroll=0; \ - if (macroDragScroll>127-totalFit) macroDragScroll=127-totalFit; \ + if (macroDragScroll>128-totalFit) macroDragScroll=128-totalFit; \ } #define MACRO_END \ @@ -1282,9 +1282,9 @@ if (ImGui::BeginTable("MacroSpace",2)) { \ ImGui::TableNextColumn(); \ ImGui::TableNextColumn(); \ ImGui::SetNextItemWidth(availableWidth); \ - if (CWSliderInt("##MacroScroll",¯oDragScroll,0,127-totalFit,"")) { \ + if (CWSliderInt("##MacroScroll",¯oDragScroll,0,128-totalFit,"")) { \ if (macroDragScroll<0) macroDragScroll=0; \ - if (macroDragScroll>127-totalFit) macroDragScroll=127-totalFit; \ + if (macroDragScroll>128-totalFit) macroDragScroll=128-totalFit; \ } \ ImGui::EndTable(); \ }