Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step Sequencer right mouse typein gesture #1381

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/sst/sst-clap-helpers
57 changes: 55 additions & 2 deletions src-ui/app/edit-screen/components/LFOPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
// Included so we can have UI-thread exceution for curve rendering
#include "modulation/modulators/steplfo.h"
#include "app/edit-screen/EditScreen.h"
#include "app/shared/MenuValueTypein.h"

namespace scxt::ui::app::edit_screen
{
Expand Down Expand Up @@ -169,8 +170,59 @@ struct StepLFOPane : juce::Component, app::HasEditor
recalcCurve();
repaint();
}
void mouseDown(const juce::MouseEvent &event) override { handleMouseAt(event.position); }
void mouseDrag(const juce::MouseEvent &event) override { handleMouseAt(event.position); }

struct StepMenuTypein : shared::MenuValueTypeinBase
{
LfoPane *parent{nullptr};
int idx;
StepMenuTypein(SCXTEditor *e, int idx, LfoPane *r)
: parent(r), shared::MenuValueTypeinBase(e), idx(idx)
{
}
std::string getInitialText() const override
{
auto &ls = parent->modulatorStorageData[parent->selectedTab].stepLfoStorage;
auto v = ls.data[idx];
return fmt::format("{:7f}", v);
}
void setValueString(const std::string &s) override
{
auto lf = std::clamp(std::atof(s.c_str()), -1.0, 1.0);
parent->stepLfoPane->setStep(idx, lf);
}
juce::Colour getValueColour() const override
{
return editor->themeColor(theme::ColorMap::accent_2b);
}
};
void showTypeinPopup(const juce::Point<float> &f)
{
auto idx = indexForPosition(f);
if (idx < 0)
return;
juce::PopupMenu p;
p.addSectionHeader("LFO Step " + std::to_string(idx + 1));
p.addSeparator();
p.addCustomItem(-1, std::make_unique<StepMenuTypein>(parent->editor, idx, parent));
p.showMenuAsync(parent->editor->defaultPopupMenuOptions());
}
void mouseDown(const juce::MouseEvent &event) override
{
if (event.mods.isPopupMenu())
{
showTypeinPopup(event.position);
return;
}
handleMouseAt(event.position);
}
void mouseDrag(const juce::MouseEvent &event) override
{
if (event.mods.isPopupMenu())
{
return;
}
handleMouseAt(event.position);
}
void mouseDoubleClick(const juce::MouseEvent &event) override
{
auto idx = indexForPosition(event.position);
Expand Down Expand Up @@ -306,6 +358,7 @@ struct StepLFOPane : juce::Component, app::HasEditor
ms.stepLfoStorage.data[idx] = v;
connectors::updateSingleValue<cmsg::UpdateZoneOrGroupModStorageFloatValue>(
ms, ms.stepLfoStorage.data[idx], parent, parent->forZone, parent->selectedTab);
repaint();
}

void rotate(int dir)
Expand Down
Loading