فهرست منبع

UI zoom: windows keep their title bar and close button on screen; Mixer EQ folds / effects panel scrolls when short; compact menus + Menu density option; Alt = no snap on the rulers; round doc

Ka1-S 1 ماه پیش
والد
کامیت
95b4d3e8a2

+ 43 - 0
docs/analise/REA_rodada163a.md

@@ -0,0 +1,43 @@
+# Round 163a (ui163) — UI zoom 150%, compact menus, Alt = no snap
+
+User feedback (2026-10-26, Windows, UI zoom 150%): windows "lost the ability to exit out", the Mixer's EQ sits on top
+of the effect slots when the window is short, menus waste vertical space, Alt-drag in the Playlist should be free
+(no snap).
+
+## 1. UI zoom 150% (and 125/175/200%)
+- [CODE] LYNX zooms with `juce::Desktop::setGlobalScaleFactor` (MainComponent::setToolbarLayout). JUCE keeps each
+  window's logical bounds, so at a higher zoom the windows grow in physical pixels: a 1600x900 main window becomes
+  2400x1350 at 150% on a 1920x1080 screen — its right end, with the close button, is off the screen. Tool / plugin /
+  editor windows centred on the main window (`setCentrePosition`, `centreWithSize`) that are taller than the
+  screen get a negative top: the native title bar is above the screen (only Esc closes them).
+- Fix: `fitWindowOnScreen` (ui/WindowOwner.cpp) shrinks a resizable window to its screen's work area (frame
+  included, respecting the resize limits) and moves it so the title bar and close button are on the screen
+  (rule in core/WindowFit.h, test `ui163_window_fit`). `keepAboveMainWindow` (called by every secondary window
+  when shown) applies it once; the main window applies it when revealed; a UI-scale change applies it to every
+  LYNX window 200 ms later.
+- Mixer: the effects panel (EffectsPanel) put its slots at fixed positions from the top and the EQ + output at
+  fixed positions from the bottom, so a short mixer (zoom 150% = 2/3 of the logical height) drew the EQ over the
+  slots. Now the EQ has a title bar (chevron + "EQ"); when the slots and the EQ don't both fit, the EQ folds to that
+  bar by itself (a folded EQ that still changes the sound shows "active"); clicking the bar folds / unfolds it by
+  hand; when even the folded layout doesn't fit, the panel sits in a viewport and scrolls. Snapshot
+  `-mixer163-<h>.png` at 450/560/680/820 px.
+
+## 2. Compact menus
+- [CODE] `LookAndFeel::getIdealPopupMenuItemSize` returned 26 px rows; JUCE asks the section-header height with
+  the same call (standard height −1) and adds half → 39 px headers; separators 9 px. The screenshot showed that.
+- Now (default "Compact"): 21 px rows, 19 px headers, 5 px separators, tighter widths (Windows 10/11 native menus
+  and FL are ~20–22 px at 100%). Options › General › "Menu density": Compact / Comfortable (the old sizes), saved
+  as `menuDensity` in the UI options. Snapshot `-menu163-compact.png` / `-menu163-comfortable.png`.
+- Settings pages: rows 28→26 px, gaps 8→5 px, section titles 28→24 px.
+
+## 3. Alt = no snap while dragging
+- [CODE] Already: Playlist clip move / resize / trim / slip / fades / paint / knife / time selection / time-move,
+  Piano Roll note move / resize / paint / knife / stretch / drum brush / ruler select, automation points.
+- Missing (fixed): scrubbing the song position on the Playlist ruler (and the Listen tool) always snapped; the
+  Piano Roll ruler had no click-to-position at all (FL: clicking the Piano Roll timeline moves the position).
+  Now both rulers follow the mouse, Alt = off the grid; Piano Roll in Song mode lands in the clip of the pattern
+  that plays (or its first clip) — `transportedit::patternSeekTarget`, test `ui163_piano_roll_ruler_seek`.
+- Hints: rulers and the seek / time-selection drags mention "[Alt] no snap".
+
+## Where I stopped
+- (kept current below)

+ 14 - 6
resources/i18n/pt-BR.txt

@@ -971,8 +971,8 @@ countries: br
 "Note: [LMB] drag moves  [Shift][LMB] copies  [2xLMB] properties  [RMB] deletes  [Alt][Wheel] velocity" = "Nota: [LMB] arrastar move  [Shift][LMB] copia  [2xLMB] propriedades  [RMB] apaga  [Alt][Wheel] velocity"
 "Point: [LMB] drag moves, then [Shift] keeps time, [Ctrl] keeps value  [RMB] deletes" = "Ponto: [LMB] arrastar move, depois [Shift] mantém o tempo, [Ctrl] mantém o valor  [RMB] apaga"
 "Point: [LMB] drag moves, then [Shift] keeps time, [Ctrl] keeps value  [RMB] menu" = "Ponto: [LMB] arrastar move, depois [Shift] mantém o tempo, [Ctrl] mantém o valor  [RMB] menu"
-"Ruler: [Ctrl][LMB] drag selects the notes in a time range  [Ctrl][Wheel] zoom  [Shift][Wheel] scroll" = "Régua: [Ctrl][LMB] arrastar seleciona as notas num trecho  [Ctrl][Wheel] zoom  [Shift][Wheel] rolar"
-"Ruler: [LMB] song position  [Ctrl][LMB] drag: time selection (loop)  [Shift][LMB] drag in it: move  [2xLMB] clear  [RMB] markers" = "Régua: [LMB] posição da música  [Ctrl][LMB] arrastar: seleção de tempo (loop)  [Shift][LMB] arrastar nela: move  [2xLMB] limpa  [RMB] marcadores"
+"Ruler: [LMB] position  [Alt] no snap  [Ctrl][LMB] drag selects the notes in a time range  [Ctrl][Wheel] zoom  [Shift][Wheel] scroll" = "Régua: [LMB] posição  [Alt] sem grade  [Ctrl][LMB] arrastar seleciona as notas num trecho  [Ctrl][Wheel] zoom  [Shift][Wheel] rolar"
+"Ruler: [LMB] song position  [Ctrl][LMB] drag: time selection (loop)  [Shift][LMB] drag in it: move  [2xLMB] clear  [RMB] markers  [Alt] no snap" = "Régua: [LMB] posição da música  [Ctrl][LMB] arrastar: seleção de tempo (loop)  [Shift][LMB] arrastar nela: move  [2xLMB] limpa  [RMB] marcadores  [Alt] sem grade"
 "Track: [LMB] mute / unmute  [Ctrl][LMB] or [RMB] solo" = "Faixa: [LMB] silencia / reativa  [Ctrl][LMB] ou [RMB] solo"
 "Track: [RMB] menu  [2xLMB] rename  [Shift][Wheel] move up / down" = "Faixa: [RMB] menu  [2xLMB] renomeia  [Shift][Wheel] move para cima / baixo"
 "[Alt] no snap" = "[Alt] sem grade"
@@ -1080,7 +1080,7 @@ countries: br
 "Deleting what the mouse crosses" = "Apagando o que o mouse cruza"
 "Key height" = "Altura das teclas"
 "Moving the point: then [Shift] keeps time  [Ctrl] keeps value" = "Movendo o ponto: depois [Shift] mantém o tempo  [Ctrl] mantém o valor"
