Skip to content

Commit

Permalink
Text improvements (#1214)
Browse files Browse the repository at this point in the history
* change font size and menu button margins

* modmatrix tooltip wip

* add some code to later add tooltip arrows

* update jucegui
  • Loading branch information
luismrguimaraes authored Aug 28, 2024
1 parent 149b953 commit 19d3be3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
49 changes: 26 additions & 23 deletions src-ui/app/edit-screen/components/ModPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ template <typename GZTrait> struct ModRow : juce::Component, HasEditor
addAndMakeVisible(*power);

source = std::make_unique<jcmp::MenuButton>();
source->setLabel("Source");
source->setLabel("SOURCE");
source->setOnCallback([w = juce::Component::SafePointer(this)]() {
if (w)
w->showSourceMenu(false);
});
addAndMakeVisible(*source);

sourceVia = std::make_unique<jcmp::MenuButton>();
sourceVia->setLabel("Via");
sourceVia->setLabel("VIA");
sourceVia->setOnCallback([w = juce::Component::SafePointer(this)]() {
if (w)
w->showSourceMenu(true);
Expand Down Expand Up @@ -137,6 +137,7 @@ template <typename GZTrait> struct ModRow : juce::Component, HasEditor
w->showCurveMenu();
});
addAndMakeVisible(*curve);
curve->centerTextAndExcludeArrow = true;

target = std::make_unique<jcmp::MenuButton>();
target->setOnCallback([w = juce::Component::SafePointer(this)]() {
Expand Down Expand Up @@ -184,7 +185,7 @@ template <typename GZTrait> struct ModRow : juce::Component, HasEditor
sqr(x1, 12);
map(sourceVia, 90);
sqr(x2, 12);
map(depth, 120, 2);
map(depth, 120, 3);
sqr(a1, 12);
map(curve, 60);
sqr(a2, 12);
Expand Down Expand Up @@ -246,9 +247,9 @@ template <typename GZTrait> struct ModRow : juce::Component, HasEditor
}

// this linear search kinda sucks bot
source->setLabel("Source");
sourceVia->setLabel("Via");
target->setLabel("Target");
source->setLabel("SOURCE");
sourceVia->setLabel("VIA");
target->setLabel("TARGET");
curve->setLabel("-");

auto makeSourceName = [](auto &si, auto &sn) {
Expand Down Expand Up @@ -281,7 +282,7 @@ template <typename GZTrait> struct ModRow : juce::Component, HasEditor
{
if (di == row.target)
{
target->setLabel(dn.first + " - " + dn.second);
target->setLabel(dn.first + ": " + dn.second);
}
}

Expand Down Expand Up @@ -319,11 +320,11 @@ template <typename GZTrait> struct ModRow : juce::Component, HasEditor
sl = "Unmapped";
if (vl == "Via")
{
vl = "";
vl = " ";
}
else
{
vl = " x " + vl;
vl = " " + std::string(u8"\U000000D7") + " " + vl;
}
sl += vl;

Expand All @@ -346,29 +347,31 @@ template <typename GZTrait> struct ModRow : juce::Component, HasEditor
auto v = md.modulationNaturalToString(ep.targetBaseValue,
at.value * (md.maxVal - md.minVal), isSourceBipolar);

auto rMove = jcmp::ToolTip::Row();
auto rDepth = jcmp::ToolTip::Row();
auto rDelta = jcmp::ToolTip::Row();
rDelta.drawLRArrow = true;
if (isSourceBipolar)
rDelta.drawRLArrow = true;

if (v.has_value())
{
if (isSourceBipolar)
{
rMove.rowLeadingGlyph = jcmp::GlyphPainter::GlyphType::LINK;
rMove.centerAlignText = v->baseValue;
rMove.leftAlignText = v->valDown;
rMove.rightAlignText = v->valUp;
rDelta.rowLeadingGlyph = jcmp::GlyphPainter::GlyphType::LEFT_RIGHT;
rDelta.leftAlignText = v->valDown;
rDelta.centerAlignText = v->baseValue;
rDelta.rightAlignText = v->valUp;
}
else
{
rMove.rowLeadingGlyph = jcmp::GlyphPainter::GlyphType::LINK;
rMove.centerAlignText = v->baseValue;
rMove.rightAlignText = v->valUp;
rDelta.rowLeadingGlyph = jcmp::GlyphPainter::GlyphType::LEFT_RIGHT;
rDelta.leftAlignText = v->baseValue;
rDelta.centerAlignText = v->valUp;
}
rDelta.rowLeadingGlyph = jcmp::GlyphPainter::GlyphType::SPEAKER;
rDelta.leftAlignText = fmt::format("{:.2f}%", at.value * 100);
rDelta.rightAlignText = fmt::format("{}", v->changeUp);
rDepth.rowLeadingGlyph = jcmp::GlyphPainter::GlyphType::VOLUME;
rDepth.leftAlignText = fmt::format("{:.2f} %", at.value * 100);
}
editor->setTooltipContents(lineOne, {rMove, rDelta});
editor->setTooltipContents(lineOne, {rDepth, rDelta});
}

void pushRowUpdate(bool forceUpdate = false)
Expand Down Expand Up @@ -615,7 +618,7 @@ template <typename GZTrait> struct ModRow : juce::Component, HasEditor

if (tn.first.empty())
{
p.addItem(tn.first + " - " + tn.second, true, selected, mop);
p.addItem(tn.first + ": " + tn.second, true, selected, mop);
}
else
{
Expand All @@ -631,7 +634,7 @@ template <typename GZTrait> struct ModRow : juce::Component, HasEditor
subMenu.addSectionHeader(tn.first);
subMenu.addSeparator();
}
subMenu.addItem(tn.first + " - " + tn.second, true, selected, mop);
subMenu.addItem(tn.first + ": " + tn.second, true, selected, mop);
checkPath = checkPath || selected;
}
}
Expand Down
8 changes: 5 additions & 3 deletions src-ui/theme/ThemeApplier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ void applyColors(const sheet_t::ptr_t &base, const ColorMap &cols)
base->setColour(Base::styleClass, Base::background, cols.get(ColorMap::bg_2));
base->setColour(Base::styleClass, Base::background_hover, cols.getHover(ColorMap::bg_2));

