diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 6a777e039..d341fd532 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1402,6 +1402,12 @@ String macroHover(int id, float val) { return fmt::sprintf("%d: %d",id,val); } +String macroHoverLoop(int id, float val) { + if (val>1) return "Release"; + if (val>0) return "Loop"; + return ""; +} + #define P(x) if (x) { \ modified=true; \ e->notifyInsChange(curIns); \ @@ -1438,7 +1444,7 @@ String macroHover(int id, float val) { if (j+macroDragScroll>=macroLen) { \ loopIndicator[j]=0; \ } else { \ - loopIndicator[j]=(macroLoop!=-1 && (j+macroDragScroll)>=macroLoop); \ + loopIndicator[j]=(macroLoop!=-1 && (j+macroDragScroll)>=macroLoop)|((macroRel!=-1 && (j+macroDragScroll)==macroRel)<<1); \ } \ } \ ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0.0f,0.0f)); \ @@ -1468,17 +1474,25 @@ String macroHover(int id, float val) { ImGui::SameLine(); \ ImGui::VSliderInt("##IArpMacroPos",ImVec2(20.0f*dpiScale,displayHeight*dpiScale),sliderVal,sliderLow,70); \ } \ - PlotCustom("##IMacroLoop_" macroName,loopIndicator,totalFit,macroDragScroll,NULL,0,1,ImVec2(availableWidth,8.0f*dpiScale),sizeof(float),macroColor,macroLen-macroDragScroll); \ + PlotCustom("##IMacroLoop_" macroName,loopIndicator,totalFit,macroDragScroll,NULL,0,2,ImVec2(availableWidth,16.0f*dpiScale),sizeof(float),macroColor,macroLen-macroDragScroll,¯oHoverLoop); \ if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) { \ macroLoopDragStart=ImGui::GetItemRectMin(); \ - macroLoopDragAreaSize=ImVec2(availableWidth,8.0f*dpiScale); \ + macroLoopDragAreaSize=ImVec2(availableWidth,16.0f*dpiScale); \ macroLoopDragLen=totalFit; \ - macroLoopDragTarget=¯oLoop; \ + if (ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) { \ + macroLoopDragTarget=¯oRel; \ + } else { \ + macroLoopDragTarget=¯oLoop; \ + } \ macroLoopDragActive=true; \ processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y); \ } \ if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { \ - macroLoop=-1; \ + if (ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) { \ + macroRel=-1; \ + } else { \ + macroLoop=-1; \ + } \ } \ ImGui::SetNextItemWidth(availableWidth); \ if (ImGui::InputText("##IMacroMML_" macroName,&mmlStr)) { \ diff --git a/src/gui/plot_nolerp.cpp b/src/gui/plot_nolerp.cpp index 31fd4a899..298258ec9 100644 --- a/src/gui/plot_nolerp.cpp +++ b/src/gui/plot_nolerp.cpp @@ -332,7 +332,10 @@ int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_gett const float v0 = values_getter(data, (v_idx) % values_count); const float v1 = values_getter(data, (v_idx + 1) % values_count); if (hoverFunc) { - ImGui::SetTooltip("%s",hoverFunc(v_idx+values_display_offset,v0).c_str()); + std::string hoverText=hoverFunc(v_idx+values_display_offset,v0); + if (!hoverText.empty()) { + ImGui::SetTooltip("%s",hoverText.c_str()); + } } else { if (plot_type == ImGuiPlotType_Lines) ImGui::SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx + 1, v1);