فهرست منبع

Merge remote-tracking branch 'origin/main' into feature/rec163

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

+ 1 - 1
CMakeLists.txt

@@ -172,7 +172,7 @@ target_sources(lynx_core PRIVATE
     src/core/EffectPresets.cpp
     src/core/PluginPresets.cpp
     src/core/ParamHelp.cpp
-    src/core/SearchQuery.cpp src/core/SearchIndex.cpp src/core/SearchService.cpp)
+    src/core/SearchQuery.cpp src/core/SearchIndex.cpp src/core/SearchService.cpp src/core/BrowserView.cpp)
 
 # spectral waveforms: band analysis and multi-resolution peak cache
 target_sources(lynx_core PRIVATE

+ 37 - 0
docs/analise/REA_rodada163b-browser.md

@@ -0,0 +1,37 @@
+# Round 163b (workflow163b): Browser customization — folders shown, content filter, Sample browser window
+
+2026-10-26. User feedback (FL user, Windows, UI zoom 150 %): "the browser always has a ton of useless folders I don't
+care about, I just need my samples/audio/soundfonts … being able to customize the browser so it only shows me what I
+want or even better a detachable separate browser for my samples/audio would be a giant improvement", plus a
+screenshot of the Browser's folder menu ("DOCUMENTS / Expand all / Collapse all / Refresh / SYSTEM / Open / Copy the
+file path / TAGS / Starred / Add folder…": "a ton of wasted space … make this more compact").
+Evidence markers: [CODE] LYNX source; [TEST] tests/BrowserView163Tests.inc; [WIN] Windows build.
+
+## What changed
+
+| Item | Before | Now |
+|---|---|---|
+| Folders shown | [CODE] fixed list: Current project, Plugin database, FL Packs, FL demo projects, FL MIDI, 3x Osc presets, synth presets, Plugin presets, Documents, Music, Desktop, Downloads, user folders | right-click a top-level folder (or Current project / Plugin database) › "Hide "…" from this Browser"; the options button beside the search box (and the folder menu's "Browser" sub-menu, the panel menu) › "Show folders" is a checklist of every entry, "Show all folders" brings everything back. Hidden folders are not searched either |
+| Content filter | everything LYNX can use | "Show: All files / Audio files only / Samples and SoundFonts / Presets / Projects and MIDI" — applies to the folder tree and to search results (folders always listed) |
+| Sample browser | — | View › "Sample browser (separate window)" (key action `view.sampleBrowser`, also in the Browser's options menu): a second, independent, resizable Browser window with its own folders and filter. First open: only FL Packs, Music, Downloads and the user's folders, filter "Samples and SoundFonts". Drag samples from it onto the Channel Rack / Playlist / Mixer like from the main Browser (the window is its own drag container, drags cross windows); click previews, double-click makes a channel. It reopens at the next start if it was open when LYNX closed, at its last size/position |
+| Menus | section titles "SYSTEM", "TAGS" (each ~39 px tall) | no section titles besides the item's name; file system actions in one "File" sub-menu; the view options in a "Browser" sub-menu (the global menu density belongs to round ui163) |
+
+Settings files (settings folder): `browser-view.txt` (main) and `sample-browser-view.txt` (window): `filter=`, `open=`,
+`bounds=x,y,w,h`, one `hidden=<path or @project/@plugins>` per hidden entry. Logic in src/core/BrowserView.{h,cpp}
+(no JUCE) [TEST]. The search index stays shared and covers every folder (hidden ones too), so switching a folder back
+on needs no re-index.
+
+## Where I stopped
+
+- See the bottom of this file (updated at each landing).
+
+### Landing 1 (2026-10-26)
+- build-local with FL Data: 1753146 checks, 0 failures (tests/BrowserView163Tests.inc: 2 tests).
+- [WIN] Windows build (build-win-workflow163b), GUI checked by hand with screenshots (D:\lynx-work\workflow163b\s1…s11):
+  the Sample browser reopened at start from its view file at its saved bounds with Current project / Plugin database
+  hidden; options button ▸ "Show: …" / "Show folders" checklist; hiding Documents and FL demo projects (checklist and
+  right-click "Hide … from this Browser") saved at once; closing the window wrote open=0; View › Sample browser
+  reopened it; a search for "kick" in it listed FL Packs results; a sample dragged from the Sample browser window onto
+  the main window's Playlist made an audio clip at the drop point (cross-window drag).
+- Not done: a dialog-style "Show folders…" window (a checklist sub-menu instead, one click per folder); the filter does
+  not hide folders that contain no matching files (folders are always listed, as in FL).

+ 16 - 0
resources/i18n/pt-BR.txt

@@ -4787,3 +4787,19 @@ countries: br
 "Audio: post-roll (plays after the punch-out, then stops)" = "Áudio: post-roll (toca depois do punch-out e para)"
 "Promote this take in the loop region to the comp track" = "Promover este take na região de loop para a trilha de comp"
 "Promote this take to the comp track" = "Promover este take para a trilha de comp"
+
+# --- Round 163: Browser view (content filter, folders shown, Sample browser window)
+"Audio files only" = "Só arquivos de áudio"
+"Samples and SoundFonts" = "Samples e SoundFonts"
+"Projects and MIDI" = "Projetos e MIDI"
+"All files" = "Todos os arquivos"
+"Browser options: what to list, which folders to show" = "Opções do Browser: o que listar, quais pastas mostrar"
+"1 folder hidden" = "1 pasta oculta"
+"{0} folders hidden" = "{0} pastas ocultas"
+"Hide \"{0}\" from this Browser" = "Ocultar \"{0}\" deste Browser"
+"Show folders" = "Mostrar pastas"
+"Show all folders" = "Mostrar todas as pastas"
+"Close the Sample browser" = "Fechar o Browser de samples"
+"Sample browser (separate window)" = "Browser de samples (janela separada)"
+"Sample browser" = "Browser de samples"
+"Open in the file manager" = "Abrir no gerenciador de arquivos"

+ 1 - 1
scripts/build-local.sh

@@ -19,7 +19,7 @@ mkdir -p build-local build-local/wavpack
 # workflow shell (key map, workspace layout, rack operations)
 CORE="$CORE src/core/KeyMap.cpp src/core/Workspace.cpp src/core/RackOps.cpp src/core/ChannelMiscFx.cpp src/core/MidiImport.cpp"
 # workflow P2 (note tools, mixer operations, history labels, browser search)
-CORE="$CORE src/core/NoteTools.cpp src/core/PianoRollTools.cpp src/core/EventEdit.cpp src/core/AudioEdit.cpp src/core/MixerOps.cpp src/core/History.cpp src/core/SearchQuery.cpp src/core/SearchIndex.cpp src/core/SearchService.cpp src/core/EffectPresets.cpp src/core/PluginPresets.cpp src/core/ParamHelp.cpp"
+CORE="$CORE src/core/NoteTools.cpp src/core/PianoRollTools.cpp src/core/EventEdit.cpp src/core/AudioEdit.cpp src/core/MixerOps.cpp src/core/History.cpp src/core/SearchQuery.cpp src/core/SearchIndex.cpp src/core/SearchService.cpp src/core/BrowserView.cpp src/core/EffectPresets.cpp src/core/PluginPresets.cpp src/core/ParamHelp.cpp"
 # start-up sound (procedural)
 CORE="$CORE src/core/StartupSound.cpp"
 # FL's 3x Osc engine (REA round 47)

+ 1 - 1
scripts/build-windows-zig.sh

@@ -89,7 +89,7 @@ APP_SOURCES+=(src/platform/FileTypes.cpp src/platform/Paths.cpp src/platform/Nat
 # SEH guard around calls into hosted plugins (round 111): the only unit built with -fms-extensions (__try / __except)
 APP_SOURCES+=(src/platform/CrashGuard.cpp)
 # workflow P2: core (note tools, mixer operations, history labels, browser search)
-APP_SOURCES+=(src/core/NoteTools.cpp src/core/PianoRollTools.cpp src/core/EventEdit.cpp src/core/AudioEdit.cpp src/core/MixerOps.cpp src/core/History.cpp src/core/SearchQuery.cpp src/core/SearchIndex.cpp src/core/SearchService.cpp src/core/EffectPresets.cpp src/core/PluginPresets.cpp src/core/ParamHelp.cpp)
+APP_SOURCES+=(src/core/NoteTools.cpp src/core/PianoRollTools.cpp src/core/EventEdit.cpp src/core/AudioEdit.cpp src/core/MixerOps.cpp src/core/History.cpp src/core/SearchQuery.cpp src/core/SearchIndex.cpp src/core/SearchService.cpp src/core/BrowserView.cpp src/core/EffectPresets.cpp src/core/PluginPresets.cpp src/core/ParamHelp.cpp)
 # workflow P2: UI (note tool dialogs, tool windows, undo history, quick-add palette)
 APP_SOURCES+=(src/ui/NoteToolDialogs.cpp src/ui/EventEditor.cpp src/ui/AudioEditor.cpp src/ui/ToolWindow.cpp src/ui/TempoTapper.cpp src/ui/HistoryPanel.cpp src/ui/QuickAddPalette.cpp)
 # start-up: splash screen and its procedurally synthesised sound

+ 144 - 0
src/core/BrowserView.cpp

@@ -0,0 +1,144 @@
+#include "core/BrowserView.h"
+
+
+#include <algorithm>
+#include <cctype>
+#include <sstream>
+
+namespace lynx::browserview
+{
+namespace
+{
+std::string extensionOf (const std::string& fileName)
+{
+    const auto dot = fileName.find_last_of ('.');
+    if (dot == std::string::npos || dot + 1 >= fileName.size())
+        return {};
+    auto ext = fileName.substr (dot + 1);
+    std::transform (ext.begin(), ext.end(), ext.begin(), [] (unsigned char c) { return (char) std::tolower (c); });
+    return ext;
+}
+
+bool among (const std::string& ext, std::initializer_list<const char*> list)
+{
+    return std::any_of (list.begin(), list.end(), [&ext] (const char* e) { return ext == e; });
+}
+
+bool isAudioExt (const std::string& ext) { return among (ext, { "wav", "flac", "ogg", "mp3", "aif", "aiff", "wv" }); }
+bool isFontExt (const std::string& ext) { return among (ext, { "sf2", "sf3" }); }
+bool isPresetExt (const std::string& ext) { return among (ext, { "fst" }); }
+bool isProjectExt (const std::string& ext) { return among (ext, { "lynx", "flp", "mid", "midi" }); }
+} // namespace
+
+const char* contentFilterId (ContentFilter filter)
+{
+    switch (filter)
+    {
+        case ContentFilter::audio: return "audio";
+        case ContentFilter::samples: return "samples";
+        case ContentFilter::presets: return "presets";
+        case ContentFilter::projects: return "projects";
+        default: return "all";
+    }
+}
+
+const char* contentFilterLabel (ContentFilter filter)
+{
+    switch (filter)
+    {
+        case ContentFilter::audio: return "Audio files only";
+        case ContentFilter::samples: return "Samples and SoundFonts";
+        case ContentFilter::presets: return "Presets";
+        case ContentFilter::projects: return "Projects and MIDI";
+        default: return "All files";
+    }
+}
+
+ContentFilter contentFilterFromId (const std::string& id)
+{
+    for (int i = 0; i < contentFilterCount; ++i)
+        if (id == contentFilterId ((ContentFilter) i))
+            return (ContentFilter) i;
+    return ContentFilter::all;
+}
+
+bool listed (const std::string& fileName, ContentFilter filter)
+{
+    const auto ext = extensionOf (fileName);
+    const auto audio = isAudioExt (ext), font = isFontExt (ext), preset = isPresetExt (ext), project = isProjectExt (ext);
+    switch (filter)
+    {
+        case ContentFilter::audio: return audio;
+        case ContentFilter::samples: return audio || font;
+        case ContentFilter::presets: return preset || font;
+        case ContentFilter::projects: return project;
+        default: return audio || font || preset || project;
+    }
+}
+
+bool sampleBrowserShowsByDefault (RootKind kind)
+{
+    return kind == RootKind::flSamples || kind == RootKind::music || kind == RootKind::downloads || kind == RootKind::user;
+}
+
+void View::setShown (const std::string& id, bool shown)
+{
+    if (shown)
+        hidden.erase (id);
+    else
+        hidden.insert (id);
+}
+
+std::string View::toText() const
+{
+    std::ostringstream out;
+    out << "filter=" << contentFilterId (filter) << "\n";
+    out << "open=" << (open ? 1 : 0) << "\n";
+    out << "bounds=" << x << "," << y << "," << width << "," << height << "\n";
+    for (const auto& id : hidden)
+        out << "hidden=" << id << "\n";
+    return out.str();
+}
+
+View View::fromText (const std::string& text)
+{
+    View v;
+    std::istringstream in (text);
+    std::string line;
+    while (std::getline (in, line))
+    {
+        if (! line.empty() && line.back() == '\r')
+            line.pop_back();
+        const auto eq = line.find ('=');
+        if (eq == std::string::npos)
+            continue;
+        auto trim = [] (std::string s) {
+            const auto a = s.find_first_not_of (" \t");
+            const auto b = s.find_last_not_of (" \t");
+            return a == std::string::npos ? std::string() : s.substr (a, b - a + 1);
+        };
+        const auto key = trim (line.substr (0, eq));
+        const auto value = trim (line.substr (eq + 1));
+        if (key == "filter")
+            v.filter = contentFilterFromId (value);
+        else if (key == "open")
+            v.open = value == "1";
+        else if (key == "hidden" && ! value.empty())
+            v.hidden.insert (value);
+        else if (key == "bounds")
+        {
+            int n[4] {};
+            char sep = 0;
+            std::istringstream b (value);
+            if ((b >> n[0] >> sep >> n[1] >> sep >> n[2] >> sep >> n[3]) && n[2] >= 0 && n[3] >= 0)
+            {
+                v.x = n[0];
+                v.y = n[1];
+                v.width = n[2];
+                v.height = n[3];
+            }
+        }
+    }
+    return v;
+}
+} // namespace lynx::browserview

+ 71 - 0
src/core/BrowserView.h

@@ -0,0 +1,71 @@
+#pragma once
+
+// What a Browser shows (round 163, user feedback "the browser always has a ton of useless folders I don't care about,
+// I just need my samples/audio/soundfonts"): which of its top-level entries (roots) are visible and which kinds of
+// files it lists. The main Browser and the separate Sample browser window each keep their own view, saved as
+// "key=value" lines in the settings folder. No JUCE, so it can be tested in isolation.
+
+#include <set>
+#include <string>
+
+namespace lynx::browserview
+{
+// What the Browser lists in its folders and search results (folders are always listed).
+enum class ContentFilter
+{
+    all,      // every file LYNX can use (audio, MIDI, projects, presets, SoundFonts)
+    audio,    // audio files only
+    samples,  // audio files and SoundFonts
+    presets,  // channel / plugin presets and SoundFonts
+    projects, // .lynx / .flp projects and MIDI files
+    count
+};
+
+constexpr int contentFilterCount = (int) ContentFilter::count;
+const char* contentFilterId (ContentFilter filter);    // "all", "audio", "samples", "presets", "projects"
+const char* contentFilterLabel (ContentFilter filter); // English menu text (the UI translates it)
+ContentFilter contentFilterFromId (const std::string& id); // unknown: all
+
+// Whether a file named `fileName` (only its extension matters, case-insensitive) is listed under `filter`.
+// Files LYNX doesn't use are never listed.
+bool listed (const std::string& fileName, ContentFilter filter);
+
+// The kinds of top-level entries a Browser has. Folder roots are identified by their path; the two entries without a
+// folder have fixed ids (projectRootId, pluginsRootId).
+enum class RootKind
+{
+    project,        // "Current project"
+    pluginDatabase, // the Plugin database
+    flSamples,      // FL's sample packs
+    flDemos,        // FL's demo projects
+    flMidi,         // FL's MIDI scores
+    flPresets,      // FL's channel / plugin presets (3x Osc, synth presets)
+    pluginPresets,  // LYNX's own plugin presets folder
+    documents,
+    music,
+    desktop,
+    downloads,
+    user            // a folder the user added
+};
+
+inline constexpr const char* projectRootId = "@project";
+inline constexpr const char* pluginsRootId = "@plugins";
+
+// Whether a root is shown in the Sample browser before the user chose (only sample / audio places).
+bool sampleBrowserShowsByDefault (RootKind kind);
+
+struct View
+{
+    std::set<std::string> hidden; // ids of the hidden roots (a folder's path, or projectRootId / pluginsRootId)
+    ContentFilter filter = ContentFilter::all;
+    bool open = false;            // the Sample browser window was open (unused for the main Browser)
+    int x = 0, y = 0, width = 0, height = 0; // the window's last bounds (0 = default)
+
+    bool shows (const std::string& id) const { return hidden.count (id) == 0; }
+    void setShown (const std::string& id, bool shown);
+
+    std::string toText() const;
+    static View fromText (const std::string& text);
+    bool operator== (const View&) const = default;
+};
+} // namespace lynx::browserview

+ 1 - 0
src/core/KeyMap.cpp

@@ -52,6 +52,7 @@ std::vector<Action> makeActions()
         { "view.toolbar", TR_NOOP ("Show or hide the toolbar panels"), Context::global, { chord (f11, ctrl) } },
         { "view.audioEditor", TR_NOOP ("Open the audio editor"), Context::global, {} },
         { "view.tempoTapper", TR_NOOP ("Tempo tapper (tap the tempo)"), Context::global, {} },
+        { "view.sampleBrowser", TR_NOOP ("Sample browser (separate window)"), Context::global, {} },
 
         // workspace panels
         { "panel.playlist", TR_NOOP ("Show, focus or hide the Playlist"), Context::global, { chord (f5) } },

+ 323 - 43
src/ui/BrowserComponent.cpp

@@ -1132,7 +1132,7 @@ private:
         }
 
         for (const auto& f : files)
-            if (isListed (f))
+            if (browser.lists (f))
             {
                 auto c = std::make_unique<Node>();
                 c->file = f;
@@ -1398,6 +1398,11 @@ private:
         {
             menu.addSectionHeader (n.label);
             expandItems();
+            if ((n.kind == Kind::project || n.kind == Kind::plugins) && n.parent == nullptr && browser.tab == allTab) // round 163
+            {
+                menu.addSeparator();
+                browser.addHideItem (menu, n.kind == Kind::project ? browserview::projectRootId : browserview::pluginsRootId, n.label);
+            }
             menu.showMenuAsync (juce::PopupMenu::Options().withMousePosition());
             return;
         }
@@ -1922,8 +1927,8 @@ private:
     std::vector<std::pair<juce::String, juce::String>> rows;
 };
 
-BrowserComponent::BrowserComponent (AudioEngine& e)
-    : engine (e)
+BrowserComponent::BrowserComponent (AudioEngine& e, Role r)
+    : engine (e), role (r)
 {
     tabs = std::make_unique<TabBar> (*this);
     addAndMakeVisible (*tabs);
@@ -1934,8 +1939,8 @@ BrowserComponent::BrowserComponent (AudioEngine& e)
     searcher->statusChanged.addChangeListener (this);
     searcher->indexChanged.addChangeListener (this);
     juce::Timer::callAfterDelay (4000, [safe = juce::Component::SafePointer<BrowserComponent> (this)] {
-        if (safe != nullptr && ! safe->roots.isEmpty())
-            safe->searcher->service->refresh (toPaths (safe->roots));
+        if (safe != nullptr && safe->role == Role::main && ! safe->allRoots.isEmpty())
+            safe->searcher->service->refresh (toPaths (safe->allRoots));
     });
     focusWatcher = std::make_unique<FocusWatcher> (*this);
 
@@ -1955,6 +1960,14 @@ BrowserComponent::BrowserComponent (AudioEngine& e)
     stopButton.onClick = [this] { stopPreview(); };
     addAndMakeVisible (stopButton);
 
+    // what this Browser shows (round 163): content filter, folders shown, the Sample browser window
+    viewButton.setFlat (true);
+    viewButton.setWantsKeyboardFocus (false);
+    viewButton.setMouseClickGrabsKeyboardFocus (false);
+    viewButton.setClickingTogglesState (false);
+    viewButton.onClick = [this] { showViewMenu(); };
+    addAndMakeVisible (viewButton);
+
     // the sample preview volume (FL's Browser has one too): a small knob at the end of the search row
     previewVolume.setRange (0.0, controls::maxUtilityVolume, 0.01);
     previewVolume.setDoubleClickReturnValue (true, 1.0);
@@ -2021,10 +2034,252 @@ void BrowserComponent::setStarred (const juce::File& file, bool on)
         rebuildTree();
 }
 
+// --- what this Browser shows (round 163) ------------------------------------------------------------
+
+juce::File BrowserComponent::viewFile (Role r)
+{
+    return PluginHost::settingsFolder().getChildFile (r == Role::samples ? "sample-browser-view.txt" : "browser-view.txt");
+}
+
+bool BrowserComponent::sampleBrowserWasOpen()
+{
+    return browserview::View::fromText (viewFile (Role::samples).loadFileAsString().toStdString()).open;
+}
+
+juce::Rectangle<int> BrowserComponent::sampleBrowserBounds()
+{
+    const auto v = browserview::View::fromText (viewFile (Role::samples).loadFileAsString().toStdString());
+    return { v.x, v.y, v.width, v.height };
+}
+
+void BrowserComponent::loadView()
+{
+    viewLoaded = true;
+    const auto file = viewFile (role);
+    viewFromFile = file.existsAsFile();
+    if (viewFromFile)
+    {
+        view = browserview::View::fromText (file.loadFileAsString().toStdString());
+        return;
+    }
+    view = {};
+    if (role == Role::samples)
+    {
+        // the Sample browser starts with only the places samples live, listing samples and SoundFonts
+        view.filter = browserview::ContentFilter::samples;
+        view.setShown (browserview::projectRootId, false);
+        view.setShown (browserview::pluginsRootId, false);
+        for (int i = 0; i < allRoots.size(); ++i)
+            if (! browserview::sampleBrowserShowsByDefault (allRootKinds[(std::size_t) i]))
+                view.setShown (allRoots[i].getFullPathName().toStdString(), false);
+    }
+}
+
+void BrowserComponent::saveView() const
+{
+    if (! viewLoaded)
+        return;
+    const auto file = viewFile (role);
+    auto v = view;
+    if (role == Role::samples) // the window's open state and bounds are the window's to write
+    {
+        const auto old = browserview::View::fromText (file.loadFileAsString().toStdString());
+        v.open = old.open;
+        v.x = old.x, v.y = old.y, v.width = old.width, v.height = old.height;
+    }
+    file.getParentDirectory().createDirectory();
+    file.replaceWithText (juce::String::fromUTF8 (v.toText().c_str()));
+}
+
+bool BrowserComponent::lists (const juce::File& file) const
+{
+    return browserview::listed (file.getFileName().toStdString(), view.filter) || file.isDirectory();
+}
+
+void BrowserComponent::setContentFilter (browserview::ContentFilter filter)
+{
+    if (filter == view.filter)
+        return;
+    view.filter = filter;
+    saveView();
+    refreshViewButton();
+    rebuildTree();
+    if (searchBox.getText().trim().isNotEmpty())
+        runSearch();
+}
+
+void BrowserComponent::setRootShown (const juce::String& id, bool shown)
+{
+    if (view.shows (id.toStdString()) == shown)
+        return;
+    view.setShown (id.toStdString(), shown);
+    saveView();
+    rebuildRoots();
+    if (searchBox.getText().trim().isNotEmpty())
+        runSearch();
+}
+
+void BrowserComponent::showAllRoots()
+{
+    view.hidden.clear();
+    saveView();
+    rebuildRoots();
+}
+
+juce::String BrowserComponent::rootId (const juce::File& folder) const
+{
+    return allRoots.contains (folder) ? folder.getFullPathName() : juce::String();
+}
+
+void BrowserComponent::refreshViewButton()
+{
+    const auto filtered = view.filter != browserview::ContentFilter::all;
+    int hidden = 0;
+    for (const auto& id : view.hidden)
+        hidden += id == browserview::projectRootId || id == browserview::pluginsRootId
+                          || allRoots.contains (juce::File (juce::String::fromUTF8 (id.c_str())))
+                      ? 1 : 0;
+    viewButton.setToggleState (filtered || hidden > 0, juce::dontSendNotification);
+    juce::String text = tr ("Browser options: what to list, which folders to show");
+    if (filtered)
+        text << "  (" << tr (browserview::contentFilterLabel (view.filter)) << ")";
+    if (hidden > 0)
+        text << "  (" << (hidden == 1 ? tr ("1 folder hidden") : tr ("{0} folders hidden", { juce::String (hidden) })) << ")";
+    viewButton.setTooltip (text);
+    ui::setHint (viewButton, text, true);
+}
+
+void BrowserComponent::addHideItem (juce::PopupMenu& menu, const juce::String& id, const juce::String& label)
+{
+    menu.addItem (tr ("Hide \"{0}\" from this Browser", { label }), [safe = juce::Component::SafePointer<BrowserComponent> (this), id] {
+        if (safe != nullptr)
+            safe->setRootShown (id, false);
+    });
+}
+
+void BrowserComponent::addViewItems (juce::PopupMenu& menu)
+{
+    juce::Component::SafePointer<BrowserComponent> safe (this);
+    // what is listed (folders are always listed)
+    juce::PopupMenu filters;
+    for (int i = 0; i < browserview::contentFilterCount; ++i)
+    {
+        const auto f = (browserview::ContentFilter) i;
+        filters.addItem (tr (browserview::contentFilterLabel (f)), true, view.filter == f, [safe, f] {
+            if (safe != nullptr)
+                safe->setContentFilter (f);
+        });
+    }
+    menu.addSubMenu (tr ("Show") + ": " + tr (browserview::contentFilterLabel (view.filter)), filters);
+
+    // which top-level entries are shown (a checklist; hidden ones come back from here)
+    juce::PopupMenu folders;
+    auto toggle = [safe] (const juce::String& id) {
+        if (safe != nullptr)
+            safe->setRootShown (id, ! safe->view.shows (id.toStdString()));
+    };
+    folders.addItem (tr ("Current project"), true, view.shows (browserview::projectRootId), [toggle] { toggle (browserview::projectRootId); });
+    folders.addItem (tr ("Plugin database"), true, view.shows (browserview::pluginsRootId), [toggle] { toggle (browserview::pluginsRootId); });
+    for (int i = 0; i < allRoots.size(); ++i)
+    {
+        const auto id = allRoots[i].getFullPathName();
+        juce::PopupMenu::Item item (allRootNames[i]);
+        item.setTicked (view.shows (id.toStdString())).setAction ([toggle, id] { toggle (id); });
+        item.shortcutKeyDescription = allRoots[i].getParentDirectory().getFileName();
+        folders.addItem (std::move (item));
+    }
+    folders.addSeparator();
+    folders.addItem (tr ("Show all folders"), ! view.hidden.empty(), false, [safe] {
+        if (safe != nullptr)
+            safe->showAllRoots();
+    });
+    folders.addItem (tr ("Add folder..."), [safe] {
+        if (safe != nullptr)
+            safe->addUserFolder();
+    });
+    menu.addSubMenu (tr ("Show folders"), folders);
+}
+
+void BrowserComponent::showViewMenu()
+{
+    juce::PopupMenu menu;
+    addViewItems (menu);
+    juce::Component::SafePointer<BrowserComponent> safe (this);
+    menu.addSeparator();
+    menu.addItem (tr ("Refresh"), [safe] { if (safe != nullptr) safe->rebuildRoots(); });
+    menu.addItem (tr ("Refresh search index"), [safe] { if (safe != nullptr) safe->refreshSearchIndex (false); });
+    if (onToggleSampleBrowser != nullptr)
+    {
+        menu.addSeparator();
+        menu.addItem (role == Role::samples ? tr ("Close the Sample browser") : tr ("Sample browser (separate window)"),
+                      [safe] { if (safe != nullptr && safe->onToggleSampleBrowser != nullptr) safe->onToggleSampleBrowser(); });
+    }
+    menu.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (&viewButton));
+}
+
+namespace
+{
+// The Sample browser window's content: a drag container (samples dragged out of this window reach the Channel Rack,
+// the Playlist and the Mixer of the main window) holding the Browser; it keeps the window's bounds and whether the
+// user closed it.
+class SampleBrowserHost final : public juce::Component,
+                                public juce::DragAndDropContainer
+{
+public:
+    SampleBrowserHost (AudioEngine& engine, const std::function<void (BrowserComponent&)>& wire)
+        : browser (engine, BrowserComponent::Role::samples)
+    {
+        if (wire != nullptr)
+            wire (browser);
+        addAndMakeVisible (browser);
+        setSize (340, 620);
+    }
+
+    ~SampleBrowserHost() override
+    {
+        // a window the user closed is hidden first (ToolWindow::closeSoon); one deleted while visible goes with LYNX
+        // and opens again at the next start
+        auto* window = getTopLevelComponent();
+        auto v = browser.getView();
+        v.open = window != this && window->isVisible();
+        if (window != this)
+        {
+            const auto b = window->getBounds();
+            v.x = b.getX();
+            v.y = b.getY();
+            v.width = b.getWidth();
+            v.height = b.getHeight();
+        }
+        file().getParentDirectory().createDirectory();
+        file().replaceWithText (juce::String::fromUTF8 (v.toText().c_str()));
+    }
+
+    void resized() override { browser.setBounds (getLocalBounds()); }
+
+    static juce::File file() { return PluginHost::settingsFolder().getChildFile ("sample-browser-view.txt"); }
+
+    BrowserComponent browser;
+};
+} // namespace
+
+std::unique_ptr<juce::Component> BrowserComponent::makeSampleBrowserContent (AudioEngine& engine, const std::function<void (BrowserComponent&)>& wire)
+{
+    auto host = std::make_unique<SampleBrowserHost> (engine, wire);
+    auto v = host->browser.getView();
+    v.open = true; // (written at once: a crash keeps it open next time too)
+    SampleBrowserHost::file().getParentDirectory().createDirectory();
+    SampleBrowserHost::file().replaceWithText (juce::String::fromUTF8 (v.toText().c_str()));
+    return host;
+}
+
 void BrowserComponent::rebuildRoots()
 {
     roots.clear();
     rootNames.clear();
+    allRoots.clear();
+    allRootNames.clear();
+    allRootKinds.clear();
+    using browserview::RootKind;
 
     // FL folders (if installed) and user folders
     const auto programs = juce::File::getSpecialLocation (juce::File::globalApplicationsDirectory);
@@ -2034,30 +2289,41 @@ void BrowserComponent::rebuildRoots()
         if (dir.getChildFile ("Data").isDirectory() && dir.getFileName() > fl.getFileName()) // "FL Studio ASIO" is the driver
             fl = dir;
 
-    auto add = [this] (const juce::String& name, const juce::File& folder) {
-        if (folder.isDirectory() && ! roots.contains (folder))
+    auto add = [this] (const juce::String& name, const juce::File& folder, RootKind kind) {
+        if (folder.isDirectory() && ! allRoots.contains (folder))
         {
-            roots.add (folder);
-            rootNames.add (name);
+            allRoots.add (folder);
+            allRootNames.add (name);
+            allRootKinds.push_back (kind);
         }
     };
 
     const auto data = fl.getChildFile ("Data");
-    add (tr ("FL samples (Packs)"), data.getChildFile ("Patches").getChildFile ("Packs"));
-    add (tr ("FL demo projects"), data.getChildFile ("Demo projects"));
-    add (tr ("FL MIDI"), data.getChildFile ("Patches").getChildFile ("Scores"));
-    add (tr ("3x Osc presets (FL)"), data.getChildFile ("Patches").getChildFile ("Channel presets").getChildFile ("3x Osc"));
-    add (tr ("Synth presets (FL)"), data.getChildFile ("Patches").getChildFile ("Plugin presets").getChildFile ("Generators"));
+    add (tr ("FL samples (Packs)"), data.getChildFile ("Patches").getChildFile ("Packs"), RootKind::flSamples);
+    add (tr ("FL demo projects"), data.getChildFile ("Demo projects"), RootKind::flDemos);
+    add (tr ("FL MIDI"), data.getChildFile ("Patches").getChildFile ("Scores"), RootKind::flMidi);
+    add (tr ("3x Osc presets (FL)"), data.getChildFile ("Patches").getChildFile ("Channel presets").getChildFile ("3x Osc"), RootKind::flPresets);
+    add (tr ("Synth presets (FL)"), data.getChildFile ("Patches").getChildFile ("Plugin presets").getChildFile ("Generators"), RootKind::flPresets);
     pluginpresetui::presetsRoot().createDirectory(); // (the plugin window saves presets there; round 162d)
-    add (tr ("Plugin presets"), pluginpresetui::presetsRoot());
-    add (tr ("Documents"), juce::File::getSpecialLocation (juce::File::userDocumentsDirectory));
-    add (tr ("Music"), juce::File::getSpecialLocation (juce::File::userMusicDirectory));
-    add (tr ("Desktop"), juce::File::getSpecialLocation (juce::File::userDesktopDirectory));
-    add (tr ("Downloads"), juce::File::getSpecialLocation (juce::File::userHomeDirectory).getChildFile ("Downloads"));
+    add (tr ("Plugin presets"), pluginpresetui::presetsRoot(), RootKind::pluginPresets);
+    add (tr ("Documents"), juce::File::getSpecialLocation (juce::File::userDocumentsDirectory), RootKind::documents);
+    add (tr ("Music"), juce::File::getSpecialLocation (juce::File::userMusicDirectory), RootKind::music);
+    add (tr ("Desktop"), juce::File::getSpecialLocation (juce::File::userDesktopDirectory), RootKind::desktop);
+    add (tr ("Downloads"), juce::File::getSpecialLocation (juce::File::userHomeDirectory).getChildFile ("Downloads"), RootKind::downloads);
 
     for (const auto& line : juce::StringArray::fromLines (userFoldersFile().loadFileAsString()))
         if (line.trim().isNotEmpty())
-            add (juce::File (line.trim()).getFileName(), juce::File (line.trim()));
+            add (juce::File (line.trim()).getFileName(), juce::File (line.trim()), RootKind::user);
+
+    if (! viewLoaded)
+        loadView();
+    for (int i = 0; i < allRoots.size(); ++i)
+        if (view.shows (allRoots[i].getFullPathName().toStdString()))
+        {
+            roots.add (allRoots[i]);
+            rootNames.add (allRootNames[i]);
+        }
+    refreshViewButton();
 
     starred.clear();
     for (const auto& line : juce::StringArray::fromLines (starredFile().loadFileAsString()))
@@ -2094,16 +2360,19 @@ void BrowserComponent::rebuildTree()
         treeView->setViewPosition (0, 0);
         return;
     }
-    top.push_back (FileTree::makeProject (tab == projectTab));
-    if (tab == allTab) // FL's Plugin database, under the project (round 142)
+    if (tab == projectTab || view.shows (browserview::projectRootId))
+        top.push_back (FileTree::makeProject (tab == projectTab));
+    if (tab == allTab && view.shows (browserview::pluginsRootId)) // FL's Plugin database, under the project (round 142)
         top.push_back (FileTree::makePluginDatabase (*this, openPluginFolders));
 
     if (tab == allTab)
-        for (int i = 0; i < roots.size(); ++i)
+        for (int i = 0; i < allRoots.size(); ++i)
         {
+            if (! roots.contains (allRoots[i]))
+                continue; // hidden from this Browser (round 163)
             // the FL folders keep their colour by position; the user's own folders share one
             auto colour = rootColour (i < 9 ? i : 99);
-            top.push_back (FileTree::makeFolder (roots[i], rootNames[i], colour));
+            top.push_back (FileTree::makeFolder (allRoots[i], allRootNames[i], colour));
         }
 
     tree->setTopLevel (std::move (top));
@@ -2192,6 +2461,7 @@ void BrowserComponent::resized()
         auto row = area.removeFromTop (24);
         previewVolume.setBounds (row.removeFromRight (24));
         stopButton.setBounds (row.removeFromRight (22));
+        viewButton.setBounds (row.removeFromRight (22));
         row.removeFromRight (4);
         searchBox.setBounds (row);
     }
@@ -2273,15 +2543,19 @@ void BrowserComponent::fileSelected (const juce::File& file, bool preview)
 // FL's Browser menus (REA round 143b, [EXEC] FL 2026: right-click on a sample, a folder, a plugin): the file's actions
 // first, then a "System" section (open the parent folder, locate the file, delete it) and a "Tags" section (Favorite);
 // a folder: Expand all / Collapse all, then System (Open). LYNX keeps its own "Add folder..." and "Refresh".
+// Round 163 (user feedback: "this sort of UI has a ton of wasted space"): no "System" / "Tags" titles any more; the
+// rarely used system actions sit in one "File" sub-menu, Starred stays one click away.
 void BrowserComponent::addSystemItems (juce::PopupMenu& menu, const juce::File& file)
 {
-    menu.addSectionHeader (tr ("System"));
-    menu.addItem (tr ("Open parent folder"), [file] { file.getParentDirectory().startAsProcess(); });
-    menu.addItem (tr ("Locate file"), [file] { file.revealToUser(); });
-    menu.addItem (tr ("Copy the file path"), [file] { juce::SystemClipboard::copyTextToClipboard (file.getFullPathName()); });
-    menu.addItem (tr ("Delete file..."), file.existsAsFile(), false, [this, file] { confirmDeleteFile (file); });
-    menu.addSectionHeader (tr ("Tags"));
+    menu.addSeparator();
     menu.addItem (tr ("Starred"), true, isStarred (file), [this, file] { setStarred (file, ! isStarred (file)); });
+    juce::PopupMenu system;
+    system.addItem (tr ("Open parent folder"), [file] { file.getParentDirectory().startAsProcess(); });
+    system.addItem (tr ("Locate file"), [file] { file.revealToUser(); });
+    system.addItem (tr ("Copy the file path"), [file] { juce::SystemClipboard::copyTextToClipboard (file.getFullPathName()); });
+    system.addSeparator();
+    system.addItem (tr ("Delete file..."), file.existsAsFile(), false, [this, file] { confirmDeleteFile (file); });
+    menu.addSubMenu (tr ("File"), system);
 }
 
 void BrowserComponent::confirmDeleteFile (const juce::File& file)
@@ -2330,28 +2604,32 @@ void BrowserComponent::showFileMenu (const juce::File& file)
     }
 
     addSystemItems (menu, file);
-    menu.addSeparator();
     menu.addItem (tr ("Collapse all folders"), [this] { tree->collapseAll(); });
-    menu.addItem (tr ("Add folder..."), [this] { addUserFolder(); });
+    juce::PopupMenu browserMenu;
+    addViewItems (browserMenu);
+    menu.addSubMenu (tr ("Browser"), browserMenu);
     menu.showMenuAsync (juce::PopupMenu::Options().withMousePosition());
 }
 
 void BrowserComponent::showFolderMenu (const juce::File& folder, std::function<void()> expandAll)
 {
+    // compact (round 163): the folder's name as the only title, its actions, then the Browser's own options
     juce::PopupMenu menu;
     menu.addSectionHeader (folder.getFileName());
     menu.addItem (tr ("Expand all"), expandAll != nullptr, false, [expandAll] { expandAll(); });
     menu.addItem (tr ("Collapse all"), [this] { tree->collapseAll(); });
-    menu.addSeparator();
-    menu.addItem (tr ("Refresh"), [this] { rebuildRoots(); });
-    menu.addItem (tr ("Refresh search index"), [this] { refreshSearchIndex (false); });
-    menu.addSectionHeader (tr ("System"));
-    menu.addItem (tr ("Open"), [folder] { folder.startAsProcess(); });
-    menu.addItem (tr ("Copy the file path"), [folder] { juce::SystemClipboard::copyTextToClipboard (folder.getFullPathName()); });
-    menu.addSectionHeader (tr ("Tags"));
     menu.addItem (tr ("Starred"), folder.isDirectory(), isStarred (folder), [this, folder] { setStarred (folder, ! isStarred (folder)); });
+    menu.addItem (tr ("Open in the file manager"), [folder] { folder.startAsProcess(); });
+    menu.addItem (tr ("Copy the file path"), [folder] { juce::SystemClipboard::copyTextToClipboard (folder.getFullPathName()); });
     menu.addSeparator();
-    menu.addItem (tr ("Add folder..."), [this] { addUserFolder(); });
+    if (const auto id = rootId (folder); id.isNotEmpty() && tab == allTab)
+        addHideItem (menu, id, allRootNames[allRoots.indexOf (folder)]);
+    juce::PopupMenu browserMenu;
+    addViewItems (browserMenu);
+    browserMenu.addSeparator();
+    browserMenu.addItem (tr ("Refresh"), [this] { rebuildRoots(); });
+    browserMenu.addItem (tr ("Refresh search index"), [this] { refreshSearchIndex (false); });
+    menu.addSubMenu (tr ("Browser"), browserMenu);
     menu.showMenuAsync (juce::PopupMenu::Options().withMousePosition());
 }
 
