Skip to content

Commit

Permalink
Various minor UI tweaks (surge-synthesizer#4954)
Browse files Browse the repository at this point in the history
Modbutton panel horizontal position adjusted
Font used on modbuttons slightly reduced in size and made bold
Adjusted the name of some modulators as a consequence
Added toOSCaseForMenu in two places in SGE where it was missing
Rename Modulation Overview to Modulation List
Minor tweaks to overlay title bar (icon position, title font, close button)
  • Loading branch information
mkruselj authored Aug 30, 2021
1 parent a19eaa0 commit 7d73879
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 60 deletions.
2 changes: 1 addition & 1 deletion resources/data/skins/dark-mode.surge-skin/skin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
<control ui_identifier="aeg.release" x="57" y="35"/>

<!-- Modulation Panel -->
<control ui_identifier="controls.modulation.panel" x="2" y="401"/>
<control ui_identifier="controls.modulation.panel" x="3" y="401"/>

<!-- LFO -->
<control ui_identifier="lfo.rate" class="mod-hslider"/>
Expand Down
48 changes: 41 additions & 7 deletions src/common/ModulationSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,47 @@ extern float samplerate_inv;
extern float samplerate;

const char modsource_names_button[n_modsources][32] = {
"Off", "Velocity", "Keytrack", "Poly AT", "Channel AT", "Pitch Bend",
"Modwheel", "Macro 1", "Macro 2", "Macro 3", "Macro 4", "Macro 5",
"Macro 6", "Macro 7", "Macro 8", "Amp EG", "Filter EG", "LFO 1",
"LFO 2", "LFO 3", "LFO 4", "LFO 5", "LFO 6", "S-LFO 1",
"S-LFO 2", "S-LFO 3", "S-LFO 4", "S-LFO 5", "S-LFO 6", "MPE Timbre",
"Rel Velocity", "Random", "RandUni", "Alternate", "Alternate Uni", "Breath",
"Expression", "Sustain", "Lowest Key", "Highest Key", "Latest Key",
"Off",
"Velocity",
"Keytrack",
"Poly AT",
"Channel AT",
"Pitch Bend",
"Modwheel",
"Macro 1",
"Macro 2",
"Macro 3",
"Macro 4",
"Macro 5",
"Macro 6",
"Macro 7",
"Macro 8",
"Amp EG",
"Filter EG",
"LFO 1",
"LFO 2",
"LFO 3",
"LFO 4",
"LFO 5",
"LFO 6",
"S-LFO 1",
"S-LFO 2",
"S-LFO 3",
"S-LFO 4",
"S-LFO 5",
"S-LFO 6",
"MPE Timbre",
"Release Velocity",
"Random",
"Rand Uni",
"Alternate",
"Alternate Uni",
"Breath",
"Expression",
"Sustain",
"Lowest Key",
"Highest Key",
"Latest Key",
};

const char modsource_names[n_modsources][32] = {
Expand Down
2 changes: 1 addition & 1 deletion src/common/SkinModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ Connector store_patch_dialog = Connector("controls.patch.store.window", 157, 57,

// modulation panel is special, so it shows up as 'CUSTOM' with no connector and is special-cased in
// SurgeGUIEditor
Connector modulation_panel = Connector("controls.modulation.panel", 2, 402, Components::Custom);
Connector modulation_panel = Connector("controls.modulation.panel", 3, 402, Components::Custom);
} // namespace OtherControls
} // namespace Skin
} // namespace Surge
34 changes: 20 additions & 14 deletions src/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2554,7 +2554,8 @@ juce::PopupMenu SurgeGUIEditor::makeZoomMenu(const juce::Point<int> &where, bool
auto dzf = Surge::Storage::getUserDefaultValue(&(synth->storage),
Surge::Storage::DefaultZoom, zoomFactor);

std::string dss = "Zoom to Default (" + std::to_string(dzf) + "%)";
std::string dss =
Surge::GUI::toOSCaseForMenu("Zoom to Default (") + std::to_string(dzf) + "%)";

zoomSubMenu.addItem(dss, [this, dzf]() { resizeWindow(dzf); });
}
Expand Down Expand Up @@ -2741,6 +2742,19 @@ juce::PopupMenu SurgeGUIEditor::makeValueDisplaysMenu(const juce::Point<int> &wh
!modValues);
});

bool infowi = Surge::Storage::getUserDefaultValue(&(this->synth->storage),
Surge::Storage::InfoWindowPopupOnIdle, true);

dispDefMenu.addItem(Surge::GUI::toOSCaseForMenu("Show Value Readout on Mouse Hover"), true,
infowi, [this, infowi]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::InfoWindowPopupOnIdle,
!infowi);
this->frame->repaint();
});

dispDefMenu.addSeparator();

bool lfoone = Surge::Storage::getUserDefaultValue(
&(this->synth->storage), Surge::Storage::ShowGhostedLFOWaveReference, true);

Expand All @@ -2752,16 +2766,7 @@ juce::PopupMenu SurgeGUIEditor::makeValueDisplaysMenu(const juce::Point<int> &wh
this->frame->repaint();
});