-"Moving the time selection with its clips" = "Movendo a seleção de tempo com seus clipes"
+"Moving the time selection with its clips  [Alt] no snap" = "Movendo a seleção de tempo com seus clipes  [Alt] sem grade"
 "Moving {0} clip(s)  [Alt] no snap" = "Movendo {0} clipe(s)  [Alt] sem grade"
 "Moving {0} note(s): then [Shift] keeps the pitch  [Ctrl] keeps the time  [Alt] no snap" = "Movendo {0} nota(s): depois [Shift] mantém a altura  [Ctrl] mantém o tempo  [Alt] sem grade"
 "Muting / unmuting what the mouse crosses" = "Silenciando / reativando o que o mouse cruza"
@@ -1167,9 +1167,9 @@ countries: br
 "All notes off (panic)" = "Desligar todas as notas (pânico)"
 "Stop: [LMB] stop and go back to the start (or the remembered position)  [2xLMB] all notes off (panic)  [RMB] remember seek time" = "Parar: [LMB] para e volta ao início (ou à posição lembrada)  [2xLMB] desliga todas as notas (pânico)  [RMB] lembrar a posição"
 "Ghost notes: show the other channels' notes (Alt+V) and, outlined, this channel's notes in the clips playing at the same time; double right-click one to edit its channel; Ctrl+Alt+V makes them editable" = "Notas fantasma: mostra as notas dos outros canais (Alt+V) e, em contorno, as notas deste canal nos clipes que tocam ao mesmo tempo; clique direito duplo em uma edita o canal dela; Ctrl+Alt+V as torna editáveis"
-"Drum brush: one hit per grid cell, on the key under the mouse  [Alt] no snap" = "Pincel de bateria: uma batida por célula da grade, na tecla sob o mouse  [Alt] sem snap"
-"Stretching {0} note(s) in time  [Alt] no snap" = "Esticando {0} nota(s) no tempo  [Alt] sem snap"
-"Stretch handle: [LMB] drag stretches or squeezes the selected notes in time (from the selection's start)  [Alt] no snap" = "Alça de esticar: [LMB] arraste para esticar ou comprimir as notas selecionadas no tempo (a partir do início da seleção)  [Alt] sem snap"
+"Drum brush: one hit per grid cell, on the key under the mouse  [Alt] no snap" = "Pincel de bateria: uma batida por célula da grade, na tecla sob o mouse  [Alt] sem grade"
+"Stretching {0} note(s) in time  [Alt] no snap" = "Esticando {0} nota(s) no tempo  [Alt] sem grade"
+"Stretch handle: [LMB] drag stretches or squeezes the selected notes in time (from the selection's start)  [Alt] no snap" = "Alça de esticar: [LMB] arraste para esticar ou comprimir as notas selecionadas no tempo (a partir do início da seleção)  [Alt] sem grade"
 "Ghost note of {0} (editable): [LMB] edit it (switches to {0})  [RMB] deletes it  [Ctrl][Alt][V] read-only ghosts" = "Nota fantasma de {0} (editável): [LMB] edita (muda para {0})  [RMB] apaga  [Ctrl][Alt][V] fantasmas só leitura"
 "Ghost note of {0}: double [RMB] edits that channel  [Alt][V] hides ghost notes  [Ctrl][Alt][V] makes them editable" = "Nota fantasma de {0}: [RMB] duplo edita esse canal  [Alt][V] esconde as notas fantasma  [Ctrl][Alt][V] torna-as editáveis"
 "Show ghost notes" = "Mostrar notas fantasma"
@@ -4736,3 +4736,11 @@ countries: br
 "Inside a Patcher: cable its \"MIDI out\" pin to an instrument or to a \"MIDI port\" pin of \"To LYNX\"; its notes go out on this MIDI channel." = "Dentro de um Patcher: ligue o pino \"Saída MIDI\" a um instrumento ou a um pino \"Porta MIDI\" de \"Para o LYNX\"; as notas saem neste canal MIDI."
 "Browse plugin database" = "Procurar no banco de plugins"
 "{0} (LYNX)" = "{0} (LYNX)"
+"Menu density" = "Densidade dos menus"
+"Comfortable" = "Confortável"
+"Time selection  [Alt] no snap" = "Seleção de tempo  [Alt] sem grade"
+"Song position  [Alt] no snap" = "Posição na música  [Alt] sem grade"
+"Position  [Alt] no snap" = "Posição  [Alt] sem grade"
+"Insert EQ (folded): [LMB] unfold it" = "EQ do insert (recolhido): [LMB] abre"
+"Insert EQ: [LMB] fold it (it folds by itself when the mixer is short)" = "EQ do insert: [LMB] recolhe (ele se recolhe sozinho quando o mixer está baixo)"
+"active" = "ativo"

+ 39 - 4
src/Main.cpp

@@ -4425,6 +4425,18 @@ private:
                 offline.dispatchPendingMessages();
             }
             saveSnapshot (ui, prefix + "-mixer.png");
+            // round 163: the Mixer at short heights (UI zoom 150%+): the EQ folds, then the effects panel scrolls
+            {
+                const auto size = ui.getBounds();
+                for (auto h : { 450, 560, 680, 820 })
+                {
+                    ui.setSize (size.getWidth(), h);
+                    offline.dispatchPendingMessages();
+                    saveSnapshot (ui, prefix + "-mixer163-" + juce::String (h) + ".png");
+                }
+                ui.setBounds (size);
+                offline.dispatchPendingMessages();
+            }
 
             // standalone windows, with the theme background
             auto saveWindow = [&prefix] (std::unique_ptr<juce::Component> c, const juce::String& name) {
@@ -4481,6 +4493,28 @@ private:
                                                      ui.getPlaylistForSnapshot().getTrackMenuForSnapshot (0),
                                                      ui.getMixerForSnapshot().getStripsForSnapshot().buildMenu (1) };
                 saveMenus (juce::StringArray { "Piano roll tools", "Playlist track", "Mixer track" }, menus, prefix + "-menus143.png");
+                // round 163: menu density, compact (default) and comfortable, on a Browser folder menu
+                {
+                    juce::PopupMenu folder;
+                    folder.addSectionHeader ("Documents");
+                    folder.addItem (1, "Expand all");
+                    folder.addItem (2, "Collapse all");
+                    folder.addSeparator();
+                    folder.addItem (3, "Refresh");
+                    folder.addSectionHeader ("System");
+                    folder.addItem (4, "Open");
+                    folder.addItem (5, "Copy the file path");
+                    folder.addSectionHeader ("Tags");
+                    folder.addItem (6, "Starred", true, true);
+                    folder.addSeparator();
+                    folder.addItem (7, "Add folder...");
+                    const auto wasCompact = lynx::theme::menus::compact();
+                    lynx::theme::menus::setCompact (true);
+                    saveMenus (juce::StringArray { "Compact" }, { folder }, prefix + "-menu163-compact.png");
+                    lynx::theme::menus::setCompact (false);
+                    saveMenus (juce::StringArray { "Comfortable" }, { folder }, prefix + "-menu163-comfortable.png");
+                    lynx::theme::menus::setCompact (wasCompact);
+                }
                 // and the clip menus of the first pattern, audio and automation clips of the project
                 juce::StringArray clipNames;
                 std::vector<juce::PopupMenu> clipMenus;
@@ -5145,8 +5179,6 @@ private:
         };
         std::vector<Laid> menus;
         const auto border = lf.getPopupMenuBorderSize();
