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

Index UI Cleanups #4882

Merged
merged 1 commit into from
Aug 21, 2021
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
4 changes: 4 additions & 0 deletions src/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4251,6 +4251,10 @@ SurgeGUIEditor::layoutComponentForSkin(std::shared_ptr<Surge::GUI::Skin::Control
lfoDisplay->setSkin(currentSkin, bitmapStore, skinCtrl);
lfoDisplay->setTag(p->id + start_paramtags);
lfoDisplay->setLFOStorage(&synth->storage.getPatch().scene[current_scene].lfo[lfo_id]);
std::cout << "Setting ModSource to " << p->ctrlgroup_entry << "/" << modsource_index
<< std::endl;
lfoDisplay->setModSource((modsources)p->ctrlgroup_entry);
lfoDisplay->setModIndex(modsource_index);
lfoDisplay->setStorage(&synth->storage);
lfoDisplay->setStepSequencerStorage(
&synth->storage.getPatch().stepsequences[current_scene][lfo_id]);
Expand Down
9 changes: 9 additions & 0 deletions src/gui/SurgeGUIEditorValueCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2251,8 +2251,10 @@ void SurgeGUIEditor::valueChanged(Surge::GUI::IComponentTagValue *control)
modsources newsource = cms->getCurrentModSource();
int newindex = cms->getCurrentModIndex();

bool updated = false;
if (cms->getMouseMode() == Surge::Widgets::ModulationSourceButton::CLICK)
{
updated = true;
switch (state & 3)
{
case 0:
Expand Down Expand Up @@ -2281,11 +2283,18 @@ void SurgeGUIEditor::valueChanged(Surge::GUI::IComponentTagValue *control)
}
else if (cms->getMouseMode() == Surge::Widgets::ModulationSourceButton::HAMBURGER)
{
updated = true;
modsource = newsource;
modsource_index = newindex;
refresh_mod();
}

if (updated && lfoDisplay && lfoDisplay->modsource == modsource)
{
lfoDisplay->setModIndex(modsource_index);
lfoDisplay->repaint();
}

if (isLFO(newsource))
{
if (modsource_editor[current_scene] != newsource)
Expand Down
12 changes: 6 additions & 6 deletions src/gui/widgets/LFOAndStepDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,20 @@ void LFOAndStepDisplay::paintWaveform(juce::Graphics &g, const juce::Rectangle<i
susCountdown--;
}

val += tlfo->get_output(0);
val += tlfo->get_output(modIndex);
if (tFullWave)
{
auto v = tFullWave->get_output(0);
auto v = tFullWave->get_output(modIndex);
minwval = std::min(v, minwval);
maxwval = std::max(v, maxwval);
wval += v;
}
if (s == 0)
firstval = tlfo->get_output(0);
firstval = tlfo->get_output(modIndex);
if (s == averagingWindow - 1)
lastval = tlfo->get_output(0);
minval = std::min(tlfo->get_output(0), minval);
maxval = std::max(tlfo->get_output(0), maxval);
lastval = tlfo->get_output(modIndex);
minval = std::min(tlfo->get_output(modIndex), minval);
maxval = std::max(tlfo->get_output(modIndex), maxval);
eval += tlfo->env_val * lfodata->magnitude.get_extended(lfodata->magnitude.val.f);
}
val = val / averagingWindow;
Expand Down
4 changes: 4 additions & 0 deletions src/gui/widgets/LFOAndStepDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ struct LFOAndStepDisplay : public juce::Component, public WidgetBaseMixin<LFOAnd
void setStorage(SurgeStorage *s) { storage = s; }
LFOStorage *lfodata{nullptr};
void setLFOStorage(LFOStorage *s) { lfodata = s; }
modsources modsource;
void setModSource(modsources m) { modsource = m; }
int modIndex{0};
void setModIndex(int m) { modIndex = m; }

StepSequencerStorage *ss{nullptr};
void setStepSequencerStorage(StepSequencerStorage *s) { ss = s; }
Expand Down
17 changes: 17 additions & 0 deletions src/gui/widgets/ModulationSourceButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,23 @@ void ModulationSourceButton::mouseWheelMove(const juce::MouseEvent &event,
mouseMode = NONE;
repaint();
}
else if (needsHamburger())
{
int dir = wheelAccumulationHelper.accumulate(wheel, false, true);
if (dir != 0)
{
auto n = this->modlistIndex - dir;
if (n < 0)
n = this->modlist.size() - 1;
else if (n >= modlist.size())
n = 0;
this->modlistIndex = n;
mouseMode = HAMBURGER;
notifyValueChanged();
mouseMode = NONE;
repaint();
}
}
}

void ModulationSourceButton::resized()
Expand Down
2 changes: 2 additions & 0 deletions src/gui/widgets/ModulationSourceButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "juce_gui_basics/juce_gui_basics.h"

#include <string>
#include "SurgeJUCEHelpers.h"

class SurgeStorage;

Expand Down Expand Up @@ -161,6 +162,7 @@ struct ModulationSourceButton : public juce::Component,
void mouseDrag(const juce::MouseEvent &event) override;
void mouseWheelMove(const juce::MouseEvent &event,
const juce::MouseWheelDetails &wheel) override;
Surge::GUI::WheelAccumulationHelper wheelAccumulationHelper;

void resized() override;

Expand Down