@@ -2550,7 +2828,8 @@ void BrowserComponent::searchAnswered (const search::SearchResult& r, const juce
 
     juce::Array<juce::File> found;
     for (const auto& path : r.paths)
-        found.add (juce::File (juce::String::fromUTF8 (path.c_str())));
+        if (juce::File f (juce::String::fromUTF8 (path.c_str())); view.filter == browserview::ContentFilter::all || lists (f))
+            found.add (f);
 
     // (partial answers and re-searches keep the selection and the scroll position)
     const auto selected = results->selectedFile();
@@ -2619,8 +2898,9 @@ void BrowserComponent::indexStatusChanged()
 
 void BrowserComponent::refreshSearchIndex (bool rebuild)
 {
-    if (! roots.isEmpty())
-        searcher->service->refresh (toPaths (roots), rebuild);
+    // the index is shared by every Browser: it covers every folder, hidden ones too
+    if (! allRoots.isEmpty())
+        searcher->service->refresh (toPaths (allRoots), rebuild);
     ui::postHint ({ rebuild ? tr ("Rebuilding the Browser's search index in the background...")
                             : tr ("Checking the Browser's search index in the background (only changed folders are read again)..."),
                     {}, false, false },

+ 42 - 2
src/ui/BrowserComponent.h

@@ -4,6 +4,7 @@
 
 #include <juce_gui_basics/juce_gui_basics.h>
 
+#include "core/BrowserView.h"
 #include "engine/AudioEngine.h"
 #include "ui/Icons.h"
 
@@ -41,8 +42,33 @@ class BrowserComponent final : public juce::Component,
                                private juce::Timer
 {
 public:
-    explicit BrowserComponent (AudioEngine& engine);
+    // The main Browser (a panel) or the separate Sample browser window (round 163): each keeps its own view (which
+    // top-level folders it shows, which kinds of files it lists).
+    enum class Role
+    {
+        main,
+        samples
+    };
+    explicit BrowserComponent (AudioEngine& engine, Role role = Role::main);
     ~BrowserComponent() override;
+    Role getRole() const noexcept { return role; }
+
+    // What this Browser shows (round 163): the content filter, the hidden top-level entries; saved at once.
+    const browserview::View& getView() const noexcept { return view; }
+    void setContentFilter (browserview::ContentFilter filter);
+    void setRootShown (const juce::String& id, bool shown);
+    void showAllRoots();
+    // The Browser's options menu (the button beside the search box, the panel menu): filter, folders, search index.
+    void addViewItems (juce::PopupMenu& menu);
+    void showViewMenu();
+    // The Sample browser window opens / closes from here (the main window sets it): View › Sample browser.
+    std::function<void()> onToggleSampleBrowser;
+    // The Sample browser window's content: a drag container holding a Browser of role `samples`; `wire` connects
+    // its callbacks like the main Browser's. The window keeps its bounds and open state in the view file.
+    static std::unique_ptr<juce::Component> makeSampleBrowserContent (AudioEngine& engine, const std::function<void (BrowserComponent&)>& wire);
+    // Whether the Sample browser was open when LYNX last closed (its view file).
+    static bool sampleBrowserWasOpen();
+    static juce::Rectangle<int> sampleBrowserBounds(); // its last window bounds (empty: default)
 
     std::function<void (const juce::File&)> onOpenProject;
     // Enter / Shift+Up/Down: put this file into the selected channel; returns false if it can't take it.
@@ -152,6 +178,13 @@ private:
     void rebuildTree();
     static juce::File userFoldersFile();
     static juce::File starredFile();
+    static juce::File viewFile (Role role);
+    void loadView();
+    void saveView() const;
+    bool viewLoaded = false, viewFromFile = false;
+    bool lists (const juce::File& file) const; // a file listed under the content filter
+    void addHideItem (juce::PopupMenu& menu, const juce::String& id, const juce::String& label);
+    juce::String rootId (const juce::File& folder) const; // the root's id, empty if `folder` isn't a root
     juce::StringArray starred;
     void openFile (const juce::File& file); // what a double-click does
     void fileSelected (const juce::File& file, bool preview);
@@ -177,6 +210,8 @@ private:
     class FocusWatcher; // a click outside the search box takes the keyboard back from it
     std::unique_ptr<FocusWatcher> focusWatcher;
     IconButton stopButton { "stop preview", Icon::stop };
+    IconButton viewButton { "browser options", Icon::panelMenu };
+    void refreshViewButton();
     juce::Slider previewVolume { juce::Slider::RotaryHorizontalVerticalDrag, juce::Slider::NoTextBox };
     std::unique_ptr<juce::FileChooser> chooser;
     int tab = allTab;
@@ -185,8 +220,13 @@ private:
     std::set<juce::String> openPluginFolders; // the Plugin database folders the user opened (round 142)
 
     AudioEngine& engine;
-    juce::Array<juce::File> roots;
+    Role role = Role::main;
+    browserview::View view;
+    juce::Array<juce::File> roots; // the folder roots shown
     juce::StringArray rootNames;
+    juce::Array<juce::File> allRoots; // every folder root (hidden ones too)
+    juce::StringArray allRootNames;
+    std::vector<browserview::RootKind> allRootKinds;
 
     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BrowserComponent)
 };

+ 36 - 1
src/ui/I18nData.h

@@ -14072,6 +14072,41 @@ inline constexpr unsigned char ptBR[] = {
 116, 101, 32, 116, 104, 105, 115, 32, 116, 97, 107, 101, 32, 116, 111, 32, 116, 104, 101, 32, 99, 111, 109, 112,
 32, 116, 114, 97, 99, 107, 34, 32, 61, 32, 34, 80, 114, 111, 109, 111, 118, 101, 114, 32, 101, 115, 116, 101,
 32, 116, 97, 107, 101, 32, 112, 97, 114, 97, 32, 97, 32, 116, 114, 105, 108, 104, 97, 32, 100, 101, 32, 99,
-111, 109, 112, 34, 10,
+111, 109, 112, 34, 10, 10, 35, 32, 45, 45, 45, 32, 82, 111, 117, 110, 100, 32, 49, 54, 51, 58, 32, 66,
+114, 111, 119, 115, 101, 114, 32, 118, 105, 101, 119, 32, 40, 99, 111, 110, 116, 101, 110, 116, 32, 102, 105, 108,
+116, 101, 114, 44, 32, 102, 111, 108, 100, 101, 114, 115, 32, 115, 104, 111, 119, 110, 44, 32, 83, 97, 109, 112,
+108, 101, 32, 98, 114, 111, 119, 115, 101, 114, 32, 119, 105, 110, 100, 111, 119, 41, 10, 34, 65, 117, 100, 105,
+111, 32, 102, 105, 108, 101, 115, 32, 111, 110, 108, 121, 34, 32, 61, 32, 34, 83, 195, 179, 32, 97, 114, 113,
+117, 105, 118, 111, 115, 32, 100, 101, 32, 195, 161, 117, 100, 105, 111, 34, 10, 34, 83, 97, 109, 112, 108, 101,
+115, 32, 97, 110, 100, 32, 83, 111, 117, 110, 100, 70, 111, 110, 116, 115, 34, 32, 61, 32, 34, 83, 97, 109,
+112, 108, 101, 115, 32, 101, 32, 83, 111, 117, 110, 100, 70, 111, 110, 116, 115, 34, 10, 34, 80, 114, 111, 106,
+101, 99, 116, 115, 32, 97, 110, 100, 32, 77, 73, 68, 73, 34, 32, 61, 32, 34, 80, 114, 111, 106, 101, 116,
+111, 115, 32, 101, 32, 77, 73, 68, 73, 34, 10, 34, 65, 108, 108, 32, 102, 105, 108, 101, 115, 34, 32, 61,
+32, 34, 84, 111, 100, 111, 115, 32, 111, 115, 32, 97, 114, 113, 117, 105, 118, 111, 115, 34, 10, 34, 66, 114,
+111, 119, 115, 101, 114, 32, 111, 112, 116, 105, 111, 110, 115, 58, 32, 119, 104, 97, 116, 32, 116, 111, 32, 108,
+105, 115, 116, 44, 32, 119, 104, 105, 99, 104, 32, 102, 111, 108, 100, 101, 114, 115, 32, 116, 111, 32, 115, 104,
+111, 119, 34, 32, 61, 32, 34, 79, 112, 195, 167, 195, 181, 101, 115, 32, 100, 111, 32, 66, 114, 111, 119, 115,
+101, 114, 58, 32, 111, 32, 113, 117, 101, 32, 108, 105, 115, 116, 97, 114, 44, 32, 113, 117, 97, 105, 115, 32,
+112, 97, 115, 116, 97, 115, 32, 109, 111, 115, 116, 114, 97, 114, 34, 10, 34, 49, 32, 102, 111, 108, 100, 101,
+114, 32, 104, 105, 100, 100, 101, 110, 34, 32, 61, 32, 34, 49, 32, 112, 97, 115, 116, 97, 32, 111, 99, 117,
+108, 116, 97, 34, 10, 34, 123, 48, 125, 32, 102, 111, 108, 100, 101, 114, 115, 32, 104, 105, 100, 100, 101, 110,
+34, 32, 61, 32, 34, 123, 48, 125, 32, 112, 97, 115, 116, 97, 115, 32, 111, 99, 117, 108, 116, 97, 115, 34,
+10, 34, 72, 105, 100, 101, 32, 92, 34, 123, 48, 125, 92, 34, 32, 102, 114, 111, 109, 32, 116, 104, 105, 115,
+32, 66, 114, 111, 119, 115, 101, 114, 34, 32, 61, 32, 34, 79, 99, 117, 108, 116, 97, 114, 32, 92, 34, 123,
+48, 125, 92, 34, 32, 100, 101, 115, 116, 101, 32, 66, 114, 111, 119, 115, 101, 114, 34, 10, 34, 83, 104, 111,
+119, 32, 102, 111, 108, 100, 101, 114, 115, 34, 32, 61, 32, 34, 77, 111, 115, 116, 114, 97, 114, 32, 112, 97,
+115, 116, 97, 115, 34, 10, 34, 83, 104, 111, 119, 32, 97, 108, 108, 32, 102, 111, 108, 100, 101, 114, 115, 34,
+32, 61, 32, 34, 77, 111, 115, 116, 114, 97, 114, 32, 116, 111, 100, 97, 115, 32, 97, 115, 32, 112, 97, 115,
+116, 97, 115, 34, 10, 34, 67, 108, 111, 115, 101, 32, 116, 104, 101, 32, 83, 97, 109, 112, 108, 101, 32, 98,
+114, 111, 119, 115, 101, 114, 34, 32, 61, 32, 34, 70, 101, 99, 104, 97, 114, 32, 111, 32, 66, 114, 111, 119,
+115, 101, 114, 32, 100, 101, 32, 115, 97, 109, 112, 108, 101, 115, 34, 10, 34, 83, 97, 109, 112, 108, 101, 32,
+98, 114, 111, 119, 115, 101, 114, 32, 40, 115, 101, 112, 97, 114, 97, 116, 101, 32, 119, 105, 110, 100, 111, 119,
+41, 34, 32, 61, 32, 34, 66, 114, 111, 119, 115, 101, 114, 32, 100, 101, 32, 115, 97, 109, 112, 108, 101, 115,
+32, 40, 106, 97, 110, 101, 108, 97, 32, 115, 101, 112, 97, 114, 97, 100, 97, 41, 34, 10, 34, 83, 97, 109,
+112, 108, 101, 32, 98, 114, 111, 119, 115, 101, 114, 34, 32, 61, 32, 34, 66, 114, 111, 119, 115, 101, 114, 32,
+100, 101, 32, 115, 97, 109, 112, 108, 101, 115, 34, 10, 34, 79, 112, 101, 110, 32, 105, 110, 32, 116, 104, 101,
+32, 102, 105, 108, 101, 32, 109, 97, 110, 97, 103, 101, 114, 34, 32, 61, 32, 34, 65, 98, 114, 105, 114, 32,
+110, 111, 32, 103, 101, 114, 101, 110, 99, 105, 97, 100, 111, 114, 32, 100, 101, 32, 97, 114, 113, 117, 105, 118,
+111, 115, 34, 10,
 };
 } // namespace lynx::i18n::data

+ 90 - 45
src/ui/MainComponent.cpp

@@ -104,51 +104,7 @@ MainComponent::MainComponent (AudioEngine& e, bool restoreUserSettings)
       browser (e)
 {
     heldKeys.setSender ([this] (int channel, int key, float velocity, bool on) { engine.sendLiveNote (channel, key, velocity, on, true); });
-    browser.onOpenProject = [this] (const juce::File& file) { confirmDiscard ([this, file] { openFile (file); }); };
-    browser.onLoadIntoChannel = [this] (const juce::File& file) { return rack.loadSampleIntoSelected (file); };
-    // the Browser's "Current project" items (REA_rodada115)
-    browser.onOpenPattern = [this] (int pattern) {
-        selectPattern (pattern);
-        openPianoRoll();
-    };
-    browser.onPatternMenu = [this] (int pattern) {
-        selectPattern (pattern);
-        makePatternMenu().showMenuAsync (juce::PopupMenu::Options().withMousePosition());
-    };
-    browser.onOpenChannel = [this] (int channel) {
-        engine.setSelectedChannel (channel);
-        rack.toggleEditor (channel, true);
-    };
-    browser.onOpenEffect = [this] (int track, int slot) {
-        showPanel (Panel::mixer);
-        mixer.openSlotEditor (track, slot);
-    };
-    browser.onShowInsert = [this] (int track) {
-        showPanel (Panel::mixer);
-        mixer.selectTrack (track);
-    };
-    browser.onOpenAutomation = [this] (int automation) { openAutomationEditor (engine, automation); };
-    // the Browser's Plugin database (round 142): the same targets as the quick-add palette
-    browser.onAddInstrument = [this] (ChannelDef c) {
-        if (PatcherWindows::takeInstrumentFromBrowser (c)) // a Patcher's Add plugin › Browse plugin database (round 162)
-            return;
-        rack.addChannel (std::move (c), true);
-        showPanel (Panel::channelRack);
-    };
-    browser.onAddEffect = [this] (EffectSlot slot) {
-        if (PatcherWindows::takeEffectFromBrowser (slot))
-            return;
-        if (! mixer.addEffectToSelected (std::move (slot)))
-            juce::AlertWindow::showMessageBoxAsync (juce::MessageBoxIconType::InfoIcon, tr ("Plugin database"),
-                                                    tr ("The selected insert has no free effect slot."));
-        else
-            showPanel (Panel::mixer);
-    };
-    browser.onPreviewVolumeChanged = [this] { saveUiSettings(); };
-    browser.onSendToPlaylist = [this] (const juce::File& file) {
-        playlist.addAudioClipAtPlayhead (file);
-        showPanel (Panel::playlist);
-    };
+    connectBrowser (browser);
     if (persistent)
     {
         loadUiSettings();
@@ -157,6 +113,11 @@ MainComponent::MainComponent (AudioEngine& e, bool restoreUserSettings)
         };
         loadKeyMap();
         startSession();
+        if (BrowserComponent::sampleBrowserWasOpen()) // it was open when LYNX closed (round 163)
+            juce::Timer::callAfterDelay (800, [safe = juce::Component::SafePointer<MainComponent> (this)] {
+                if (safe != nullptr && findToolWindow ("sampleBrowser") == nullptr)
+                    safe->openSampleBrowser();
+            });
         EditorGlobals::get().onOptionsChanged = [safe = juce::Component::SafePointer<MainComponent> (this)] { // Follow on/off
             if (safe != nullptr) safe->saveUiSettings();
         };
@@ -1157,6 +1118,7 @@ bool MainComponent::runAction (const std::string& id)
     }
     else if (is ("view.audioEditor")) openAudioEditorForSelection();
     else if (is ("view.tempoTapper")) openTempoTapper (engine);
+    else if (is ("view.sampleBrowser")) toggleSampleBrowser();
     else if (is ("rack.groupSelected")) rack.groupSelected();
     else if (is ("rack.rotateLeft")) rack.rotateSelected (-1);
     else if (is ("rack.rotateRight")) rack.rotateSelected (1);
@@ -1249,6 +1211,85 @@ void MainComponent::loadKeyMap()
     }
 }
 