-        const auto itemHeight = 26;
-
         for (int m = 0; m < names.size(); ++m)
         {
             Laid laid { source[(std::size_t) m] };
@@ -5156,7 +5188,8 @@ private:
             {
                 const auto& item = it.getItem();
                 int w = 0, h = 0;
-                lf.getIdealPopupMenuItemSize (item.text, item.isSeparator, item.isSectionHeader ? 22 : itemHeight, w, h);
+                lf.getIdealPopupMenuItemSize (item.text, item.isSeparator, item.isSectionHeader ? -1 : 0, w, h);
+                if (item.isSectionHeader) h += h / 2; // as JUCE does
                 if (item.shortcutKeyDescription.isNotEmpty() || item.text.containsChar ('\t'))
                     w += 90;
                 width = juce::jmax (width, w + 10);
@@ -5199,7 +5232,8 @@ private:
                     {
                         const auto& item = it.getItem();
                         int w = 0, h = 0;
-                        lf.getIdealPopupMenuItemSize (item.text, item.isSeparator, item.isSectionHeader ? 22 : itemHeight, w, h);
+                        lf.getIdealPopupMenuItemSize (item.text, item.isSeparator, item.isSectionHeader ? -1 : 0, w, h);
+                if (item.isSectionHeader) h += h / 2; // as JUCE does
                         const juce::Rectangle<int> r (0, y, l.width, h);
                         auto text = item.text, shortcut = item.shortcutKeyDescription;
                         if (text.containsChar ('\t'))
@@ -5413,6 +5447,7 @@ private:
         {
             setVisible (true);
             lynx::applyWindowChrome (*this);
+            lynx::fitWindowOnScreen (*this); // a size saved at another UI zoom still fits (round 163)
             toFront (true);
             content->grabKeyboardFocus();
         }

+ 28 - 0
src/core/TransportEdit.h

@@ -79,6 +79,34 @@ inline double patternPlayhead (const Song& song, int pattern, double transportTi
     return best != nullptr ? inSong - (double) best->start + (double) best->offset : -1.0;
 }
 
+// Where the transport goes when the Piano Roll's ruler is clicked at `patternTick` (round 163, FL: clicking the
+// Piano Roll's timeline moves the position): in Pattern mode that pattern position; in Song mode the same place in
+// the clip of `pattern` that plays at `transportTick`, else in its earliest clip (upper track first). -1 in Song
+// mode when the pattern has no clip in the Playlist.
+inline double patternSeekTarget (const Song& song, int pattern, double patternTick, double transportTick)
+{
+    patternTick = std::max (0.0, patternTick);
+    if (song.mode == PlayMode::pattern)
+        return patternTick;
+
+    const auto inSong = transportTick >= 0.0 ? std::fmod (transportTick, (double) std::max<std::int64_t> (1, song.songLength())) : -1.0;
+    const Clip *playing = nullptr, *earliest = nullptr;
+    for (const auto& c : song.playlist)
+    {
+        if (c.kind != ClipKind::pattern || c.pattern != pattern)
+            continue;
+        if (inSong >= (double) c.start && inSong < (double) c.end() && (playing == nullptr || c.track < playing->track))
+            playing = &c;
+        if (earliest == nullptr || c.start < earliest->start || (c.start == earliest->start && c.track < earliest->track))
+            earliest = &c;
+    }
+    const auto* clip = playing != nullptr ? playing : earliest;
+    if (clip == nullptr)
+        return -1.0;
+    const auto inClip = std::clamp (patternTick - (double) clip->offset, 0.0, (double) std::max<std::int64_t> (0, clip->length - 1));
+    return (double) clip->start + inClip;
+}
+
 // --- follow (auto scrolling) ----------------------------------------------------------------------------------
 
 // The editors' "Follow": when the playhead at `tick` leaves the view [viewStart, viewStart + viewTicks), the view

+ 31 - 0
src/core/WindowFit.h

@@ -0,0 +1,31 @@
+#pragma once
+
+// Keeping a window reachable on its screen (round 163: UI zoom 150%+ made windows larger than the screen, with the
+// title bar or the close button out of reach). Pure logic, no JUCE (unit-tested in tests/tests.cpp).
+
+#include <algorithm>
+
+namespace lynx::windowfit
+{
+struct Box
+{
+    int x = 0, y = 0, w = 0, h = 0;
+    bool operator== (const Box&) const = default;
+};
+
+// Where a window whose outer rectangle (frame included) is `outer` goes inside the usable screen `area`: moved as
+// little as possible so it fits; when it is wider than the screen its right end (the close button) stays on the
+// screen; its title bar is never above the screen. The size is kept.
+inline Box place (Box outer, Box area)
+{
+    auto x = outer.x, y = outer.y;
+    if (x + outer.w > area.x + area.w)
+        x = area.x + area.w - outer.w;
+    if (x < area.x && outer.w <= area.w)
+        x = area.x;
+    if (y + outer.h > area.y + area.h)
+        y = area.y + area.h - outer.h;
+    y = std::max (y, area.y);
+    return { x, y, outer.w, outer.h };
+}
+} // namespace lynx::windowfit

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 4678 - 10952
src/ui/I18nData.h


+ 9 - 0
src/ui/MainComponent.cpp

@@ -840,7 +840,11 @@ void MainComponent::setToolbarLayout (const toolbarlayout::Layout& layout, bool
     playlist.resized();
 
     if (save && scaleChanged)
+    {
         juce::Desktop::getInstance().setGlobalScaleFactor ((float) toolbarLayout.uiScale / 100.0f);
+        // the windows grow with the zoom: keep their title bars and close buttons on the screen (round 163)
+        juce::Timer::callAfterDelay (200, [] { fitAllWindowsOnScreen(); });
+    }
 
     resized();
     repaint();
@@ -1297,6 +1301,8 @@ void MainComponent::loadUiSettings()
             toolbarLayout.separators = on;
         else if (key == "toolbarVisible")
             toolbarLayout.visible = on;
+        else if (key == "menuDensity")
+            theme::menus::setCompact (line.fromFirstOccurrenceOf ("=", false, false).trim() != "comfortable");
         else if (key == "uiScale")
             toolbarLayout.uiScale = toolbarlayout::clampScale (line.fromFirstOccurrenceOf ("=", false, false).trim().getIntValue());
         else if (key == "editPatternsIn")
@@ -1369,6 +1375,7 @@ void MainComponent::saveUiSettings()
                                       + "\ntoolbarGroups=" + juce::String (toolbarLayout.orderToString())
                                       + "\ntoolbarIcons=" + toolbarlayout::Layout::iconSizeId (toolbarLayout.iconSize)
                                       + "\nuiScale=" + juce::String (toolbarLayout.uiScale)
+                                      + "\nmenuDensity=" + juce::String (theme::menus::compact() ? "compact" : "comfortable")
                                       + "\ntoolbarSeparators=" + juce::String (toolbarLayout.separators ? 1 : 0)
                                       + "\ntoolbarVisible=" + juce::String (toolbarLayout.visible ? 1 : 0)
                                       + "\nautosaveMinutes=" + juce::String (autosaveMinutes) + "\nautosaveKeep=" + juce::String (autosaveKeep)
@@ -3464,6 +3471,7 @@ void MainComponent::openSettings (int page)
             return o;
         o.language = i18n::saved();
         o.uiScale = safe->toolbarLayout.uiScale;
+        o.compactMenus = theme::menus::compact();
         o.waveSpectral = ui::WaveformCache::spectral;
         o.waveStereo = ui::WaveformCache::stereo;
         o.reducedEffects = skin::reducedEffects();
@@ -3496,6 +3504,7 @@ void MainComponent::openSettings (int page)
             layout.uiScale = toolbarlayout::clampScale (o.uiScale);
             self.setToolbarLayout (layout, true);
         }
+        theme::menus::setCompact (o.compactMenus);
         if (o.reducedEffects != skin::reducedEffects() || o.pluginStyle != skin::forcedStyle())
         {
             skin::setReducedEffects (o.reducedEffects);

+ 91 - 5
src/ui/MixerComponent.cpp

@@ -1924,6 +1924,7 @@ void EffectsPanel::setTrack (int t)
     track = t;
     const auto* s = slots();
     selectedSlot = s != nullptr && ! s->empty() ? 0 : -1;
+    refit();
     repaint();
 }
 
@@ -2006,14 +2007,56 @@ float eqResponseDb (const TrackEq& eq, double hz, double sampleRate)
 }
 } // namespace
 
+constexpr int eqFoldBarHeight = 20;
+
+int EffectsPanel::belowHeight (bool folded) const
+{
+    return outputRowHeight + eqFoldBarHeight + (folded ? 4 : eqGraphHeight + eqKnobsHeight + 14);
+}
+
 int EffectsPanel::bottomTop() const
 {
-    return getHeight() - (eqGraphHeight + eqKnobsHeight + outputRowHeight + 22);
+    return getHeight() - belowHeight (eqFolded);
+}
+
+juce::Rectangle<int> EffectsPanel::eqFoldBounds() const
+{
+    return { 8, bottomTop(), getWidth() - 16, eqFoldBarHeight };
+}
+
+int EffectsPanel::neededHeight (bool folded) const
+{
+    // the slots and the effect's title row under them always fit; the knobs below may be cut by the EQ
+    return slotsTop + maxEffectSlots * slotHeight + 64 + 6 + belowHeight (folded);
+}
+
+void EffectsPanel::fitToView (int w, int h, int scrollBar)
+{
+    viewWidth = w;
+    viewHeight = h;
+    scrollBarThickness = scrollBar;
+    refit();
+}
+
+void EffectsPanel::refit()
+{
+    if (viewWidth <= 0 || viewHeight <= 0)
+        return;
+    const auto folded = eqFoldChoice == 2 || (eqFoldChoice == 0 && viewHeight < neededHeight (false));
+    const auto need = neededHeight (folded);
+    const auto scrolls = viewHeight < need;
+    const auto changed = folded != eqFolded;
+    eqFolded = folded;
+    const juce::Rectangle<int> size (viewWidth - (scrolls ? scrollBarThickness : 0), juce::jmax (viewHeight, need));
+    if (getWidth() != size.getWidth() || getHeight() != size.getHeight())
+        setSize (size.getWidth(), size.getHeight());
+    else if (changed)
+        repaint();
 }
 
 juce::Rectangle<int> EffectsPanel::eqGraphBounds() const
 {
-    return { 8, bottomTop() + 8, getWidth() - 16 - 3 * 18 - 6, eqGraphHeight };
+    return { 8, bottomTop() + eqFoldBarHeight, getWidth() - 16 - 3 * 18 - 6, eqGraphHeight };
 }
 
 juce::Rectangle<int> EffectsPanel::eqFaderBounds (int band) const
@@ -2045,7 +2088,7 @@ juce::Point<float> EffectsPanel::eqHandle (int band) const
 
 int EffectsPanel::eqControlAt (juce::Point<int> p) const
 {
-    if (slots() == nullptr)
+    if (slots() == nullptr || eqFolded)
         return 0;
     for (int b = 0; b < 3; ++b)
     {
@@ -2097,6 +2140,30 @@ void EffectsPanel::paintEq (juce::Graphics& g)
     g.setColour (colour::border);
     g.fillRect (8, top, getWidth() - 16, 1);
 
+    // the title bar: click folds / unfolds the EQ (it folds by itself when the mixer is too short for it)
+    {
+        const auto bar = eqFoldBounds().toFloat();
+        const auto active = eq.gainDb[0] != 0.0f || eq.gainDb[1] != 0.0f || eq.gainDb[2] != 0.0f;
+        auto chevron = bar.withWidth (14.0f).withSizeKeepingCentre (12.0f, 12.0f);
+        {
+            juce::Graphics::ScopedSaveState state (g);
+            if (eqFolded)
+                g.addTransform (juce::AffineTransform::rotation (-juce::MathConstants<float>::halfPi, chevron.getCentreX(), chevron.getCentreY()));
+            icons::draw (g, Icon::chevronDown, chevron, colour::textSecondary);
+        }
+        g.setFont (font (type::small, true));
+        g.setColour (colour::textSecondary);
+        textcache::drawText (g, tr ("EQ"), bar.withTrimmedLeft (18.0f).toNearestInt(), juce::Justification::centredLeft);
+        if (eqFolded && active) // a folded EQ that still changes the sound says so
+        {
+            g.setColour (colour::accent);
+            g.setFont (font (type::caption));
+            textcache::drawText (g, tr ("active"), bar.withTrimmedLeft (44.0f).toNearestInt(), juce::Justification::centredLeft);
+        }
+    }
+    if (eqFolded)
+        return;
+
     // the response graph: frequency (log) across, ±18 dB up and down
     const auto graph = eqGraphBounds().toFloat();
     theme::fillRoundRect (g, graph, radius::sm, colour::bg1);
@@ -2962,6 +3029,14 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
     if (s == nullptr)
         return;
 
+    if (eqFoldBounds().contains (e.getPosition()) && e.mods.isLeftButtonDown())
+    {
+        eqFoldChoice = eqFolded ? 1 : 2;
+        refit();
+        repaint();
+        return;
+    }
+
     // the built-in EQ and the output target (bottom section)
     if (outputBounds().contains (e.getPosition()))
     {
@@ -3333,6 +3408,13 @@ ui::Hint EffectsPanel::hintAt (juce::Point<int> p)
         return h;
     }
 
+    if (slots() != nullptr && eqFoldBounds().contains (p))
+    {
+        ui::Hint h;
+        h.text = eqFolded ? tr ("Insert EQ (folded): [LMB] unfold it") : tr ("Insert EQ: [LMB] fold it (it folds by itself when the mixer is short)");
+        return h;
+    }
+
     if (outputBounds().contains (p))
     {
         ui::Hint h;
@@ -4214,7 +4296,10 @@ MixerComponent::MixerComponent (AudioEngine& e)
     viewport.setViewedComponent (&strips, false);
     viewport.setScrollBarsShown (false, true);
     addAndMakeVisible (viewport);
-    addAndMakeVisible (effects);
+    effectsView.setViewedComponent (&effects, false);
+    effectsView.setScrollBarsShown (true, false);
+    effectsView.setScrollBarThickness (10);
+    addAndMakeVisible (effectsView);
     strips.onSelectionChanged = [this] (int track) { effects.setTrack (track); };
     strips.onEffectDropped = [this] (int track, EffectSlot fx) {
         strips.selectTrack (track);
@@ -4295,7 +4380,8 @@ void MixerComponent::selectTrack (int track)
 void MixerComponent::resized()
 {
     auto area = getLocalBounds();
-    effects.setBounds (area.removeFromRight (effectsWidth));
+    effectsView.setBounds (area.removeFromRight (effectsWidth));
+    effects.fitToView (effectsView.getWidth(), effectsView.getHeight(), effectsView.getScrollBarThickness());
     viewport.setBounds (area);
     strips.setVisibleHeight (area.getHeight() - viewport.getScrollBarThickness());
 }

+ 15 - 0
src/ui/MixerComponent.h

@@ -220,6 +220,14 @@ public:
     }
     void openSlotEditor (int slot) { openEditor (slot); }
 
+    // Sizes the panel for a view of `viewWidth` x `viewHeight` (round 163): when the slots and the EQ don't both fit,
+    // the EQ folds to its title bar (click it to unfold); when even that doesn't fit, the panel is taller than the
+    // view and the viewport around it scrolls. Nothing overlaps at any height or UI zoom.
+    void fitToView (int viewWidth, int viewHeight, int scrollBarThickness);
+    bool isEqFolded() const noexcept { return eqFolded; }
+    // the heights the panel needs with the EQ open and folded (the knobs of the selected effect may be cut below)
+    int neededHeight (bool folded) const;
+
     void paint (juce::Graphics& g) override;
     void mouseDown (const juce::MouseEvent& e) override;
     void mouseDrag (const juce::MouseEvent& e) override;
@@ -252,6 +260,12 @@ private:
     juce::Rectangle<int> arrowBounds (int slot) const; // the slot's options arrow
     juce::Rectangle<int> ledBounds (int slot) const;   // the slot's on/off LED
     int bottomTop() const;                             // top of the EQ + output section
+    int belowHeight (bool folded) const;               // height of the EQ + output section
+    juce::Rectangle<int> eqFoldBounds() const;         // the EQ's title bar (click: fold / unfold)
+    void refit();
+    bool eqFolded = false;
+    int viewWidth = 0, viewHeight = 0, scrollBarThickness = 0;
+    static inline int eqFoldChoice = 0;                // 0 automatic, 1 open (the user unfolded it), 2 folded by the user
     juce::Rectangle<int> eqGraphBounds() const;
     juce::Rectangle<int> eqFaderBounds (int band) const;
     juce::Rectangle<int> eqKnobBounds (int band, int what) const; // what: 1 = frequency, 2 = width
@@ -339,6 +353,7 @@ private:
     AudioEngine& engine;
     MixerStrips strips;
     juce::Viewport viewport;
+    juce::Viewport effectsView; // the effects panel scrolls when the mixer is short (round 163)
     EffectsPanel effects;
 };
 } // namespace lynx

+ 29 - 1
src/ui/PianoRollComponent.cpp

@@ -1335,6 +1335,14 @@ void PianoRollComponent::mouseDown (const juce::MouseEvent& e)
         return;
     }
 
+    // ruler: click or drag = position (FL), Alt = off the grid
+    if (e.y >= rulerTop && e.y < headerHeight && e.x >= keyboardWidth && e.mods.isLeftButtonDown() && ! e.mods.isShiftDown())
+    {
+        drag = Drag::seek;
+        seekAt (e.x, ! e.mods.isAltDown());
+        return;
+    }
+
     if (velocityArea().contains (e.getPosition()) && eventLaneTarget())
     {
         // pattern events: drag draws one event per grid step, right-drag erases
@@ -1828,6 +1836,10 @@ void PianoRollComponent::mouseDrag (const juce::MouseEvent& e)
             listenAt (e.x);
             return;
 
+        case Drag::seek:
+            seekAt (e.x, snapOn);
+            return;
+
         case Drag::drumPaint:
             drumPaintAt (e.getPosition(), snapOn);
             return;
@@ -2023,6 +2035,7 @@ void PianoRollComponent::postDragHint (const juce::MouseEvent& e)
         case Drag::keyZoom: hint.text = tr ("Key height"); hint.value = juce::String (rowHeight) + " px"; break;
         case Drag::pan:
         case Drag::keyboard:
+        case Drag::seek: hint.text = tr ("Position  [Alt] no snap"); break;
         case Drag::listen:
         case Drag::zoomRange:
         case Drag::none: return;
@@ -2248,7 +2261,7 @@ ui::Hint PianoRollComponent::hintAt (juce::Point<int> p)
 
     if (p.y >= rulerTop && p.y < headerHeight && p.x >= keyboardWidth)
     {
-        hint.text = tr ("Ruler: [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] drag selects the notes in a time range  [Ctrl][Wheel] zoom  [Shift][Wheel] scroll");
         return hint;
     }
 
@@ -2411,6 +2424,21 @@ void PianoRollComponent::zoomOut (int anchorX)
     repaint();
 }
 
+void PianoRollComponent::seekAt (int x, bool snapOn)
+{
+    const auto& song = engine.getSong();
+    const auto tick = snapOn ? (double) snap (xToTick (x), true) : xToTick (x);
+    const auto target = transportedit::patternSeekTarget (song, song.currentPattern, tick, engine.getTransport().positionTicks.load());
+    if (target < 0.0)
+    {
+        // Song mode and no clip of this pattern: play the pattern on its own from there
+        engine.editSong ([] (Song& s) { s.mode = PlayMode::pattern; }, false);
+        engine.seek (juce::jmax (0.0, tick));
+        return;
+    }
+    engine.seek (target);
+}
+
 void PianoRollComponent::listenAt (int x)
 {
     // plays the channel's notes that sound at the tick under the mouse

+ 2 - 1
src/ui/PianoRollComponent.h

@@ -102,7 +102,7 @@ public:
 
 private:
     enum class Drag { none, move, resize, resizeLeft, erase, keyboard, select, velocity, velocityLine, velocitySet, paint, muting, knife,
-                      zoomRange, listen, pan, keyZoom, keySelect, rulerSelect, drumPaint, stretch, eventDraw, eventErase };
+                      zoomRange, listen, pan, keyZoom, keySelect, rulerSelect, seek, drumPaint, stretch, eventDraw, eventErase };
 
     // Channel selector: the wheel steps through the channels with notes (Ctrl+wheel: all channels).
     class ChannelBox final : public juce::ComboBox
@@ -139,6 +139,7 @@ private:
     void zoomIn (int anchorX);
     void zoomOut (int anchorX);
     void listenAt (int x);
+    void seekAt (int x, bool snapOn); // the ruler: moves the position (Alt: off the grid)
     void stopListening();
     void cutWithKnife (juce::Point<int> from, juce::Point<int> to, bool snapOn);
     void paintNoteAt (std::int64_t start, int key, bool monophonic);

+ 12 - 9
src/ui/PlaylistComponent.cpp

@@ -1430,9 +1430,9 @@ int PlaylistComponent::clipAt (int x, int y, bool& onRightEdge, bool& onLeftEdge
     return -1;
 }
 
-void PlaylistComponent::seekTo (int x)
+void PlaylistComponent::seekTo (int x, bool snapOn)
 {
-    const auto tick = juce::jmax (0.0, (double) snap (xToTick (x), true));
+    const auto tick = juce::jmax (0.0, snapOn ? (double) snap (xToTick (x), true) : xToTick (x));
 
     if (engine.getSong().mode != PlayMode::song)
         engine.editSong ([] (Song& s) { s.mode = PlayMode::song; }, false);
@@ -1641,8 +1641,8 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
         }
 
         drag = Drag::seek;
-        seekTo (e.x);
-        EditorGlobals::get().seekMark = (std::int64_t) juce::jmax (0.0, (double) snap (xToTick (e.x), true));
+        seekTo (e.x, ! e.mods.isAltDown());
+        EditorGlobals::get().seekMark = (std::int64_t) juce::jmax (0.0, (double) snap (xToTick (e.x), ! e.mods.isAltDown()));
         return;
     }
 
