Ka1-S 1 месяц назад
Родитель
Сommit
c5cfe4e271

+ 6 - 0
src/core/KeyMap.cpp

@@ -1,4 +1,5 @@
 #include "core/KeyMap.h"
+#include "core/ModifierMap.h"
 
 #include <algorithm>
 #include <cctype>
@@ -340,6 +341,11 @@ bool Chord::isPrintable() const noexcept
     return key > ' ' && key < 0x7f;
 }
 
+std::string displayString (const Chord& c)
+{
+    return modmap::keyNames (toString (c), modmap::hostOs());
+}
+
 std::string toString (const Chord& c)
 {
     std::string out;

+ 3 - 0
src/core/KeyMap.h

@@ -51,6 +51,9 @@ struct Chord
 
 // "Ctrl+Shift+F4", "Alt+Up", "Numpad +", "Space"... (English key names, used in the JSON file and menus)
 std::string toString (const Chord& chord);
+// toString for the screen: on macOS with FL-for-Mac's key names (Ctrl -> ⌘, Alt -> ⌥; core/ModifierMap.h). The saved
+// keymap always uses toString.
+std::string displayString (const Chord& chord);
 std::optional<Chord> parseChord (const std::string& text);
 
 // Where a binding applies. Global bindings work everywhere; the others only while that panel has focus

+ 5 - 4
src/ui/AutomationUi.cpp

@@ -1,3 +1,4 @@
+#include "ui/FlMods.h"
 #include "ui/WindowOwner.h"
 #include "ui/AutomationUi.h"
 #include "core/LastTweaked.h"
@@ -271,7 +272,7 @@ public:
 
         const auto handle = hit < 0 ? handleAt (e.position) : -1;
 
-        if (e.mods.isPopupMenu())
+        if (flmods::popup (e.mods))
         {
             if (hit >= 0)
             {
@@ -367,7 +368,7 @@ public:
 
         if (tensionPoint >= 0 && tensionPoint < (int) a->points.size())
         {
-            const auto up = -(float) e.getDistanceFromDragStartY() / (e.mods.isCtrlDown() ? 400.0f : 100.0f);
+            const auto up = -(float) e.getDistanceFromDragStartY() / (flmods::ctrl (e.mods) ? 400.0f : 100.0f);
             const auto tension = juce::jlimit (-1.0f, 1.0f, tensionStart + tensionSign * up); // the segment follows the mouse
             edit ([i = tensionPoint, tension] (Automation& x) { x.points[(std::size_t) i].tension = tension; });
             return;
@@ -387,7 +388,7 @@ public:
         // locks: Shift pressed after the click keeps the time, Ctrl keeps the value
         if (e.mods.isShiftDown() && ! downMods.isShiftDown())
             tick = points[(std::size_t) dragPoint].tick;
-        if (e.mods.isCtrlDown() && ! downMods.isCtrlDown())
+        if (flmods::ctrl (e.mods) && ! flmods::ctrl (downMods))
             value = points[(std::size_t) dragPoint].value;
 
         edit ([i = dragPoint, tick, value] (Automation& x) {
@@ -406,7 +407,7 @@ public:
 
     void mouseWheelMove (const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel) override
     {
-        if (e.mods.isCtrlDown())
+        if (flmods::ctrl (e.mods))
         {
             const auto anchor = xToTick (e.x);
             juce::ignoreUnused (anchor);

+ 32 - 21
src/ui/ChannelRackComponent.cpp

@@ -1,3 +1,5 @@
+#include "core/RackFilter.h"
+#include "ui/FlMods.h"
 #include "ui/EditorTools.h"
 #include "core/FruityDance.h"
 #include "core/VideoPlayer.h"
@@ -193,13 +195,12 @@ int ChannelRackComponent::shownSteps() const
 
 bool ChannelRackComponent::isShown (int row) const
 {
-    const auto& channels = engine.getSong().channels;
-    return filterGroup < 0 || row < 0 || row >= (int) channels.size() || channels[(std::size_t) row].group == filterGroup;
+    return rackfilter::shows (engine.getSong(), row, filterGroup);
 }
 
 int ChannelRackComponent::visibleIndex (int row) const
 {
-    if (filterGroup < 0)
+    if (filterGroup == rackfilter::all)
         return row;
 
     int index = 0;
@@ -215,8 +216,7 @@ int ChannelRackComponent::shownCount() const
 
 void ChannelRackComponent::setFilterGroup (int group)
 {
-    const auto groups = (int) engine.getSong().channelGroups.size();
-    group = group >= 0 && group < groups ? group : -1;
+    group = rackfilter::clamp (engine.getSong(), group);
 
     if (group == filterGroup)
         return;
@@ -232,6 +232,10 @@ void ChannelRackComponent::setFilterGroup (int group)
 juce::String ChannelRackComponent::filterName() const
 {
     const auto& groups = engine.getSong().channelGroups;
+    if (filterGroup == rackfilter::audioClips)
+        return tr ("Audio clips");
+    if (filterGroup == rackfilter::unsorted)
+        return tr ("Unsorted");
     return filterGroup >= 0 && filterGroup < (int) groups.size() ? juce::String::fromUTF8 (groups[(std::size_t) filterGroup].c_str()) : tr ("All");
 }
 
@@ -239,13 +243,20 @@ void ChannelRackComponent::showFilterMenu (juce::Component* target)
 {
     const auto& song = engine.getSong();
     juce::PopupMenu menu;
-    menu.addItem (tr ("All"), true, filterGroup < 0, [this] { setFilterGroup (-1); });
-
-    if (! song.channelGroups.empty())
-        menu.addSeparator();
+    menu.addItem (tr ("All"), true, filterGroup == rackfilter::all, [this] { setFilterGroup (rackfilter::all); });
+    // FL's built-in views (round 168t, REA_rodada168t.md §3): the audio clip channels, and the channels in no group
+    menu.addItem (tr ("Unsorted"), true, filterGroup == rackfilter::unsorted, [this] { setFilterGroup (rackfilter::unsorted); });
+    menu.addItem (tr ("Audio clips"), true, filterGroup == rackfilter::audioClips, [this] { setFilterGroup (rackfilter::audioClips); });
 
+    bool separated = false;
     for (int g = 0; g < (int) song.channelGroups.size(); ++g)
+    {
+        if (rackfilter::isBuiltinName (song.channelGroups[(std::size_t) g]))
+            continue; // FL's own "Audio clips" / "Unsorted" groups: the two views above
+        if (! std::exchange (separated, true))
+            menu.addSeparator();
         menu.addItem (juce::String::fromUTF8 (song.channelGroups[(std::size_t) g].c_str()), true, filterGroup == g, [this, g] { setFilterGroup (g); });
+    }
 
     menu.addSeparator();
     menu.addItem (tr ("Group selected...") + "\tAlt+G", [this] { groupSelected(); });
@@ -364,7 +375,7 @@ int ChannelRackComponent::rowAtY (int y) const
 
     const auto index = (y - 4) / rowHeight;
 
-    if (filterGroup < 0)
+    if (filterGroup == rackfilter::all)
         return index;
 
     // the index-th shown row (the "add channel" row after the last one)
@@ -1144,7 +1155,7 @@ void ChannelRackComponent::clickSelector (int row, const juce::ModifierKeys& mod
 
     if (mods.isShiftDown())
         selection.extendTo (row);
-    else if (mods.isCtrlDown() || mods.isPopupMenu())
+    else if (flmods::ctrl (mods) || flmods::popup (mods))
         selection.toggle (row);
     else
         selection.selectOnly (row);
@@ -1726,7 +1737,7 @@ void ChannelRackComponent::mouseDown (const juce::MouseEvent& e)
 
         case Area::loop: // the advanced looping control: drag sets the loop point in steps, right-click its menu
         {
-            if (e.mods.isPopupMenu())
+            if (flmods::popup (e.mods))
             {
                 showLoopPointMenu (row);
                 return;
@@ -1767,7 +1778,7 @@ void ChannelRackComponent::mouseDown (const juce::MouseEvent& e)
         }
 
         case Area::mute:
-            if (e.mods.isPopupMenu() || e.mods.isCtrlDown())
+            if (flmods::popup (e.mods) || flmods::ctrl (e.mods))
                 solo (row);
             else
                 toggleMute (row);
@@ -1779,7 +1790,7 @@ void ChannelRackComponent::mouseDown (const juce::MouseEvent& e)
         {
             const auto spec = specFor (area, row);
 
-            if (e.mods.isPopupMenu())
+            if (flmods::popup (e.mods))
             {
                 juce::PopupMenu menu;
                 menu.addSectionHeader (spec.name + ": " + spec.text (valueOf (area, row)));
@@ -1820,7 +1831,7 @@ void ChannelRackComponent::mouseDown (const juce::MouseEvent& e)
         }
 
         case Area::name:
-            if (e.mods.isPopupMenu())
+            if (flmods::popup (e.mods))
             {
                 if (! std::binary_search (engine.getSelectedChannels().begin(), engine.getSelectedChannels().end(), row))
                     clickSelector (row, {});
@@ -1843,7 +1854,7 @@ void ChannelRackComponent::mouseDown (const juce::MouseEvent& e)
                 selectRows ({ row }, row);
             }
 
-            if (e.mods.isCtrlDown()) // audition without opening anything
+            if (flmods::ctrl (e.mods)) // audition without opening anything
             {
                 previews.press (row, 60, 0.8f); // stops on release
                 return;
@@ -1859,13 +1870,13 @@ void ChannelRackComponent::mouseDown (const juce::MouseEvent& e)
         case Area::select:
             clickSelector (row, e.mods);
 
-            if (e.mods.isPopupMenu()) // right-drag adds the rows it crosses
+            if (flmods::popup (e.mods)) // right-drag adds the rows it crosses
             {
                 selectDownRow = row;
                 selectDragAdds = true;
                 selectDragBase = engine.getSelectedChannels();
             }
-            else if (! e.mods.isShiftDown() && ! e.mods.isCtrlDown()) // left-drag selects a range
+            else if (! e.mods.isShiftDown() && ! flmods::ctrl (e.mods)) // left-drag selects a range
             {
                 selectDownRow = row;
                 selectDragAdds = false;
@@ -1881,7 +1892,7 @@ void ChannelRackComponent::mouseDown (const juce::MouseEvent& e)
 
             if (showsNotePreview (pattern, row, pianoRollView)) // the miniature opens the Piano Roll (steps would break the melody)
             {
-                if (! e.mods.isPopupMenu())
+                if (! flmods::popup (e.mods))
                 {
                     selectionAnchor = row;
                     selectRows ({ row }, row);
@@ -2032,9 +2043,9 @@ void ChannelRackComponent::mouseDoubleClick (const juce::MouseEvent& e)
         else
             engine.editSong ([row] (Song& s) { s.channels[(std::size_t) row].mixerTrack = s.claimFreeInsert(); });
     }
-    else if (area == Area::loop && ! e.mods.isPopupMenu())
+    else if (area == Area::loop && ! flmods::popup (e.mods))
         setLoopPoint (row, ChannelLoop::nextBar);
-    else if (area == Area::select && ! e.mods.isPopupMenu())
+    else if (area == Area::select && ! flmods::popup (e.mods))
         selectAll();
     // a double-click on a channel's name is two clicks, as in FL: its window opens and closes again (FL 2026, checked
     // round 165q F7). It no longer opens the Piano Roll — the hint promised that, but FL's channel button does not.

+ 2 - 1
src/ui/EditorTools.cpp

@@ -1,3 +1,4 @@
+#include "ui/FlMods.h"
 #include "ui/EditorTools.h"
 
 #include "core/NoteEdit.h"
@@ -426,7 +427,7 @@ GlobalGridBox::~GlobalGridBox()
 
 void GlobalGridBox::mouseDown (const juce::MouseEvent& e)
 {
-    if (e.mods.isPopupMenu())
+    if (flmods::popup (e.mods))
     {
         showDefaultLengthMenu (this);
         return;

+ 2 - 1
src/ui/EventEditor.cpp

@@ -1,3 +1,4 @@
+#include "ui/FlMods.h"
 #include "ui/EventEditor.h"
 #include "core/MidiControls.h"
 
@@ -448,7 +449,7 @@ public:
 
     void mouseWheelMove (const juce::MouseEvent& e, const juce::MouseWheelDetails& w) override
     {
-        if (e.mods.isCtrlDown())
+        if (flmods::ctrl (e.mods))
         {
             const auto at = xToTick (e.x);
             pixelsPerTick = juce::jlimit (2.0 / ticksPerStep, 80.0 / ticksPerStep, pixelsPerTick * (w.deltaY > 0 ? 1.2 : 1.0 / 1.2));

+ 6 - 4
src/ui/HintBar.cpp

@@ -1,3 +1,4 @@
+#include "ui/FlMods.h"
 #include "ui/HintBar.h"
 
 #include <cmath>
@@ -68,7 +69,8 @@ std::vector<Item> makeItems (const juce::String& text, const juce::Font& font, c
 
     for (const auto& segment : hintmarkup::parse (text.toStdString()))
     {
-        const auto value = juce::String::fromUTF8 (segment.value.c_str());
+        // macOS: FL-for-Mac key names (Ctrl -> ⌘, Alt -> ⌥), in the key caps and in the words (core/ModifierMap.h)
+        const auto value = flmods::keyNames (juce::String::fromUTF8 (segment.value.c_str()));
 
         if (segment.kind != hintmarkup::Segment::Kind::text)
         {
@@ -81,7 +83,7 @@ std::vector<Item> makeItems (const juce::String& text, const juce::Font& font, c
                              : juce::GlyphArrangement::getStringWidth (keyFont, value) + 8.0f;
             items.push_back (item);
             pendingGap = 0.0f;
-            consumed += value.length() + 2;
+            consumed += (int) segment.value.size() + 2;
             continue;
         }
 
@@ -259,7 +261,7 @@ juce::String plainHint (const juce::String& markup)
 {
     const std::vector<std::string> words { tr ("click").toStdString(), tr ("double-click").toStdString(), tr ("right-click").toStdString(),
                                            tr ("middle-click").toStdString(), tr ("wheel").toStdString() };
-    return juce::String::fromUTF8 (hintmarkup::plain (markup.toStdString(), words).c_str());
+    return flmods::keyNames (juce::String::fromUTF8 (hintmarkup::plain (markup.toStdString(), words).c_str()));
 }
 
 juce::String withMarkup (const juce::String& text)
@@ -361,7 +363,7 @@ constexpr int tipHeight = 20;
 
 void setQuickTip (juce::Component& c, const juce::String& name, const juce::String& shortcut)
 {
-    c.getProperties().set (quickTipProperty, shortcut.trim().isEmpty() ? name : name + "\t" + shortcut.trim());
+    c.getProperties().set (quickTipProperty, shortcut.trim().isEmpty() ? name : name + "\t" + flmods::keyNames (shortcut.trim()));
 }
 
 juce::String quickTipOf (const juce::Component& c)

+ 32 - 6
src/ui/MainComponent.cpp

@@ -251,7 +251,7 @@ MainComponent::MainComponent (AudioEngine& e, bool restoreUserSettings)
         b.setFlat (true);
         b.setOnColour (theme::colour::bg5);
         b.setIconColourWhenOn (theme::colour::textPrimary);
-        b.setTooltip (panelName (panel) + " (" + keys::toString (keyMap.chordsFor (panelAction (panel)).empty() ? keys::Chord {}
+        b.setTooltip (panelName (panel) + " (" + keys::displayString (keyMap.chordsFor (panelAction (panel)).empty() ? keys::Chord {}
                                                                                                           : keyMap.chordsFor (panelAction (panel)).front()) + ")\n"
                       + tr ("Click: show, focus or hide.  Right-click: show maximized"));
         b.onClick = [this, panel] { togglePanel (panel); };
@@ -585,6 +585,14 @@ MainComponent::MainComponent (AudioEngine& e, bool restoreUserSettings)
                 safe->engine.getPluginHost().startBackgroundScan();
         });
 
+    // round 168t (the YouTube review, 168d #9: "How do we get back to the playlist? Where is the playlist?"): the first
+    // three starts name the window buttons and their keys in the hint bar for a while
+    if (persistent)
+        juce::Timer::callAfterDelay (2500, [safe = juce::Component::SafePointer<MainComponent> (this)] {
+            if (safe != nullptr)
+                safe->showWindowsTip();
+        });
+
     // the keys a secondary window (tool, plugin, channel window) leaves unused run the global shortcuts, as in FL
     setSecondaryWindowKeyHandler ([safe = juce::Component::SafePointer<MainComponent> (this)] (const juce::KeyPress& key) {
         return safe != nullptr && safe->keyFromSecondaryWindow (key);
@@ -1399,7 +1407,7 @@ bool MainComponent::keyStateChanged (bool)
 juce::String MainComponent::shortcutText (const char* actionId) const
 {
     const auto& chords = keyMap.chordsFor (actionId);
-    return chords.empty() ? juce::String() : "\t" + juce::String (keys::toString (chords.front()));
+    return chords.empty() ? juce::String() : "\t" + juce::String (keys::displayString (chords.front()));
 }
 
 void MainComponent::setTypingPiano (bool on)
@@ -1409,7 +1417,7 @@ void MainComponent::setTypingPiano (bool on)
     typingPianoButton.setToggleState (on, juce::dontSendNotification);
     typingPianoButton.setTooltip ((on ? tr ("Typing keyboard as a piano: on (Z..M and Q..P play the selected channels)")
                                       : tr ("Typing keyboard as a piano: off (letter and number keys are shortcuts)"))
-                                  + juce::String (" (") + juce::String (keys::toString (keyMap.chordsFor ("view.typingPiano").empty() ? keys::Chord {}
+                                  + juce::String (" (") + juce::String (keys::displayString (keyMap.chordsFor ("view.typingPiano").empty() ? keys::Chord {}
                                                                                                                                  : keyMap.chordsFor ("view.typingPiano").front()))
                                   + ")");
 
@@ -1433,7 +1441,7 @@ void MainComponent::loadKeyMap()
 
     auto keyOf = [this] (const std::string& id) {
         const auto& chords = keyMap.chordsFor (id);
-        return chords.empty() ? juce::String() : juce::String (keys::toString (chords.front()));
+        return chords.empty() ? juce::String() : juce::String (keys::displayString (chords.front()));
     };
     pianoRoll.refreshToolKeys (keyOf);
     playlist.refreshToolKeys (keyOf);
@@ -1861,6 +1869,24 @@ void MainComponent::showPanel (Panel panel)
     refreshPanelButtons();
 }
 
+void MainComponent::showWindowsTip()
+{
+    const auto counter = PluginHost::settingsFolder().getChildFile ("windows-tip.txt");
+    const auto shown = counter.existsAsFile() ? counter.loadFileAsString().trim().getIntValue() : 0;
+    if (shown >= 3)
+        return;
+    counter.replaceWithText (juce::String (shown + 1));
+
+    auto key = [this] (Panel p) {
+        const auto chords = keyMap.chordsFor (panelAction (p));
+        return chords.empty() ? juce::String() : "[" + juce::String (keys::toString (chords.front())) + "] ";
+    };
+    ui::Hint hint;
+    hint.text = tr ("Windows: {0}Playlist  {1}Channel Rack  {2}Piano Roll  {3}Mixer  {4}Browser  (the buttons at the left of the toolbar; again: hide)",
+                    { key (Panel::playlist), key (Panel::channelRack), key (Panel::pianoRoll), key (Panel::mixer), key (Panel::browser) });
+    ui::postHint (hint, 15000);
+}
+
 void MainComponent::refreshPanelButtons()
 {
     for (int i = 0; i < workspace::panelCount; ++i)
@@ -3085,7 +3111,7 @@ juce::String MainComponent::keyMarkup (const char* actionId) const
         return {};
 
     // "Ctrl+Shift+S" -> "[Ctrl][Shift][S]"; a key name that is not markup stays as text
-    const auto text = juce::String (keys::toString (chords.front()));
+    const auto text = juce::String (keys::displayString (chords.front()));
     juce::String out;
 
     for (const auto& part : juce::StringArray::fromTokens (text, "+", ""))
@@ -5104,7 +5130,7 @@ std::unique_ptr<juce::Component> MainComponent::makeHelpContent (const keys::Key
                                     : b.context == keys::Context::pianoRoll   ? "Piano Roll"
                                                                                : "Channel Rack")
                      << ")";
-            functionKeys.push_back ({ juce::String (keys::toString (b.chord)), text });
+            functionKeys.push_back ({ juce::String (keys::displayString (b.chord)), text });
         }
 
     struct Sheet final : juce::Component

+ 1 - 0
src/ui/MainComponent.h

@@ -159,6 +159,7 @@ private:
     int fittedChannelCount = -1;
     void showPanel (Panel panel);
     void refreshPanelButtons();
+    void showWindowsTip(); // the first starts name the window buttons in the hint bar (round 168t)
     void saveLayoutAs();
     juce::PopupMenu layoutsMenu();
 

+ 19 - 18
src/ui/MixerComponent.cpp

@@ -1,3 +1,4 @@
+#include "ui/FlMods.h"
 #include "platform/Paths.h"
 #include "ui/ColourPicker.h"
 #include "ui/MixerComponent.h"
@@ -853,7 +854,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
     headerDragTrack = -1;
     headerDragged = false;
 
-    if (part == Part::add && e.mods.isPopupMenu())
+    if (part == Part::add && flmods::popup (e.mods))
     {
         // FL's "+" menu (round 166d [SHOT]): Add one / Add multiple...
         juce::PopupMenu menu;
@@ -913,7 +914,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
 
     if (part == Part::arm)
     {
-        if (e.mods.isPopupMenu()) // FL: "Record <insert> to" (round 167a); the input box keeps the input menu
+        if (flmods::popup (e.mods)) // FL: "Record <insert> to" (round 167a); the input box keeps the input menu
             mixerinput::chooseRecordTo (engine, t);
         else
             mixerinput::toggleArm (engine, t, this);
@@ -927,7 +928,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
         return;
     }
 
-    if (part == Part::meter && ! e.mods.isPopupMenu()) // clears the clip latch and the peak hold, and selects (as FL)
+    if (part == Part::meter && ! flmods::popup (e.mods)) // clears the clip latch and the peak hold, and selects (as FL)
     {
         for (int ch = 0; ch < 2; ++ch)
             if (const auto i = (std::size_t) t * 2 + (std::size_t) ch; i < levels.size())
@@ -935,7 +936,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
         repaint (meterArea (t).expanded (2));
     }
 
-    if (part == Part::route && e.mods.isPopupMenu())
+    if (part == Part::route && flmods::popup (e.mods))
     {
         showSendMenu (t);
         return;
@@ -944,7 +945,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
     if (part == Part::send)
     {
         const auto from = selected;
-        if (e.mods.isPopupMenu())
+        if (flmods::popup (e.mods))
         {
             juce::PopupMenu menu;
             const auto spec = specFor (Part::send, t);
@@ -971,7 +972,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
         return;
     }
 
-    if (part == Part::mute && (e.mods.isPopupMenu() || e.mods.isCtrlDown())) // solo on the same LED
+    if (part == Part::mute && (flmods::popup (e.mods) || flmods::ctrl (e.mods))) // solo on the same LED
     {
         soloExclusive (t);
         return;
@@ -997,7 +998,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
         return;
     }
 
-    if ((part == Part::body || part == Part::header || part == Part::meter) && ! e.mods.isPopupMenu() && (e.mods.isCtrlDown() || e.mods.isShiftDown()) && t > 0)
+    if ((part == Part::body || part == Part::header || part == Part::meter) && ! flmods::popup (e.mods) && (flmods::ctrl (e.mods) || e.mods.isShiftDown()) && t > 0)
     {
         auto s = selection;
         if (e.mods.isShiftDown())
@@ -1023,7 +1024,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
 
     if (part == Part::pan || part == Part::fader || part == Part::stereo)
     {
-        if (e.mods.isPopupMenu())
+        if (flmods::popup (e.mods))
         {
             ui::showValueMenu (*this, part == Part::stereo ? nullptr : &engine, specFor (part, t), valueOf (part, t),
                                [this, part, t] (double v) { setValue (part, t, v); });
@@ -1038,7 +1039,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
         }
     }
 
-    if (e.mods.isPopupMenu())
+    if (flmods::popup (e.mods))
     {
         showMenu (t);
         return;
@@ -1076,7 +1077,7 @@ void MixerStrips::mouseDown (const juce::MouseEvent& e)
             dragTrack = t;
             dragStartValue = part == Part::pan ? track.pan : track.volume;
 
-            if (part == Part::fader && ! e.mods.isCtrlDown()) // clicking the track jumps the fader there
+            if (part == Part::fader && ! flmods::ctrl (e.mods)) // clicking the track jumps the fader there
             {
                 const auto area = faderRail (t);
                 const auto capY = area.getBottom() - track.volume * (float) area.getHeight();
@@ -3732,7 +3733,7 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
             setEqFromGraph (eqPointBase - eqControl, e.getPosition());
             return;
         }
-        if (e.mods.isPopupMenu())
+        if (flmods::popup (e.mods))
             ui::showValueMenu (*this, &engine, specFor (eqControl, -1), valueOf (eqControl, -1), [this, eqControl] (double v) { setValue (eqControl, -1, v); });
         else if (ui::isResetClick (e))
             setValue (eqControl, -1, specFor (eqControl, -1).defaultValue);
@@ -3747,7 +3748,7 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
 
     if (track > 0 && armBounds().contains (e.getPosition()))
     {
-        if (e.mods.isPopupMenu()) // FL: "Record <insert> to" (round 167a)
+        if (flmods::popup (e.mods)) // FL: "Record <insert> to" (round 167a)
             mixerinput::chooseRecordTo (engine, track);
         else
             mixerinput::toggleArm (engine, track, this);
@@ -3763,7 +3764,7 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
 
     if (! s->empty() && fxSwitchBounds().contains (e.getPosition()))
     {
-        if (e.mods.isPopupMenu())
+        if (flmods::popup (e.mods))
             toggleAllWindows();
         else
         {
@@ -3799,7 +3800,7 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
 
         if (mixBounds (i).contains (e.getPosition()))
         {
-            if (e.mods.isPopupMenu())
+            if (flmods::popup (e.mods))
                 ui::showValueMenu (*this, &engine, specFor (mixParam, i), valueOf (mixParam, i), [this, i] (double v) { setValue (mixParam, i, v); });
             else if (ui::isResetClick (e))
             {
@@ -3816,7 +3817,7 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
             return;
         }
 
-        if (e.mods.isPopupMenu())
+        if (flmods::popup (e.mods))
             showSlotMenu (i);
         else if (ledBounds (i).contains (e.getPosition())) // LED: bypass
             engine.editSong ([t = track, i] (Song& song) {
@@ -3866,7 +3867,7 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
 
     if (vocoderSelected() && bandLevelsBounds().contains (e.getPosition()))
     {
-        if (e.mods.isPopupMenu())
+        if (flmods::popup (e.mods))
             showBandLevelMenu();
         else
         {
@@ -3884,7 +3885,7 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
 
     if (gateSelected() && gateStepsBounds().contains (e.getPosition()))
     {
-        if (e.mods.isPopupMenu())
+        if (flmods::popup (e.mods))
             showGatePatterns();
         else
         {
@@ -3896,7 +3897,7 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
 
     dragParam = knobAt (e.getPosition());
 
-    if (dragParam >= 0 && e.mods.isPopupMenu())
+    if (dragParam >= 0 && flmods::popup (e.mods))
     {
         const auto p = dragParam;
         ui::showValueMenu (*this, &engine, specFor (p, selectedSlot), valueOf (p, selectedSlot),

+ 26 - 21
src/ui/PianoRollComponent.cpp

@@ -1,3 +1,4 @@
+#include "ui/FlMods.h"
 #include "ui/PianoRollComponent.h"
 #include "core/KeyMap.h"
 #include "core/NoteNames.h"
@@ -1364,7 +1365,7 @@ void PianoRollComponent::mouseDown (const juce::MouseEvent& e)
         // zoom the time (drag up = zoom in, sideways = scroll)
         const auto onNotes = gridArea().contains (e.getPosition());
         const auto onRuler = e.y >= rulerTop && e.y < headerHeight && e.x >= keyboardWidth;
-        if (onKeyboard || (onNotes && e.mods.isCtrlDown() && ! e.mods.isAltDown()))
+        if (onKeyboard || (onNotes && flmods::ctrl (e.mods) && ! e.mods.isAltDown()))
         {
             beginKeyZoom (e);
             return;
@@ -1384,7 +1385,7 @@ void PianoRollComponent::mouseDown (const juce::MouseEvent& e)
 
     if (onKeyboard)
     {
-        if (e.mods.isCtrlDown()) // Ctrl+click / drag: selects the notes of a key (range)
+        if (flmods::ctrl (e.mods)) // Ctrl+click / drag: selects the notes of a key (range)
         {
             drag = Drag::keySelect;
             selectionBefore = e.mods.isShiftDown() ? selection : std::vector<int> {};
@@ -1406,8 +1407,12 @@ void PianoRollComponent::mouseDown (const juce::MouseEvent& e)
         return;
     }
 
-    // ruler: Ctrl+drag selects the notes in a time range
-    if (e.y >= rulerTop && e.y < headerHeight && e.x >= keyboardWidth && e.mods.isCtrlDown() && e.mods.isLeftButtonDown())
+    // ruler: a time-range drag selects the notes in it. FL 2026 (one ruler handler for the Piano roll and the Playlist,
+    // TimePanelMouseDown 0xe56bf0, REA_rodada168t.md): Ctrl+drag, a double click held and dragged, the Select tool, or
+    // a right-drag (on a Mac Cmd or Control: core/ModifierMap.h)
+    if (e.y >= rulerTop && e.y < headerHeight && e.x >= keyboardWidth
+        && ((e.mods.isLeftButtonDown() && (flmods::ctrl (e.mods) || e.getNumberOfClicks() >= 2 || tools.getTool() == EditTool::lasso))
+            || (e.mods.isRightButtonDown() && ! flmods::ctrl (e.mods))))
     {
         drag = Drag::rulerSelect;
         selectionBefore = e.mods.isShiftDown() ? selection : std::vector<int> {};
@@ -1471,7 +1476,7 @@ void PianoRollComponent::mouseDown (const juce::MouseEvent& e)
         return;
 
     // the selection's stretch handle: drag scales the selected notes in time from the selection's start
-    if (e.mods.isLeftButtonDown() && ! e.mods.isCtrlDown() && stretchHandle().expanded (2.0f).contains (e.position))
+    if (e.mods.isLeftButtonDown() && ! flmods::ctrl (e.mods) && stretchHandle().expanded (2.0f).contains (e.position))
     {
         const auto& notes = currentPattern (engine.getSong()).notes;
         dragIndices.clear();
@@ -1496,7 +1501,7 @@ void PianoRollComponent::mouseDown (const juce::MouseEvent& e)
     const auto tool = tools.getTool();
 
     // editable ghost notes (Ctrl+Alt+V): a left press on one switches to its channel and grabs the note there
-    if (hit < 0 && editGhosts && e.mods.isLeftButtonDown() && ! e.mods.isCtrlDown())
+    if (hit < 0 && editGhosts && e.mods.isLeftButtonDown() && ! flmods::ctrl (e.mods))
         if (const auto ghost = ghostAt (e.x, e.y); ghost >= 0)
         {
             engine.setSelectedChannel (currentPattern (engine.getSong()).notes[(std::size_t) ghost].channel);
@@ -1506,7 +1511,7 @@ void PianoRollComponent::mouseDown (const juce::MouseEvent& e)
         }
 
     // Zoom tool: right-click zooms out around the point (a click zooms in, a drag zooms to the range)
-    if (tool == EditTool::zoom && e.mods.isRightButtonDown() && ! e.mods.isCtrlDown())
+    if (tool == EditTool::zoom && e.mods.isRightButtonDown() && ! flmods::ctrl (e.mods))
     {
         zoomOut (e.x);
         return;
@@ -1544,7 +1549,7 @@ void PianoRollComponent::mouseDown (const juce::MouseEvent& e)
     }
 
     // every tool: Ctrl+click on a note adds/removes it from the selection; Ctrl+drag selects (Shift adds)
-    if (hit >= 0 && e.mods.isCtrlDown())
+    if (hit >= 0 && flmods::ctrl (e.mods))
     {
         auto s = selection;
 
@@ -1557,7 +1562,7 @@ void PianoRollComponent::mouseDown (const juce::MouseEvent& e)
         return;
     }
 
-    if ((hit < 0 && e.mods.isCtrlDown()) || tool == EditTool::lasso
+    if ((hit < 0 && flmods::ctrl (e.mods)) || tool == EditTool::lasso
         || (hit < 0 && e.mods.isShiftDown() && tool != EditTool::brush && tool != EditTool::drumPaint))
     {
         drag = Drag::select;
@@ -1759,7 +1764,7 @@ void PianoRollComponent::mouseDrag (const juce::MouseEvent& e)
         case Drag::keyZoom:
         {
             // up = taller keys (Ctrl: fine); the centre of the clicked key stays where it was
-            keyZoomDrag.move (e.y, e.mods.isCtrlDown());
+            keyZoomDrag.move (e.y, flmods::ctrl (e.mods));
             rowHeight = keyZoomDrag.height (keyZoomStartRow);
             scrollY = juce::jlimit (0, juce::jmax (0, rows.count * rowHeight - gridArea().getHeight()),
                                     rowFor (keyZoomKey) * rowHeight + rowHeight / 2 - (keyZoomCentreY - headerHeight));
@@ -1771,7 +1776,7 @@ void PianoRollComponent::mouseDrag (const juce::MouseEvent& e)
         case Drag::timeZoom:
         {
             const auto width = (double) juce::jmax (1, gridArea().getWidth());
-            timeZoomDrag.move (e.x, e.y, e.mods.isCtrlDown());
+            timeZoomDrag.move (e.x, e.y, flmods::ctrl (e.mods));
             pixelsPerTick = juce::jlimit (2.0 / ticksPerStep, 120.0 / ticksPerStep, width / timeZoomDrag.span);
             scrollTicks = juce::jmax (0.0, timeZoomDrag.centre - width * 0.5 / pixelsPerTick);
             updateScrollBars();
@@ -1984,7 +1989,7 @@ void PianoRollComponent::mouseDrag (const juce::MouseEvent& e)
             // locks: Shift pressed after the click keeps the pitch, Ctrl keeps the time
             if (e.mods.isShiftDown() && ! downMods.isShiftDown())
                 deltaKeys = rawKeys = 0;
-            if (e.mods.isCtrlDown() && ! downMods.isCtrlDown())
+            if (flmods::ctrl (e.mods) && ! flmods::ctrl (downMods))
                 deltaTicks = 0;
 
             const auto& current = currentPattern (engine.getSong()).notes[(std::size_t) dragNote];
@@ -2333,20 +2338,20 @@ void PianoRollComponent::updateCursor (juce::ModifierKeys mods)
     auto cursor = gesture::Cursor::normal;
 
     if (p.x < keyboardWidth && p.y >= headerHeight && p.y < gridArea().getBottom())
-        cursor = mods.isCtrlDown() ? gesture::Cursor::select : gesture::Cursor::point;
+        cursor = flmods::ctrl (mods) ? gesture::Cursor::select : gesture::Cursor::point;
     else if (velocityArea().contains (p))
         cursor = gesture::Cursor::draw;
-    else if (gridArea().contains (p) && hover.stretch && ! mods.isCtrlDown())
+    else if (gridArea().contains (p) && hover.stretch && ! flmods::ctrl (mods))
         cursor = gesture::Cursor::resizeH;
-    else if (gridArea().contains (p) && editGhosts && hover.note < 0 && hover.ghost >= 0 && ! mods.isCtrlDown())
+    else if (gridArea().contains (p) && editGhosts && hover.note < 0 && hover.ghost >= 0 && ! flmods::ctrl (mods))
         cursor = gesture::Cursor::move;
     else if (gridArea().contains (p))
     {
-        const gesture::Mods m { mods.isShiftDown(), mods.isCtrlDown(), mods.isAltDown() };
+        const gesture::Mods m { mods.isShiftDown(), flmods::ctrl (mods), mods.isAltDown() };
         const auto tool = tools.getTool();
         cursor = gesture::cursorFor (gesture::leftAction (tool, targetAt (hover), m, false), tool);
     }
-    else if (p.y >= rulerTop && p.y < headerHeight && p.x >= keyboardWidth && mods.isCtrlDown())
+    else if (p.y >= rulerTop && p.y < headerHeight && p.x >= keyboardWidth && flmods::ctrl (mods))
         cursor = gesture::Cursor::select;
 
     setMouseCursor (editorCursor (cursor));
@@ -2382,7 +2387,7 @@ ui::Hint PianoRollComponent::hintAt (juce::Point<int> p)
 
     if (p.y >= rulerTop && p.y < headerHeight && p.x >= keyboardWidth)
     {
-        hint.text = tr ("Ruler: [LMB] position  [Alt] no snap  [Ctrl][LMB] drag selects the notes in a time range  [Ctrl][Wheel] zoom  [Shift][Wheel] scroll");
+        hint.text = tr ("Ruler: [LMB] position  [Alt] no snap  [Ctrl][LMB], [RMB] or [2xLMB] drag selects the notes in a time range  [Ctrl][Wheel] zoom  [Shift][Wheel] scroll");
         return hint;
     }
 
@@ -2410,7 +2415,7 @@ ui::Hint PianoRollComponent::hintAt (juce::Point<int> p)
         return hint;
     }
 
-    const gesture::Mods m { mods.isShiftDown(), mods.isCtrlDown(), mods.isAltDown() };
+    const gesture::Mods m { mods.isShiftDown(), flmods::ctrl (mods), mods.isAltDown() };
     hint.text = actionHint (gesture::leftAction (tools.getTool(), targetAt (h), m, false), false);
     hint.value = h.note >= 0 ? noteValue (h.note) : keyName (h.key);
     return hint;
@@ -2418,7 +2423,7 @@ ui::Hint PianoRollComponent::hintAt (juce::Point<int> p)
 
 void PianoRollComponent::mouseDoubleClick (const juce::MouseEvent& e)
 {
-    if (! gridArea().contains (e.getPosition()) || e.mods.isRightButtonDown() || e.mods.isCtrlDown())
+    if (! gridArea().contains (e.getPosition()) || e.mods.isRightButtonDown() || flmods::ctrl (e.mods))
         return;
 
     // the first click of this double click created the note: that was drawing, not opening it
@@ -3283,7 +3288,7 @@ void PianoRollComponent::glideFrame()
 
 void PianoRollComponent::mouseWheelMove (const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel)
 {
-    const auto ctrl = e.mods.isCtrlDown(), alt = e.mods.isAltDown(), shift = e.mods.isShiftDown();
+    const auto ctrl = flmods::ctrl (e.mods), alt = e.mods.isAltDown(), shift = e.mods.isShiftDown();
     const auto overGrid = gridArea().contains (e.getPosition()) || velocityArea().contains (e.getPosition());
 
     // Alt+wheel: the velocity (or the lane's property) of the selected notes wherever the mouse is, with nothing

+ 2 - 1
src/ui/PianoRollComponent.h

@@ -5,6 +5,7 @@
 #include "core/NoteTools.h"
 #include "engine/AudioEngine.h"
 #include "ui/EditorTools.h"
+#include "ui/FlMods.h"
 #include "ui/NoteToolDialogs.h"
 #include "ui/ValueControl.h"
 #include "core/NoteEdit.h"
@@ -125,7 +126,7 @@ private:
         void mouseWheelMove (const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel) override
         {
             if (onStep && wheel.deltaY != 0.0f)
-                onStep (wheel.deltaY < 0 ? 1 : -1, e.mods.isCtrlDown());
+                onStep (wheel.deltaY < 0 ? 1 : -1, flmods::ctrl (e.mods));
         }
     };
 

+ 137 - 72
src/ui/PlaylistComponent.cpp

@@ -1,3 +1,5 @@
+#include "ui/FlMods.h"
+#include "core/RulerGestures.h"
 #include "ui/ColourPicker.h"
 #include "ui/ClipProperties.h"
 #include "ui/UiTrace.h"
@@ -1935,7 +1937,7 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
     {
         const auto onClips = gridArea().contains (e.getPosition());
         const auto onRuler = e.y >= rulerTop && e.y < headerHeight;
-        if (onClips && e.mods.isCtrlDown() && ! e.mods.isAltDown()) // FL: Ctrl+middle-drag = vertical zoom
+        if (onClips && flmods::ctrl (e.mods) && ! e.mods.isAltDown()) // FL: Ctrl+middle-drag = vertical zoom
         {
             drag = Drag::heightZoom;
             const auto track = yToTrack (e.y);
@@ -1990,7 +1992,7 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
 
         if (noteedit::isFoldedAway (engine.getSong(), track)) // a thin row of a folded group: only its menu
         {
-            if (e.mods.isPopupMenu())
+            if (flmods::popup (e.mods))
                 showTrackMenu (track);
             return;
         }
@@ -2005,7 +2007,7 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
         if (onArm || onInput)
         {
             const auto insert = trackmodes::armableInsert (engine.getSong(), track);
-            if (! e.mods.isPopupMenu() && insert > 0)
+            if (! flmods::popup (e.mods) && insert > 0)
             {
                 if (onArm)
                     mixerinput::toggleArm (engine, insert, this);
@@ -2016,9 +2018,9 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
             return;
         }
 
-        if (onLed && (e.mods.isPopupMenu() || e.mods.isCtrlDown()))
+        if (onLed && (flmods::popup (e.mods) || flmods::ctrl (e.mods)))
             engine.editSong ([track, count = numTracks()] (Song& s) { noteedit::soloTrack (s, track, count); });
-        else if (e.mods.isPopupMenu())
+        else if (flmods::popup (e.mods))
             showTrackMenu (track);
         else if (onLed)
             editTrack (track, [] (PlaylistTrack& t) { t.muted = ! t.muted; });
@@ -2031,7 +2033,7 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
         {
             // Ctrl+click adds / removes a track, Shift+click selects the tracks from the last clicked one (round 165m:
             // FL's track menu settings, e.g. Performance settings, apply to every selected track)
-            if (e.mods.isCtrlDown())
+            if (flmods::ctrl (e.mods))
             {
                 if (selectedTracks.empty() && currentTrack >= 0)
                     selectedTracks.push_back (currentTrack);
@@ -2054,61 +2056,102 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
         return;
     }
 
-    // ruler: click = position; Ctrl+drag = time selection (Ctrl+click or double click clears it)
+    // ruler, FL 2026's rules (core/RulerGestures.h, docs/analise/REA_rodada168t.md): click = position; Ctrl / Shift /
+    // double-click drag, the Select tool or a right-drag = time selection; Ctrl+right-drag or the Zoom tool = zoom to
+    // a range; Shift+drag moves the selection. On a Mac, FL's Ctrl is Cmd (or Control, which is not a right click here)
     if (e.y >= rulerTop && e.y < headerHeight && e.x >= headerWidth)
     {
-        if (e.mods.isPopupMenu())
+        const auto fl = flmods::of (e.mods);
+        const auto& song = engine.getSong();
+        const auto snapOn = ! e.mods.isAltDown();
+        const auto tick = juce::jmax<std::int64_t> (0, snap (xToTick (e.x), snapOn));
+        const auto markerHit = markerTagAt (e.x, e.y);
+
+        ruler::Press press;
+        press.mods = fl;
+        press.clicks = e.getNumberOfClicks();
+        press.tool = tools.getTool();
+        press.onMarkerTag = markerHit >= 0;
+        press.hasSelection = song.hasLoop();
+        press.insideSelection = song.hasLoop() && xToTick (e.x) >= (double) song.loopStart && xToTick (e.x) < (double) song.loopEnd;
+
+        loopAnchor = tick;
+        rulerDoubleDrag = false;
+        rulerMenuOnClick = false;
+
+        switch (ruler::press (press))
         {
-            showRulerMenu (e.x);
-            return;
-        }
+            case ruler::Action::markerMenu:
+                showRulerMenu (e.x);
+                return;
 
-        loopAnchor = juce::jmax<std::int64_t> (0, snap (xToTick (e.x), ! e.mods.isAltDown()));
+            case ruler::Action::zoomRange:
+                drag = Drag::zoomRange;
+                rubberBand = {};
+                return;
 
-        // FL 2026 [SHOT round 166e]: a double click held and dragged draws a time selection (as Ctrl+drag), selecting
-        // the clips in it, with the song position at its start; a double click released in place clears it
-        rulerDoubleDrag = false;
-        if (e.getNumberOfClicks() >= 2)
-        {
-            drag = Drag::loop;
-            rulerDoubleDrag = true;
-            return;
-        }
+            case ruler::Action::adjust:
+                drag = Drag::loop;
+                loopAnchor = ruler::adjustAnchor (song.loopStart, song.loopEnd, tick);
+                setTimeSelection (juce::jmin (loopAnchor, tick), juce::jmax (loopAnchor, tick));
+                return;
 
-        // Shift+drag inside the time selection moves it with what it holds (Ctrl+Shift: a copy)
-        if (const auto& song = engine.getSong(); e.mods.isShiftDown() && song.hasLoop() && xToTick (e.x) >= (double) song.loopStart
-                                                    && xToTick (e.x) < (double) song.loopEnd)
-        {
-            drag = Drag::timeMove;
-            timeMoveOriginals = song.playlist;
-            timeMoveFrom = song.loopStart;
-            timeMoveTo = song.loopEnd;
-            timeMoveAnchor = loopAnchor;
-            timeMoveCopy = e.mods.isCtrlDown();
-            return;
-        }
+            case ruler::Action::select:
+                drag = Drag::loop;
+                // FL 2026 [SHOT round 166e]: a double click held and dragged draws a time selection, with the song
+                // position at its start; released in place it clears it (as a Ctrl+click does)
+                rulerDoubleDrag = press.clicks >= 2 && ! fl.right;
+                // LYNX: a right click released in place with no selection opens the ruler menu (FL: does nothing)
+                rulerMenuOnClick = fl.right;
+                return;
 
-        if (e.mods.isCtrlDown())
-        {
-            drag = Drag::loop;
-            return;
-        }
+            case ruler::Action::markerSpan:
+            {
+                const auto from = song.markers()[(std::size_t) markerHit].tick;
+                auto to = juce::jmax (from, song.songLength());
+                for (const auto& m : song.markers())
+                    if (m.tick > from)
+                        to = juce::jmin (to, m.tick);
+                if (to > from)
+                    setTimeSelection (from, to);
+                return;
+            }
 
-        // a click on a marker's tag goes to the marker (FL), quantized while playing like any song jump
-        if (const auto hit = markerTagAt (e.x, e.y); hit >= 0)
-        {
-            const auto tick = engine.getSong().markers()[(std::size_t) hit].tick;
-            const auto waits = engine.getTransport().playing.load() && engine.quantizeSongJumps.load() > 0;
-            engine.jumpToMarker (hit);
-            if (! waits)
-                playheadTick = (double) tick;
-            repaint();
-            return;
+            case ruler::Action::moveSelection:
+                drag = Drag::timeShift;
+                timeMoveFrom = song.loopStart;
+                timeMoveTo = song.loopEnd;
+                timeMoveAnchor = tick;
+                return;
+
+            case ruler::Action::moveWithClips:
+                drag = Drag::timeMove;
+                timeMoveOriginals = song.playlist;
+                timeMoveFrom = song.loopStart;
+                timeMoveTo = song.loopEnd;
+                timeMoveAnchor = tick;
+                timeMoveCopy = false;
+                return;
+
+            case ruler::Action::marker:
+            {
+                // a click on a marker's tag goes to the marker (LYNX), quantized while playing like any song jump
+                const auto markerTick = song.markers()[(std::size_t) markerHit].tick;
+                const auto waits = engine.getTransport().playing.load() && engine.quantizeSongJumps.load() > 0;
+                engine.jumpToMarker (markerHit);
+                if (! waits)
+                    playheadTick = (double) markerTick;
+                repaint();
+                return;
+            }
+
+            case ruler::Action::seek:
+                break;
         }
 
         drag = Drag::seek;
-        seekTo (e.x, ! e.mods.isAltDown());
-        EditorGlobals::get().seekMark = (std::int64_t) juce::jmax (0.0, (double) snap (xToTick (e.x), ! e.mods.isAltDown()));
+        seekTo (e.x, snapOn);
+        EditorGlobals::get().seekMark = tick;
         return;
     }
 
@@ -2122,13 +2165,13 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
     // Performance mode (round 165m): while the song plays, a click on a clip of the performance zone launches it (the
     // button's release is the release of the Hold modes) and a right-click stops its track; Ctrl / Alt edit as usual
     if (const auto& song = engine.getSong(); hit >= 0 && song.mode == PlayMode::song && song.inPerformanceZone (song.playlist[(std::size_t) hit])
-                                            && engine.getTransport().playing.load() && ! e.mods.isCtrlDown() && ! e.mods.isAltDown())
+                                            && engine.getTransport().playing.load() && ! flmods::ctrl (e.mods) && ! e.mods.isAltDown())
     {
         const auto& clip = song.playlist[(std::size_t) hit];
         perf::Command c;
         c.track = clip.track;
         c.clipStart = clip.start;
-        c.type = e.mods.isPopupMenu() ? perf::Command::Type::stopTrack : perf::Command::Type::press;
+        c.type = flmods::popup (e.mods) ? perf::Command::Type::stopTrack : perf::Command::Type::press;
         engine.performanceCommand (c);
         if (c.type == perf::Command::Type::press)
         {
@@ -2140,7 +2183,7 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
     }
 
     // Ctrl+right-click on empty space: zoom to show everything; again: back to the previous view
-    if (e.mods.isRightButtonDown() && e.mods.isCtrlDown() && hit < 0)
+    if (e.mods.isRightButtonDown() && flmods::ctrl (e.mods) && hit < 0)
     {
         if (zoomBeforeAll > 0.0)
         {
@@ -2160,7 +2203,7 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
     }
 
     // the menu button in a clip's title strip
-    if (hit >= 0 && e.mods.isLeftButtonDown() && ! e.mods.isCtrlDown() && clipMenuButton (hit).contains (e.getPosition()))
+    if (hit >= 0 && e.mods.isLeftButtonDown() && ! flmods::ctrl (e.mods) && clipMenuButton (hit).contains (e.getPosition()))
     {
         showClipMenu (hit);
         return;
@@ -2272,7 +2315,7 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
     }
 
     // every tool: Ctrl+click on a clip adds/removes it from the selection; Ctrl+drag selects (Shift adds)
-    if (hit >= 0 && e.mods.isCtrlDown())
+    if (hit >= 0 && flmods::ctrl (e.mods))
     {
         auto s = selection;
 
@@ -2285,7 +2328,7 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
         return;
     }
 
-    if ((hit < 0 && e.mods.isCtrlDown()) || tool == EditTool::lasso
+    if ((hit < 0 && flmods::ctrl (e.mods)) || tool == EditTool::lasso
         || (hit < 0 && e.mods.isShiftDown() && tool != EditTool::brush))
     {
         drag = Drag::select;
@@ -2557,7 +2600,7 @@ void PlaylistComponent::mouseDrag (const juce::MouseEvent& e)
 
     if (drag == Drag::heightZoom)
     {
-        heightZoomDrag.move (e.y, e.mods.isCtrlDown());
+        heightZoomDrag.move (e.y, flmods::ctrl (e.mods));
         const auto height = heightZoomDrag.height (heightZoomStartHeight, 8, 640);
         setTrackZoom (trackZoomStart * (double) height / (double) heightZoomStartHeight, heightZoomTrackY);
         return;
@@ -2566,7 +2609,7 @@ void PlaylistComponent::mouseDrag (const juce::MouseEvent& e)
     if (drag == Drag::timeZoom)
     {
         const auto width = (double) juce::jmax (1, gridArea().getWidth());
-        timeZoomDrag.move (e.x, e.y, e.mods.isCtrlDown());
+        timeZoomDrag.move (e.x, e.y, flmods::ctrl (e.mods));
         pixelsPerTick = juce::jlimit (4.0 / (4 * ppq), 800.0 / (4 * ppq), width / timeZoomDrag.span);
         scrollTicks = juce::jmax (0.0, timeZoomDrag.centre - width * 0.5 / pixelsPerTick);
         zoomBeforeAll = 0.0;
@@ -2644,7 +2687,7 @@ void PlaylistComponent::mouseDrag (const juce::MouseEvent& e)
 
             if (e.mods.isShiftDown() && ! downMods.isShiftDown())
                 tick = points[(std::size_t) autoPoint].tick;
-            if (e.mods.isCtrlDown() && ! downMods.isCtrlDown())
+            if (flmods::ctrl (e.mods) && ! flmods::ctrl (downMods))
                 value = points[(std::size_t) autoPoint].value;
 
             engine.editSong ([a = c.automation, i = autoPoint, tick, value] (Song& s) {
@@ -2664,7 +2707,7 @@ void PlaylistComponent::mouseDrag (const juce::MouseEvent& e)
             if (a < 0 || a >= (int) song.automations.size() || autoPoint < 0 || autoPoint + 1 >= (int) song.automations[(std::size_t) a].points.size())
                 return;
             // the handle follows the mouse: a drag over the curve's height bends the segment fully (Ctrl: 4× finer)
-            const auto range = juce::jmax (30.0f, automationBody (song.playlist[(std::size_t) autoClip]).getHeight()) * (e.mods.isCtrlDown() ? 4.0f : 1.0f);
+            const auto range = juce::jmax (30.0f, automationBody (song.playlist[(std::size_t) autoClip]).getHeight()) * (flmods::ctrl (e.mods) ? 4.0f : 1.0f);
             const auto up = -(float) e.getDistanceFromDragStartY() / range;
             const auto tension = juce::jlimit (-1.0f, 1.0f, tensionStart + tensionSign * up);
             engine.editSong ([a, i = autoPoint, tension] (Song& s) { s.automations[(std::size_t) a].points[(std::size_t) i].tension = tension; });
@@ -2686,6 +2729,14 @@ void PlaylistComponent::mouseDrag (const juce::MouseEvent& e)
             return;
         }
 
+        case Drag::timeShift: // FL: Shift+drag on the ruler moves the time selection (its length kept)
+        {
+            const auto here = juce::jmax<std::int64_t> (0, snap (xToTick (e.x), snapOn));
+            const auto r = ruler::moved (timeMoveFrom, timeMoveTo, here - timeMoveAnchor);
+            setTimeSelection (r.from, r.to);
+            return;
+        }
+
         case Drag::seek:
         case Drag::listen:
             seekTo (e.x, snapOn);
@@ -2740,15 +2791,18 @@ void PlaylistComponent::mouseDrag (const juce::MouseEvent& e)
                 return;
 
             const auto area = gridArea();
-            rubberBand = juce::Rectangle<int> (e.getMouseDownPosition(), e.getPosition()).getIntersection (area);
 
-            if (drag == Drag::zoomRange)
+            if (drag == Drag::zoomRange) // a time range over the whole height (also when dragged on the ruler)
             {
-                rubberBand = rubberBand.withY (area.getY()).withHeight (area.getHeight());
+                const auto x0 = juce::jlimit (area.getX(), area.getRight(), juce::jmin (e.getMouseDownX(), e.x));
+                const auto x1 = juce::jlimit (area.getX(), area.getRight(), juce::jmax (e.getMouseDownX(), e.x));
+                rubberBand = juce::Rectangle<int>::leftTopRightBottom (x0, area.getY(), x1, area.getBottom());
                 repaint();
                 return;
             }
 
+            rubberBand = juce::Rectangle<int> (e.getMouseDownPosition(), e.getPosition()).getIntersection (area);
+
             const auto t0 = xToTick (rubberBand.getX()), t1 = xToTick (rubberBand.getRight());
             const auto tr0 = yToTrack (rubberBand.getY()), tr1 = yToTrack (rubberBand.getBottom());
             const auto& playlist = engine.getSong().playlist;
@@ -2993,6 +3047,10 @@ void PlaylistComponent::postDragHint()
         case Drag::knife: hint.text = tr ("Cutting along the line  [Alt] no snap"); break;
         case Drag::paint: hint.text = tr ("Painting clips  [Alt] no snap"); break;
         case Drag::timeMove: hint.text = tr ("Moving the time selection with its clips  [Alt] no snap"); break;
+        case Drag::timeShift:
+            hint.text = tr ("Moving the time selection  [Alt] no snap");
+            hint.value = position (song.loopStart) + " - " + position (song.loopEnd);
+            break;
         case Drag::seek:
             hint.text = tr ("Song position  [Alt] no snap");
             hint.value = position ((std::int64_t) playheadTick);
@@ -3046,9 +3104,15 @@ void PlaylistComponent::mouseUp (const juce::MouseEvent& e)
         setSelection (s);
     }
 
-    // Ctrl+click on the ruler without dragging clears the time selection (and so does a double click)
-    if (drag == Drag::loop && e.getDistanceFromDragStart() < 3)
+    // Ctrl+click on the ruler without dragging clears the time selection (and so does a double click); a right click
+    // in place keeps what it did (FL: moved the nearer edge) and, with no selection, opens LYNX's ruler menu
+    if (drag == Drag::loop && e.getDistanceFromDragStart() < 3 && ! flmods::of (downMods).right)
         setTimeSelection (0, 0);
+    else if (drag == Drag::loop && rulerMenuOnClick && ruler::isClick (e.getDistanceFromDragStartX(), e.getDistanceFromDragStartY()))
+    {
+        rulerMenuOnClick = false;
+        showRulerMenu (e.getMouseDownX());
+    }
     else if (drag == Drag::loop && rulerDoubleDrag && engine.getSong().hasLoop())
     {
         const auto start = (double) engine.getSong().loopStart;
@@ -3058,6 +3122,7 @@ void PlaylistComponent::mouseUp (const juce::MouseEvent& e)
             playheadTick = start;
     }
     rulerDoubleDrag = false;
+    rulerMenuOnClick = false;
 
     if (drag == Drag::listen)
         engine.stop();
@@ -4918,12 +4983,12 @@ void PlaylistComponent::updateCursor (juce::ModifierKeys mods)
         cursor = hover.led || hover.arrow || hover.arm || hover.input ? gesture::Cursor::point : gesture::Cursor::normal;
     else if (gridArea().contains (p))
     {
-        const gesture::Mods m { mods.isShiftDown(), mods.isCtrlDown(), mods.isAltDown() };
+        const gesture::Mods m { mods.isShiftDown(), flmods::ctrl (mods), mods.isAltDown() };
         const auto tool = tools.getTool();
         cursor = gesture::cursorFor (gesture::leftAction (tool, hover.target, m, true), tool);
     }
     else if (p.y >= rulerTop && p.y < headerHeight && p.x >= headerWidth)
-        cursor = mods.isCtrlDown() ? gesture::Cursor::select : gesture::Cursor::point;
+        cursor = flmods::ctrl (mods) ? gesture::Cursor::select : gesture::Cursor::point;
 
     setMouseCursor (editorCursor (cursor));
 }
@@ -4975,14 +5040,14 @@ ui::Hint PlaylistComponent::hintAt (juce::Point<int> p)
         if (const auto m = markerTagAt (p.x, p.y); m >= 0)
         {
             const auto& marker = song.markers()[(std::size_t) m];
-            hint.text = tr ("Marker: [LMB] jump to it (while playing: at the next Quantize song jumps step)  [RMB] action, rename, delete");
+            hint.text = tr ("Marker: [LMB] jump to it (while playing: at the next Quantize song jumps step)  [Ctrl][LMB] select up to the next marker  [RMB] action, rename, delete");
             hint.value = markerLabel (marker);
             if (const auto* action = markers::actionName (marker.isSignature() ? Marker::timeSignature : marker.action); *action != 0)
                 hint.value += " (" + tr (action) + ")";
             hint.hasMenu = true;
             return hint;
         }
-        hint.text = tr ("Ruler: [LMB] song position  [Ctrl][LMB] or [2xLMB] drag: time selection (loop)  [Shift][LMB] drag in it: move  [2xLMB] clear  [RMB] markers  [Alt] no snap");
+        hint.text = tr ("Ruler: [LMB] song position  [RMB] or [Ctrl][LMB] or [2xLMB] drag: time selection (loop)  [Shift][LMB] drag: move it  [Ctrl][RMB] drag: zoom  [RMB] click: menu  [Alt] no snap");
         hint.hasMenu = true;
         return hint;
     }
@@ -4990,7 +5055,7 @@ ui::Hint PlaylistComponent::hintAt (juce::Point<int> p)
     if (! gridArea().contains (p))
         return hint;
 
-    const gesture::Mods m { mods.isShiftDown(), mods.isCtrlDown(), mods.isAltDown() };
+    const gesture::Mods m { mods.isShiftDown(), flmods::ctrl (mods), mods.isAltDown() };
     hint.text = actionHint (gesture::leftAction (tools.getTool(), h.target, m, true), true);
 
     if (h.clip >= 0)
@@ -5228,7 +5293,7 @@ void PlaylistComponent::glideFrame()
 
 void PlaylistComponent::mouseWheelMove (const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel)
 {
-    const auto ctrl = e.mods.isCtrlDown(), alt = e.mods.isAltDown(), shift = e.mods.isShiftDown();
+    const auto ctrl = flmods::ctrl (e.mods), alt = e.mods.isAltDown(), shift = e.mods.isShiftDown();
 
     // Shift+wheel over a track header: moves the track up / down
     if (shift && ! ctrl && e.x < headerWidth && e.y >= headerHeight && wheel.deltaY != 0.0f)
@@ -5709,7 +5774,7 @@ void PatternPicker::mouseDown (const juce::MouseEvent& e)
     if (row.kind == ClipKind::pattern && row.index != engine.getSong().currentPattern)
         engine.editSong ([p = row.index] (Song& s) { s.currentPattern = p; }, false);
 
-    if (e.mods.isPopupMenu() && row.kind == ClipKind::pattern && onPatternMenu)
+    if (flmods::popup (e.mods) && row.kind == ClipKind::pattern && onPatternMenu)
         onPatternMenu();
 
     repaint();

+ 2 - 1
src/ui/PlaylistComponent.h

@@ -141,7 +141,7 @@ public:
     void showSongAfterOpen();
 
 private:
-    enum class Drag { none, move, resize, trimLeft, slip, erase, seek, loop, select, fadeIn, fadeOut, paint, muting, knife, zoomRange, listen, pan, timeMove, autoPoint, autoTension,
+    enum class Drag { none, move, resize, trimLeft, slip, erase, seek, loop, select, fadeIn, fadeOut, paint, muting, knife, zoomRange, listen, pan, timeMove, timeShift, autoPoint, autoTension,
                       trackResize, preview, trackZoom, heightZoom, timeZoom, perfLaunch, clipGain };
     // Performance mode (round 165m): the clip a click launched (its release goes with the mouse button)
     int perfTrack = -1;
@@ -321,6 +321,7 @@ private:
     static inline bool hasCopiedGain = false;
     // FL: a double click held on the ruler drags a time selection (as Ctrl+drag); released without moving it clears
     bool rulerDoubleDrag = false;
+    bool rulerMenuOnClick = false; // a right press on the ruler: the ruler menu if released in place (round 168t)
     juce::Rectangle<float> automationBody (const Clip& clip) const;
     int automationPointAt (int clip, juce::Point<int> p) const;
     bool isOnAutomationCurve (int clip, juce::Point<int> p) const;

+ 1 - 1
src/ui/ShortcutManager.cpp

@@ -67,7 +67,7 @@ juce::String contextName (keys::Context c)
     return {};
 }
 
-juce::String chordText (const keys::Chord& c) { return juce::String (keys::toString (c)); }
+juce::String chordText (const keys::Chord& c) { return juce::String (keys::displayString (c)); }
 
 // key caps: "Ctrl+Shift+F4" drawn as one rounded pill per chord; returns the width used
 int drawChord (juce::Graphics& g, const keys::Chord& chord, int x, int centreY, bool strong)

+ 1 - 0
tests/tests.cpp

@@ -16933,3 +16933,4 @@ TEST (fl_low_lifter_matches_fl_engine)
 #include "LoopStarter168bTests.inc"
 #include "Rec168kTests.inc"
 #include "MixPre167qTests.inc"
+#include "Sel168tTests.inc"