+// --- Browsers ------------------------------------------------------------------------------------
+
+// The main Browser and the separate Sample browser window (round 163) act on the project the same way.
+void MainComponent::connectBrowser (BrowserComponent& b)
+{
+    b.onOpenProject = [this] (const juce::File& file) { confirmDiscard ([this, file] { openFile (file); }); };
+    b.onLoadIntoChannel = [this] (const juce::File& file) { return rack.loadSampleIntoSelected (file); };
+    // the Browser's "Current project" items (REA_rodada115)
+    b.onOpenPattern = [this] (int pattern) {
+        selectPattern (pattern);
+        openPianoRoll();
+    };
+    b.onPatternMenu = [this] (int pattern) {
+        selectPattern (pattern);
+        makePatternMenu().showMenuAsync (juce::PopupMenu::Options().withMousePosition());
+    };
+    b.onOpenChannel = [this] (int channel) {
+        engine.setSelectedChannel (channel);
+        rack.toggleEditor (channel, true);
+    };
+    b.onOpenEffect = [this] (int track, int slot) {
+        showPanel (Panel::mixer);
+        mixer.openSlotEditor (track, slot);
+    };
+    b.onShowInsert = [this] (int track) {
+        showPanel (Panel::mixer);
+        mixer.selectTrack (track);
+    };
+    b.onOpenAutomation = [this] (int automation) { openAutomationEditor (engine, automation); };
+    // the Browser's Plugin database (round 142): the same targets as the quick-add palette
+    b.onAddInstrument = [this] (ChannelDef c) {
+        if (PatcherWindows::takeInstrumentFromBrowser (c)) // a Patcher's Add plugin › Browse plugin database (round 162)
+            return;
+        rack.addChannel (std::move (c), true);
+        showPanel (Panel::channelRack);
+    };
+    b.onAddEffect = [this] (EffectSlot slot) {
+        if (PatcherWindows::takeEffectFromBrowser (slot))
+            return;
+        if (! mixer.addEffectToSelected (std::move (slot)))
+            juce::AlertWindow::showMessageBoxAsync (juce::MessageBoxIconType::InfoIcon, tr ("Plugin database"),
+                                                    tr ("The selected insert has no free effect slot."));
+        else
+            showPanel (Panel::mixer);
+    };
+    b.onPreviewVolumeChanged = [this] { saveUiSettings(); };
+    b.onSendToPlaylist = [this] (const juce::File& file) {
+        playlist.addAudioClipAtPlayhead (file);
+        showPanel (Panel::playlist);
+    };
+    b.onToggleSampleBrowser = [this] { toggleSampleBrowser(); };
+}
+
+void MainComponent::toggleSampleBrowser()
+{
+    if (auto* w = findToolWindow ("sampleBrowser"))
+    {
+        w->closeButtonPressed(); // (hidden, then deleted: remembered as closed)
+        return;
+    }
+    openSampleBrowser();
+}
+
+void MainComponent::openSampleBrowser()
+{
+    auto* window = openToolWindow (BrowserComponent::makeSampleBrowserContent (engine, [this] (BrowserComponent& b) { connectBrowser (b); }),
+                                   tr ("Sample browser"), "sampleBrowser");
+    if (window == nullptr)
+        return;
+    window->setResizable (true, false);
+    window->setResizeLimits (240, 260, 4000, 4000);
+    const auto saved = BrowserComponent::sampleBrowserBounds();
+    const auto area = juce::Desktop::getInstance().getDisplays().getTotalBounds (true);
+    if (saved.getWidth() >= 240 && saved.getHeight() >= 260 && area.intersects (saved))
+        window->setBounds (saved);
+    else if (auto* top = getTopLevelComponent())
+        window->setBounds (top->getScreenBounds().getRight() - 360, top->getScreenY() + 80, 340, juce::jmax (400, top->getHeight() - 160));
+}
+
 // --- UI options ----------------------------------------------------------------------------------
 
 juce::File MainComponent::uiSettingsFile() const