@@ -1820,7 +1820,7 @@ void PlaylistComponent::mouseDown (const juce::MouseEvent& e)
 
         case EditTool::listen:
             drag = Drag::listen;
-            seekTo (e.x);
+            seekTo (e.x, ! e.mods.isAltDown());
             engine.play();
             return;
 
@@ -2072,7 +2072,7 @@ void PlaylistComponent::mouseDrag (const juce::MouseEvent& e)
 
         case Drag::seek:
         case Drag::listen:
-            seekTo (e.x);
+            seekTo (e.x, snapOn);
             return;
 
         case Drag::loop:
@@ -2345,15 +2345,18 @@ void PlaylistComponent::postDragHint()
             hint.value = tr ("{0} selected", { juce::String ((int) selection.size()) });
             break;
         case Drag::loop:
-            hint.text = tr ("Time selection");
+            hint.text = tr ("Time selection  [Alt] no snap");
             hint.value = position (song.loopStart) + " - " + position (song.loopEnd);
             break;
         case Drag::erase: hint.text = tr ("Deleting what the mouse crosses"); break;
         case Drag::muting: hint.text = tr ("Muting / unmuting what the mouse crosses"); break;
         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"); break;
+        case Drag::timeMove: hint.text = tr ("Moving the time selection with its clips  [Alt] no snap"); break;
         case Drag::seek:
+            hint.text = tr ("Song position  [Alt] no snap");
+            hint.value = position ((std::int64_t) playheadTick);
+            break;
         case Drag::listen:
         case Drag::pan:
         case Drag::zoomRange:
@@ -3855,7 +3858,7 @@ ui::Hint PlaylistComponent::hintAt (juce::Point<int> p)
 
     if (p.y >= rulerTop && p.y < headerHeight && p.x >= headerWidth)
     {
-        hint.text = tr ("Ruler: [LMB] song position  [Ctrl][LMB] drag: time selection (loop)  [Shift][LMB] drag in it: move  [2xLMB] clear  [RMB] markers");
+        hint.text = tr ("Ruler: [LMB] song position  [Ctrl][LMB] drag: time selection (loop)  [Shift][LMB] drag in it: move  [2xLMB] clear  [RMB] markers  [Alt] no snap");
         hint.hasMenu = true;
         return hint;
     }

+ 1 - 1
src/ui/PlaylistComponent.h

@@ -190,7 +190,7 @@ private:
     void normalizeClips (const std::vector<int>& targets);
     juce::PopupMenu buildClipMenu (int index, int mouseX);
     void duplicateSelection();
-    void seekTo (int x);
+    void seekTo (int x, bool snapOn = true); // Alt held while scrubbing: snapOn false (free position, FL)
     void paintAudioClip (juce::Graphics& g, const Clip& clip, juce::Rectangle<float> bounds);
     // Clips a few pixels wide (zoomed far out), gathered and filled per colour at the end (round 151)
     struct SmallClips;

