GUI: fix more issues

- macro range is now 128 (it was 127 before)
- fix #407
This commit is contained in:
tildearrow 2022-05-04 18:42:36 -05:00
parent 99b5afd4da
commit 44f1134875
2 changed files with 21 additions and 11 deletions

View file

@ -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;
if (x>=macroLoopDragLen) {
x=-1;
} else {
x+=macroDragScroll;
}
*macroLoopDragTarget=x;
}
}
@ -2417,6 +2420,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();
if (midiQueue.empty()) {

View file

@ -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,&macro.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,&macro.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",&macroDragScroll,0,127-totalFit,"")) { \
if (CWSliderInt("##MacroScroll",&macroDragScroll,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",&macroDragScroll,0,127-totalFit,"")) { \
if (CWSliderInt("##MacroScroll",&macroDragScroll,0,128-totalFit,"")) { \
if (macroDragScroll<0) macroDragScroll=0; \
if (macroDragScroll>127-totalFit) macroDragScroll=127-totalFit; \
if (macroDragScroll>128-totalFit) macroDragScroll=128-totalFit; \
} \
ImGui::EndTable(); \
}