bool infowi = Surge::Storage::getUserDefaultValue(&(this->synth->storage),
Surge::Storage::InfoWindowPopupOnIdle, true);

dispDefMenu.addItem(Surge::GUI::toOSCaseForMenu("Show Value Popup On Slider Mouseover"), true,
infowi, [this, infowi]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::InfoWindowPopupOnIdle,
!infowi);
this->frame->repaint();
});
dispDefMenu.addSeparator();

// Middle C submenu
auto middleCSubMenu = juce::PopupMenu();
Expand Down Expand Up @@ -3133,7 +3138,8 @@ juce::PopupMenu SurgeGUIEditor::makeSmoothMenu(

auto asmt = [&smoothMenu, smoothing, setSmooth](const char *label,
ControllerModulationSource::SmoothingMode md) {
smoothMenu.addItem(label, true, (smoothing == md), [setSmooth, md]() { setSmooth(md); });
smoothMenu.addItem(Surge::GUI::toOSCaseForMenu(label), true, (smoothing == md),
[setSmooth, md]() { setSmooth(md); });
};

asmt("Legacy", ControllerModulationSource::SmoothingMode::LEGACY);
Expand Down Expand Up @@ -4765,7 +4771,7 @@ void SurgeGUIEditor::togglePatchBrowserDialog()
void SurgeGUIEditor::showModulationEditorDialog()
{
auto pt = std::make_unique<Surge::Overlays::ModulationEditor>(this, this->synth);
addJuceEditorOverlay(std::move(pt), "Modulation Overview", MODULATION_EDITOR,
addJuceEditorOverlay(std::move(pt), "Modulation List", MODULATION_EDITOR,
juce::Rectangle<int>(50, 50, 750, 450));
}

Expand Down Expand Up @@ -5011,7 +5017,7 @@ std::string SurgeGUIEditor::modulatorIndexExtension(int scene, int ms, int index
if (index == 0)
return shortV ? "" : " (Uniform)";
if (index == 1)
return shortV ? " hN" : " (Half Normal)";
return shortV ? " HN" : " (Half Normal)";
}
if (shortV)
return "." + std::to_string(index + 1);
Expand Down
11 changes: 5 additions & 6 deletions src/gui/SurgeGUIEditorValueCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c

contextMenu.addSeparator();

contextMenu.addItem(Surge::GUI::toOSCaseForMenu("Modulation Editor"), [this]() {
contextMenu.addItem(Surge::GUI::toOSCaseForMenu("Modulation List..."), [this]() {
if (!isAnyOverlayPresent(MODULATION_EDITOR))
showModulationEditorDialog();
});
Expand Down Expand Up @@ -1899,11 +1899,10 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c
}
}

contextMenu.addItem(Surge::GUI::toOSCaseForMenu("Modulation Overview..."),
[this]() {
if (!isAnyOverlayPresent(MODULATION_EDITOR))
showModulationEditorDialog();
});
contextMenu.addItem(Surge::GUI::toOSCaseForMenu("Modulation List..."), [this]() {
if (!isAnyOverlayPresent(MODULATION_EDITOR))
showModulationEditorDialog();
});

if (n_ms)
{
Expand Down
34 changes: 25 additions & 9 deletions src/gui/overlays/MiniEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MiniEdit::MiniEdit()
{
typein = std::make_unique<juce::TextEditor>("minieditTypein");
typein->setJustification(juce::Justification::centred);
typein->setFont(Surge::GUI::getFontManager()->getLatoAtSize(11));
typein->setFont(Surge::GUI::getFontManager()->getLatoAtSize(10, juce::Font::bold));
typein->setSelectAllWhenFocused(true);
typein->addListener(this);
addAndMakeVisible(*typein);
Expand All @@ -42,12 +42,15 @@ MiniEdit::MiniEdit()
cancelButton->addListener(this);
addAndMakeVisible(*cancelButton);
}

MiniEdit::~MiniEdit() {}

juce::Rectangle<int> MiniEdit::getDisplayRegion()
{
auto fullRect = juce::Rectangle<int>(0, 0, 160, 80).withCentre(getBounds().getCentre());
return fullRect;
}

void MiniEdit::paint(juce::Graphics &g)
{
if (!skin || !associatedBitmapStore)
Expand All @@ -56,30 +59,36 @@ void MiniEdit::paint(juce::Graphics &g)
g.fillAll(juce::Colours::red);
return;
}

g.fillAll(skin->getColor(Colors::Overlay::Background));

auto fullRect = getDisplayRegion();

auto tbRect = fullRect.withHeight(18);

g.setColour(skin->getColor(Colors::Dialog::Titlebar::Background));
g.fillRect(tbRect);
g.setColour(skin->getColor(Colors::Dialog::Titlebar::Text));
g.setFont(Surge::GUI::getFontManager()->getLatoAtSize(11));
g.setFont(Surge::GUI::getFontManager()->getLatoAtSize(10, juce::Font::bold));
g.drawText(title, tbRect, juce::Justification::centred);

auto d = associatedBitmapStore->getImage(IDB_SURGE_ICON);

if (d)
{
d->drawAt(g, fullRect.getX(), fullRect.getY(), 1.0);
d->drawAt(g, fullRect.getX(), fullRect.getY() + 2, 1.0);
}

auto bodyRect = fullRect.withTrimmedTop(18);

g.setColour(skin->getColor(Colors::Dialog::Background));
g.fillRect(bodyRect);

g.setColour(skin->getColor(Colors::Dialog::Label::Text));
g.setFont(Surge::GUI::getFontManager()->getLatoAtSize(9));
auto labelRect = bodyRect.withHeight(22).withTrimmedLeft(3).withTrimmedRight(3);

auto labelRect = bodyRect.withHeight(20).reduced(4, 0);

g.drawText(label, labelRect, juce::Justification::centredLeft);

g.setColour(skin->getColor(Colors::Dialog::Border));
Expand All @@ -97,10 +106,11 @@ void MiniEdit::onSkinChanged()
skin->getColor(Colors::Dialog::Entry::Border));
repaint();
}

void MiniEdit::resized()
{
auto fullRect = getDisplayRegion();
auto eh = 18, mg = 2, bw = 40;
auto fullRect = getDisplayRegion();

auto typeinBox = fullRect.translated(0, 2 * eh + mg * 2)
.withHeight(eh)
Expand All @@ -109,19 +119,22 @@ void MiniEdit::resized()
typein->setBounds(typeinBox);
typein->setIndents(4, (typein->getHeight() - typein->getTextHeight()) / 2);

auto buttonRow = fullRect.translated(0, 3 * eh + mg * 3)
.withHeight(eh)
auto buttonRow = fullRect.translated(0, (3 * eh) + (mg * 3) + 2)
.withHeight(eh - 4)
.withTrimmedLeft(mg)
.withTrimmedRight(mg);
auto okRect = buttonRow.withTrimmedLeft(40).withWidth(38);
auto canRect = buttonRow.withTrimmedLeft(80).withWidth(38);
auto okRect = buttonRow.withTrimmedLeft(40).withWidth(40);
auto canRect = buttonRow.withTrimmedLeft(80).withWidth(40);

okButton->setBounds(okRect);
cancelButton->setBounds(canRect);

if (isVisible())
{
grabFocus();
}
}

void MiniEdit::buttonClicked(juce::Button *button)
{
if (button == okButton.get())
Expand All @@ -130,16 +143,19 @@ void MiniEdit::buttonClicked(juce::Button *button)
}
setVisible(false);
}

