소스 검색

Channel Rack and Piano Roll: design tokens and translatable strings

Rack rows: neutral name buttons with a channel-colour strip, red outline on the
selected channel, red steps, theme knobs (pan in blue, volume neutral), a dashed
"add channel" slot. Piano Roll: token grid and rows, notes from dark rose to red
by velocity, selected notes outlined in white, quieter toolbar hint that hides
when there is no room. Menus, tooltips and alerts go through tr().
Kauan 1 개월 전
부모
커밋
0e8b46df9f
2개의 변경된 파일과 214개의 추가작업 그리고 175개의 파일을 삭제
  1. 110 95
      src/ui/ChannelRackComponent.cpp
  2. 104 80
      src/ui/PianoRollComponent.cpp

+ 110 - 95
src/ui/ChannelRackComponent.cpp

@@ -5,6 +5,7 @@
 #include "ui/ChannelSettings.h"
 
 #include "engine/Text.h"
+#include "ui/I18n.h"
 #include "ui/BrowserComponent.h"
 
 #include "ui/PluginWindow.h"
@@ -14,6 +15,7 @@ namespace lynx
 {
 namespace
 {
+// English name (used for new channel names stored in the song)
 juce::String instrumentName (InstrumentKind k)
 {
     switch (k)
@@ -24,7 +26,7 @@ juce::String instrumentName (InstrumentKind k)
         case InstrumentKind::clap: return "Clap";
         case InstrumentKind::synth: return "Synth";
         case InstrumentKind::sampler: return "Sampler";
-        case InstrumentKind::audioClip: return utf8 ("Audio clip");
+        case InstrumentKind::audioClip: return "Audio clip";
         case InstrumentKind::plugin: return "Plugin";
         case InstrumentKind::controller: return "Controller";
         case InstrumentKind::sakura: return "Sakura";
@@ -36,6 +38,23 @@ juce::String instrumentName (InstrumentKind k)
     return "?";
 }
 
+// name shown in menus (translated)
+juce::String instrumentLabel (InstrumentKind k)
+{
+    switch (k)
+    {
+        case InstrumentKind::kick: return tr ("Kick");
+        case InstrumentKind::snare: return tr ("Snare");
+        case InstrumentKind::hat: return tr ("Hat");
+        case InstrumentKind::clap: return tr ("Clap");
+        case InstrumentKind::synth: return tr ("Synth");
+        case InstrumentKind::sampler: return tr ("Sampler");
+        case InstrumentKind::audioClip: return tr ("Audio clip");
+        case InstrumentKind::controller: return tr ("Controller");
+        default: return instrumentName (k);
+    }
+}
+
 constexpr InstrumentKind builtInKinds[] = { InstrumentKind::kick, InstrumentKind::snare, InstrumentKind::hat,
                                             InstrumentKind::clap, InstrumentKind::synth };
 
@@ -45,30 +64,6 @@ void setStep (Pattern& p, int channel, int step, bool on)
         p.toggleStep (channel, step);
 }
 
-void drawKnob (juce::Graphics& g, juce::Rectangle<float> r, float value01, bool bipolar, juce::Colour colour)
-{
-    const auto size = juce::jmin (r.getWidth(), r.getHeight()) - 6.0f;
-    const auto area = r.withSizeKeepingCentre (size, size);
-    const auto centre = area.getCentre();
-    const auto radius = size / 2.0f;
-    constexpr auto start = juce::MathConstants<float>::pi * 1.25f;
-    constexpr auto range = juce::MathConstants<float>::pi * 1.5f;
-
-    g.setColour (theme::knobBackground);
-    g.fillEllipse (area);
-
-    const auto from = bipolar ? start + range * 0.5f : start;
-    const auto to = start + range * value01;
-    juce::Path arc;
-    arc.addCentredArc (centre.x, centre.y, radius - 1.5f, radius - 1.5f, 0.0f, juce::jmin (from, to), juce::jmax (from, to), true);
-    g.setColour (colour);
-    g.strokePath (arc, juce::PathStrokeType (2.5f));
-
-    // JUCE angles: 0 = 12 o'clock, clockwise
-    const auto length = radius - 3.0f;
-    g.setColour (juce::Colours::white);
-    g.drawLine (centre.x, centre.y, centre.x + std::sin (to) * length, centre.y - std::cos (to) * length, 1.5f);
-}
 } // namespace
 
 ChannelRackComponent::ChannelRackComponent (AudioEngine& e)
