GUI: fix mistakes in op macro editor

This commit is contained in:
tildearrow 2022-02-09 12:27:20 -05:00
parent 85e9add020
commit 1c361003c2
1 changed files with 16 additions and 4 deletions

View File

@ -1527,7 +1527,11 @@ String macroHoverLoop(int id, float val) {
asFloat[j]=macro[j+macroDragScroll]; \ asFloat[j]=macro[j+macroDragScroll]; \
asInt[j]=macro[j+macroDragScroll]; \ asInt[j]=macro[j+macroDragScroll]; \
} \ } \
loopIndicator[j]=(macroLoop!=-1 && (j+macroDragScroll)>=macroLoop); \ if (j+macroDragScroll>=macroLen) { \
loopIndicator[j]=0; \
} else { \
loopIndicator[j]=(macroLoop!=-1 && (j+macroDragScroll)>=macroLoop)|((macroRel!=-1 && (j+macroDragScroll)==macroRel)<<1); \
} \
} \ } \
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0.0f,0.0f)); \ ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0.0f,0.0f)); \
\ \
@ -1552,17 +1556,25 @@ String macroHoverLoop(int id, float val) {
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y); \ processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y); \
} \ } \
if (displayLoop) { \ if (displayLoop) { \
ImGui::PlotHistogram("##IOPMacroLoop_" #op macroName,loopIndicator,totalFit,0,NULL,0,1,ImVec2(availableWidth,8.0f*dpiScale)); \ PlotCustom("##IOPMacroLoop_" #op macroName,loopIndicator,totalFit,macroDragScroll,NULL,0,2,ImVec2(availableWidth,12.0f*dpiScale),sizeof(float),uiColors[GUI_COLOR_MACRO_OTHER],macroLen-macroDragScroll,&macroHoverLoop); \
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) { \ if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) { \
macroLoopDragStart=ImGui::GetItemRectMin(); \ macroLoopDragStart=ImGui::GetItemRectMin(); \
macroLoopDragAreaSize=ImVec2(availableWidth,8.0f*dpiScale); \ macroLoopDragAreaSize=ImVec2(availableWidth,8.0f*dpiScale); \
macroLoopDragLen=totalFit; \ macroLoopDragLen=totalFit; \
macroLoopDragTarget=&macroLoop; \ if (ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) { \
macroLoopDragTarget=&macroRel; \
} else { \
macroLoopDragTarget=&macroLoop; \
} \
macroLoopDragActive=true; \ macroLoopDragActive=true; \
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y); \ processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y); \
} \ } \
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { \ if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { \
macroLoop=-1; \ if (ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) { \
macroRel=-1; \
} else { \
macroLoop=-1; \
} \
} \ } \
ImGui::SetNextItemWidth(availableWidth); \ ImGui::SetNextItemWidth(availableWidth); \
if (ImGui::InputText("##IOPMacroMML_" macroName,&mmlStr)) { \ if (ImGui::InputText("##IOPMacroMML_" macroName,&mmlStr)) { \