base->setFont(BaseLabel::styleClass, BaseLabel::labelfont, juce::Font(12, juce::Font::plain));
base->setFont(BaseLabel::styleClass, BaseLabel::labelfont,
juce::Font(juce::Font::plain).withPointHeight(12));
base->setColour(BaseLabel::styleClass, jcmp::NamedPanel::Styles::labelcolor,
cols.get(ColorMap::generic_content_medium));
base->setColour(BaseLabel::styleClass, jcmp::NamedPanel::Styles::labelcolor_hover,
Expand Down Expand Up @@ -415,8 +416,9 @@ void applyColors(const sheet_t::ptr_t &base, const ColorMap &cols)
base->setColour(jcmp::HSliderFilled::Styles::styleClass,
jcmp::HSliderFilled::Styles::handle_hover, cols.getHover(ColorMap::accent_1a));

auto interMed = connectors::resources::loadTypeface("fonts/Inter/static/Inter-Medium.ttf");
base->replaceFontsWithTypeface(interMed);
// auto interMed = connectors::resources::loadTypeface("fonts/Inter/static/Inter-Medium.ttf");
auto interReg = connectors::resources::loadTypeface("fonts/Inter/static/Inter-Regular.ttf");
base->replaceFontsWithTypeface(interReg);

auto fixedWidth =
connectors::resources::loadTypeface("fonts/Anonymous_Pro/AnonymousPro-Regular.ttf");
Expand Down

0 comments on commit 19d3be3

Please sign in to comment.