@@ -155,7 +150,8 @@ bool ChannelRackComponent::cellHasNote (int channel, int step) const
 
 void ChannelRackComponent::paint (juce::Graphics& g)
 {
-    g.fillAll (theme::panel);
+    using namespace theme::colour;
+    g.fillAll (bg2);
 
     const auto& song = engine.getSong();
 
@@ -166,7 +162,7 @@ void ChannelRackComponent::paint (juce::Graphics& g)
     const auto steps = numSteps();
     const auto clip = g.getClipBounds();
     const auto selected = engine.getSelectedChannel();
-    g.setFont (juce::FontOptions (14.0f));
+    g.setFont (theme::font (theme::type::body));
 
     for (int row = 0; row < (int) song.channels.size(); ++row)
     {
@@ -178,47 +174,54 @@ void ChannelRackComponent::paint (juce::Graphics& g)
         const auto& channel = song.channels[(std::size_t) row];
         const auto nameArea = juce::Rectangle<float> ((float) nameLeft(), (float) y + 3, (float) nameWidth, (float) rowHeight - 6);
 
+        if (row == selected) // the whole row is subtly lifted
+        {
+            g.setColour (bg3);
+            g.fillRect (0, y + 1, getWidth(), rowHeight - 2);
+        }
+
         g.setColour (theme::muteLed (channel.muted));
-        g.fillEllipse ((float) 9, (float) y + rowHeight / 2.0f - 5, 10, 10);
+        g.fillEllipse ((float) 9, (float) y + rowHeight / 2.0f - 4.5f, 9, 9);
 
-        drawKnob (g, { (float) muteWidth, (float) y, (float) knobWidth, (float) rowHeight }, (channel.pan + 1.0f) / 2.0f,
-                  true, theme::accentBlue);
-        drawKnob (g, { (float) muteWidth + knobWidth, (float) y, (float) knobWidth, (float) rowHeight }, channel.volume,
-                  false, theme::accentGreen);
+        theme::drawKnob (g, juce::Rectangle<float> ((float) muteWidth, (float) y, (float) knobWidth, (float) rowHeight).reduced (1.0f, 2.0f),
+                         (channel.pan + 1.0f) / 2.0f, true, info);
+        theme::drawKnob (g, juce::Rectangle<float> ((float) muteWidth + knobWidth, (float) y, (float) knobWidth, (float) rowHeight).reduced (1.0f, 2.0f),
+                         channel.volume, false, knobArc);
 
         // small box with the mixer insert ("-" = straight to Master), as in FL
         const auto routeArea = juce::Rectangle<float> ((float) (muteWidth + 2 * knobWidth) + 1, (float) y + 7,
                                                        (float) routeWidth - 3, (float) rowHeight - 14);
-        g.setColour (theme::knobBackground);
-        g.fillRoundedRectangle (routeArea, 3.0f);
-        g.setColour (channel.mixerTrack > 0 ? theme::accentOrange : theme::text.withAlpha (0.5f));
-        g.setFont (juce::FontOptions (12.0f));
+        g.setColour (bg0);
+        g.fillRoundedRectangle (routeArea, theme::radius::sm);
+        g.setColour (channel.mixerTrack > 0 ? textPrimary : textDisabled);
+        g.setFont (theme::font (theme::type::caption, true));
         g.drawText (channel.mixerTrack > 0 ? juce::String (channel.mixerTrack) : juce::String ("-"), routeArea.toNearestInt(),
                     juce::Justification::centred);
-        g.setFont (juce::FontOptions (14.0f));
+        g.setFont (theme::font (theme::type::body));
 
-        // channel colour (from the .flp or user-picked) blended into the button, as in FL
-        auto button = row == selected ? theme::channelButtonSelected : theme::channelButton;
-        if (channel.colour != 0)
-            button = button.interpolatedWith (juce::Colour (channel.colour), 0.55f);
-        g.setColour (button);
-        g.fillRoundedRectangle (nameArea, 4.0f);
+        // name button: neutral surface with the channel colour (from the .flp or user-picked) as a strip
+        g.setColour (row == selected ? bg6 : bg4);
+        g.fillRoundedRectangle (nameArea, theme::radius::md);
 
         if (row == selected)
         {
-            g.setColour (theme::accentOrange);
-            g.fillRoundedRectangle (nameArea.withWidth (4.0f), 2.0f);
+            g.setColour (accent);
+            g.drawRoundedRectangle (nameArea.reduced (0.5f), theme::radius::md, 1.0f);
         }
 
-        g.setColour (channel.muted ? juce::Colours::grey : juce::Colours::white);
-        g.drawText (juce::String::fromUTF8 (channel.name.c_str()), nameArea.reduced (10, 0).toNearestInt(),
+        g.setColour (channel.colour != 0 ? theme::tame (juce::Colour (channel.colour)) : bg6.brighter (0.2f));
+        g.fillRoundedRectangle (nameArea.withWidth (4.0f).reduced (0.0f, 3.0f).translated (3.0f, 0.0f), 1.5f);
+
+        g.setColour (channel.muted ? textDisabled : textPrimary);
+        g.drawText (juce::String::fromUTF8 (channel.name.c_str()), nameArea.withTrimmedLeft (14).withTrimmedRight (6).toNearestInt(),
                     juce::Justification::centredLeft, true);
 
         if (channel.instrument == InstrumentKind::audioClip)
         {
-            g.setColour (theme::text.withAlpha (0.35f));
-            g.drawText (utf8 ("audio clip — plays from the Playlist"), gridLeft() + 4, y, 400, rowHeight, juce::Justification::centredLeft);
-            g.setFont (juce::FontOptions (14.0f));
+            g.setColour (textDisabled);
+            g.setFont (theme::font (theme::type::small));
+            g.drawText (tr ("audio clip — plays from the Playlist"), gridLeft() + 4, y, 400, rowHeight, juce::Justification::centredLeft);
+            g.setFont (theme::font (theme::type::body));
             continue;
         }
 
@@ -232,20 +235,32 @@ void ChannelRackComponent::paint (juce::Graphics& g)
             const auto onGrid = pattern.hasStep (row, step);
             const auto any = onGrid || cellHasNote (row, step);
 
-            g.setColour (any ? (onGrid ? theme::stepOn : theme::stepOnOffGrid) : theme::stepOff (step));
-            g.fillRoundedRectangle (r.toFloat(), 3.0f);
+            g.setColour (any ? (onGrid ? stepOn : stepNote) : theme::stepOff (step));
+            g.fillRoundedRectangle (r.toFloat(), theme::radius::sm);
         }
     }
 
     const auto addY = 4 + (int) song.channels.size() * rowHeight;
-    g.setColour (juce::Colours::white.withAlpha (0.5f));
-    g.drawText (utf8 ("+ add channel (or drop an audio file)"), nameLeft() + 2, addY,
-                400, rowHeight, juce::Justification::centredLeft);
+    {
+        const auto addArea = juce::Rectangle<float> ((float) nameLeft(), (float) addY + 3, (float) nameWidth, (float) rowHeight - 6);
+        const float dash[] = { 3.0f, 3.0f };
+        juce::Path outline, dashed;
+        outline.addRoundedRectangle (addArea.reduced (0.5f), theme::radius::md);
+        juce::PathStrokeType (1.0f).createDashedStroke (dashed, outline, dash, 2);
+        g.setColour (borderStrong);
+        g.fillPath (dashed);
+        g.setColour (textSecondary);
+        g.setFont (theme::font (theme::type::small));
+        g.drawText (tr ("+ add channel"), addArea.toNearestInt(), juce::Justification::centred);
+        g.setColour (textDisabled);
+        g.drawText (tr ("or drop an audio file here"), gridLeft() + 4, addY, 400, rowHeight, juce::Justification::centredLeft);
+    }
 
     if (playheadStep >= 0 && playheadStep < steps)
     {
-        g.setColour (theme::playhead.withAlpha (0.35f));
-        g.fillRect (gridLeft() + playheadStep * stepWidth, 0, stepWidth - 2, addY);
+        g.setColour (playhead.withAlpha (0.28f));
+        g.fillRoundedRectangle (juce::Rectangle<float> ((float) (gridLeft() + playheadStep * stepWidth), 2.0f, (float) stepWidth - 2.0f,
+                                                        (float) addY - 2.0f), theme::radius::sm);
     }
 }
 
@@ -417,12 +432,12 @@ void ChannelRackComponent::showChannelMenu (int channel)
     juce::PopupMenu instruments;
 
     for (auto kind : builtInKinds)
-        instruments.addItem (instrumentName (kind), true, c.instrument == kind, [this, channel, kind] {
+        instruments.addItem (instrumentLabel (kind), true, c.instrument == kind, [this, channel, kind] {
             engine.editSong ([channel, kind] (Song& s) { s.channels[(std::size_t) channel].instrument = kind; });
         });
 
     instruments.addSeparator();
-    instruments.addItem ("Sampler (choose file)...", [this, channel] { chooseSample (channel); });
+    instruments.addItem (tr ("Sampler (choose file)..."), [this, channel] { chooseSample (channel); });
 
     juce::PopupMenu plugins;
     addPluginItems (plugins, engine, true, [this, channel] (PluginRef ref) {
@@ -434,42 +449,42 @@ void ChannelRackComponent::showChannelMenu (int channel)
         });
         openPluginWindow (channel);
     });
