Skip to content

Commit

Permalink
Finish of LFO etc bugs (surge-synthesizer#4942)
Browse files Browse the repository at this point in the history
1. Hand shows over Waveform for MSEG and Formula
2. StepSequencer drags limited to stepsequencer actions

Closes surge-synthesizer#4877
  • Loading branch information
baconpaul authored Aug 28, 2021
1 parent b3e867d commit 8075918
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 16 deletions.
68 changes: 52 additions & 16 deletions src/gui/widgets/LFOAndStepDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,9 +1425,29 @@ void LFOAndStepDisplay::mouseExit(const juce::MouseEvent &event)
lfoTypeHover = -1;
stepSeqShiftHover = -1;

if (overWaveform)
{
enterExitWaveform(false);
}
overWaveform = false;
repaint();
}

void LFOAndStepDisplay::enterExitWaveform(bool isInWF)
{
if (isInWF)
{
if (lfodata->shape.val.i == lt_mseg || lfodata->shape.val.i == lt_formula)
{
setMouseCursor(juce::MouseCursor::PointingHandCursor);
}
}
else
{
setMouseCursor(juce::MouseCursor::NormalCursor);
}
}

void LFOAndStepDisplay::mouseMove(const juce::MouseEvent &event)
{
int nextHover = -1;
Expand Down Expand Up @@ -1475,38 +1495,54 @@ void LFOAndStepDisplay::mouseMove(const juce::MouseEvent &event)
return;
}
}

if (waveform_display.contains(event.position.toInt()))
{
if (!overWaveform)
enterExitWaveform(true);
overWaveform = true;
}
else
{
if (overWaveform)
enterExitWaveform(false);
overWaveform = false;
}
}

void LFOAndStepDisplay::mouseDrag(const juce::MouseEvent &event)
{
auto sge = firstListenerOfType<SurgeGUIEditor>();

for (int i = 0; i < n_lfo_types; ++i)
if (!isStepSequencer() || dragMode == NONE)
{
if (shaperect[i].contains(event.position.toInt()))
for (int i = 0; i < n_lfo_types; ++i)
{
if (event.mods.isPopupMenu())
if (shaperect[i].contains(event.position.toInt()))
{
notifyControlModifierClicked(event.mods);
if (event.mods.isPopupMenu())
{
notifyControlModifierClicked(event.mods);

return;
}
return;
}

if (i != lfodata->shape.val.i)
{
auto prior = lfodata->shape.val.i;
if (i != lfodata->shape.val.i)
{
auto prior = lfodata->shape.val.i;

lfodata->shape.val.i = i;
lfodata->shape.val.i = i;

sge->refresh_mod();
sge->broadcastPluginAutomationChangeFor(&(lfodata->shape));
sge->refresh_mod();
sge->broadcastPluginAutomationChangeFor(&(lfodata->shape));

repaint();
repaint();

sge->lfoShapeChanged(prior, i);
}
sge->lfoShapeChanged(prior, i);
}

return;
return;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/gui/widgets/LFOAndStepDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ struct LFOAndStepDisplay : public juce::Component, public WidgetBaseMixin<LFOAnd

int lfoTypeHover{-1};
int stepSeqShiftHover{-1};
bool overWaveform{false};
void enterExitWaveform(bool isInWF);

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LFOAndStepDisplay);
};
Expand Down

0 comments on commit 8075918

Please sign in to comment.