void MiniEdit::visibilityChanged()
{
if (isVisible())
grabFocus();
}

void MiniEdit::textEditorReturnKeyPressed(juce::TextEditor &editor)
{
callback(typein->getText().toStdString());
setVisible(false);
}

void MiniEdit::textEditorEscapeKeyPressed(juce::TextEditor &editor) { setVisible(false); }
} // namespace Overlays
} // namespace Surge
23 changes: 15 additions & 8 deletions src/gui/overlays/OverlayWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,23 @@ OverlayWrapper::OverlayWrapper()
{
closeButton = std::make_unique<juce::TextButton>("closeButton");
closeButton->addListener(this);
closeButton->setButtonText("Close");
closeButton->setButtonText("X");
addAndMakeVisible(*closeButton);
}

void OverlayWrapper::paint(juce::Graphics &g)
{
g.fillAll(skin->getColor(Colors::Dialog::Titlebar::Background));
g.setColour(skin->getColor(Colors::Dialog::Titlebar::Text));
g.setFont(Surge::GUI::getFontManager()->getLatoAtSize(11));
g.setFont(Surge::GUI::getFontManager()->getLatoAtSize(10, juce::Font::bold));
g.drawText(title, getLocalBounds().withHeight(titlebarSize + margin),
juce::Justification::centred);

if (icon)
icon->drawAt(g, 1, 1, 1);
{
icon->drawAt(g, 2, 1, 1);
}

g.setColour(skin->getColor(Colors::Dialog::Border));
g.drawRect(getLocalBounds(), 1);
}
Expand All @@ -51,16 +55,19 @@ void OverlayWrapper::addAndTakeOwnership(std::unique_ptr<juce::Component> c)
primaryChild = std::move(c);
primaryChild->setBounds(q);

auto buttonWidth = 50;
auto closeButtonBounds = getLocalBounds()
.withHeight(titlebarSize - 1)
.withLeft(getWidth() - buttonWidth)
.translated(-2, 2);
auto buttonSize = titlebarSize - 2;
auto closeButtonBounds =
getLocalBounds().withHeight(buttonSize).withLeft(getWidth() - buttonSize).translated(-2, 2);

if (showCloseButton)
{
closeButton->setBounds(closeButtonBounds);
}
else
{
closeButton->setVisible(false);
}

addAndMakeVisible(*primaryChild);
}

Expand Down
Loading

0 comments on commit 7d73879

Please sign in to comment.