+ 23 - 16
src/ui/SettingsPages.cpp

@@ -22,9 +22,9 @@ juce::File autosaveFolder()
 namespace
 {
 constexpr int labelWidth = 190;
-constexpr int rowHeight = 28;
-constexpr int rowGap = 8;
-constexpr int sectionHeight = 28;
+constexpr int rowHeight = 26;
+constexpr int rowGap = 5; // round 163: tighter (was 8)
+constexpr int sectionHeight = 24;
 
 void styleCombo (juce::ComboBox& box)
 {
@@ -92,7 +92,7 @@ public:
             options.language = "en";
 
         for (auto* c : std::initializer_list<juce::Component*> { &languageTitle, &displayTitle, &startupTitle, &editingTitle, &backupTitle,
-                                                                 &pluginsTitle, &languageLabel, &languageBox, &languageNote, &scaleLabel, &scaleBox,
+                                                                 &pluginsTitle, &languageLabel, &languageBox, &languageNote, &scaleLabel, &scaleBox, &menuLabel, &menuBox,
                                                                  &wavesLabel, &wavesBox, &stereoWaves, &pluginStyleLabel, &pluginStyleBox, &reducedEffects, &gpuRendering, &splash, &startupSound, &scanAtStart, &menuEntry,
                                                                  &typingPiano, &keepEditors, &rememberSeek, &editInLabel, &editInBox, &undoLabel,
                                                                  &undoBox, &autosaveLabel, &autosaveBox, &keepLabel, &keepBox, &openBackups, &unusedTakes,
@@ -122,6 +122,12 @@ public:
         scaleBox.setSelectedId (options.uiScale, juce::dontSendNotification);
         scaleBox.onChange = [this] { change ([&] { options.uiScale = scaleBox.getSelectedId(); }); };
 
+        styleLabel (menuLabel, tr ("Menu density"));
+        menuBox.addItem (tr ("Compact"), 1);
+        menuBox.addItem (tr ("Comfortable"), 2);
+        menuBox.setSelectedId (options.compactMenus ? 1 : 2, juce::dontSendNotification);
+        menuBox.onChange = [this] { change ([&] { options.compactMenus = menuBox.getSelectedId() == 1; }); };
+
         styleLabel (wavesLabel, tr ("Waveforms"));
         wavesBox.addItem (tr ("Clean (the clip colour)"), 1);
         wavesBox.addItem (tr ("Spectral colours (warm = bass, cool = treble)"), 2);
@@ -222,7 +228,7 @@ public:
                                   "your name, file names or projects. It goes to lynx-share.com only with your consent (Help > Report a problem... "
                                   "sends one by hand)."));
 
-        for (auto* b : { &languageBox, &scaleBox, &wavesBox, &pluginStyleBox, &editInBox, &undoBox, &autosaveBox, &keepBox, &crashBox })
+        for (auto* b : { &languageBox, &scaleBox, &menuBox, &wavesBox, &pluginStyleBox, &editInBox, &undoBox, &autosaveBox, &keepBox, &crashBox })
             styleCombo (*b);
         juce::ignoreUnused (engine, persistent);
     }
@@ -233,8 +239,9 @@ private:
         Rows r (width);
         r.section (languageTitle, true);
         languageBox.setBounds (r.row (languageLabel, 220));
-        languageNote.setBounds (r.indented (16).translated (0, -6));
+        languageNote.setBounds (r.indented (16).translated (0, -3));
         scaleBox.setBounds (r.row (scaleLabel, 120));
+        menuBox.setBounds (r.row (menuLabel, 160));
         wavesBox.setBounds (r.row (wavesLabel, 0));
         stereoWaves.setBounds (r.indented (24));
         pluginStyleBox.setBounds (r.row (pluginStyleLabel, 300));
@@ -267,9 +274,9 @@ private:
 
         r.section (pluginsTitle);
         sandbox.setBounds (r.full (24));
-        sandboxNote.setBounds (r.full (16).translated (0, -6));
+        sandboxNote.setBounds (r.full (16).translated (0, -3));
         substitutes.setBounds (r.full (24));
-        substitutesNote.setBounds (r.full (16).translated (0, -6));
+        substitutesNote.setBounds (r.full (16).translated (0, -3));
         {
             auto row = r.full();
             managePlugins.setBounds (row.removeFromLeft (180));
@@ -281,7 +288,7 @@ private:
 
         r.section (reportsTitle);
         crashBox.setBounds (r.row (crashLabel, 260));
-        crashNote.setBounds (r.full (46).translated (0, -6));
+        crashNote.setBounds (r.full (46).translated (0, -3));
         displayTitle.setVisible (false);
         return r.bottom();
     }
@@ -315,8 +322,8 @@ private:
     GeneralOptions options;
     SectionTitle languageTitle { tr ("Language and display") }, displayTitle, startupTitle { tr ("Startup") }, editingTitle { tr ("Editing") },
         backupTitle { tr ("Backup") }, pluginsTitle { tr ("Plugins and shortcuts") }, reportsTitle { tr ("Crash reports") };
-    juce::Label languageLabel, languageNote, scaleLabel, wavesLabel, pluginStyleLabel, editInLabel, undoLabel, autosaveLabel, keepLabel, sandboxNote, substitutesNote, shortcutsNote, crashLabel, crashNote;
-    juce::ComboBox crashBox, languageBox, scaleBox, wavesBox, pluginStyleBox, editInBox, undoBox, autosaveBox, keepBox;
+    juce::Label languageLabel, languageNote, scaleLabel, menuLabel, wavesLabel, pluginStyleLabel, editInLabel, undoLabel, autosaveLabel, keepLabel, sandboxNote, substitutesNote, shortcutsNote, crashLabel, crashNote;
+    juce::ComboBox crashBox, languageBox, scaleBox, menuBox, wavesBox, pluginStyleBox, editInBox, undoBox, autosaveBox, keepBox;
     juce::ToggleButton stereoWaves, reducedEffects, gpuRendering, splash, startupSound, scanAtStart, menuEntry, typingPiano, keepEditors, rememberSeek, sandbox, substitutes, unusedTakes;
     juce::TextButton openBackups { tr ("Open backup folder") }, managePlugins { tr ("Plugin manager...") }, manageShortcuts { tr ("Manage shortcuts...") };
 };