-    instruments.addSubMenu ("Plugin (VST3/CLAP)", plugins);
+    instruments.addSubMenu (tr ("Plugin (VST3/CLAP)"), plugins);
 
     juce::PopupMenu menu;
     menu.addSectionHeader (juce::String::fromUTF8 (c.name.c_str()));
 
     if (c.instrument == InstrumentKind::sampler)
     {
-        menu.addItem (juce::String ("Sample: ") + juce::File (juce::String::fromUTF8 (c.samplePath.c_str())).getFileName(),
+        menu.addItem (tr ("Sample: {0}", { juce::File (juce::String::fromUTF8 (c.samplePath.c_str())).getFileName() }),
                       false, false, [] {});
-        menu.addItem (utf8 ("Sampler settings (pitch, envelope, reverse)..."),
+        menu.addItem (tr ("Sampler settings (pitch, envelope, reverse)..."),
                       [this, channel] { openChannelSettings (engine, channel); });
 
         if (c.sampler.slices.empty())
-            menu.addItem (utf8 ("Slice sample (slicer): one slice per key and a pattern with the loop"), [this, channel] { sliceChannel (channel); });
+            menu.addItem (tr ("Slice sample (slicer): one slice per key and a pattern with the loop"), [this, channel] { sliceChannel (channel); });
         else
-            menu.addItem (utf8 ("Undo slices (") + juce::String ((int) c.sampler.slices.size()) + ")", [this, channel] {
+            menu.addItem (tr ("Undo slices ({0})", { juce::String ((int) c.sampler.slices.size()) }), [this, channel] {
                 engine.editSong ([channel] (Song& s) { s.channels[(std::size_t) channel].sampler.slices.clear(); });
             });
     }
 
     if (c.instrument == InstrumentKind::synth)
-        menu.addItem (utf8 ("Synth settings (oscillators, envelope, filter)..."), [this, channel] { openChannelSettings (engine, channel); });
+        menu.addItem (tr ("Synth settings (oscillators, envelope, filter)..."), [this, channel] { openChannelSettings (engine, channel); });
 
     if (c.instrument == InstrumentKind::plugin)
     {
-        menu.addItem (utf8 ("Open plugin editor"), [this, channel] { openPluginWindow (channel); });
+        menu.addItem (tr ("Open plugin editor"), [this, channel] { openPluginWindow (channel); });
 
         if (auto* p = dynamic_cast<PluginInstrument*> (engine.getChannelInstrument (channel).get()))
             addPluginParameterItems (menu, engine, p->getInstance(), { AutomationTargetKind::channelParam, channel, 0, 0 });
     }
 
-    menu.addItem ("Piano Roll", [this] {
+    menu.addItem (tr ("Piano Roll"), [this] {
         if (onOpenPianoRoll)
             onOpenPianoRoll();
     });
-    menu.addSubMenu ("Instrument", instruments);
+    menu.addSubMenu (tr ("Instrument"), instruments);
     {
         // channel arpeggiator
         const auto arp = c.arp;
@@ -477,21 +492,21 @@ void ChannelRackComponent::showChannelMenu (int channel)
             engine.editSong ([channel, change] (Song& s) { change (s.channels[(std::size_t) channel].arp); });
         };
         juce::PopupMenu arpMenu;
-        const char* directions[] = { "Off", "Up", "Down", "Up and down", "Random" };
+        const char* directions[] = { TR_NOOP ("Off"), TR_NOOP ("Up"), TR_NOOP ("Down"), TR_NOOP ("Up and down"), TR_NOOP ("Random") };
 
         for (int d = 0; d < 5; ++d)
-            arpMenu.addItem (utf8 (directions[d]), true, arp.direction == d, [set, d] { set ([d] (ArpSettings& a) { a.direction = d; }); });
+            arpMenu.addItem (tr (directions[d]), true, arp.direction == d, [set, d] { set ([d] (ArpSettings& a) { a.direction = d; }); });
 
         arpMenu.addSeparator();
         juce::PopupMenu range, speed, gate, repeat;
 
         for (int o = 1; o <= 4; ++o)
-            range.addItem (juce::String (o) + (o == 1 ? " octave" : " octaves"), true, arp.range == o, [set, o] { set ([o] (ArpSettings& a) { a.range = o; }); });
+            range.addItem (o == 1 ? tr ("1 octave") : tr ("{0} octaves", { juce::String (o) }), true, arp.range == o, [set, o] { set ([o] (ArpSettings& a) { a.range = o; }); });
 
-        const std::pair<const char*, float> speeds[] = { { "1/4", 1.0f }, { "1/8", 0.5f }, { "1/8 triplet", 1.0f / 3.0f },
-                                                          { "1/16", 0.25f }, { "1/16 triplet", 1.0f / 6.0f }, { "1/32", 0.125f } };
+        const std::pair<const char*, float> speeds[] = { { "1/4", 1.0f }, { "1/8", 0.5f }, { TR_NOOP ("1/8 triplet"), 1.0f / 3.0f },
+                                                          { "1/16", 0.25f }, { TR_NOOP ("1/16 triplet"), 1.0f / 6.0f }, { "1/32", 0.125f } };
         for (const auto& [name, beats] : speeds)
-            speed.addItem (name, true, std::abs (arp.stepBeats - beats) < 1e-4f, [set, b = beats] { set ([b] (ArpSettings& a) { a.stepBeats = b; }); });
+            speed.addItem (tr (name), true, std::abs (arp.stepBeats - beats) < 1e-4f, [set, b = beats] { set ([b] (ArpSettings& a) { a.stepBeats = b; }); });
 
         for (int g : { 25, 50, 75, 100 })
             gate.addItem (juce::String (g) + "%", true, std::abs (arp.gate - g / 100.0f) < 1e-4f, [set, g] { set ([g] (ArpSettings& a) { a.gate = g / 100.0f; }); });
@@ -499,17 +514,17 @@ void ChannelRackComponent::showChannelMenu (int channel)
         for (int n : { 1, 2, 3, 4 })
             repeat.addItem (juce::String (n) + "x", true, arp.repeat == n, [set, n] { set ([n] (ArpSettings& a) { a.repeat = n; }); });
 
-        arpMenu.addSubMenu (utf8 ("Range"), range);
-        arpMenu.addSubMenu ("Speed", speed);
-        arpMenu.addSubMenu ("Gate", gate);
-        arpMenu.addSubMenu (utf8 ("Repeat"), repeat);
-        menu.addSubMenu (arp.enabled() ? utf8 ("Arpeggiator (on)") : utf8 ("Arpeggiator"), arpMenu);
+        arpMenu.addSubMenu (tr ("Range"), range);
+        arpMenu.addSubMenu (tr ("Speed"), speed);
+        arpMenu.addSubMenu (tr ("Gate"), gate);
+        arpMenu.addSubMenu (tr ("Repeat"), repeat);
+        menu.addSubMenu (arp.enabled() ? tr ("Arpeggiator (on)") : tr ("Arpeggiator"), arpMenu);
     }
 
-    menu.addItem ("Rename...", [this, channel] { rename (channel); });
+    menu.addItem (tr ("Rename..."), [this, channel] { rename (channel); });
     {
         juce::PopupMenu colours;
-        colours.addItem (utf8 ("Default"), [this, channel] { engine.editSong ([channel] (Song& s) { s.channels[(std::size_t) channel].colour = 0; }); });
+        colours.addItem (tr ("Default"), [this, channel] { engine.editSong ([channel] (Song& s) { s.channels[(std::size_t) channel].colour = 0; }); });
 
         for (auto c : { 0xff485156u, 0xffa14547u, 0xffa16f45u, 0xffa19d45u, 0xff6ca145u, 0xff45a175u, 0xff45a1a0u, 0xff457ca1u,
                         0xff4f45a1u, 0xff8a5096u, 0xffa1458au })
@@ -523,9 +538,9 @@ void ChannelRackComponent::showChannelMenu (int channel)
             colours.addItem (std::move (item));
         }
 
-        menu.addSubMenu ("Colour", colours);
+        menu.addSubMenu (tr ("Color"), colours);
     }
-    menu.addItem ("Clear notes in this pattern", [this, channel] {
+    menu.addItem (tr ("Clear notes in this pattern"), [this, channel] {
         engine.editSong ([channel] (Song& s) {
             auto& notes = s.patterns[(std::size_t) s.currentPattern].notes;
             notes.erase (std::remove_if (notes.begin(), notes.end(), [channel] (const Note& n) { return n.channel == channel; }),
@@ -533,7 +548,7 @@ void ChannelRackComponent::showChannelMenu (int channel)
         });
     });
     menu.addSeparator();
-    menu.addItem ("Delete channel", engine.getSong().channels.size() > 1, false, [this, channel] {
+    menu.addItem (tr ("Delete channel"), engine.getSong().channels.size() > 1, false, [this, channel] {
         engine.editSong ([channel] (Song& s) { s.removeChannel (channel); });
     });
 
@@ -545,7 +560,7 @@ void ChannelRackComponent::showAddChannelMenu()
     juce::PopupMenu menu;
 
     for (auto kind : builtInKinds)
-        menu.addItem (instrumentName (kind), [this, kind] {
+        menu.addItem (instrumentLabel (kind), [this, kind] {
             engine.editSong ([kind] (Song& s) {
                 ChannelDef c;
                 c.name = instrumentName (kind).toStdString();
@@ -557,7 +572,7 @@ void ChannelRackComponent::showAddChannelMenu()
         });
 
     menu.addSeparator();
-    menu.addItem ("Sampler (choose file)...", [this] { chooseSample (-1); });
+    menu.addItem (tr ("Sampler (choose file)..."), [this] { chooseSample (-1); });
 
     juce::PopupMenu plugins;
     addPluginItems (plugins, engine, true, [this] (PluginRef ref) {
@@ -573,14 +588,14 @@ void ChannelRackComponent::showAddChannelMenu()
         engine.setSelectedChannel (added);
         openPluginWindow (added); // as in FL: the plugin opens when added
     });
-    menu.addSubMenu ("Plugin (VST3/CLAP)", plugins);
+    menu.addSubMenu (tr ("Plugin (VST3/CLAP)"), plugins);
 
     menu.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (this).withMousePosition());
 }
 
 void ChannelRackComponent::chooseSample (int channel)
 {
-    fileChooser = std::make_unique<juce::FileChooser> ("Choose sample", juce::File(), engine.getSampleLibrary().wildcard());
+    fileChooser = std::make_unique<juce::FileChooser> (tr ("Choose sample"), juce::File(), engine.getSampleLibrary().wildcard());
     fileChooser->launchAsync (juce::FileBrowserComponent::openMode | juce::FileBrowserComponent::canSelectFiles,
                               [this, channel] (const juce::FileChooser& chooser) {
                                   if (chooser.getResult().existsAsFile())
@@ -592,8 +607,8 @@ void ChannelRackComponent::assignSample (int channel, const juce::File& file)
 {
     if (engine.getSampleLibrary().load (file.getFullPathName()) == nullptr)
     {
-        juce::AlertWindow::showMessageBoxAsync (juce::MessageBoxIconType::WarningIcon, "Sample",
-                                                utf8 ("Could not read ") + file.getFileName());
+        juce::AlertWindow::showMessageBoxAsync (juce::MessageBoxIconType::WarningIcon, tr ("Sample"),
+                                                tr ("Could not read {0}", { file.getFileName() }));
         return;
     }
 
@@ -627,16 +642,16 @@ void ChannelRackComponent::openPluginWindow (int channel)
         return;
     }
 
-    juce::AlertWindow::showMessageBoxAsync (juce::MessageBoxIconType::WarningIcon, "Plugin",
-                                            utf8 ("This plugin could not be loaded (it is not installed or has not been scanned)."));
+    juce::AlertWindow::showMessageBoxAsync (juce::MessageBoxIconType::WarningIcon, tr ("Plugin"),
+                                            tr ("This plugin could not be loaded (it is not installed or has not been scanned)."));
 }
 
 void ChannelRackComponent::rename (int channel)
 {
-    auto* window = new juce::AlertWindow ("Rename channel", {}, juce::MessageBoxIconType::NoIcon);
+    auto* window = new juce::AlertWindow (tr ("Rename channel"), {}, juce::MessageBoxIconType::NoIcon);
     window->addTextEditor ("name", juce::String::fromUTF8 (engine.getSong().channels[(std::size_t) channel].name.c_str()));
-    window->addButton ("OK", 1, juce::KeyPress (juce::KeyPress::returnKey));
-    window->addButton ("Cancel", 0, juce::KeyPress (juce::KeyPress::escapeKey));
+    window->addButton (tr ("OK"), 1, juce::KeyPress (juce::KeyPress::returnKey));
+    window->addButton (tr ("Cancel"), 0, juce::KeyPress (juce::KeyPress::escapeKey));
 
     window->enterModalState (true, juce::ModalCallbackFunction::create ([this, channel, window] (int result) {
                                  const auto name = window->getTextEditorContents ("name").trim().toStdString();

+ 104 - 80
src/ui/PianoRollComponent.cpp

@@ -3,6 +3,7 @@
 #include "core/NoteEdit.h"
 #include "engine/MidiFileIo.h"
 #include "engine/Text.h"
+#include "ui/I18n.h"
 #include "ui/Theme.h"
 
 namespace lynx
@@ -47,9 +48,9 @@ struct NamedIntervals
 const std::vector<NamedIntervals>& chords()
 {
     static const std::vector<NamedIntervals> list {
-        { "Note", { 0 } },         { "Major", { 0, 4, 7 } },     { "Minor", { 0, 3, 7 } },     { "Dim", { 0, 3, 6 } },
+        { TR_NOOP ("Note"), { 0 } }, { TR_NOOP ("Major"), { 0, 4, 7 } }, { TR_NOOP ("Minor"), { 0, 3, 7 } },     { "Dim", { 0, 3, 6 } },
         { "Aug", { 0, 4, 8 } },    { "Sus2", { 0, 2, 7 } },      { "Sus4", { 0, 5, 7 } },      { "7", { 0, 4, 7, 10 } },
-        { "Maj7", { 0, 4, 7, 11 } }, { "m7", { 0, 3, 7, 10 } }, { "m9", { 0, 3, 7, 10, 14 } }, { "Octave", { 0, 12 } },
+        { "Maj7", { 0, 4, 7, 11 } }, { "m7", { 0, 3, 7, 10 } }, { "m9", { 0, 3, 7, 10, 14 } }, { TR_NOOP ("Octave"), { 0, 12 } },
     };
     return list;
 }
@@ -57,23 +58,23 @@ const std::vector<NamedIntervals>& chords()
 const std::vector<NamedIntervals>& scales()
 {
     static const std::vector<NamedIntervals> list {
-        { "No scale", {} },
-        { "Major", { 0, 2, 4, 5, 7, 9, 11 } },
-        { "Natural minor", { 0, 2, 3, 5, 7, 8, 10 } },
-        { "Harmonic minor", { 0, 2, 3, 5, 7, 8, 11 } },
-        { "Major pentatonic", { 0, 2, 4, 7, 9 } },
-        { "Minor pentatonic", { 0, 3, 5, 7, 10 } },
+        { TR_NOOP ("No scale"), {} },
+        { TR_NOOP ("Major"), { 0, 2, 4, 5, 7, 9, 11 } },
+        { TR_NOOP ("Natural minor"), { 0, 2, 3, 5, 7, 8, 10 } },
+        { TR_NOOP ("Harmonic minor"), { 0, 2, 3, 5, 7, 8, 11 } },
+        { TR_NOOP ("Major pentatonic"), { 0, 2, 4, 7, 9 } },
+        { TR_NOOP ("Minor pentatonic"), { 0, 3, 5, 7, 10 } },
         { "Blues", { 0, 3, 5, 6, 7, 10 } },
-        { "Dorian", { 0, 2, 3, 5, 7, 9, 10 } },
-        { "Phrygian", { 0, 1, 3, 5, 7, 8, 10 } },
+        { TR_NOOP ("Dorian"), { 0, 2, 3, 5, 7, 9, 10 } },
+        { TR_NOOP ("Phrygian"), { 0, 1, 3, 5, 7, 8, 10 } },
     };
     return list;
 }
 
 const SnapOption snapOptions[] = {
-    { "No snap", 1 }, { "1/6 step", ticksPerStep / 6 }, { "1/4 step", ticksPerStep / 4 },
-    { "1/3 step", ticksPerStep / 3 }, { "1/2 step", ticksPerStep / 2 }, { "Step", ticksPerStep },
-    { "1/3 beat", ppq / 3 }, { "1/2 beat", ppq / 2 }, { "Beat", ppq }, { "Bar", 0 },
+    { TR_NOOP ("No snap"), 1 }, { TR_NOOP ("1/6 step"), ticksPerStep / 6 }, { TR_NOOP ("1/4 step"), ticksPerStep / 4 },
+    { TR_NOOP ("1/3 step"), ticksPerStep / 3 }, { TR_NOOP ("1/2 step"), ticksPerStep / 2 }, { TR_NOOP ("Step"), ticksPerStep },
+    { TR_NOOP ("1/3 beat"), ppq / 3 }, { TR_NOOP ("1/2 beat"), ppq / 2 }, { TR_NOOP ("Beat"), ppq }, { TR_NOOP ("Bar"), 0 },
 };
 constexpr int defaultSnap = 5;
 } // namespace
@@ -93,19 +94,19 @@ PianoRollComponent::PianoRollComponent (AudioEngine& e)
     }
 
     for (int i = 0; i < (int) std::size (snapOptions); ++i)
-        snapBox.addItem (utf8 (snapOptions[i].name), i + 1);
+        snapBox.addItem (tr (snapOptions[i].name), i + 1);
 
     snapBox.setSelectedItemIndex (defaultSnap, juce::dontSendNotification);
-    snapBox.setTooltip ("Piano Roll snap (grid); hold Alt while dragging to disable");
+    snapBox.setTooltip (tr ("Piano Roll snap (grid); hold Alt while dragging to disable"));
     snapBox.setWantsKeyboardFocus (false);
     snapBox.setMouseClickGrabsKeyboardFocus (false);
     snapBox.onChange = [this] { repaint(); };
     addAndMakeVisible (snapBox);
 
     for (int i = 0; i < (int) chords().size(); ++i)
-        chordBox.addItem (utf8 (chords()[(std::size_t) i].name), i + 1);
+        chordBox.addItem (tr (chords()[(std::size_t) i].name), i + 1);
     chordBox.setSelectedId (1, juce::dontSendNotification);
-    chordBox.setTooltip (utf8 ("Clicking creates this chord (the clicked note is the root)"));
+    chordBox.setTooltip (tr ("Clicking creates this chord (the clicked note is the root)"));
 
     // scale: root x type
     static const char* noteNames[] = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
@@ -113,21 +114,22 @@ PianoRollComponent::PianoRollComponent (AudioEngine& e)
     {
         if (s == 0)
         {
-            scaleBox.addItem (utf8 (scales()[0].name), 1);
+            scaleBox.addItem (tr (scales()[0].name), 1);
             continue;
         }
 
         for (int root = 0; root < 12; ++root)
-            scaleBox.addItem (juce::String (noteNames[root]) + " " + utf8 (scales()[(std::size_t) s].name), s * 100 + root + 1);
+            scaleBox.addItem (tr ("{0} {1}", { juce::String (noteNames[root]), tr (scales()[(std::size_t) s].name) }), s * 100 + root + 1);
     }
     scaleBox.setSelectedId (1, juce::dontSendNotification);
-    scaleBox.setTooltip (utf8 ("Highlights the notes of a scale"));
+    scaleBox.setTooltip (tr ("Highlights the notes of a scale"));
 
     slideButton.setClickingTogglesState (true);
-    slideButton.setTooltip (utf8 ("New notes are \"slide\" notes: the currently sounding note glides to them (808 glide)"));
+    slideButton.setTooltip (tr ("New notes are \"slide\" notes: the currently sounding note glides to them (808 glide)"));
     slideButton.setWantsKeyboardFocus (false);
     slideButton.setMouseClickGrabsKeyboardFocus (false);
-    slideButton.setColour (juce::TextButton::buttonOnColourId, theme::accentOrange.darker (0.2f));
+    slideButton.setButtonText (tr ("Slide"));
+    slideButton.setColour (juce::TextButton::buttonOnColourId, theme::colour::accent);
     addAndMakeVisible (slideButton);
 
     for (auto* box : { &chordBox, &scaleBox })
@@ -138,25 +140,28 @@ PianoRollComponent::PianoRollComponent (AudioEngine& e)
         addAndMakeVisible (box);
     }
 
-    laneBox.addItem ("Velocity", 1);
-    laneBox.addItem ("Pan", 2);
-    laneBox.addItem (utf8 ("Fine pitch"), 3);
+    laneBox.addItem (tr ("Velocity"), 1);
+    laneBox.addItem (tr ("Pan"), 2);
+    laneBox.addItem (tr ("Fine pitch"), 3);
+    laneBox.setTooltip (tr ("What the bottom lane edits"));
     laneBox.setSelectedId (1, juce::dontSendNotification);
     laneBox.setWantsKeyboardFocus (false);
     laneBox.setMouseClickGrabsKeyboardFocus (false);
     laneBox.onChange = [this] { repaint(); };
     addAndMakeVisible (laneBox);
 
-    midiButton.setTooltip (utf8 ("Import a .mid into this channel or export the pattern"));
+    midiButton.setTooltip (tr ("Import a .mid into this channel or export the pattern"));
     midiButton.setWantsKeyboardFocus (false);
     midiButton.setMouseClickGrabsKeyboardFocus (false);
     midiButton.onClick = [this] { showMidiMenu(); };
     addAndMakeVisible (midiButton);
 
-    hintLabel.setFont (juce::FontOptions (11.0f));
-    hintLabel.setColour (juce::Label::textColourId, theme::text.withAlpha (0.45f));
-    hintLabel.setText (utf8 ("Ctrl+drag selects · Ctrl+click adds · Shift+drag copies · Del deletes · Ctrl+C/X/V copy · "
-                             "Ctrl+B duplicate · Ctrl+Q quantize · Ctrl+M mute · Ctrl+P porta · arrows move (Shift = octave)"),
+    hintLabel.setFont (theme::font (theme::type::caption));
+    hintLabel.setColour (juce::Label::textColourId, theme::colour::textDisabled.brighter (0.2f));
+    hintLabel.setJustificationType (juce::Justification::centredLeft);
+    hintLabel.setMinimumHorizontalScale (1.0f);
+    hintLabel.setText (tr ("Ctrl+drag selects · Ctrl+click adds · Shift+drag copies · Del deletes · Ctrl+C/X/V copy · "
+                           "Ctrl+B duplicate · Ctrl+Q quantize · Ctrl+M mute · Ctrl+P porta · arrows move (Shift = octave)"),
                        juce::dontSendNotification);
     hintLabel.setInterceptsMouseClicks (false, false);
     addAndMakeVisible (hintLabel);
@@ -237,12 +242,16 @@ void PianoRollComponent::updateScrollBars()
 
 void PianoRollComponent::resized()
 {
-    snapBox.setBounds (keyboardWidth + 4, 3, 130, toolbarHeight - 6);
-    midiButton.setBounds (snapBox.getRight() + 6, 3, 50, toolbarHeight - 6);
-    slideButton.setBounds (midiButton.getRight() + 6, 3, 50, toolbarHeight - 6);
-    chordBox.setBounds (slideButton.getRight() + 6, 3, 90, toolbarHeight - 6);
-    scaleBox.setBounds (chordBox.getRight() + 6, 3, 170, toolbarHeight - 6);
-    hintLabel.setBounds (scaleBox.getRight() + 10, 0, getWidth() - scaleBox.getRight() - 14, toolbarHeight);
+    const auto h = toolbarHeight - 6;
+    snapBox.setBounds (keyboardWidth + 4, 3, 120, h);
+    midiButton.setBounds (snapBox.getRight() + 4, 3, 50, h);
+    slideButton.setBounds (midiButton.getRight() + 4, 3, 56, h);
+    chordBox.setBounds (slideButton.getRight() + 4, 3, 96, h);
+    scaleBox.setBounds (chordBox.getRight() + 4, 3, 180, h);
+    // the shortcut hint only shows when there is room for it (two small lines)
+    const auto hintArea = juce::Rectangle<int> (scaleBox.getRight() + 10, 0, getWidth() - scaleBox.getRight() - 14, toolbarHeight);
+    hintLabel.setBounds (hintArea);
+    hintLabel.setVisible (hintArea.getWidth() >= 320);
     laneBox.setBounds (2, velocityArea().getY() + 4, keyboardWidth - 4, 20);
     hBar.setBounds (keyboardWidth, getHeight() - scrollBarSize, getWidth() - keyboardWidth - scrollBarSize, scrollBarSize);
     vBar.setBounds (getWidth() - scrollBarSize, headerHeight, scrollBarSize,
@@ -355,9 +364,12 @@ void PianoRollComponent::paint (juce::Graphics& g)
     const auto bar = (std::int64_t) ppq * song.beatsPerBar;
     const auto snapGrid = gridTicks();
 
-    g.fillAll (theme::window);
-    g.setColour (theme::toolbar);
+    using namespace theme::colour;
+    g.fillAll (bg1);
+    g.setColour (bg3);
     g.fillRect (0, 0, getWidth(), toolbarHeight);
+    g.setColour (border);
+    g.fillRect (0, toolbarHeight - 1, getWidth(), 1);
 
     auto drawVerticalGrid = [&] (juce::Rectangle<int> area) {
         // grid lines: bar > beat > snap (unless too dense)
@@ -369,7 +381,7 @@ void PianoRollComponent::paint (juce::Graphics& g)
         {
             const auto tick = i * step;
             const auto x = (float) tickToX ((double) tick);
-            g.setColour (tick % bar == 0 ? juce::Colour (0xff15181b) : tick % ppq == 0 ? juce::Colour (0xff22272c) : juce::Colour (0xff2a2f35));
+            g.setColour (tick % bar == 0 ? gridBar : tick % ppq == 0 ? gridBeat : gridStep);
             g.drawVerticalLine ((int) x, (float) area.getY(), (float) area.getBottom());
         }
     };
@@ -386,15 +398,15 @@ void PianoRollComponent::paint (juce::Graphics& g)
             if (y > grid.getBottom() || y + rowHeight < grid.getY())
                 continue;
 
-            auto row = isBlackKey (key) ? juce::Colour (0xff262b30) : juce::Colour (0xff30363d);
+            auto row = isBlackKey (key) ? rowBlack : rowWhite;
             if (inScale (key))
-                row = row.interpolatedWith (theme::accentBlue, 0.12f);
+                row = row.interpolatedWith (info, 0.10f);
             g.setColour (row);
             g.fillRect (grid.getX(), y, grid.getWidth(), rowHeight);
 
             if (key % 12 == 0)
             {
-                g.setColour (juce::Colour (0xff1a1d21));
+                g.setColour (gridBeat);
                 g.drawHorizontalLine (y + rowHeight - 1, (float) grid.getX(), (float) grid.getRight());
             }
         }
@@ -403,7 +415,7 @@ void PianoRollComponent::paint (juce::Graphics& g)
 
         // outside the pattern is darkened
         const auto endX = (float) tickToX ((double) patternLength);
-        g.setColour (juce::Colours::black.withAlpha (0.35f));
+        g.setColour (bg0.withAlpha (0.55f));
         g.fillRect (juce::Rectangle<float> (endX, (float) grid.getY(), (float) grid.getRight() - endX, (float) grid.getHeight()));
 
         // ghost notes
@@ -414,7 +426,7 @@ void PianoRollComponent::paint (juce::Graphics& g)
 
             const auto r = juce::Rectangle<float> ((float) tickToX ((double) n.start), (float) keyToY (n.key) + 1,
                                                    (float) (n.length * pixelsPerTick), (float) rowHeight - 2);
-            g.setColour (juce::Colours::white.withAlpha (0.08f));
+            g.setColour (textPrimary.withAlpha (0.07f));
             g.fillRoundedRectangle (r, 2.0f);
         }
 
@@ -428,14 +440,14 @@ void PianoRollComponent::paint (juce::Graphics& g)
             const auto selected = isSelected (i);
             const auto r = juce::Rectangle<float> ((float) tickToX ((double) n.start), (float) keyToY (n.key) + 1,
                                                    juce::jmax (4.0f, (float) (n.length * pixelsPerTick) - 1.0f), (float) rowHeight - 2);
-            g.setColour (selected ? juce::Colour (0xffff6f6f) : n.muted ? juce::Colour (0xff6a6f75) : theme::noteColour (n.velocity));
+            g.setColour (selected ? accentHover.brighter (0.15f) : n.muted ? noteMuted : theme::noteColour (n.velocity));
             g.fillRoundedRectangle (r, 2.5f);
-            g.setColour (selected ? juce::Colours::white : juce::Colours::black.withAlpha (0.5f));
-            g.drawRoundedRectangle (r, 2.5f, selected ? 1.5f : 1.0f);
+            g.setColour (selected ? textPrimary : bg0.withAlpha (0.6f));
+            g.drawRoundedRectangle (r, 2.5f, 1.0f);
 
             if (n.porta) // porta: slanted stroke at the start, like the glide
             {
-                g.setColour (juce::Colours::black.withAlpha (0.6f));
+                g.setColour (bg0.withAlpha (0.65f));
                 g.drawLine (r.getX() + 2.0f, r.getBottom() - 2.0f, r.getX() + 9.0f, r.getY() + 2.0f, 2.0f);
             }
 
@@ -443,29 +455,29 @@ void PianoRollComponent::paint (juce::Graphics& g)
             {
                 juce::Path arrow;
                 arrow.addTriangle (r.getX() + 2.0f, r.getBottom() - 2.0f, r.getX() + 2.0f, r.getY() + 2.0f, r.getX() + 9.0f, r.getCentreY());
-                g.setColour (juce::Colours::black.withAlpha (0.6f));
+                g.setColour (bg0.withAlpha (0.65f));
                 g.fillPath (arrow);
             }
 
             if (r.getWidth() > 30)
             {
-                g.setColour (juce::Colours::black.withAlpha (0.7f));
-                g.setFont (juce::FontOptions (10.0f));
+                g.setColour (bg0.withAlpha (0.8f));
+                g.setFont (theme::font (10.0f));
                 g.drawText (keyName (n.key), r.reduced (n.slide ? 11 : 3, 0), juce::Justification::centredLeft, false);
             }
         }
 
         if (! rubberBand.isEmpty())
         {
-            g.setColour (theme::accentBlue.withAlpha (0.15f));
+            g.setColour (selectionFill);
             g.fillRect (rubberBand);
-            g.setColour (theme::accentBlue);
+            g.setColour (theme::colour::selection);
             g.drawRect (rubberBand);
         }
 
         if (playheadTick >= 0.0)
         {
-            g.setColour (theme::playhead);
+            g.setColour (playhead);
             g.drawVerticalLine ((int) tickToX (playheadTick), (float) grid.getY(), (float) grid.getBottom());
         }
     }
@@ -473,12 +485,12 @@ void PianoRollComponent::paint (juce::Graphics& g)
     // --- velocity lane -----------------------------------------------------
     {
         const auto lane = velocityArea();
-        g.setColour (juce::Colour (0xff23272c));
+        g.setColour (bg0);
         g.fillRect (lane);
         juce::Graphics::ScopedSaveState state (g);
         g.reduceClipRegion (lane);
         drawVerticalGrid (lane);
-        g.setColour (juce::Colour (0xff15181b));
+        g.setColour (border);
         g.drawHorizontalLine (lane.getY(), (float) lane.getX(), (float) lane.getRight());
 
         const auto usable = (float) lane.getHeight() - 8.0f;
@@ -487,7 +499,7 @@ void PianoRollComponent::paint (juce::Graphics& g)
 
         if (bipolar)
         {
-            g.setColour (theme::text.withAlpha (0.15f));
+            g.setColour (textPrimary.withAlpha (0.15f));
             g.drawHorizontalLine ((int) base, (float) lane.getX(), (float) lane.getRight());
         }
 
@@ -500,9 +512,9 @@ void PianoRollComponent::paint (juce::Graphics& g)
 
             const auto x = (float) tickToX ((double) n.start);
             const auto top = (float) lane.getBottom() - 2.0f - usable * laneValue (n);
-            auto colour = isSelected (i) ? juce::Colour (0xffff6f6f) : theme::noteColour (n.velocity);
+            auto colour = isSelected (i) ? accentHover.brighter (0.15f) : theme::noteColour (n.velocity);
             if (n.muted)
-                colour = juce::Colours::grey;
+                colour = noteMuted;
             g.setColour (colour.withAlpha (0.8f));
             g.fillRect (juce::Rectangle<float> (x, juce::jmin (top, base), 2.0f, std::abs (base - top)));
             g.fillEllipse (x - 3.0f, top - 3.0f, 7.0f, 7.0f);
@@ -512,11 +524,13 @@ void PianoRollComponent::paint (juce::Graphics& g)
     // --- time ruler --------------------------------------------------------
     {
         const auto ruler = juce::Rectangle<int> (keyboardWidth, toolbarHeight, grid.getWidth(), timelineHeight);
-        g.setColour (theme::toolbar.darker (0.15f));
+        g.setColour (bg2);
         g.fillRect (ruler);
+        g.setColour (border);
+        g.fillRect (ruler.withTop (ruler.getBottom() - 1));
         juce::Graphics::ScopedSaveState state (g);
         g.reduceClipRegion (ruler);
-        g.setFont (juce::FontOptions (12.0f));
+        g.setFont (theme::font (theme::type::caption));
 
         const auto firstBar = (std::int64_t) std::floor (scrollTicks / (double) bar);
         const auto lastBar = (std::int64_t) std::ceil (xToTick (grid.getRight()) / (double) bar);
@@ -524,7 +538,7 @@ void PianoRollComponent::paint (juce::Graphics& g)
         for (auto b = firstBar; b <= lastBar; ++b)
         {
             const auto x = (int) tickToX ((double) (b * bar));
-            g.setColour (theme::text.withAlpha (0.7f));
+            g.setColour (textSecondary);
             g.drawVerticalLine (x, (float) toolbarHeight + 10.0f, (float) headerHeight);
             g.drawText (juce::String (b + 1), x + 3, toolbarHeight + 2, 40, timelineHeight - 4, juce::Justification::centredLeft);
         }
@@ -534,7 +548,7 @@ void PianoRollComponent::paint (juce::Graphics& g)
             const auto x = (float) tickToX (playheadTick);
             juce::Path tri;
             tri.addTriangle (x - 5, (float) toolbarHeight, x + 5, (float) toolbarHeight, x, (float) toolbarHeight + 8);
-            g.setColour (theme::playhead);
+            g.setColour (playhead);
             g.fillPath (tri);
         }
     }
@@ -544,7 +558,9 @@ void PianoRollComponent::paint (juce::Graphics& g)
         const auto keys = juce::Rectangle<int> (0, headerHeight, keyboardWidth, grid.getHeight());
         juce::Graphics::ScopedSaveState state (g);
         g.reduceClipRegion (keys);
-        g.setFont (juce::FontOptions (10.0f));
+        g.setFont (theme::font (10.0f));
+        g.setColour (bg0);
+        g.fillRect (keys);
 
         for (int key = 0; key < 128; ++key)
         {
@@ -555,14 +571,14 @@ void PianoRollComponent::paint (juce::Graphics& g)
 
             const auto black = isBlackKey (key);
             const auto pressed = key == previewKey;
-            g.setColour (pressed ? theme::accentOrange : black ? juce::Colour (0xff1c1c1c) : juce::Colour (0xffdedede));
-            g.fillRect (0, y, black ? keyboardWidth * 2 / 3 : keyboardWidth, rowHeight);
-            g.setColour (juce::Colour (0xff888888));
-            g.drawHorizontalLine (y + rowHeight - 1, 0.0f, (float) keyboardWidth);
+            g.setColour (pressed ? accent : black ? keyBlack : keyWhite);
+            g.fillRect (0, y, black ? keyboardWidth * 2 / 3 : keyboardWidth - 1, rowHeight);
+            g.setColour (black ? bg0 : keyWhite.darker (0.35f));
+            g.drawHorizontalLine (y + rowHeight - 1, 0.0f, (float) (black ? keyboardWidth * 2 / 3 : keyboardWidth - 1));
 
             if (key % 12 == 0)
             {
-                g.setColour (juce::Colours::black);
+                g.setColour (pressed ? onAccent : bg1);
                 g.drawText (keyName (key), keyboardWidth - 30, y, 28, rowHeight, juce::Justification::centredRight);
             }
         }
@@ -571,21 +587,29 @@ void PianoRollComponent::paint (juce::Graphics& g)
     // velocity lane label
     {
         const auto lane = velocityArea();
-        g.setColour (theme::toolbar);
+        g.setColour (bg2);
         g.fillRect (0, lane.getY(), keyboardWidth, lane.getHeight());
         juce::ignoreUnused (lane); // the property combo sits here
     }
 
     // top-left corner: channel name
-    g.setColour (theme::toolbar);
-    g.fillRect (0, 0, keyboardWidth, headerHeight);
+    g.setColour (bg3);
+    g.fillRect (0, 0, keyboardWidth, toolbarHeight);
+    g.setColour (bg2);
+    g.fillRect (0, toolbarHeight, keyboardWidth, timelineHeight);
+    g.setColour (border);
+    g.fillRect (0, headerHeight - 1, keyboardWidth, 1);
+    g.fillRect (keyboardWidth - 1, 0, 1, headerHeight);
 
     if (channel < (int) song.channels.size())
     {
-        g.setColour (theme::accentOrange);
-        g.setFont (juce::FontOptions (11.0f));
-        g.drawFittedText (juce::String::fromUTF8 (song.channels[(std::size_t) channel].name.c_str()), 4, 0, keyboardWidth - 6,
-                          headerHeight, juce::Justification::centredLeft, 2);
+        const auto& ch = song.channels[(std::size_t) channel];
+        g.setColour (ch.colour != 0 ? theme::tame (juce::Colour (ch.colour)) : accent);
+        g.fillRoundedRectangle (4.0f, (float) toolbarHeight + 5.0f, 3.0f, (float) timelineHeight - 10.0f, 1.0f);
+        g.setColour (textPrimary);
+        g.setFont (theme::font (theme::type::caption, true));
+        g.drawFittedText (juce::String::fromUTF8 (ch.name.c_str()), 11, toolbarHeight, keyboardWidth - 14, timelineHeight,
+                          juce::Justification::centredLeft, 1, 0.8f);
     }
 }
 
@@ -1163,8 +1187,8 @@ bool PianoRollComponent::handleKey (const juce::KeyPress& key)
 void PianoRollComponent::showMidiMenu()
 {
     juce::PopupMenu menu;
-    menu.addItem (utf8 ("Import .mid into this channel..."), [this] {
-        chooser = std::make_unique<juce::FileChooser> ("Import MIDI", juce::File(), "*.mid;*.midi");
+    menu.addItem (tr ("Import .mid into this channel..."), [this] {
+        chooser = std::make_unique<juce::FileChooser> (tr ("Import MIDI"), juce::File(), "*.mid;*.midi");
         chooser->launchAsync (juce::FileBrowserComponent::openMode | juce::FileBrowserComponent::canSelectFiles, [this] (const juce::FileChooser& fc) {
             if (! fc.getResult().existsAsFile())
                 return;
@@ -1185,10 +1209,10 @@ void PianoRollComponent::showMidiMenu()
             scrollToNotes();
         });
     });
-    menu.addItem (utf8 ("Export pattern as .mid..."), [this] {
+    menu.addItem (tr ("Export pattern as .mid..."), [this] {
         const auto& song = engine.getSong();
         const auto name = juce::String::fromUTF8 (song.patterns[(std::size_t) song.currentPattern].name.c_str());
-        chooser = std::make_unique<juce::FileChooser> ("Export MIDI", juce::File::getSpecialLocation (juce::File::userMusicDirectory).getChildFile (name + ".mid"),
+        chooser = std::make_unique<juce::FileChooser> (tr ("Export MIDI"), juce::File::getSpecialLocation (juce::File::userMusicDirectory).getChildFile (name + ".mid"),
                                                        "*.mid");
         chooser->launchAsync (juce::FileBrowserComponent::saveMode | juce::FileBrowserComponent::warnAboutOverwriting, [this] (const juce::FileChooser& fc) {
             auto file = fc.getResult();