From f6b0d567df30c7b015175fe2c0c1cfa25c5f67b5 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Thu, 28 Nov 2024 19:20:06 -0500 Subject: [PATCH] Expand and fix up rotation view 1. Show 0..count like other views 2. make ti clear in rotation view that the 0 and 12 are non-editable Closes #7828 --- src/surge-xt/gui/overlays/TuningOverlays.cpp | 31 +++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/surge-xt/gui/overlays/TuningOverlays.cpp b/src/surge-xt/gui/overlays/TuningOverlays.cpp index 60485294f83..f09280c0145 100644 --- a/src/surge-xt/gui/overlays/TuningOverlays.cpp +++ b/src/surge-xt/gui/overlays/TuningOverlays.cpp @@ -1680,7 +1680,7 @@ struct IntervalMatrix : public juce::Component, public Surge::GUI::SkinConsuming namespace clr = Colors::TuningOverlay::Interval; g.fillAll(skin->getColor(clr::Background)); auto ic = matrix->tuning.scale.count; - int mt = ic + (mode == ROTATION ? 1 : 2); + int mt = ic + 2; g.setFont(skin->fontManager->getLatoAtSize(9)); for (int i = 0; i < mt; ++i) { @@ -1797,9 +1797,10 @@ struct IntervalMatrix : public juce::Component, public Surge::GUI::SkinConsuming auto evenStep = lastTone / matrix->tuning.scale.count; auto desCents = disNote * evenStep; + juce::Colour bg; if (fabs(cdiff - desCents) < 0.1) { - g.setColour(skin->getColor(clr::HeatmapZero)); + bg = (skin->getColor(clr::HeatmapZero)); } else if (cdiff < desCents) { @@ -1808,7 +1809,7 @@ struct IntervalMatrix : public juce::Component, public Surge::GUI::SkinConsuming auto r = (1.0 - dist); auto c1 = skin->getColor(clr::HeatmapNegFar); auto c2 = skin->getColor(clr::HeatmapNegNear); - g.setColour(c1.interpolatedWith(c2, r)); + bg = (c1.interpolatedWith(c2, r)); } else { @@ -1816,15 +1817,23 @@ struct IntervalMatrix : public juce::Component, public Surge::GUI::SkinConsuming auto b = 1.0 - dist; auto c1 = skin->getColor(clr::HeatmapPosFar); auto c2 = skin->getColor(clr::HeatmapPosNear); - g.setColour(c1.interpolatedWith(c2, b)); + bg = (c1.interpolatedWith(c2, b)); } + if (i == mt - 1 || i == 1) + bg = skin->getColor(clr::HeatmapZero).withAlpha(0.9f); + + g.setColour(bg); g.fillRect(bx); + juce::Colour fg; if (isHovered) - g.setColour(skin->getColor(clr::IntervalTextHover)); + fg = skin->getColor(clr::IntervalTextHover); else - g.setColour(skin->getColor(clr::IntervalText)); + fg = skin->getColor(clr::IntervalText); + if (i == mt - 1 || i == 1) + fg = fg.withAlpha(0.7f); + g.setColour(fg); g.drawText(fmt::format("{:.1f}", cdiff), bx, juce::Justification::centred); } } @@ -1881,8 +1890,14 @@ struct IntervalMatrix : public juce::Component, public Surge::GUI::SkinConsuming if (mode == ROTATION) { - int tonI = (hoverI - 1 + hoverJ - 2) % matrix->tuning.scale.count; - matrix->overlay->onToneChanged(tonI, matrix->tuning.scale.tones[tonI].cents + dPos); + if (hoverI > 1 && hoverI <= matrix->tuning.scale.count) + { + int tonI = (hoverI - 1 + hoverJ - 2); + + tonI = tonI % matrix->tuning.scale.count; + matrix->overlay->onToneChanged(tonI, + matrix->tuning.scale.tones[tonI].cents + dPos); + } } else {