@@ -421,12 +428,12 @@ private:
         Rows r (width);
         r.section (deviceTitle, true);
         driverBox.setBounds (r.row (driverLabel, 320));
-        driverNote.setBounds (r.indented (46).translated (0, -6));
+        driverNote.setBounds (r.indented (46).translated (0, -3));
         outputBox.setBounds (r.row (outputLabel, 0));
         inputBox.setBounds (r.row (inputLabel, 0));
         rateBox.setBounds (r.row (rateLabel, 160));
         bufferBox.setBounds (r.row (bufferLabel, 260));
-        bufferNote.setBounds (r.indented (18).translated (0, -6));
+        bufferNote.setBounds (r.indented (18).translated (0, -3));
         {
             auto row = r.indented();
             panelButton.setBounds (row.removeFromLeft (170));
@@ -443,7 +450,7 @@ private:
         r.section (recordTitle);
         inputChannels.setBounds (r.full (34));
         recordInput.setBounds (r.full (24));
-        recordNote.setBounds (r.full (32).translated (0, -6));
+        recordNote.setBounds (r.full (32).translated (0, -3));
         return r.bottom();
     }
 
@@ -858,7 +865,7 @@ private:
 
         r.section (notesTitle);
         velocityBox.setBounds (r.row (velocityLabel, 300));
-        velocityNote.setBounds (r.indented (16).translated (0, -6));
+        velocityNote.setBounds (r.indented (16).translated (0, -3));
 
         r.section (controllersTitle);
         {
@@ -867,7 +874,7 @@ private:
             typeValue.setBounds (row.withTrimmedTop (6));
         }
         pickup.setBounds (r.full (24));
