Skip to content

Commit

Permalink
Improve slider rename when arrowing through menu sliders
Browse files Browse the repository at this point in the history
Discrete (menu) sliders rebuild on menu change but not arrow
so do that. But rebuilding on every arrow is annoying in VO
so di it at the end.

Also invalidate a few other places

Addresses surge-synthesizer#6822
  • Loading branch information
baconpaul committed Jan 25, 2023
1 parent 3e1820b commit 917e484
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6861,13 +6861,22 @@ void SurgeGUIEditor::setAccessibilityInformationByTitleAndAction(juce::Component
const std::string &title,
const std::string &action)
{
auto currT = c->getTitle().toStdString();
#if MAC
c->setDescription(title);
c->setTitle(title);
#else
c->setDescription(action);
c->setTitle(title);
#endif

if (currT != title)
{
if (auto h = c->getAccessibilityHandler())
{
h->notifyAccessibilityEvent(juce::AccessibilityEvent::titleChanged);
}
}
}

std::string SurgeGUIEditor::modulatorIndexExtension(int scene, int ms, int index, bool shortV)
Expand Down
15 changes: 15 additions & 0 deletions src/surge-xt/gui/widgets/MenuForDiscreteParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,24 @@ bool MenuForDiscreteParams::keyPressed(const juce::KeyPress &key)
setValue(nextValueInOrder(value, -dir));
notifyValueChanged();
notifyEndEdit();

rebuildOnFocus = true;
repaint();
return true;
}

void MenuForDiscreteParams::focusLost(juce::Component::FocusChangeType cause)
{
endHover();
if (rebuildOnFocus)
{
auto sge = firstListenerOfType<SurgeGUIEditor>();
if (sge)
{
sge->queue_refresh = true;
}
}
}

} // namespace Widgets
} // namespace Surge
4 changes: 3 additions & 1 deletion src/surge-xt/gui/widgets/MenuForDiscreteParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,14 @@ struct MenuForDiscreteParams : public juce::Component,

bool keyPressed(const juce::KeyPress &key) override;

bool rebuildOnFocus = false;
void focusGained(juce::Component::FocusChangeType cause) override
{
rebuildOnFocus = false;
startHover(getBounds().getBottomLeft().toFloat());
}

void focusLost(juce::Component::FocusChangeType cause) override { endHover(); }
void focusLost(juce::Component::FocusChangeType cause) override;

juce::Point<int> mouseDownOrigin;
bool isDraggingGlyph{false};
Expand Down
10 changes: 10 additions & 0 deletions src/surge-xt/gui/widgets/OscillatorWaveformDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1891,6 +1891,11 @@ void OscillatorWaveformDisplay::showCustomEditor()
customEditorAccOverlay->setTitle("Close Custom Editor");
customEditorAccOverlay->setDescription("Close Custom Editor");
}

if (auto h = getAccessibilityHandler())
{
h->notifyAccessibilityEvent(juce::AccessibilityEvent::structureChanged);
}
}

void OscillatorWaveformDisplay::hideCustomEditor()
Expand All @@ -1905,6 +1910,11 @@ void OscillatorWaveformDisplay::hideCustomEditor()
customEditorAccOverlay->setTitle("Open Custom Editor");
customEditorAccOverlay->setDescription("Open Custom Editor");

if (auto h = getAccessibilityHandler())
{
h->notifyAccessibilityEvent(juce::AccessibilityEvent::structureChanged);
}

repaint();
}

Expand Down

0 comments on commit 917e484

Please sign in to comment.