Skip to content

Commit

Permalink
Fix a number of step seq UI/UX regressions
Browse files Browse the repository at this point in the history
Addresses surge-synthesizer#4877

Also:
- properly update state of Pencil button when toggling
  MSEG/formula overlays by clicking on the display
- rename msegEditSwitch SGE member to something more universal
- make elementary rects of LFO widget member variables,
  remove &within argument from pain functions as a consequence
- step seq value is added directly on mouse down, not just on mouse move
  • Loading branch information
mkruselj committed Aug 26, 2021
1 parent da92f4a commit bfb8a50
Show file tree
Hide file tree
Showing 4 changed files with 418 additions and 150 deletions.
46 changes: 32 additions & 14 deletions src/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ void SurgeGUIEditor::openOrRecreateEditor()
** There are a collection of member states we need to reset
*/
polydisp = nullptr;
msegEditSwitch = nullptr;
lfoEditSwitch = nullptr;
lfoNameLabel = nullptr;
midiLearnOverlay = nullptr;

Expand Down Expand Up @@ -1124,14 +1124,14 @@ void SurgeGUIEditor::openOrRecreateEditor()
}
case Surge::Skin::Connector::NonParameterConnection::MSEG_EDITOR_OPEN:
{
msegEditSwitch = layoutComponentForSkin(skinCtrl, tag_mseg_edit);
setAccessibilityInformationByTitleAndAction(msegEditSwitch->asJuceComponent(),
lfoEditSwitch = layoutComponentForSkin(skinCtrl, tag_mseg_edit);
setAccessibilityInformationByTitleAndAction(lfoEditSwitch->asJuceComponent(),
"Show MSEG Editor", "Show");
auto msejc = dynamic_cast<juce::Component *>(msegEditSwitch);
auto msejc = dynamic_cast<juce::Component *>(lfoEditSwitch);
jassert(msejc);
msejc->setVisible(false);
msegEditSwitch->setValue(isAnyOverlayPresent(MSEG_EDITOR) ||
isAnyOverlayPresent(FORMULA_EDITOR));
lfoEditSwitch->setValue(isAnyOverlayPresent(MSEG_EDITOR) ||
isAnyOverlayPresent(FORMULA_EDITOR));
auto q = modsource_editor[current_scene];
if ((q >= ms_lfo1 && q <= ms_lfo6) || (q >= ms_slfo1 && q <= ms_slfo6))
{
Expand Down Expand Up @@ -4575,9 +4575,9 @@ void SurgeGUIEditor::lfoShapeChanged(int prior, int curr)
if (prior != curr || prior == lt_mseg || curr == lt_mseg || prior == lt_formula ||
curr == lt_formula)
{
if (msegEditSwitch)
if (lfoEditSwitch)
{
auto msejc = dynamic_cast<juce::Component *>(msegEditSwitch);
auto msejc = dynamic_cast<juce::Component *>(lfoEditSwitch);
msejc->setVisible(curr == lt_mseg || curr == lt_formula);
}
}
Expand Down Expand Up @@ -4626,6 +4626,12 @@ void SurgeGUIEditor::closeMSEGEditor()
{
broadcastMSEGState();
dismissEditorOfType(MSEG_EDITOR);

if (lfoEditSwitch)
{
lfoEditSwitch->setValue(0.0);
lfoEditSwitch->asJuceComponent()->repaint();
}
}
}
void SurgeGUIEditor::toggleMSEGEditor()
Expand Down Expand Up @@ -4707,13 +4713,25 @@ void SurgeGUIEditor::showFormulaEditorDialog()

addJuceEditorOverlay(std::move(pt), "Formula Editor", FORMULA_EDITOR, skinCtrl->getRect(), true,
[]() {});

if (lfoEditSwitch)
{
lfoEditSwitch->setValue(1.0);
lfoEditSwitch->asJuceComponent()->repaint();
}
}

void SurgeGUIEditor::closeFormulaEditorDialog()
{
if (isAnyOverlayPresent(FORMULA_EDITOR))
{
dismissEditorOfType(FORMULA_EDITOR);

if (lfoEditSwitch)
{
lfoEditSwitch->setValue(0.0);
lfoEditSwitch->asJuceComponent()->repaint();
}
}
}

Expand Down Expand Up @@ -4797,17 +4815,17 @@ void SurgeGUIEditor::showMSEGEditor()
auto skinCtrl = currentSkin->getOrCreateControlForConnector(conn);

addJuceEditorOverlay(std::move(mse), title, MSEG_EDITOR, skinCtrl->getRect(), true, [this]() {
if (msegEditSwitch)
if (lfoEditSwitch)
{
msegEditSwitch->setValue(0.0);
msegEditSwitch->asJuceComponent()->repaint();
lfoEditSwitch->setValue(0.0);
lfoEditSwitch->asJuceComponent()->repaint();
}
});

if (msegEditSwitch)
if (lfoEditSwitch)
{
msegEditSwitch->setValue(1.0);
msegEditSwitch->asJuceComponent()->repaint();
lfoEditSwitch->setValue(1.0);
lfoEditSwitch->asJuceComponent()->repaint();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ class SurgeGUIEditor : public Surge::GUI::IComponentTagValue::Listener,
friend struct Surge::Overlays::PatchStoreDialog;
friend struct Surge::Widgets::MainFrame;

Surge::GUI::IComponentTagValue *msegEditSwitch = nullptr;
Surge::GUI::IComponentTagValue *lfoEditSwitch = nullptr;
int typeinResetCounter = -1;
std::string typeinResetLabel = "";

Expand Down
Loading

0 comments on commit bfb8a50

Please sign in to comment.