@@ -1708,7 +1749,9 @@ void MainComponent::addPanelMenuItems (Panel panel, juce::PopupMenu& menu)
             break;
         case Panel::browser:
             action (menu, "browser.search", tr ("Search the Browser"));
+            browser.addViewItems (menu); // what it lists, which folders it shows (round 163)
             menu.addItem (tr ("Add folder..."), [this] { browser.addUserFolder(); });
+            action (menu, "view.sampleBrowser", tr ("Sample browser (separate window)"));
             menu.addSeparator();
             // the search index (round 162, issue #9): searches read it; it follows changed folders by itself
             menu.addSectionHeader (browser.searchIndexStatus());
@@ -4195,6 +4238,8 @@ juce::PopupMenu MainComponent::getMenuForIndex (int barIndex, const juce::String
         menu.addSeparator();
         menu.addItem (tr ("Audio editor") + shortcutText ("view.audioEditor"), [this] { openAudioEditorForSelection(); });
         menu.addItem (tr ("Tempo tapper") + shortcutText ("view.tempoTapper"), [this] { openTempoTapper (engine); });
+        menu.addItem (tr ("Sample browser (separate window)") + shortcutText ("view.sampleBrowser"), true, findToolWindow ("sampleBrowser") != nullptr,
+                      [this] { toggleSampleBrowser(); });
         menu.addSeparator();
         menu.addItem (tr ("Typing keyboard as a piano") + shortcutText ("view.typingPiano"), true, typingPiano, [this] { setTypingPiano (! typingPiano); });
         menu.addItem (tr ("Touch keyboard"), true, isTouchKeyboardOpen(), [this] { toggleTouchKeyboard (engine); });

+ 3 - 0
src/ui/MainComponent.h

@@ -278,6 +278,9 @@ private:
     void showMetronomeVolume();
     // View > Audio editor: the selected channel's sample when it is a Sampler with one, else an empty editor
     void openAudioEditorForSelection();
+    void connectBrowser (BrowserComponent& b); // the main Browser and the Sample browser window (round 163)
+    void toggleSampleBrowser();
+    void openSampleBrowser();
     void toggleRecording();       // the record button: asks what to record first (unless told not to)
     void armSelectedInsertForAudio(); // "Audio, into the Playlist": arms the selected insert (asks for its input)
     void setControlHints(); // the hint bar text of every toolbar control (markup, see ui/HintBar.h)

+ 49 - 0
tests/BrowserView163Tests.inc

@@ -0,0 +1,49 @@
+// Round 163 (user feedback): what a Browser shows — hidden roots, the content filter and the saved view of the main
+// Browser and of the separate Sample browser window.
+
+#include "core/BrowserView.h"
+
+TEST (browser163_content_filter)
+{
+    using namespace lynx::browserview;
+    CHECK (listed ("Kick.WAV", ContentFilter::all));
+    CHECK (listed ("pad.sf2", ContentFilter::all));
+    CHECK (! listed ("readme.txt", ContentFilter::all));
+    CHECK (! listed ("noextension", ContentFilter::all));
+    CHECK (listed ("loop.flac", ContentFilter::audio));
+    CHECK (! listed ("pad.sf2", ContentFilter::audio));
+    CHECK (listed ("pad.SF3", ContentFilter::samples));
+    CHECK (listed ("hat.mp3", ContentFilter::samples));
+    CHECK (! listed ("beat.flp", ContentFilter::samples));
+    CHECK (listed ("lead.fst", ContentFilter::presets));
+    CHECK (! listed ("lead.wav", ContentFilter::presets));
+    CHECK (listed ("song.lynx", ContentFilter::projects));
+    CHECK (listed ("song.mid", ContentFilter::projects));
+    CHECK (! listed ("kick.wav", ContentFilter::projects));
+    for (int i = 0; i < contentFilterCount; ++i)
+        CHECK (contentFilterFromId (contentFilterId ((ContentFilter) i)) == (ContentFilter) i);
+    CHECK (contentFilterFromId ("bogus") == ContentFilter::all);
+}
+
+TEST (browser163_view_round_trip)
+{
+    using namespace lynx::browserview;
+    View v;
+    CHECK (v.shows ("C:\\Users\\me\\Desktop"));
+    v.setShown ("C:\\Users\\me\\Desktop", false);
+    v.setShown (projectRootId, false);
+    v.filter = ContentFilter::samples;
+    v.open = true;
+    v.x = 10; v.y = -20; v.width = 340; v.height = 600;
+    CHECK (! v.shows ("C:\\Users\\me\\Desktop") && ! v.shows (projectRootId) && v.shows (pluginsRootId));
+    const auto back = View::fromText (v.toText());
+    CHECK (back == v);
+    v.setShown (projectRootId, true);
+    CHECK (v.shows (projectRootId));
+    // old / empty files: everything shown, all files
+    CHECK (View::fromText ("") == View {});
+    CHECK (View::fromText ("garbage\nfilter=presets\r\nbounds=1,2,x\n").filter == ContentFilter::presets);
+    CHECK (sampleBrowserShowsByDefault (RootKind::flSamples) && sampleBrowserShowsByDefault (RootKind::user));
+    CHECK (! sampleBrowserShowsByDefault (RootKind::documents) && ! sampleBrowserShowsByDefault (RootKind::project)
+           && ! sampleBrowserShowsByDefault (RootKind::flDemos) && ! sampleBrowserShowsByDefault (RootKind::pluginDatabase));
+}

+ 1 - 0
tests/tests.cpp

@@ -16038,5 +16038,6 @@ TEST (fl_low_lifter_matches_fl_engine)
 #include "Look162Tests.inc"
 #include "EnvController162Tests.inc"
 #include "Browser162Tests.inc"
+#include "BrowserView163Tests.inc"
 #include "Transport162Tests.inc"
 #include "Rec163Tests.inc"