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

Deal with more hovers #6019

Merged
merged 1 commit into from
Apr 5, 2022
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
3 changes: 3 additions & 0 deletions src/surge-xt/gui/widgets/EffectChooser.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ struct EffectChooser : public juce::Component,
void mouseExit(const juce::MouseEvent &event) override { isHovered = false; }
void endHover() override
{
if (stuckHover)
return;

isHovered = false;
repaint();
}
Expand Down
3 changes: 3 additions & 0 deletions src/surge-xt/gui/widgets/LFOAndStepDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ struct LFOAndStepDisplay : public juce::Component,

void endHover() override
{
if (stuckHover)
return;

lfoTypeHover = -1;
stepSeqShiftHover = -1;
repaint();
Expand Down
3 changes: 3 additions & 0 deletions src/surge-xt/gui/widgets/MenuForDiscreteParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ struct MenuForDiscreteParams : public juce::Component,
}
void endHover() override
{
if (stuckHover)
return;

isHovered = false;

if (glyphMode)
Expand Down
9 changes: 5 additions & 4 deletions src/surge-xt/gui/widgets/NumberField.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,13 @@ struct NumberField : public juce::Component,
bool isHover{false};
void mouseEnter(const juce::MouseEvent &event) override
{
isHover = true;
startHover(event.position);
setMouseCursor(juce::MouseCursor::UpDownResizeCursor);
repaint();
}
void mouseExit(const juce::MouseEvent &event) override
{
isHover = false;
endHover();
setMouseCursor(juce::MouseCursor::NormalCursor);
repaint();
}
void startHover(const juce::Point<float> &p) override
{
Expand All @@ -118,6 +116,9 @@ struct NumberField : public juce::Component,
}
void endHover() override
{
if (stuckHover)
return;

isHover = false;
repaint();
}
Expand Down
3 changes: 3 additions & 0 deletions src/surge-xt/gui/widgets/WaveShaperSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ struct WaveShaperSelector : public juce::Component,

void endHover() override
{
if (stuckHover)
return;

isWaveHovered = false;
isLabelHovered = false;

Expand Down
28 changes: 8 additions & 20 deletions src/surge-xt/gui/widgets/XMLConfiguredMenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,10 @@ void OscillatorMenu::mouseDown(const juce::MouseEvent &event)

auto sge = firstListenerOfType<SurgeGUIEditor>();

stuckHoverOn();
menu.showMenuAsync(sge->popupMenuOptions(this),
Surge::GUI::makeAsyncCallback<OscillatorMenu>(this, [](auto *that, int) {
that->stuckHoverOff();
that->isHovered = false;
that->repaint();
}));
Expand All @@ -392,17 +394,9 @@ void OscillatorMenu::mouseWheelMove(const juce::MouseEvent &event,
jogBy(-dir);
}
}
void OscillatorMenu::mouseEnter(const juce::MouseEvent &event)
{
isHovered = true;
repaint();
}
void OscillatorMenu::mouseEnter(const juce::MouseEvent &event) { startHover(event.position); }

void OscillatorMenu::mouseExit(const juce::MouseEvent &event)
{
isHovered = false;
repaint();
}
void OscillatorMenu::mouseExit(const juce::MouseEvent &event) { endHover(); }

bool OscillatorMenu::keyPressed(const juce::KeyPress &key)
{
Expand Down Expand Up @@ -518,24 +512,18 @@ void FxMenu::mouseDown(const juce::MouseEvent &event)

auto sge = firstListenerOfType<SurgeGUIEditor>();

stuckHoverOn();
menu.showMenuAsync(sge->popupMenuOptions(this),
Surge::GUI::makeAsyncCallback<FxMenu>(this, [](auto *that, int) {
that->stuckHoverOff();
that->isHovered = false;
that->repaint();
}));
}

void FxMenu::mouseEnter(const juce::MouseEvent &event)
{
isHovered = true;
repaint();
}
void FxMenu::mouseEnter(const juce::MouseEvent &event) { startHover(event.position); }

void FxMenu::mouseExit(const juce::MouseEvent &event)
{
isHovered = false;
repaint();
}
void FxMenu::mouseExit(const juce::MouseEvent &event) { endHover(); }

void FxMenu::loadSnapshot(int type, TiXmlElement *e, int idx)
{
Expand Down
3 changes: 3 additions & 0 deletions src/surge-xt/gui/widgets/XMLConfiguredMenus.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ struct FxMenu : public juce::Component, public XMLMenuPopulator, public WidgetBa
}
void endHover() override
{
if (stuckHover)
return;

isHovered = false;
repaint();
}
Expand Down