-        pickupNote.setBounds (r.full (16).translated (0, -6));
+        pickupNote.setBounds (r.full (16).translated (0, -3));
         {
             auto row = r.row (linksLabel, 0, 110);
             linksLabel.setBounds (linksLabel.getBounds().withTrimmedTop (4));

+ 1 - 0
src/ui/SettingsPages.h

@@ -18,6 +18,7 @@ struct GeneralOptions
 {
     juce::String language;      // i18n id ("en", "pt-BR")
     int uiScale = 100;          // percent
+    bool compactMenus = true;   // menu density: compact (native-like rows) or comfortable (round 163)
     bool waveSpectral = false, waveStereo = false;
     bool splash = true, startupSound = true, scanAtStart = true;
     bool menuEntry = false;     // Linux AppImage: LYNX in the applications menu + the .lynx file type (round 161)

+ 25 - 4
src/ui/Theme.cpp

@@ -620,6 +620,19 @@ void LookAndFeel::drawPopupMenuBackground (juce::Graphics& g, int width, int hei
     g.drawRect (bounds, 1.0f);
 }
 
+namespace menus
+{
+namespace
+{
+bool compactMenus = true;
+}
+void setCompact (bool c) { compactMenus = c; }
+bool compact() { return compactMenus; }
+int itemHeight() { return compactMenus ? 21 : 26; }
+int headerHeight() { return compactMenus ? 19 : 39; }
+int separatorHeight() { return compactMenus ? 5 : 9; }
+} // namespace menus
+
 juce::Font LookAndFeel::getPopupMenuFont()
 {
     return uiFont (type::body);
@@ -631,13 +644,21 @@ void LookAndFeel::getIdealPopupMenuItemSize (const juce::String& text, bool isSe
     if (isSeparator)
     {
         idealWidth = 50;
-        idealHeight = 9;
+        idealHeight = menus::separatorHeight();
         return;
     }
 
     const auto font = getPopupMenuFont();
-    idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : 26;
-    idealWidth = juce::roundToInt (juce::GlyphArrangement::getStringWidth (font, text)) + idealHeight * 2 + 8;
+    if (standardMenuItemHeight < 0)
+    {
+        // JUCE asks with -1 for a section header and then adds half of the answer: hand back 2/3 of the wanted height
+        idealHeight = (menus::headerHeight() * 2 + 2) / 3;
+        idealWidth = juce::roundToInt (juce::GlyphArrangement::getStringWidth (uiFont (type::small, true), caps (text)) * 0.8f) + 24;
+        return;
+    }
+    idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : menus::itemHeight();
+    const auto iconWidth = juce::roundToInt ((float) idealHeight * 0.8f);
+    idealWidth = juce::roundToInt (juce::GlyphArrangement::getStringWidth (font, text)) + iconWidth + (menus::compact() ? 36 : idealHeight + 30);
 }
 
 void LookAndFeel::drawPopupMenuItem (juce::Graphics& g, const juce::Rectangle<int>& area, bool isSeparator, bool isActive, bool isHighlighted,
@@ -701,7 +722,7 @@ void LookAndFeel::drawPopupMenuSectionHeader (juce::Graphics& g, const juce::Rec
 {
     g.setFont (uiFont (type::small, true));
     g.setColour (textSecondary);
-    g.drawFittedText (caps (sectionName), area.reduced (14, 0).withTrimmedTop (4), juce::Justification::centredLeft, 1);
+    g.drawFittedText (caps (sectionName), area.reduced (14, 0).withTrimmedTop (menus::compact() ? 2 : 4), juce::Justification::centredLeft, 1);
 }
 
 void LookAndFeel::drawMenuBarBackground (juce::Graphics&, int, int, bool, juce::MenuBarComponent&)

+ 12 - 0
src/ui/Theme.h

@@ -93,6 +93,18 @@ inline juce::FontOptions font (float size, bool bold = false)
     return juce::FontOptions (size, bold ? juce::Font::bold : juce::Font::plain);
 }
 
+// --- menus -------------------------------------------------------------------------------------------
+// Options › General › Menu density (round 163): compact rows close to native Windows / FL menus (the default),
+// or the roomier rows of LYNX 0.1.17 and older.
+namespace menus
+{
+void setCompact (bool compact);
+bool compact();
+int itemHeight();    // a normal row
+int headerHeight();  // a section header (the "DOCUMENTS" titles)
+int separatorHeight();
+} // namespace menus
+
 inline juce::FontOptions monoFont (float size)
 {
     return juce::FontOptions (juce::Font::getDefaultMonospacedFontName(), size, juce::Font::plain);

+ 55 - 0
src/ui/WindowOwner.cpp

@@ -1,5 +1,7 @@
 #include "ui/WindowOwner.h"
 
+#include "core/WindowFit.h"
+
 #include "ui/LogoData.h"
 #include "ui/Theme.h"
 #include "platform/Paths.h"
@@ -258,7 +260,60 @@ void keepAboveMainWindow (juce::Component& window)
     auto& all = keepers();
     auto& keeper = all[&window];
     if (keeper == nullptr)
+    {
         keeper = std::make_unique<OwnershipKeeper> (window);
+        fitWindowOnScreen (window);
+    }
     applyOwnership (window);
 }
+
+void fitWindowOnScreen (juce::Component& window)
+{
+    if (! window.isOnDesktop() || ! window.isVisible())
+        return;
+    auto* resizable = dynamic_cast<juce::ResizableWindow*> (&window);
+    if (resizable != nullptr && (resizable->isFullScreen() || resizable->isMinimised()))
+        return;
+
+    juce::BorderSize<int> frame;
+    if (auto* peer = window.getPeer())
+        if (const auto size = peer->getFrameSizeIfPresent())
+            frame = *size;
+
+    const auto bounds = window.getBounds();
+    const auto& displays = juce::Desktop::getInstance().getDisplays();
+    const auto* display = displays.getDisplayForRect (frame.addedTo (bounds));
+    if (display == nullptr)
+        display = displays.getPrimaryDisplay();
+    if (display == nullptr)
+        return;
+    const auto area = display->userArea;
+
+    auto content = bounds;
+    if (resizable != nullptr && resizable->isResizable())
+    {
+        auto w = juce::jmin (content.getWidth(), area.getWidth() - frame.getLeftAndRight());
+        auto h = juce::jmin (content.getHeight(), area.getHeight() - frame.getTopAndBottom());
+        if (auto* limits = resizable->getConstrainer())
+        {
+            w = juce::jmax (w, limits->getMinimumWidth());
+            h = juce::jmax (h, limits->getMinimumHeight());
+        }
+        content.setSize (juce::jmax (1, w), juce::jmax (1, h));
+    }
+    const auto outer = frame.addedTo (content);
+    const auto placed = windowfit::place ({ outer.getX(), outer.getY(), outer.getWidth(), outer.getHeight() },
+                                          { area.getX(), area.getY(), area.getWidth(), area.getHeight() });
+    content.setPosition (placed.x + frame.getLeft(), placed.y + frame.getTop());
+    if (content != bounds)
+        window.setBounds (content);
+}
+
+void fitAllWindowsOnScreen()
+{
+    auto& desktop = juce::Desktop::getInstance();
+    for (int i = desktop.getNumComponents(); --i >= 0;)
+        if (auto* window = dynamic_cast<juce::ResizableWindow*> (desktop.getComponent (i)))
+            fitWindowOnScreen (*window);
+}
 } // namespace lynx

+ 6 - 0
src/ui/WindowOwner.h

@@ -18,6 +18,12 @@ bool isOwnedByMainWindow (juce::Component& window);
 // True when `window` is above the main window in the z-order (Windows; elsewhere: isOwnedByMainWindow).
 bool isAboveMainWindow (juce::Component& window);
 
+// Keeps a top-level window reachable (round 163, UI zoom 150%+): a resizable window larger than its screen shrinks
+// to it, and the window moves so its title bar and close button are on the screen. keepAboveMainWindow does it the
+// first time; the UI scale change does it for every LYNX window.
+void fitWindowOnScreen (juce::Component& window);
+void fitAllWindowsOnScreen();
+
 // --windowtest only: makes `window` the foreground window even when LYNX was started in the background.
 void forceForegroundForTest (juce::Component& window);
 

+ 33 - 0
tests/Transport162Tests.inc

@@ -104,6 +104,39 @@ TEST (transport162_piano_roll_playhead)
     CHECK (patternPlayhead (song, 7, 10.0) < 0.0 && patternPlayhead (song, 0, -1.0) < 0.0);
 }
 
+TEST (ui163_piano_roll_ruler_seek)
+{
+    using lynx::transportedit::patternSeekTarget;
+    lynx::Song song;
+    song.beatsPerBar = 4;
+    song.patterns.resize (2);
+    const auto bar = (std::int64_t) lynx::ppq * 4;
+    song.mode = lynx::PlayMode::pattern;
+    CHECK (patternSeekTarget (song, 0, 500.0, 0.0) == 500.0);
+    CHECK (patternSeekTarget (song, 0, -5.0, 0.0) == 0.0);
+
+    song.mode = lynx::PlayMode::song;
+    CHECK (patternSeekTarget (song, 0, 500.0, 0.0) < 0.0); // no clip of it
+    lynx::Clip a;
+    a.pattern = 0;
+    a.track = 1;
+    a.start = 4 * bar;
+    a.length = bar;
+    a.offset = 100;
+    lynx::Clip b = a;
+    b.start = 2 * bar;
+    b.offset = 0;
+    song.playlist.push_back (a);
+    song.playlist.push_back (b);
+    // nothing of it plays now: the earliest clip
+    CHECK (patternSeekTarget (song, 0, 500.0, 0.0) == (double) (2 * bar + 500));
+    // the clip under the song position wins; its offset counts; the position stays inside the clip
+    CHECK (patternSeekTarget (song, 0, 500.0, (double) (4 * bar + 10)) == (double) (4 * bar + 400));
+    CHECK (patternSeekTarget (song, 0, 50.0, (double) (4 * bar + 10)) == (double) (4 * bar));
+    CHECK (patternSeekTarget (song, 0, (double) (5 * bar), (double) (4 * bar + 10)) == (double) (5 * bar - 1));
+    CHECK (patternSeekTarget (song, 1, 10.0, 0.0) < 0.0);
+}
+
 TEST (transport162_follow_and_stop)
 {
     using lynx::transportedit::followViewStart;

+ 22 - 0
tests/Ui163Tests.inc

@@ -0,0 +1,22 @@
+// Round 163 (user feedback, UI zoom 150%): windows kept reachable on their screen.
+#include "core/WindowFit.h"
+
+TEST (ui163_window_fit)
+{
+    using lynx::windowfit::Box;
+    using lynx::windowfit::place;
+    const Box screen { 0, 0, 1280, 700 }; // a 1920x1050 work area at 150%
+    // inside: unchanged
+    CHECK ((place ({ 100, 100, 600, 400 }, screen) == Box { 100, 100, 600, 400 }));
+    // taller than the screen, centred (title bar above the top): the title bar comes back on the screen
+    CHECK ((place ({ 100, -150, 600, 1000 }, screen) == Box { 100, 0, 600, 1000 }));
+    // off the right edge: moved back left
+    CHECK ((place ({ 1000, 50, 600, 300 }, screen) == Box { 680, 50, 600, 300 }));
+    // wider than the screen: the right end (close button) stays on it
+    CHECK ((place ({ 0, 0, 1600, 300 }, screen) == Box { -320, 0, 1600, 300 }));
+    // below the bottom: moved up; above the top: down
+    CHECK ((place ({ 10, 600, 300, 200 }, screen) == Box { 10, 500, 300, 200 }));
+    CHECK ((place ({ 10, -40, 300, 200 }, Box { 0, 30, 1280, 670 }) == Box { 10, 30, 300, 200 }));
+    // a second monitor at negative x
+    CHECK ((place ({ -2000, 10, 400, 300 }, Box { -1920, 0, 1920, 1040 }) == Box { -1920, 10, 400, 300 }));
+}

+ 1 - 0
tests/tests.cpp

@@ -16030,3 +16030,4 @@ TEST (fl_low_lifter_matches_fl_engine)
 #include "EnvController162Tests.inc"
 #include "Browser162Tests.inc"
 #include "Transport162Tests.inc"
+#include "Ui163Tests.inc"

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است