Explorar o código

Merge branch 'feature/plugui93'

Ka1-S hai 1 mes
pai
achega
00a5863

+ 2 - 0
CMakeLists.txt

@@ -29,6 +29,7 @@ add_library(lynx_core STATIC
     src/core/FlPluginDb.cpp
     src/core/MissingFiles.cpp
     src/core/Preferences.cpp
+    src/core/PluginLayout.cpp
     src/core/FlEffects.cpp
     src/core/Effector.cpp
     src/core/FlSamplers.cpp
@@ -212,6 +213,7 @@ if(LYNX_BUILD_APP)
         src/ui/PluginWindow.cpp
         src/ui/WindowOwner.cpp
         src/ui/ParametricEqEditor.cpp
+        src/ui/PluginEditors.cpp
         src/ui/ExportDialog.cpp
         src/ui/AutomationUi.cpp
         src/ui/ChannelSettings.cpp

+ 10 - 0
docs/PLUGINS.md

@@ -152,6 +152,16 @@ instruments (built-in synth, sampler, drums) or any VST3/CLAP plugin.
 | Limiter | Emphasis | Insert | Approximate | not ported yet |
 | Parametric EQ | Low Lifter | Insert | Approximate | harmonics generator missing; not ported yet |
 
+**Windows.** Every native effect opens its own window (double-click its Mixer slot, or the **Editor** button over its
+knobs). For the plugins studied so far — Fruity Limiter, Parametric EQ 2, Delay 3, Multiband Compressor, Reeverb 2,
+LuxeVerb, Compressor, Filter, Fast Dist, Chorus, Flanger, Stereo Enhancer, Gross Beat, Delay 2, Reeverb, Flangus, Soft
+Clipper, Blood Overdrive, PanOMatic, Stereo Shaper, Transient Processor, Free Filter, WaveShaper, Vintage Chorus, Hyper
+Chorus, Balance, Squeeze, Soundgoodizer, and the 3x Osc, FL Keys, BooBass, Sytrus (main page) and Harmor pages
+of the channel settings — the window has the same controls, sections, captions and arrangement as the FL plugin,
+drawn in LYNX's own style, with a presets bar that lists the plugin's FL presets from your installation
+([`docs/analise/UI_STUDY_plugins93.md`](analise/UI_STUDY_plugins93.md)); the other effects show their controls as a
+grid of knobs.
+
 Also on every insert: LYNX's own Filter, Distortion, Lo-fi, Reverb, Compressor, Limiter, Crossover, Volume gate,
 Rhythmic envelope, Auto-pan and the parallel container (Patcher graphs from FL projects are reduced to it, each effect
 inside running its own engine), plus any VST3/CLAP plugin. FL's Peak, Envelope and Keyboard Controllers are imported

+ 1 - 1
docs/WORKFLOW_FL.md

@@ -547,7 +547,7 @@ gesture or reduced scope · **No** = absent (searched, not found). Locations are
 
 | ID | LYNX | Where / note |
 |---|---|---|
-| W1 | Partial | Native window with minimise and close (`ui/PluginWindow.cpp`); no header bar, presets or menu |
+| W1 | Partial | External plugins: native window with minimise and close (`ui/PluginWindow.cpp`); no header bar, presets or menu. **Native effects (round 93): their own window in the FL plugin's arrangement** (`ui/PluginEditors.cpp`, layouts in `core/PluginLayout.cpp`, study in `docs/analise/UI_STUDY_plugins93.md`) with FL's wrapper bar: options arrow (presets, reset, hidden switches, bypass), preset name with the FL presets of the plugin, previous / next; opened by double-clicking the Mixer slot or the **Editor** button. 3x Osc and FL Keys pages follow FL's arrangement in the channel settings |
 | W2 | **Done** | The channel button toggles the plugin window (`PluginWindows::isOpen/close`) |
 | W3 | Partial | Always detached; parameters are reachable through the "Automate plugin parameter" submenus |
 | W4, W5 | No | — |

+ 129 - 0
docs/analise/UI_STUDY_plugins93.md

@@ -0,0 +1,129 @@
+# UI study, round 93 — native plugin windows in FL's arrangement
+
+Goal (user request): every native LYNX plugin opens a window that **looks and works like the FL Studio plugin it is
+compatible with** — same controls, same arrangement and sections, same captions, the same interactions (knob drag,
+right-click menu, presets bar) — so an FL user finds everything where they expect it, while the drawing stays LYNX's
+own (dark surfaces, red accent, own vector knobs, sliders and switches; no FL bitmap, skin, font, logo or icon).
+
+Method:
+- **[EXEC] FL captures.** Each plugin was opened in FL Studio 2026 (v26.1.7 build 5654) from the installation's own
+  `Default.fst` preset (or the first preset of its folder) in a fresh FL instance, and the plugin window was cropped by
+  diffing against an empty FL screen (`tmp/r93/fresh.sh`, `py/win.py`). Pages that are hidden at first (Fruity Limiter's
+  COMP page, LuxeVerb's feedback pitch mode) were captured after clicking them. The captures stay in `tmp/r93/flref`
+  (never in the repository).
+- **[DECOMP]** The effect DLLs (`Plugins/Fruity/Effects/*/*_x64.dll`) carry no form resources for their panels (their
+  RCDATA holds only the shared wrapper forms: `TSynthEditorForm`, `TNameEditForm`, `TPaletteEditorForm`…; read with
+  `tmp/r93/py/pres.py`), so the control positions are **built in code** and were measured on the captures: one design
+  unit = one pixel of FL's window at 100 % zoom, origin at the top-left of the plugin body (under FL's wrapper title).
+  Ranges, units and value texts are not re-derived here: they are the ones the exact engines already use (rounds 48–73,
+  `formatEffectParam`), checked against the captures' read-outs (e.g. Fruity Compressor `0.0 dB`, `1.0 : 1`,
+  `15.0 ms`, `200 ms`, `Hard`; LuxeVerb `6.78 s`, `955 Hz`, `+12.0 st`).
+
+## 1. The layout system
+
+`src/core/PluginLayout.{h,cpp}` (no JUCE, tested): a `Layout` is FL's body size plus a list of items — `section`
+(titled panel or plain cell), `label`, `knob`, `hslider`, `vslider`, `radio` (column of options), `tabs` (segmented
+row), `toggle`, `stepper` (number box with arrows), `value` (read-out), `display` (a graph). Value items name the
+effect parameter they edit by its `EffectInfo` name, so layouts never depend on indices. Items can belong to a page
+(FL's LIMIT | COMP) or be shown only while another parameter is in a range (LuxeVerb's pitch mode, the tempo-synced
+delay knobs that replace the free ones while **T** is on).
+
+`src/ui/PluginEditors.{h,cpp}` draws a layout at any scale (windows open at 125 % and resize) with the LYNX control
+contract on every control: drag (Ctrl = fine), wheel, Alt+click / middle-click / double-click = default, right-click =
+type value, automation clip, MIDI link; value tip while dragging; hint bar text. The **presets bar** on top follows
+FL's wrapper: options arrow (presets, reset, the plugin's hidden switches, bypass), bypass LED, plugin and insert name,
+the preset name (click = the FL presets of that plugin found in the user's installation) and previous / next arrows.
+Effects without a studied arrangement get a generated grid of knobs, so every native effect has a window.
+
+Opening: double-click an effect's slot in the Mixer (FL opens the window on a click), or the **Editor** button on the
+title row of the selected effect's knobs.
+
+## 2. Arrangements (FL Studio 2026, measured)
+
+| Plugin | Body (units) | Arrangement |
+|---|---|---|
+| Fruity Limiter | 633 × 306 | display across the top (623 × 158) with its view strip; LOUDNESS / ENVELOPE / NOISE GATE header strip at y 161; GAIN, SAT; inset panel with CEIL, ATT, REL, SUSTAIN and two CURVE steppers (LIMIT page) or THRES, KNEE, RATIO, ATT, REL, SUSTAIN, one CURVE stepper and SIDECHAIN (COMP page); LIMIT / COMP tabs at the bottom-left of the inset; gate REL, GAIN, THRES |
+| Fruity Compressor, Filter, Chorus, Flanger (FL's generic "Fruity" panel) | 501 × (50·rows + 5) | cells of 160 × 45 in three columns, 165 / 50 apart: knob at the left, caption on a plate, the value (or a slider for Fruity Filter) under it; Filter's X2 / CENTER are half cells with Off / On |
+| Fruity Fast Dist | 386 × 122 | PRE, THRESH, A/B switch, MIX, POST on the left panel; transfer curve on the right |
+| Fruity Stereo Enhancer | 405 × 116 | STEREO SEP knob; PRE / POST, PHASE OFFSET knob, INVERT none / left / right; PAN and VOL |
+| Fruity Delay 3 | 752 × 220 | INPUT (wet fader) · DELAY TIME (TIME, TEMPO SYNC, KEEP PITCH, SMOOTHING slider, OFFSET) · DELAY MODEL (mono / stereo / ping pong / off, STEREO) · FEEDBACK (LEVEL, CUTOFF, RES, LP / HP / BP / off, SMP RATE, BITS) · OUTPUT (WET, TONE, DRY); MODULATION (RATE, TIME, CUTOFF) · DIFFUSION (LEVEL, SPREAD) · FEEDBACK DISTORTION (limit / sat, LEVEL, KNEE, SYMMETRY, curve) |
+| Fruity Multiband Compressor | 805 × 160 | input meter, IIR / FIR, LIMITER, GAIN; band graph with four crossover knobs; LOW / MID / HIGH BAND each with A·M·B mode, THRES RATIO KNEE / ATT REL GAIN and its meters |
+| Fruity Reeverb 2 | 538 × 166 | room view; MID / SIDE, H.CUT, L.CUT; DELAY + TEMPO, SIZE, MOD, DIFF, SPEED; BASS, DEC, CROSS, DAMP; DRY / ER / WET faders and SEP |
+| LuxeVerb | 947 × 456 | INPUT · REVERB · PITCH · OUTPUT tiles (value plate, knob, caption), the PITCH section switching between FEEDFORWARD (direct amp fader, pitch / amp / delay ×2) and FEEDBACK (high / low cut, pitch-shift and gain faders, delay, reverb mix); ENVELOPE (off / wet / decay, threshold, scale, low cut, offset, sidechain, attack, decay, smooth) and the analyser |
+| Fruity Parametric EQ 2 | 707 × 356 | response graph (C1…C9 octave plates and SUB / BASS / LOW MID / MID / HIGH MID / PRS / TREBLE plates above, 20 Hz…10 kHz under it, ±18 dB scale at its right) with numbered band handles; the output fader; seven band columns (type button with the band's shape, gain fader, FREQ and BW knobs); FL's bottom row (LIN, HQ, monitor, compare) is replaced by the selected band's read-out |
+| Gross Beat | 840 × 563 | time panel (mix knob), HOLD, scratch dial; 36 time slots and 36 volume slots in 4 × 9 grids (names from the saved state); ATT / REL / TNS; volume panel; envelope editor (the selected time and volume slots, read-only here) with the slot's hold / trigger sync / position sync under it |
+| 3x Osc (channel page) | 560 × 390 | three oscillator rows: shape buttons (sine, square, rounded, custom / triangle, saw, noise, ± invert), PHASE OFS and DETUNE faders, COARSE, FINE, pan, volume (osc 2 and 3); AM OSC 3, HQ, PHASE RAND below |
+| FL Keys (channel page) | 480 × 186 | ENVIRONMENT (decay, release, pan, stereo), MISC (overdrive, LFO, treble, stretch), VELOCITY (vel → muffle, muffle, vel → hardness, hardness, sens), TUNING (tune, detune), the sample set's name; FL's keyboard strip is left out (LYNX's touch keyboard is in the Channel Rack) |
+| Fruity Delay 2 | 404 × 102 | INPUT (pan, vol) · FEEDBACK (normal / invert / ping-pong, vol, cut) · TIME (time, offset) · DRY |
+| Fruity Reeverb, Free Filter | Fruity cells | two columns of five (Reeverb); Free Filter: TYPE, FREQ, CENTER / Q (slider), GAIN |
+| Fruity Flangus | 366 × 176 | the order bar and seven faders (depth, speed, delay, spread, cross, dry, wet) in columns |
+| Fruity Soft Clipper | 274 × 133 | THRES, POST, name plate, meter strip, transfer curve |
+| Fruity Blood Overdrive | 428 × 186 | PRE BAND, COLOR · big PRE AMP with x100 · POST FILTER, POST GAIN, captions on plates |
+| Fruity PanOMatic | 307 × 166 | PAN, VOL; LFO shape buttons, AMT, SPD, off / pan / vol; the pan-volume pad |
+| Fruity Stereo Shaper | 276 × 316 | mixer matrix of four faders (R→L, left, right, L→R) over LEFT / RIGHT; pre / post, DELAY, PHASE, in/out difference |
+| Transient Processor | 553 × 325 | in / out meters, SPLIT FREQ, ATTACK and RELEASE panels with their shape controls, DRIVE, SPLIT BALANCE, GAIN, off / on, the view |
+| Fruity WaveShaper | 277 × 358 | the saved shaping curve (read-only here), bipolar / unipolar, PRE, MIX, POST, smooth, oversample, HQ, center |
+| Vintage Chorus | 754 × 214 | MODE (I / II / edit) · DELAYS (time 1 / 2, feedback, high-pass faders) · MODULATION (start phase, wave, L/R phase, tempo sync, speed) · LEVELS (mono input, invert wet, noise gate, noise, gain, mix) |
+| Hyper Chorus | 754 × 214 | three movement pads (delay / feedback, modulation / rate, movement / rate; drag sets both), the voices view, one row of knobs and the delay-lines switch |
+| Fruity Balance | 232 × 150 | Balance and Volume knobs (captions above, values under them) around the meter |
+| Soundgoodizer | 215 × 300 | one big Amount knob, presets A–D under it; LYNX edits the slot's Maximus container (Amount = band mix, the preset = the installation's `Data\Presets\a…d.dat`) |
+| BooBass (channel page) | 343 × 154 | BASS, MID, TREBLE stepping down along the body |
+| Sytrus MAIN page | 850 × 346 | VOL / LFO / PITCH faders, VOL and FILTER ADSR faders, UNISON (order, pan, volume, pitch, sub, phase, envelope variation), MODULATION X/Y pad and knobs, QUALITY (HQ envelopes and oversampling, draft / render), PORTA; the operator / filter / FX pages and the FM / RM matrix are not editable in LYNX and say so |
+| Harmor (channel page) | 1000 × 600 | the controls LYNX edits at their FL places on the part page (timbre mix, blur, tremolo, harmonizer, unison order and pitch, vibrato, part volume, filter 1 freq / res, pluck, phaser mix) and the global section (volume, part A / B); FL's section titles for orientation |
+| Fruity Squeeze | 282 × 223 | SQUARIZE amount and PUNCHER (preserve, impact, relation, amount) on plates; FILTER (on, type, freq, res, pre / pos); MIX and GAIN faders. SQUARIZE AMOUNT is mapped to the engine's `Steps` control — **not confirmed** |
+| Maximus | 633 × 391 | band curve (the selected band's drawn curve) and the bands view on top; LOW / MID / HIGH / MASTER selector; per band: mode (on / comp off / muted / off), PRE / POST gain, stereo separation, saturation THRES / CEIL, ATT, REL, SUSTAIN, two CURVE steppers, PEAK / RMS, REL 2; LMH DEL, LMH MIX; crossover LOW / HIGH frequency with 12 / 24 dB slopes; LOW CUT. Edits the 59 parameters of the slot's Maximus state (REA_rodada8 §1.2); the curve points, SOLO, LIN and the monitor options are not editable |
+| Vintage Phaser | 754 × 214 | PHASING (min / max faders, HQ, manual, feedback) · MODULATION (start phase, type, L/R phase, tension, speed + T) · DELAY (on, mix, stereo, big time + T, feedback, LP, HP, keep pitch) · LEVELS (noise, noise gate, mono input, mix); the engine's other controls (manual freq., rates, depth scale, pull-down, drive, colour, HP filters, engine V2, invert feedback) on an ADVANCED page — where FL shows them is **not confirmed** |
+
+Mapping notes:
+- 3x Osc's shape buttons follow FL's order (sine, square, rounded, custom on the first row; triangle, saw, noise on the
+  second) and set the engine's shapes 0 sine, 1 triangle, 2 square, 3 saw, 4 rounded, 5 noise, 6 custom
+  (REA_rodada47 §1.2); the ± button is the oscillator's invert switch. Captions sit between the rows as in FL (the third
+  row has none).
+- Fruity Limiter COMP page: FL captions the compressor detector window **SUSTAIN** like the limiter's peak window; it is
+  mapped to the engine's RMS window (p14) — by analogy with the LIMIT page's SUSTAIN = peak window (p7), **[model]**.
+- LuxeVerb's PITCH header switch is the engine's `Feedback` control (on in the "Exact Mass of Jupiter" preset whose
+  pitch section FL draws enabled; off and greyed in `Default`) **[EXEC + DATA]**.
+- Fruity Chorus' LFO wave knobs are continuous in FL (the engine reads `x·3`), so they are not stepped.
+- Switches that FL keeps out of the panel (Fruity Limiter's exact ceiling, Fruity Compressor's look-ahead) are in the
+  presets bar's options menu.
+
+## 3. Adding or changing a plugin page (notes for other plugin agents)
+
+Everything below is reusable as is; a new page is data in `src/core/PluginLayout.cpp` plus, only when FL draws
+something special, a display in `src/ui/PluginEditors.cpp`.
+
+1. **Capture FL.** Take `flock ~/.cache/lynx-fl.lock` (release it as soon as the captures are done, other agents use
+   FL too), open the plugin's `Default.fst` (or first preset) with `tmp/r93/grab.sh <name> <fst>` (uses
+   `fl.sh` and `/mnt/c/Users/kauan/lynx-test/flref/cap.ps1`), keep the PNG in `tmp/<round>/flref` (never in the repo).
+   Measure at 2× with `tmp/r93/py/grid.py` (draws a ruler in FL pixels). Body origin = top-left under FL's wrapper
+   title: subtract about 2 px in x and 25–27 px in y from the window capture. One design unit = one FL pixel at 100 %.
+2. **Write the layout** as a function `Layout <plugin>()` with the builders at the top of `PluginLayout.cpp`:
+   `section`, `label`, `knob (cx, cy, diameter, param, caption, captionY, style)`, `slider (Item::vslider|hslider …)`,
+   `radio`, `tabs`, `pageTabs`, `toggle` (`boxed` = a lit letter button such as FL's **T**), `stepper`, `value`,
+   `display`, and the modifiers `onPage (item, page)` and `when (item, param, lo, hi)` (shown only while another
+   parameter is in a range). Generic FL "Fruity" panels: `fruityGrid` + `fruityCell` / `fruityHalfCell`.
+   Register it in `layoutFor` and in `flLayoutKinds()` (generators: `instrumentLayout` / `instrumentLayoutKinds`).
+3. **Name parameters, not indices.** `param` is the `EffectInfo` name of the effect's parameter (`paramIndex`).
+   Effects whose controls live in the slot's state instead of `EffectSlot::params` declare it in
+   `plugui::usesStateParams` and expose a table like `maximusfx::stateParams()` (name, raw min / max / default),
+   `stateParam`, `withStateParam` and `stateParamText`; the editor then reads and writes the state (Maximus is the
+   example; such controls are not automatable).
+4. **Every parameter must have a control.** The test `plugin_layouts_name_real_parameters` fails when a parameter of
+   an FL-arranged effect has no control and no entry in `menuSwitches` (on / off switches FL keeps in a menu: they go
+   to the presets bar's options menu) or `editedElsewhere`. When FL keeps controls out of its panel and their place is
+   not known, put them on a second page (`pages` + `pageTabs`, e.g. Vintage Phaser's ADVANCED) and say so.
+5. **Captions** are English inside `TR_NOOP(...)`; every new caption and every `"A|B|C"` option string needs a line
+   in `resources/i18n/pt-BR.txt`, then `python3 -I tools/make_i18n.py` (tests check both).
+6. **Look at it.** `LYNX.exe --plugui <folder>` writes one PNG per page of every FL-arranged editor from FL's default
+   preset; `tmp/r93/shots.sh <changed sources>` rebuilds (`tmp/r93/qbuild.sh`), renders and writes FL | LYNX
+   side-by-side images to `tmp/r93/compare` (add the pair to `py/compare.py`).
+7. **Interactions come for free:** drag (Ctrl fine), wheel, Alt/middle/double-click reset, right-click menu (type in,
+   automation clip, MIDI link), value tips, hint bar, presets bar with the installation's FL presets, bypass, reset.
+   Vertical `tabs` (taller than wide) draw as a column with band colours (Maximus' band selector).
+
+## Where I stopped / next steps
+- Landed in batches 1–3 (merge of feature/plugui93, 2026-10-17); batch 4 below.
+- Batch 4 (2026-10-17): Maximus (state-backed controls), Vintage Phaser; the layout notes (§3).
+- Not done: Fruity Send and Fruity Phaser (mapped to LYNX's generic utility / chorus, not FL's controls: they need an
+  engine with FL's parameters first), Newtone (pass-through placeholder), Delay Bank, Vocoder, Pitch Shifter, Convolver, EQUO, Multiband Delay, Frequency Splitter, Hardcore,
+  Effector (captures of most in `tmp/r93/flref`; they keep the generated grid of knobs).

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

@@ -1767,3 +1767,266 @@ countries: br
 "Note names" = "Nomes das notas"
 "Plays: {0}" = "Toca: {0}"
 "Select a channel in the Channel Rack" = "Selecione um canal no Channel Rack"
+
+# --- Native plugin windows in FL's arrangement (round 93)
+"(no preset)" = "(sem preset)"
+"Amp 1" = "Amp 1"
+"Amp 2" = "Amp 2"
+"Att" = "Att"
+"BW" = "Larg."
+"Band pass" = "Passa-banda"
+"Bass" = "Graves"
+"Bits" = "Bits"
+"Brightness" = "Brilho"
+"Bypass" = "Bypass"
+"Ceil" = "Teto"
+"Center" = "Centro"
+"Character" = "Caráter"
+"Comp" = "Comp"
+"Cross cutoff" = "Corte cruzado"
+"Cross type" = "Tipo cruzado"
+"Cross" = "Cruzado"
+"Crossovers" = "Crossovers"
+"Cutoff freq" = "Freq. de corte"
+"Damp" = "Amortec."
+"Dec" = "Decaim."
+"Delay 1" = "Delay 1"
+"Delay 2" = "Delay 2"
+"Delay model" = "Modelo do delay"
+"Delay time" = "Tempo do delay"
+"Depth" = "Profundidade"
+"Diff" = "Difusão"
+"Diffusion" = "Difusão"
+"Direct amp" = "Amp direto"
+"Dry" = "Seco"
+"ER" = "RP"
+"Editor" = "Editor"
+"Envelope" = "Envelope"
+"Fast dist" = "Fast dist"
+"Feed" = "Realim."
+"Feedback distortion" = "Distorção da realimentação"
+"Feedback" = "Realimentação"
+"Feedback|Feedforward" = "Realimentação|Alimentação direta"
+"Freq" = "Freq."
+"H.cut" = "Corte A."
+"HQ" = "HQ"
+"High band" = "Banda alta"
+"High mid" = "Médio-agudo"
+"High pass" = "Passa-altas"
+"Input" = "Entrada"
+"Inv feedback" = "Inv. realim."
+"Inv wet" = "Inv. molhado"
+"Invert" = "Inverter"
+"Keep pitch" = "Manter tom"
+"Knee" = "Joelho"
+"L.cut" = "Corte B."
+"LFO 1 freq" = "Freq. LFO 1"
+"LFO 1 wave" = "Onda LFO 1"
+"LFO 2 freq" = "Freq. LFO 2"
+"LFO 2 wave" = "Onda LFO 2"
+"LFO 3 freq" = "Freq. LFO 3"
+"LFO 3 wave" = "Onda LFO 3"
+"LP|HP|BP|Off" = "PB|PA|PF|Desl."
+"Limiter" = "Limitador"
+"Limit|Comp" = "Limit.|Comp."
+"Limit|Sat" = "Limitar|Saturar"
+"Loudness" = "Volume"
+"Low band" = "Banda baixa"
+"Low mid" = "Médio-grave"
+"Low pass" = "Passa-baixas"
+"Mid band" = "Banda média"
+"Mid|Side" = "Mid|Side"
+"Mod amp" = "Amp mod."
+"Mod freq" = "Freq. mod."
+"Mod" = "Mod."
+"Modulation" = "Modulação"
+"Mono|Stereo|Ping pong|Off" = "Mono|Estéreo|Pingue-pongue|Desl."
+"Next preset" = "Próximo preset"
+"No FL presets found for this plugin" = "Nenhum preset do FL encontrado para este plugin"
+"Noise gate" = "Noise gate"
+"None|Left|Right" = "Nenhum|Esquerdo|Direito"
+"Normal|Freeze|Sustain" = "Normal|Congelar|Sustentar"
+"Off|On" = "Desl.|Lig."
+"Off|Peak|Low shelf|High shelf|Low cut|High cut|Band-pass|Notch" = "Desligada|Pico|Prateleira grave|Prateleira aguda|Corte de graves|Corte de agudos|Passa-banda|Notch"
+"Off|Wet|Decay" = "Desl.|Molhado|Decaimento"
+"Open the effect's window (its full controls, as in FL); double-clicking the slot does the same" = "Abre a janela do efeito (todos os controles, como no FL); clicar duas vezes no slot faz o mesmo"
+"Options: presets, reset, bypass" = "Opções: presets, restaurar, bypass"
+"Output" = "Saída"
+"P. delay" = "Pré-delay"
+"Page: switch the controls shown" = "Página: troca os controles mostrados"
+"Peak Q" = "Q do pico"
+"Peak freq" = "Freq. do pico"
+"Peak gain" = "Ganho do pico"
+"Phase offset" = "Desvio de fase"
+"Pitch 1" = "Tom 1"
+"Pitch 2" = "Tom 2"
+"Pitch shift" = "Desvio de tom"
+"Post" = "Pós"
+"Pre" = "Pré"
+"Preset: click for the list of FL presets of this plugin" = "Preset: clique para a lista de presets do FL deste plugin"
+"Presets" = "Presets"
+"Previous preset" = "Preset anterior"
+"Pre|Post" = "Pré|Pós"
+"Prs" = "Pres."
+"Rate" = "Taxa"
+"Ratio" = "Razão"
+"Rel" = "Rel"
+"Res" = "Res"
+"Reset to defaults" = "Restaurar o padrão"
+"Reverb mix" = "Mix do reverb"
+"Reverb" = "Reverb"
+"Sat" = "Sat"
+"Sep" = "Sep."
+"Size" = "Tamanho"
+"Smooth" = "Suavizar"
+"Smoothing" = "Suavização"
+"Smp rate" = "Taxa amostr."
+"Stereo enhancer" = "Realce estéreo"
+"Stereo sep" = "Separação estéreo"
+"Sub" = "Sub"
+"Symmetry" = "Simetria"
+"Tempo sync" = "Sinc. ao tempo"
+"The effect was removed from this slot." = "O efeito foi removido deste slot."
+"Thres" = "Limiar"
+"Thresh" = "Limiar"
+"Threshold" = "Limiar"
+"Tone" = "Timbre"
+"Treble" = "Agudos"
+"Vol" = "Vol"
+"Wet gain" = "Ganho molhado"
+"Wet only" = "Só molhado"
+"Wet" = "Molhado"
+"Width" = "Largura"
+"X 2" = "X 2"
+"Time: {0}" = "Tempo: {0}"
+"Hold: {0}" = "Hold: {0}"
+"Trig sync: {0}" = "Sinc. do disparo: {0}"
+"Pos sync: {0}" = "Sinc. da posição: {0}"
+"Tns" = "Tensão"
+"AM osc 3" = "AM osc 3"
+"Amt" = "Qtd."
+"Bipolar|Unipolar" = "Bipolar|Unipolar"
+"Coarse" = "Grosso"
+"Del" = "Atraso"
+"Detune" = "Desafinar"
+"Drive" = "Drive"
+"Environment" = "Ambiente"
+"Hardness" = "Dureza"
+"High damping" = "Amortecimento agudo"
+"Highcut" = "Corte agudo"
+"In/out difference" = "Diferença entrada/saída"
+"Left" = "Esquerdo"
+"Lowcut" = "Corte grave"
+"Misc" = "Diversos"
+"Mixer matrix" = "Matriz de mixagem"
+"Muffle" = "Abafar"
+"Normal|Invert|P.pong" = "Normal|Inverter|Pingue-p."
+"Off|Pan|Vol" = "Desl.|Pan|Vol"
+"Ofs" = "Desl."
+"Ord" = "Ordem"
+"Overdrive" = "Overdrive"
+"Oversample" = "Sobreamostragem"
+"Phase ofs" = "Desvio de fase"
+"Phase rand" = "Fase aleatória"
+"Post filter" = "Filtro pós"
+"Post gain" = "Ganho pós"
+"Pre amp" = "Pré-amp"
+"Pre band" = "Banda pré"
+"Predelay" = "Pré-delay"
+"Q" = "Q"
+"Right" = "Direito"
+"Room size" = "Tamanho da sala"
+"Sens" = "Sens."
+"Sine|Triangle|Square" = "Senoide|Triângulo|Quadrada"
+"Soft clipper" = "Soft clipper"
+"Spd" = "Veloc."
+"Split balance" = "Equilíbrio da divisão"
+"Split freq." = "Freq. da divisão"
+"Sprd" = "Espalh."
+"Tune" = "Afinação"
+"Tuning" = "Afinação"
+"Vel" = "Vel"
+"Start phase" = "Fase inicial"
+"L/R phase" = "Fase E/D"
+"Levels" = "Níveis"
+"Mono input" = "Entrada mono"
+"Delays" = "Delays"
+"I|II|Edit" = "I|II|Editar"
+"Triangle|Sine" = "Triângulo|Senoide"
+"H.pass" = "Passa-A."
+"Movement" = "Movimento"
+"Move rate" = "Taxa do mov."
+"Mod rate" = "Taxa da mod."
+"LFO phase dif" = "Dif. de fase LFO"
+"Delay lines" = "Linhas de delay"
+"Invert wet" = "Inverter molhado"
+"Amount: drag up or down (Ctrl: fine)" = "Quantidade: arraste para cima ou para baixo (Ctrl: fino)"
+"Soundgoodizer preset A to D (read from your FL installation)" = "Preset A a D do Soundgoodizer (lido da sua instalação do FL)"
+"Drag the point: both values at once" = "Arraste o ponto: os dois valores de uma vez"
+"Balance" = "Balanço"
+"Draft" = "Rascunho"
+"En" = "En"
+"Filter" = "Filtro"
+"HQ envelopes" = "Envelopes HQ"
+"Main" = "Principal"
+"Operators, filters, effects and the matrix" = "Operadores, filtros, efeitos e a matriz"
+"Oversampling" = "Sobreamostragem"
+"Ph" = "Fa"
+"Pn" = "Pn"
+"Pt" = "Tm"
+"Quality" = "Qualidade"
+"Render" = "Render"
+"Sb" = "Sb"
+"Unison" = "Uníssono"
+"Vl" = "Vl"
+"keep the saved patch" = "mantêm o patch salvo"
+"Timbre" = "Timbre"
+"Blur" = "Desfoque"
+"Trem" = "Trem"
+"Prism" = "Prisma"
+"Harmonizer" = "Harmonizador"
+"Vibrato" = "Vibrato"
+"Pluck" = "Pluck"
+"Phaser" = "Phaser"
+"EQ" = "EQ"
+"Filter 1" = "Filtro 1"
+"Order" = "Ordem"
+"Part A / B" = "Parte A / B"
+"The other Harmor controls keep the saved patch" = "Os outros controles do Harmor mantêm o patch salvo"
+"Squarize" = "Quadratizar"
+"Puncher" = "Puncher"
+"Preserve" = "Preservar"
+"Impact" = "Impacto"
+"Relation" = "Relação"
+"Freq." = "Freq."
+"Res." = "Res."
+"Pre|Pos" = "Pré|Pós"
+"Env" = "Env."
+"Rel 2" = "Rel. 2"
+"LMH del" = "Atraso LMH"
+"LMH mix" = "Mix LMH"
+"Out" = "Saída"
+"In" = "Entrada"
+"On|Comp off|Muted|Off" = "Lig.|Sem comp.|Mudo|Desl."
+"Low|Mid|High|Master" = "Graves|Médios|Agudos|Master"
+"Peak|RMS" = "Pico|RMS"
+"Advanced" = "Avançado"
+"Main|Advanced" = "Principal|Avançado"
+"Phasing" = "Phasing"
+"Min" = "Mín."
+"Max" = "Máx."
+"Manual" = "Manual"
+"Tension" = "Tensão"
+"LP" = "PB"
+"HP" = "PA"
+"Manual freq." = "Freq. manual"
+"Rate 1" = "Taxa 1"
+"Rate 2" = "Taxa 2"
+"Depth scale" = "Escala de prof."
+"Pull-down" = "Pull-down"
+"Colour gain" = "Ganho de cor"
+"Colour freq." = "Freq. de cor"
+"Input HP" = "PA de entrada"
+"Feedback HP" = "PA do feedback"
+"Engine V2" = "Motor V2"
+"Invert feedback" = "Inverter feedback"

+ 2 - 0
scripts/build-local.sh

@@ -30,6 +30,8 @@ CORE="$CORE src/core/FlPluginDb.cpp"
 CORE="$CORE src/core/MissingFiles.cpp"
 # settings pages, plugin manager and shortcut manager logic (round 82)
 CORE="$CORE src/core/Preferences.cpp"
+# layouts of the native plugin editors (round 93)
+CORE="$CORE src/core/PluginLayout.cpp"
 # spectral waveforms (band analysis, multi-resolution peak cache)
 CORE="$CORE src/core/WaveAnalysis.cpp"
 # FL's Plucked!, Sawer and BeepMap engines (REA round 65)

+ 2 - 0
scripts/build-windows-zig.sh

@@ -116,6 +116,8 @@ APP_SOURCES+=(src/core/OggVorbis.cpp)
 # export options + MP3, plugin performance monitor, clip properties / arrangements, new project, touch keyboard (round 84)
 APP_SOURCES+=(src/core/ExportOptions.cpp src/core/Mp3Encoder.cpp src/core/PluginMonitor.cpp src/core/PlaylistOps.cpp)
 APP_SOURCES+=(src/ui/NewProjectDialog.cpp src/ui/ClipProperties.cpp src/ui/PluginMonitorWindow.cpp src/ui/TouchKeyboard.cpp)
+# native plugin editors in FL's arrangement (round 93)
+APP_SOURCES+=(src/core/PluginLayout.cpp src/ui/PluginEditors.cpp)
 
 echo "WavPack (decoder, C)..."
 mkdir -p "$OUT/wavpack"

+ 197 - 0
src/Main.cpp

@@ -1,6 +1,11 @@
 #include <juce_gui_basics/juce_gui_basics.h>
 
 #include "core/Effects.h"
+#include "core/FlEffects.h"
+#include "core/FlpImport.h"
+#include "core/MaximusFx.h"
+#include "core/Harmor.h"
+#include "flp/Flp.h"
 #include "core/SynthPresets.h"
 #include "core/FlWrapper.h"
 #include "engine/AudioEngine.h"
@@ -34,6 +39,8 @@
 #include "ui/EventEditor.h"
 #include "core/EventEdit.h"
 #include "ui/ParametricEqEditor.h"
+#include "ui/PluginEditors.h"
+#include "core/PluginLayout.h"
 #include "ui/Splash.h"
 #include "ui/Theme.h"
 #include "ui/WaveformView.h"
@@ -374,6 +381,15 @@ public:
             return;
         }
 
+        if (args.contains ("--plugui"))
+        {
+            // LYNX.exe --plugui <folder>: the native effect editors at FL's size (one PNG per editor and page), each
+            // loaded with the FL plugin's Default preset when the FL installation has one
+            const auto i = args.indexOf ("--plugui");
+            runPluginEditorSnapshots (args[i + 1].unquoted());
+            return;
+        }
+
         if (args.contains ("--snapshot"))
         {
             const auto i = args.indexOf ("--snapshot");
@@ -1484,6 +1500,187 @@ private:
 
     // LYNX.exe --snapshot prefix [project]: draws the window off-screen and writes
     // prefix-rack.png, -pianoroll.png and -playlist.png (to check the UI without touching the screen).
+    void runPluginEditorSnapshots (const juce::String& folder)
+    {
+        juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);
+        {
+            const juce::File out (folder);
+            out.createDirectory();
+            lynx::AudioEngine offline (false);
+            const auto roots = lynx::findFlStudioRoots();
+            const auto presets = juce::File (juce::String::fromUTF8 (roots.data.c_str())).getChildFile ("Patches/Plugin presets/Effects");
+
+            auto kinds = lynx::plugui::flLayoutKinds();
+            kinds.push_back (lynx::EffectKind::maximus); // Soundgoodizer (below)
+            const auto database = juce::File (juce::String::fromUTF8 (roots.data.c_str())).getChildFile ("Patches/Plugin database/Effects");
+
+            for (const auto kind : kinds)
+            {
+                auto fx = lynx::makeEffectSlot (kind);
+                juce::String name (lynx::effectInfo (kind).name);
+                for (const auto& plugin : lynx::flPluginsForEffect (kind))
+                {
+                    const auto dir = presets.getChildFile (juce::String::fromUTF8 (plugin.c_str()));
+                    auto file = dir.getChildFile ("Default.fst");
+                    if (! file.existsAsFile()) // plugins without presets: their entry of FL's plugin database
+                        for (const auto& f : database.findChildFiles (juce::File::findFiles, true, juce::String::fromUTF8 (plugin.c_str()) + ".fst"))
+                            file = f;
+                    if (! file.existsAsFile())
+                    {
+                        auto files = dir.findChildFiles (juce::File::findFiles, true, "*.fst");
+                        std::sort (files.begin(), files.end(), [] (const juce::File& a, const juce::File& b) { return a.getFullPathName().compareNatural (b.getFullPathName()) < 0; });
+                        file = files.isEmpty() ? juce::File() : files[0];
+                    }
+                    juce::MemoryBlock data;
+                    if (file.existsAsFile() && file.loadFileAsData (data))
+                    {
+                        const auto* bytes = static_cast<const std::uint8_t*> (data.getData());
+                        if (auto loaded = lynx::effectFromFlPreset (std::vector<std::uint8_t> (bytes, bytes + data.getSize()), 130.0); loaded && loaded->kind == kind)
+                            fx = *loaded;
+                    }
+                    name = juce::String::fromUTF8 (plugin.c_str());
+                    break;
+                }
+
+                if (kind == lynx::EffectKind::maximus) // Soundgoodizer: preset A of the installation, Amount 60 %
+                {
+                    juce::MemoryBlock data;
+                    juce::File (juce::String::fromUTF8 (roots.factoryData.c_str())).getChildFile ("Plugins/Fruity/Effects/Soundgoodizer/Data/Presets/a.dat").loadFileAsData (data);
+                    lynx::maximusfx::Blob blob;
+                    blob.build = lynx::hlfx::MaximusBuild::soundgoodizer;
+                    blob.mix = 600;
+                    const auto* b = static_cast<const std::uint8_t*> (data.getData());
+                    blob.state.assign (b, b + data.getSize());
+                    fx = lynx::makeEffectSlot (kind);
+                    fx.state = lynx::maximusfx::pack (blob);
+                    name = "Soundgoodizer";
+                }
+
+                lynx::Song song;
+                song.mixer.resize (2);
+                song.mixer[0].name = "Master";
+                song.mixer[1].name = "Insert 1";
+                song.mixer[1].effects.push_back (fx);
+                offline.setSong (std::move (song));
+                offline.dispatchPendingMessages();
+
+                const auto pages = name == "Soundgoodizer" ? 1 : juce::jmax (1, (int) lynx::plugui::layoutFor (kind).pages.size());
+                for (int page = 0; page < pages; ++page)
+                {
+                    auto editor = lynx::makeNativeEffectEditor (offline, 1, 0, 1.0f, page);
+                    juce::Image image (juce::Image::ARGB, editor->getWidth(), editor->getHeight(), true);
+                    {
+                        juce::Graphics g (image);
+                        g.fillAll (lynx::theme::panel);
+                        editor->paintEntireComponent (g, false);
+                    }
+                    const auto file = out.getChildFile (name + (page > 0 ? "-p" + juce::String (page + 1) : juce::String()) + ".png");
+                    file.deleteFile();
+                    juce::PNGImageFormat png;
+                    if (auto stream = file.createOutputStream())
+                        png.writeImageToStream (image, *stream);
+                }
+            }
+
+            // generators in FL's arrangement: the channel's plugin page with the FL preset's settings
+            const auto generators = juce::File (juce::String::fromUTF8 (roots.data.c_str())).getChildFile ("Patches/Plugin presets/Generators");
+            for (auto [folder, preset] : std::vector<std::pair<const char*, const char*>> { { "3x Osc", "Default.fst" }, { "FL Keys", "Grand Piano.fst" }, { "BooBass", "" }, { "Sytrus", "Default.fst" }, { "Harmor", "Default.fst" } })
+            {
+                juce::MemoryBlock data;
+                if (juce::String (folder) == "Harmor") // the first preset whose state the engine reads
+                {
+                    auto files = generators.getChildFile (folder).findChildFiles (juce::File::findFiles, true, "*.fst");
+                    files.sort();
+                    for (const auto& f : files)
+                    {
+                        juce::MemoryBlock block;
+                        if (! f.loadFileAsData (block))
+                            continue;
+                        const auto* b = static_cast<const std::uint8_t*> (block.getData());
+                        try
+                        {
+                            const auto p = flp::parseProject (std::vector<std::uint8_t> (b, b + block.getSize()), true);
+                            if (! p.channels.empty() && lynx::harmorStateUsable (p.channels.front().pluginState))
+                            {
+                                preset = nullptr;
+                                data = block;
+                                break;
+                            }
+                        }
+                        catch (const std::exception&)
+                        {
+                        }
+                    }
+                }
+                auto file = preset == nullptr ? juce::File() : juce::String (preset).isEmpty() ? database.getSiblingFile ("Generators").getChildFile ("Misc").getChildFile (juce::String (folder) + ".fst")
+                                                            : generators.getChildFile (folder).getChildFile (preset);
+                if (! file.existsAsFile())
+                {
+                    auto files = generators.getChildFile (folder).findChildFiles (juce::File::findFiles, true, "*.fst");
+                    files.sort();
+                    file = files.isEmpty() ? juce::File() : files[0];
+                }
+                if (data.isEmpty() && ! file.loadFileAsData (data))
+                    continue;
+                try
+                {
+                    const auto* bytes = static_cast<const std::uint8_t*> (data.getData());
+                    auto project = flp::parseProject (std::vector<std::uint8_t> (bytes, bytes + data.getSize()), true);
+                    if (project.channels.empty())
+                        continue;
+                    project.channels.front().type = flp::ChannelType::native;
+                    lynx::FlpImportOptions options;
+                    options.roots = roots;
+                    options.fileExists = [] (const std::string& path) { return juce::File (juce::String::fromUTF8 (path.c_str())).existsAsFile(); };
+                    options.readFile = [] (const std::string& path) {
+                        juce::MemoryBlock block;
+                        juce::File (juce::String::fromUTF8 (path.c_str())).loadFileAsData (block);
+                        const auto* b = static_cast<const std::uint8_t*> (block.getData());
+                        return std::vector<std::uint8_t> (b, b + block.getSize());
+                    };
+                    options.saveEmbedded = [out] (const std::vector<std::uint8_t>& wav, const std::string& name) {
+                        const auto f = out.getChildFile ("samples").getNonexistentChildFile (juce::String::fromUTF8 (name.c_str()), ".wav");
+                        f.getParentDirectory().createDirectory();
+                        f.replaceWithData (wav.data(), wav.size());
+                        return f.getFullPathName().toStdString();
+                    };
+                    auto song = lynx::importFlp (project, options);
+                    // the page only needs the plugin's saved state (FL Keys' sample zones need the installed wavetables)
+                    if (! song.channels.empty() && project.channels.front().pluginName == "BooBass" && song.channels.front().instrument != lynx::InstrumentKind::boobass)
+                    {
+                        song.channels.front().instrument = lynx::InstrumentKind::boobass; // (its sound needs the engine DLL; the page does not)
+                        song.channels.front().modelParams.assign (3, 32768.0f);
+                    }
+                    if (! song.channels.empty() && project.channels.front().pluginName == "FL Keys")
+                    {
+                        song.channels.front().instrument = lynx::InstrumentKind::flkeys;
+                        song.channels.front().pluginState = project.channels.front().pluginState;
+                    }
+                    offline.setSong (std::move (song));
+                    offline.dispatchPendingMessages();
+                    if (offline.getSong().channels.empty())
+                        continue;
+                    auto panel = lynx::makeChannelSettingsPanel (offline, 0);
+                    juce::Image image (juce::Image::ARGB, panel->getWidth(), panel->getHeight(), true);
+                    {
+                        juce::Graphics g (image);
+                        g.fillAll (lynx::theme::panel);
+                        panel->paintEntireComponent (g, false);
+                    }
+                    const auto out2 = out.getChildFile (juce::String (folder) + ".png");
+                    out2.deleteFile();
+                    juce::PNGImageFormat png;
+                    if (auto stream = out2.createOutputStream())
+                        png.writeImageToStream (image, *stream);
+                }
+                catch (const std::exception&)
+                {
+                }
+            }
+        }
+        quit();
+    }
+
     void runSnapshot (const juce::String& prefix, const juce::String& projectPath)
     {
         juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);

+ 32 - 0
src/core/HarmlessFx.cpp

@@ -493,6 +493,38 @@ std::shared_ptr<const MaximusPreset> makeMaximusPreset (const std::vector<std::u
     return m;
 }
 
+std::vector<std::vector<std::pair<double, float>>> maximusEnvelopes (const std::vector<std::uint8_t>& d)
+{
+    // the same walk as makeMaximusPreset: fixed block by version, the v14 / v15 options, then 8 envelopes
+    std::vector<std::vector<std::pair<double, float>>> out;
+    if (d.size() < 0x1fe + 12)
+        return out;
+    const auto header = (std::uint32_t) i32At (d, 0);
+    const auto version = header > 0xFFFFu ? (int) (header >> 16) : (int) header;
+    if (version < 3)
+        return out;
+    const std::size_t block = version >= 7 ? 0x1fa : version == 6 ? 0x1f9 : version == 5 ? 0x1f5 : version == 4 ? 0x1f1 : 0x1ee;
+    auto pos = 4 + block;
+    if (version >= 14)
+        pos += 9 + 20;
+    if (version >= 15)
+        pos += 4;
+    bool ok = true;
+    for (int e = 0; e < 8 && ok; ++e)
+    {
+        const auto pts = readCurve (d, pos, ok);
+        if (! ok)
+            break;
+        std::vector<std::pair<double, float>> curve;
+        for (const auto& p : pts)
+            curve.emplace_back (p.dx, p.y);
+        out.push_back (std::move (curve));
+    }
+    if (! ok)
+        out.clear();
+    return out;
+}
+
 namespace
 {
 // FUN_00624580 (types 1 low-pass, 4 high-pass, 5 all-pass) + FUN_00624e90 (stereo direct form I in double, the

+ 4 - 0
src/core/HarmlessFx.h

@@ -138,5 +138,9 @@ private:
 
 // a Maximus state with some parameters replaced (index, value): Harmor sends its globals 49–52 as the hosted
 // plugin's parameters 5, 8, 21 and 34 after loading the preset
+// the 8 envelopes of a Maximus state (per band: the compression curve, then the second envelope) as (Δx, y)
+// points; empty when the state cannot be read
+std::vector<std::vector<std::pair<double, float>>> maximusEnvelopes (const std::vector<std::uint8_t>& state);
+
 std::vector<std::uint8_t> withMaximusParams (std::vector<std::uint8_t> state, const std::vector<std::pair<int, int>>& params);
 } // namespace lynx::hlfx

+ 175 - 0
src/core/MaximusFx.cpp

@@ -1,6 +1,9 @@
 #include "core/MaximusFx.h"
 
+#include <cmath>
+#include <cstdio>
 #include <cstring>
+#include <algorithm>
 
 namespace lynx::maximusfx
 {
@@ -97,4 +100,176 @@ std::unique_ptr<Effect> make (const std::vector<std::uint8_t>& slotState)
 {
     return std::make_unique<MaximusEffect> (slotState);
 }
+// --- editing -----------------------------------------------------------------------------------------------
+
+const std::vector<StateParam>& stateParams()
+{
+    // REA_rodada8 §1.2 (FUN_00842440 splits the index; ranges and defaults from the parameter texts and the reset state)
+    static const std::vector<StateParam> table = [] {
+        std::vector<StateParam> t {
+            { "Low band frequency", 0, 65536, 19800 }, { "Low band slope", 0, 1, 1 },
+            { "High band frequency", 0, 65536, 48065 }, { "High band slope", 0, 1, 1 },
+            { "LMH lookahead delay", 0, 10000, 1115 }, { "LMH mix", 0, 1000, 1000 },
+            { "Low cut", -1, 65536, 32768 },
+        };
+        static const char* bands[4] { "Low", "Mid", "High", "Master" };
+        static const char* controls[13] { "mode", "pre gain", "post gain", "stereo separation", "saturation threshold",
+                                          "saturation ceiling", "attack", "release 2", "attack curve", "release",
+                                          "release curve", "sustain", "envelope mode" };
+        static const int ranges[13][3] { { 0, 3, 0 }, { 0, 2000, 1000 }, { 0, 2000, 1000 }, { -1000, 1000, 0 }, { -1000, 1000, 0 },
+                                         { 0, 2000, 1000 }, { 0, 10000, 1115 }, { 0, 10000, 0 }, { 1, 8, 2 }, { 0, 10000, 5000 },
+                                         { 1, 8, 3 }, { 0, 10000, 2882 }, { 0, 1, 0 } };
+        static std::vector<std::string> names; // stable storage for the composed names
+        names.reserve (52);
+        for (int b = 0; b < 4; ++b)
+            for (int j = 0; j < 13; ++j)
+                names.push_back (std::string (bands[b]) + " " + controls[j]);
+        for (int k = 0; k < 52; ++k)
+            t.push_back ({ names[(std::size_t) k].c_str(), ranges[k % 13][0], ranges[k % 13][1], ranges[k % 13][2] });
+        return t;
+    }();
+    return table;
+}
+
+int stateParamIndex (const char* name)
+{
+    if (name == nullptr)
+        return -1;
+    const auto& t = stateParams();
+    for (int i = 0; i < (int) t.size(); ++i)
+        if (std::strcmp (t[(std::size_t) i].name, name) == 0)
+            return i;
+    return -1;
+}
+
+std::optional<int> stateParam (const std::vector<std::uint8_t>& slotState, int index)
+{
+    const auto blob = unpack (slotState);
+    if (! blob || index < 0 || index >= 59 || blob->state.size() < 4 + 4 * (std::size_t) (index + 1))
+        return std::nullopt;
+    if (index == 5 && blob->mix >= 0)
+        return blob->mix;
+    std::int32_t v = 0;
+    std::memcpy (&v, blob->state.data() + 4 + 4 * (std::size_t) index, 4);
+    return (int) v;
+}
+
+std::vector<std::uint8_t> withStateParam (const std::vector<std::uint8_t>& slotState, int index, int raw)
+{
+    auto blob = unpack (slotState);
+    if (! blob || index < 0 || index >= 59)
+        return slotState;
+    const auto& p = stateParams()[(std::size_t) index];
+    raw = std::max (p.minimum, std::min (p.maximum, raw));
+    blob->state = hlfx::withMaximusParams (std::move (blob->state), { { index, raw } });
+    if (index == 5 && blob->mix >= 0)
+        blob->mix = raw;
+    return pack (*blob);
+}
+
+namespace
+{
+// time law T(v) = 2·(501^(v/10000) − 1) ms (REA_rodada36 §2.1)
+double timeMs (int v) { return 2.0 * (std::pow (501.0, (double) v / 10000.0) - 1.0); }
+// L7 gain law (7^x − 1)/6, x = v/1000
+std::string gainText (int v)
+{
+    const auto g = (std::pow (7.0, (double) v / 1000.0) - 1.0) / 6.0;
+    if (g <= 0.0)
+        return "-inf dB";
+    char t[32];
+    std::snprintf (t, sizeof (t), "%+.1f dB", 20.0 * std::log10 (g));
+    return t;
+}
+std::string msText (double ms)
+{
+    char t[32];
+    std::snprintf (t, sizeof (t), ms < 10.0 ? "%.2f ms" : ms < 100.0 ? "%.1f ms" : "%.0f ms", ms);
+    return t;
+}
+} // namespace
+
+std::string stateParamText (int index, int raw)
+{
+    char t[48];
+    switch (index)
+    {
+        case 0:
+        case 2:
+            std::snprintf (t, sizeof (t), "%d Hz", (int) std::lround (30.0 * std::pow (533.33, (double) raw / 65536.0)));
+            return t;
+        case 1:
+        case 3: return raw != 0 ? "24 dB/oct" : "12 dB/oct";
+        case 4: return msText (timeMs (raw));
+        case 5:
+            std::snprintf (t, sizeof (t), "%.1f%%", (double) raw / 10.0);
+            return t;
+        case 6:
+            if (raw < 0)
+                return "Off";
+            std::snprintf (t, sizeof (t), "%.1f Hz", 5.0 * std::pow (16.0, (double) raw / 65536.0));
+            return t;
+        default: break;
+    }
+    if (index < 7 || index >= 59)
+        return {};
+    const auto band = (index - 7) / 13, j = (index - 7) % 13;
+    switch (j)
+    {
+        case 0:
+        {
+            static const char* modes[4] { "On", "Compression off", "Muted", "Off" };
+            return modes[std::max (0, std::min (3, raw))];
+        }
+        case 1:
+        case 2:
+        case 5: return gainText (raw);
+        case 3:
+            std::snprintf (t, sizeof (t), "%+.0f%%", (double) raw / 10.0);
+            return t;
+        case 4:
+            if (raw == 0)
+                return "No saturation";
+            std::snprintf (t, sizeof (t), "%s %.0f%%", raw < 0 ? "Mode A" : "Mode B", std::abs ((double) raw) / 10.0);
+            return t;
+        case 6: return raw == 0 && band < 3 ? "Default" : msText (timeMs (raw));
+        case 7: return raw == 0 ? "Default" : msText (2.0 * timeMs (raw));
+        case 9: return msText (2.0 * timeMs (raw));
+        case 8:
+        case 10:
+            std::snprintf (t, sizeof (t), "%d", raw);
+            return t;
+        case 11: return msText (timeMs (raw));
+        case 12: return raw != 0 ? "RMS" : "Peak";
+        default: return {};
+    }
+}
+
+std::vector<std::pair<float, float>> curvePoints (const std::vector<std::uint8_t>& slotState, int band)
+{
+    std::vector<std::pair<float, float>> out;
+    const auto blob = unpack (slotState);
+    if (! blob || band < 0 || band > 3)
+        return out;
+    const auto envelopes = hlfx::maximusEnvelopes (blob->state);
+    if (envelopes.size() < 8)
+        return out;
+    double x = 0.0;
+    for (const auto& [dx, y] : envelopes[(std::size_t) (2 * band)])
+    {
+        x += dx;
+        out.emplace_back ((float) std::min (1.0, x), std::max (0.0f, std::min (1.0f, y)));
+    }
+    return out;
+}
+
+int selectedBand (const std::vector<std::uint8_t>& slotState)
+{
+    const auto blob = unpack (slotState);
+    if (! blob || blob->state.size() < 0x1e4)
+        return 3;
+    std::int32_t b = 3;
+    std::memcpy (&b, blob->state.data() + 0x1e0, 4);
+    return b >= 0 && b <= 3 ? (int) b : 3;
+}
 } // namespace lynx::maximusfx

+ 21 - 0
src/core/MaximusFx.h

@@ -13,6 +13,8 @@
 #include <cstdint>
 #include <memory>
 #include <optional>
+#include <string>
+#include <utility>
 #include <vector>
 
 #include "core/Effects.h"
@@ -42,4 +44,23 @@ std::optional<SoundgoodizerState> parseSoundgoodizer (const std::vector<std::uin
 const char* soundgoodizerPresetFile (int preset); // "a.dat" … "d.dat"
 
 std::unique_ptr<Effect> make (const std::vector<std::uint8_t>& slotState);
+
+// --- editing a Maximus slot (the native editor's page) -------------------------------------------------------
+// The 59 parameters of the Maximus state (REA_rodada8 §1.2: 7 globals, then 13 per band low / mid / high / master),
+// raw integer ranges and defaults as the plugin stores them. Index = the Maximus parameter number.
+struct StateParam
+{
+    const char* name;
+    int minimum, maximum, defaultValue;
+};
+const std::vector<StateParam>& stateParams();
+int stateParamIndex (const char* name);                                     // −1 = no such parameter
+std::optional<int> stateParam (const std::vector<std::uint8_t>& slotState, int index); // raw value
+// the slot state with one parameter replaced (parameter 5 also updates the container's band mix when it is set)
+std::vector<std::uint8_t> withStateParam (const std::vector<std::uint8_t>& slotState, int index, int raw);
+std::string stateParamText (int index, int raw);                            // the value as the editor shows it
+// The drawn compression curve of band 0…3 (cumulative x, y; both 0…1; x = log₃(1 + 2·level)/2, so 0.5 = 0 dBFS)
+std::vector<std::pair<float, float>> curvePoints (const std::vector<std::uint8_t>& slotState, int band);
+// The band selected in FL's editor when the state was saved (UI block +0x1E0), 0…3
+int selectedBand (const std::vector<std::uint8_t>& slotState);
 } // namespace lynx::maximusfx

+ 1610 - 0
src/core/PluginLayout.cpp

@@ -0,0 +1,1610 @@
+#include "core/PluginLayout.h"
+
+#include <algorithm>
+#include <cmath>
+#include <cstring>
+#include <map>
+#include <mutex>
+#include <string>
+
+#include "core/Effects.h"
+#include "core/MaximusFx.h"
+
+// (the i18n test scans the sources for TR_NOOP: captions below are translated by the editor)
+#ifndef TR_NOOP
+#define TR_NOOP(text) text
+#endif
+
+namespace lynx::plugui
+{
+namespace
+{
+// --- builders (positions in FL's window pixels, body origin) -----------------------------------------
+
+LayoutItem section (float x, float y, float w, float h, const char* title, std::uint16_t style = 0)
+{
+    LayoutItem i;
+    i.type = Item::section;
+    i.x = x, i.y = y, i.w = w, i.h = h;
+    i.label = title;
+    i.style = style;
+    return i;
+}
+
+// a knob centred at (cx, cy), `d` wide, its caption centred at `captionY`
+LayoutItem knob (float cx, float cy, float d, const char* param, const char* caption, float captionY, std::uint16_t style = 0, int steps = 0)
+{
+    LayoutItem i;
+    i.type = Item::knob;
+    i.x = cx - d * 0.5f;
+    i.y = cy - d * 0.5f - ((style & valueAbove) != 0 ? 16.0f : 0.0f);
+    i.w = d;
+    i.h = (captionY + 6.0f) - i.y;
+    if ((style & noCaption) != 0)
+        i.h = d + ((style & valueAbove) != 0 ? 16.0f : 0.0f);
+    i.param = param;
+    i.label = caption;
+    i.style = style;
+    i.steps = steps;
+    return i;
+}
+
+LayoutItem label (float x, float y, float w, float h, const char* text, std::uint16_t style = 0)
+{
+    LayoutItem i;
+    i.type = Item::label;
+    i.x = x, i.y = y, i.w = w, i.h = h;
+    i.label = text;
+    i.style = style;
+    return i;
+}
+
+LayoutItem value (float x, float y, float w, float h, const char* param, std::uint16_t style = alignLeft)
+{
+    LayoutItem i;
+    i.type = Item::value;
+    i.x = x, i.y = y, i.w = w, i.h = h;
+    i.param = param;
+    i.style = style;
+    return i;
+}
+
+LayoutItem slider (Item type, float x, float y, float w, float h, const char* param, const char* caption = nullptr, std::uint16_t style = 0)
+{
+    LayoutItem i;
+    i.type = type;
+    i.x = x, i.y = y, i.w = w, i.h = h;
+    i.param = param;
+    i.label = caption;
+    i.style = style;
+    return i;
+}
+
+LayoutItem radio (float x, float y, float w, float h, const char* param, const char* options, std::vector<float> values = {})
+{
+    LayoutItem i;
+    i.type = Item::radio;
+    i.x = x, i.y = y, i.w = w, i.h = h;
+    i.param = param;
+    i.options = options;
+    i.values = std::move (values);
+    return i;
+}
+
+LayoutItem tabs (float x, float y, float w, float h, const char* param, const char* options, std::vector<float> values = {}, std::uint16_t style = 0)
+{
+    LayoutItem i;
+    i.type = Item::tabs;
+    i.x = x, i.y = y, i.w = w, i.h = h;
+    i.param = param;
+    i.options = options;
+    i.values = std::move (values);
+    i.style = style;
+    return i;
+}
+
+LayoutItem pageTabs (float x, float y, float w, float h, const char* options)
+{
+    auto i = tabs (x, y, w, h, nullptr, options, {}, plugui::pageTabs);
+    return i;
+}
+
+LayoutItem toggle (float x, float y, float w, float h, const char* param, const char* caption, std::uint16_t style = 0)
+{
+    LayoutItem i;
+    i.style = style;
+    i.type = Item::toggle;
+    i.x = x, i.y = y, i.w = w, i.h = h;
+    i.param = param;
+    i.label = caption;
+    return i;
+}
+
+LayoutItem stepper (float x, float y, float w, float h, const char* param, const char* caption, int steps)
+{
+    LayoutItem i;
+    i.type = Item::stepper;
+    i.x = x, i.y = y, i.w = w, i.h = h;
+    i.param = param;
+    i.label = caption;
+    i.steps = steps;
+    return i;
+}
+
+LayoutItem display (float x, float y, float w, float h, const char* id, const char* param = nullptr, const char* param2 = nullptr)
+{
+    LayoutItem i;
+    i.type = Item::display;
+    i.x = x, i.y = y, i.w = w, i.h = h;
+    i.display = id;
+    i.param = param;
+    i.param2 = param2;
+    return i;
+}
+
+LayoutItem onPage (LayoutItem i, int page)
+{
+    i.page = page;
+    return i;
+}
+
+// shown only while `param` is within [lo, hi] (two conditions at most)
+LayoutItem when (LayoutItem i, const char* param, float lo, float hi)
+{
+    if (i.whenParam == nullptr)
+    {
+        i.whenParam = param;
+        i.whenMin = lo;
+        i.whenMax = hi;
+    }
+    else
+    {
+        i.when2Param = param;
+        i.when2Min = lo;
+        i.when2Max = hi;
+    }
+    return i;
+}
+
+// --- FL's generic "Fruity" editor: cells of 160 × 45 in three columns, 50 px apart ---------------------
+// (knob at the left, the caption on a plate, the value or a slider under it)
+enum class Cell { value, slider, radio };
+
+void fruityCell (std::vector<LayoutItem>& items, int column, int row, const char* param, const char* caption, Cell kind = Cell::value,
+                 int steps = 0, const char* options = nullptr)
+{
+    const auto x = 6.0f + 165.0f * (float) column, y = 5.0f + 50.0f * (float) row;
+    items.push_back (section (x, y, 160.0f, 45.0f, nullptr, boxed));
+
+    if (kind == Cell::radio) // half cell: plate + Off / On
+        return;
+
+    items.push_back (knob (x + 25.0f, y + 22.5f, 38.0f, param, caption, 0.0f, noCaption, steps));
+    items.push_back (label (x + 54.0f, y + 3.0f, 102.0f, 15.0f, caption, boxed));
+    if (kind == Cell::slider)
+        items.push_back (slider (Item::hslider, x + 54.0f, y + 25.0f, 102.0f, 16.0f, param, nullptr, noCaption));
+    else
+        items.push_back (value (x + 57.0f, y + 23.0f, 99.0f, 18.0f, param));
+    (void) options;
+}
+
+// a half-width cell with a plate and an Off / On switch (Fruity Filter's X2 / CENTER)
+void fruityHalfCell (std::vector<LayoutItem>& items, int column, int row, int half, const char* param, const char* caption)
+{
+    const auto x = 6.0f + 165.0f * (float) column + 82.5f * (float) half, y = 5.0f + 50.0f * (float) row;
+    items.push_back (section (x, y, 77.5f, 45.0f, nullptr, boxed));
+    items.push_back (label (x + 18.0f, y + 3.0f, 56.0f, 15.0f, caption, boxed));
+    items.push_back (radio (x + 4.0f, y + 19.0f, 44.0f, 24.0f, param, TR_NOOP ("Off|On")));
+}
+
+Layout fruityGrid (const char* fl, int rows, int columns = 3)
+{
+    Layout l;
+    l.fl = fl;
+    l.width = 6 + 165 * columns;
+    l.height = 50 * rows + 5;
+    return l;
+}
+
+// --- the layouts ------------------------------------------------------------------------------------
+
+Layout fruityLimiter()
+{
+    // REA/FL capture: display on top (with its view strip at the left), LOUDNESS / ENVELOPE / NOISE GATE headers,
+    // the LIMIT | COMP page switch at the bottom of the middle panel
+    Layout l;
+    l.fl = "Fruity Limiter";
+    l.width = 633;
+    l.height = 306;
+    l.pages = { TR_NOOP ("Limit"), TR_NOOP ("Comp") };
+    auto& v = l.items;
+    v.push_back (display (7, 2, 623, 158, "limiter"));
+    v.push_back (section (2, 161, 629, 143, nullptr, boxed));
+    v.push_back (section (32, 161, 255, 16, TR_NOOP ("Loudness")));
+    v.push_back (section (288, 161, 176, 16, TR_NOOP ("Envelope")));
+    v.push_back (section (465, 161, 166, 16, TR_NOOP ("Noise gate")));
+    v.push_back (section (117, 180, 345, 120, nullptr, boxed | raised));
+    v.push_back (knob (34, 205, 44, "Gain", TR_NOOP ("Gain"), 240));
+    v.push_back (knob (88, 205, 44, "Saturation", TR_NOOP ("Sat"), 240));
+    v.push_back (pageTabs (119, 277, 82, 20, TR_NOOP ("Limit|Comp")));
+    v.push_back (knob (492, 205, 44, "Gate release", TR_NOOP ("Rel"), 240));
+    v.push_back (knob (546, 205, 44, "Gate gain", TR_NOOP ("Gain"), 240));
+    v.push_back (knob (600, 205, 44, "Gate threshold", TR_NOOP ("Thres"), 240));
+
+    // LIMIT page
+    v.push_back (onPage (knob (148, 205, 44, "Ceiling", TR_NOOP ("Ceil"), 240), 0));
+    v.push_back (onPage (knob (316, 205, 44, "Attack", TR_NOOP ("Att"), 240), 0));
+    v.push_back (onPage (knob (372, 205, 44, "Release", TR_NOOP ("Rel"), 240), 0));
+    v.push_back (onPage (knob (432, 205, 44, "Sustain", TR_NOOP ("Sustain"), 240), 0));
+    v.push_back (onPage (stepper (302, 259, 28, 30, "Attack curve", TR_NOOP ("Curve"), 7), 0));
+    v.push_back (onPage (stepper (358, 259, 28, 30, "Release curve", TR_NOOP ("Curve"), 7), 0));
+
+    l.menuSwitches = { "Exact ceiling" };
+
+    // COMP page
+    v.push_back (onPage (knob (148, 205, 44, "Comp. threshold", TR_NOOP ("Thres"), 240), 1));
+    v.push_back (onPage (knob (202, 205, 44, "Knee", TR_NOOP ("Knee"), 240, bipolar), 1));
+    v.push_back (onPage (knob (256, 205, 44, "Ratio", TR_NOOP ("Ratio"), 240, bipolar), 1));
+    v.push_back (onPage (knob (316, 205, 44, "Comp. attack", TR_NOOP ("Att"), 240), 1));
+    v.push_back (onPage (knob (372, 205, 44, "Comp. release", TR_NOOP ("Rel"), 240), 1));
+    // FL captions the compressor's detector window SUSTAIN too (the limiter's is its peak window)
+    v.push_back (onPage (knob (432, 205, 44, "RMS window", TR_NOOP ("Sustain"), 240), 1));
+    v.push_back (onPage (stepper (302, 259, 28, 30, "Comp. curve", TR_NOOP ("Curve"), 7), 1));
+    return l;
+}
+
+Layout fruityCompressor()
+{
+    auto l = fruityGrid ("Fruity Compressor", 2);
+    auto& v = l.items;
+    fruityCell (v, 0, 0, "Threshold", TR_NOOP ("Threshold"));
+    fruityCell (v, 1, 0, "Ratio", TR_NOOP ("Ratio"));
+    fruityCell (v, 2, 0, "Gain", TR_NOOP ("Gain"));
+    fruityCell (v, 0, 1, "Attack", TR_NOOP ("Attack"));
+    fruityCell (v, 1, 1, "Release", TR_NOOP ("Release"));
+    fruityCell (v, 2, 1, "Type", TR_NOOP ("Type"), Cell::value, 7);
+    l.menuSwitches = { "Look-ahead" };
+    return l;
+}
+
+Layout fruityFilter()
+{
+    auto l = fruityGrid ("Fruity Filter", 2);
+    auto& v = l.items;
+    fruityCell (v, 0, 0, "Cutoff", TR_NOOP ("Cutoff freq"), Cell::slider);
+    fruityCell (v, 1, 0, "Resonance", TR_NOOP ("Resonance"), Cell::slider);
+    fruityCell (v, 2, 0, "Low pass", TR_NOOP ("Low pass"), Cell::slider);
+    fruityCell (v, 0, 1, "Band pass", TR_NOOP ("Band pass"), Cell::slider);
+    fruityCell (v, 1, 1, "High pass", TR_NOOP ("High pass"), Cell::slider);
+    fruityHalfCell (v, 2, 1, 0, "x2", TR_NOOP ("X 2"));
+    fruityHalfCell (v, 2, 1, 1, "Center", TR_NOOP ("Center"));
+    return l;
+}
+
+Layout fruityChorus()
+{
+    auto l = fruityGrid ("Fruity Chorus", 4);
+    auto& v = l.items;
+    fruityCell (v, 0, 0, "Delay", TR_NOOP ("Delay"));
+    fruityCell (v, 1, 0, "Depth", TR_NOOP ("Depth"));
+    fruityCell (v, 2, 0, "Stereo", TR_NOOP ("Stereo"));
+    fruityCell (v, 0, 1, "LFO 1 freq", TR_NOOP ("LFO 1 freq"));
+    fruityCell (v, 1, 1, "LFO 2 freq", TR_NOOP ("LFO 2 freq"));
+    fruityCell (v, 2, 1, "LFO 3 freq", TR_NOOP ("LFO 3 freq"));
+    fruityCell (v, 0, 2, "LFO 1 wave", TR_NOOP ("LFO 1 wave"));
+    fruityCell (v, 1, 2, "LFO 2 wave", TR_NOOP ("LFO 2 wave"));
+    fruityCell (v, 2, 2, "LFO 3 wave", TR_NOOP ("LFO 3 wave"));
+    fruityCell (v, 0, 3, "Cross type", TR_NOOP ("Cross type"));
+    fruityCell (v, 1, 3, "Cross cutoff", TR_NOOP ("Cross cutoff"));
+    fruityCell (v, 2, 3, "Wet only", TR_NOOP ("Wet only"));
+    return l;
+}
+
+Layout fruityFlanger()
+{
+    auto l = fruityGrid ("Fruity Flanger", 4);
+    auto& v = l.items;
+    fruityCell (v, 0, 0, "Delay", TR_NOOP ("Delay"));
+    fruityCell (v, 1, 0, "Depth", TR_NOOP ("Depth"));
+    fruityCell (v, 2, 0, "Rate", TR_NOOP ("Rate"));
+    fruityCell (v, 0, 1, "Phase", TR_NOOP ("Phase"));
+    fruityCell (v, 1, 1, "Damp", TR_NOOP ("Damp"));
+    fruityCell (v, 2, 1, "Shape", TR_NOOP ("Shape"));
+    fruityCell (v, 0, 2, "Feed", TR_NOOP ("Feed"));
+    fruityCell (v, 1, 2, "Invert feed", TR_NOOP ("Inv feedback"), Cell::value, 1);
+    fruityCell (v, 2, 2, "Invert wet", TR_NOOP ("Inv wet"), Cell::value, 1);
+    fruityCell (v, 0, 3, "Dry", TR_NOOP ("Dry"));
+    fruityCell (v, 1, 3, "Wet", TR_NOOP ("Wet"));
+    fruityCell (v, 2, 3, "Cross", TR_NOOP ("Cross"));
+    return l;
+}
+
+Layout fruityFastDist()
+{
+    // four knobs and the A/B switch on the left panel, the transfer curve on the right
+    Layout l;
+    l.fl = "Fruity Fast Dist";
+    l.width = 386;
+    l.height = 122;
+    auto& v = l.items;
+    v.push_back (section (0, 0, 262, 96, nullptr, boxed));
+    v.push_back (knob (34, 42, 40, "Pre amp", TR_NOOP ("Pre"), 75));
+    v.push_back (knob (88, 42, 40, "Threshold", TR_NOOP ("Thresh"), 75));
+    v.push_back (radio (122, 30, 30, 26, "Type", "A|B"));
+    v.push_back (knob (179, 42, 40, "Mix", TR_NOOP ("Mix"), 75));
+    v.push_back (knob (233, 42, 40, "Post gain", TR_NOOP ("Post"), 75));
+    v.push_back (label (0, 99, 258, 20, TR_NOOP ("Fast dist"), dim));
+    v.push_back (display (264, 0, 122, 122, "clip", "Threshold"));
+    return l;
+}
+
+Layout stereoEnhancer()
+{
+    // STEREO SEP | phase offset (pre/post, knob, invert) | pan and volume
+    Layout l;
+    l.fl = "Fruity Stereo Enhancer";
+    l.width = 405;
+    l.height = 116;
+    auto& v = l.items;
+    v.push_back (section (0, 0, 82, 116, nullptr, boxed));
+    v.push_back (label (2, 14, 78, 14, TR_NOOP ("Stereo sep")));
+    v.push_back (knob (44, 62, 48, "Separation", nullptr, 0, noCaption | bipolar));
+    v.push_back (label (14, 92, 54, 14, "+          -", dim));
+    v.push_back (section (83, 0, 190, 116, nullptr, boxed));
+    v.push_back (radio (93, 20, 50, 32, "Effects post", TR_NOOP ("Pre|Post")));
+    v.push_back (knob (178, 57, 48, "Phase offset", nullptr, 0, noCaption | bipolar));
+    v.push_back (label (152, 86, 52, 14, "L         R", dim));
+    v.push_back (radio (223, 20, 50, 48, "Invert", TR_NOOP ("None|Left|Right")));
+    v.push_back (label (88, 96, 100, 18, TR_NOOP ("Phase offset"), dim | alignLeft));
+    v.push_back (label (222, 96, 50, 18, TR_NOOP ("Invert"), dim | alignLeft));
+    v.push_back (section (274, 0, 131, 116, nullptr, boxed));
+    v.push_back (label (276, 4, 127, 16, TR_NOOP ("Stereo enhancer"), dim));
+    v.push_back (knob (312, 77, 46, "Pan", TR_NOOP ("Pan"), 0, bipolar | noCaption));
+    v.push_back (label (290, 38, 44, 14, TR_NOOP ("Pan")));
+    v.push_back (knob (374, 77, 46, "Volume", nullptr, 0, noCaption));
+    v.push_back (label (352, 38, 44, 14, TR_NOOP ("Vol")));
+    return l;
+}
+
+Layout fruityDelay3()
+{
+    Layout l;
+    l.fl = "Fruity Delay 3";
+    l.width = 752;
+    l.height = 220;
+    auto& v = l.items;
+    v.push_back (section (2, 2, 58, 216, TR_NOOP ("Input")));
+    v.push_back (slider (Item::vslider, 17, 26, 30, 160, "Send", TR_NOOP ("Wet")));
+
+    v.push_back (section (62, 2, 193, 110, TR_NOOP ("Delay time")));
+    v.push_back (knob (95, 58, 56, "Time", TR_NOOP ("Time"), 104, big));
+    v.push_back (toggle (142, 37, 80, 14, "Tempo sync", TR_NOOP ("Tempo sync")));
+    v.push_back (toggle (142, 55, 80, 14, "Keep pitch", TR_NOOP ("Keep pitch")));
+    v.push_back (slider (Item::hslider, 145, 80, 60, 30, "Time smoothing", TR_NOOP ("Smoothing")));
+    v.push_back (knob (233, 82, 34, "Time R / pan", TR_NOOP ("Offset"), 104, bipolar));
+
+    v.push_back (section (257, 2, 121, 110, TR_NOOP ("Delay model")));
+    v.push_back (radio (268, 36, 62, 52, "Delay type", TR_NOOP ("Mono|Stereo|Ping pong|Off"), { 0.0f, 1.0f / 3.0f, 2.0f / 3.0f, 1.0f }));
+    v.push_back (knob (356, 80, 34, "Stereo spread", TR_NOOP ("Stereo"), 104));
+
+    v.push_back (section (380, 2, 305, 110, TR_NOOP ("Feedback")));
+    v.push_back (knob (418, 70, 56, "Feedback", TR_NOOP ("Level"), 104, big));
+    v.push_back (knob (469, 80, 34, "Cutoff", TR_NOOP ("Cutoff"), 104));
+    v.push_back (knob (516, 80, 34, "Resonance", TR_NOOP ("Res"), 104));
+    v.push_back (radio (557, 36, 40, 52, "Filter mode", TR_NOOP ("LP|HP|BP|Off"), { 0.0f, 1.0f / 3.0f, 2.0f / 3.0f, 1.0f }));
+    v.push_back (knob (620, 80, 34, "Rate reduce", TR_NOOP ("Smp rate"), 104));
+    v.push_back (knob (666, 80, 34, "Bit reduce", TR_NOOP ("Bits"), 104));
+
+    v.push_back (section (688, 2, 62, 216, TR_NOOP ("Output")));
+    v.push_back (knob (719, 48, 34, "Wet", TR_NOOP ("Wet"), 80));
+    v.push_back (knob (719, 110, 34, "Colour", TR_NOOP ("Tone"), 142, bipolar));
+    v.push_back (knob (719, 172, 34, "Dry", TR_NOOP ("Dry"), 204));
+
+    v.push_back (section (62, 114, 193, 104, TR_NOOP ("Modulation")));
+    v.push_back (knob (94, 172, 44, "Mod rate", TR_NOOP ("Rate"), 206, big));
+    v.push_back (knob (180, 172, 34, "Mod amount", TR_NOOP ("Time"), 206));
+    v.push_back (knob (231, 172, 34, "Cutoff mod", TR_NOOP ("Cutoff"), 206));
+
+    v.push_back (section (257, 114, 121, 104, TR_NOOP ("Diffusion")));
+    v.push_back (knob (292, 172, 34, "Diffusion", TR_NOOP ("Level"), 206));
+    v.push_back (knob (343, 172, 34, "Diffusion spread", TR_NOOP ("Spread"), 206));
+
+    v.push_back (section (380, 114, 305, 104, TR_NOOP ("Feedback distortion")));
+    v.push_back (radio (392, 160, 44, 28, "Saturation type", TR_NOOP ("Limit|Sat")));
+    v.push_back (knob (476, 172, 34, "Distortion", TR_NOOP ("Level"), 206));
+    v.push_back (knob (524, 172, 34, "Hardness", TR_NOOP ("Knee"), 206));
+    v.push_back (knob (572, 172, 34, "Symmetry", TR_NOOP ("Symmetry"), 206, bipolar));
+    v.push_back (display (614, 140, 68, 72, "shaper", "Distortion"));
+    return l;
+}
+
+Layout fruityMultiband()
+{
+    // input meter strip, IIR/FIR, limiter, output gain | band graph with the four crossover knobs | LOW, MID and
+    // HIGH bands (A/M/B mode, threshold, ratio, knee, attack, release, gain), each followed by its meters
+    Layout l;
+    l.fl = "Fruity Multiband Compressor";
+    l.width = 805;
+    l.height = 160;
+    auto& v = l.items;
+    v.push_back (display (8, 7, 14, 128, "meter"));
+    v.push_back (radio (34, 7, 40, 26, "Linear phase", "IIR|FIR"));
+    v.push_back (label (26, 44, 48, 13, TR_NOOP ("Limiter")));
+    v.push_back (toggle (40, 58, 20, 14, "Limiter", nullptr));
+    v.push_back (knob (50, 118, 34, "Output gain", TR_NOOP ("Gain"), 144, bipolar));
+    v.push_back (section (79, 7, 200, 142, nullptr, boxed));
+    v.push_back (display (83, 11, 192, 78, "multiband"));
+    v.push_back (label (86, 90, 186, 12, TR_NOOP ("Crossovers"), dim));
+    v.push_back (knob (103, 121, 34, "Low crossover", nullptr, 0, noCaption));
+    v.push_back (knob (153, 121, 34, "Mid lower crossover", nullptr, 0, noCaption));
+    v.push_back (knob (203, 121, 34, "Mid upper crossover", nullptr, 0, noCaption));
+    v.push_back (knob (254, 121, 34, "High crossover", nullptr, 0, noCaption));
+
+    constexpr int bandColours[] = { 0, 2, 5 }; // low / mid / high: the editor's red, yellow and blue band colours
+    v[8].colour = bandColours[0];  // crossover knobs: the band each one bounds from below
+    v[9].colour = bandColours[1];
+    v[10].colour = bandColours[1];
+    v[11].colour = bandColours[2];
+    struct Band { const char* title; const char *mode, *threshold, *ratio, *knee, *attack, *release, *gain; };
+    const Band bands[] = { { TR_NOOP ("Low band"), "Low mode", "Low threshold", "Low ratio", "Low knee", "Low attack", "Low release", "Low gain" },
+                           { TR_NOOP ("Mid band"), "Mid mode", "Mid threshold", "Mid ratio", "Mid knee", "Mid attack", "Mid release", "Mid gain" },
+                           { TR_NOOP ("High band"), "High mode", "High threshold", "High ratio", "High knee", "High attack", "High release", "High gain" } };
+    for (int b = 0; b < 3; ++b)
+    {
+        const auto x = 287.0f + 172.0f * (float) b;
+        const auto& band = bands[b];
+        v.push_back (section (x, 7, 130, 16, nullptr, boxed));
+        v.push_back (tabs (x + 2, 8, 48, 14, band.mode, "A|M|B", { 0.0f, 0.5f, 1.0f }));
+        v.push_back (label (x + 52, 8, 76, 14, band.title));
+        const auto first = v.size();
+        v.push_back (knob (x + 19, 58, 32, band.threshold, TR_NOOP ("Thres"), 84));
+        v.push_back (knob (x + 65, 58, 32, band.ratio, TR_NOOP ("Ratio"), 84));
+        v.push_back (knob (x + 111, 58, 32, band.knee, TR_NOOP ("Knee"), 84));
+        v.push_back (knob (x + 19, 120, 32, band.attack, TR_NOOP ("Att"), 144));
+        v.push_back (knob (x + 65, 120, 32, band.release, TR_NOOP ("Rel"), 144));
+        v.push_back (knob (x + 111, 120, 32, band.gain, TR_NOOP ("Gain"), 144, bipolar));
+        for (auto k = first; k < v.size(); ++k)
+            v[k].colour = bandColours[b];
+        v.push_back (display (x + 140, 7, 24, 128, "meter"));
+    }
+    return l;
+}
+
+Layout reeverb2()
+{
+    Layout l;
+    l.fl = "Fruity Reeverb 2";
+    l.width = 538;
+    l.height = 166;
+    auto& v = l.items;
+    v.push_back (display (2, 2, 160, 160, "room", "Room size"));
+    v.push_back (section (164, 2, 58, 160, nullptr, boxed));
+    v.push_back (radio (176, 20, 44, 28, "Mid/side input", TR_NOOP ("Mid|Side"), { 0.0f, 1.0f }));
+    v.push_back (knob (193, 75, 30, "High cut", TR_NOOP ("H.cut"), 100));
+    v.push_back (knob (193, 126, 30, "Low cut", TR_NOOP ("L.cut"), 151));
+    v.push_back (section (224, 2, 102, 160, nullptr, boxed));
+    v.push_back (knob (251, 23, 30, "Predelay", TR_NOOP ("Delay"), 48));
+    v.push_back (toggle (290, 26, 20, 14, "Tempo predelay", nullptr));
+    v.push_back (label (281, 42, 36, 12, TR_NOOP ("Tempo")));
+    v.push_back (knob (251, 74, 30, "Room size", TR_NOOP ("Size"), 100));
+    v.push_back (knob (297, 74, 30, "Mod depth", TR_NOOP ("Mod"), 100));
+    v.push_back (knob (251, 125, 30, "Diffusion", TR_NOOP ("Diff"), 151));
+    v.push_back (knob (297, 125, 30, "Mod speed", TR_NOOP ("Speed"), 151));
+    v.push_back (section (328, 2, 100, 160, nullptr, boxed));
+    v.push_back (knob (355, 23, 30, "Bass mult.", TR_NOOP ("Bass"), 48));
+    v.push_back (knob (398, 23, 30, "Decay", TR_NOOP ("Dec"), 48));
+    v.push_back (knob (355, 74, 30, "Crossover", TR_NOOP ("Cross"), 100));
+    v.push_back (knob (398, 74, 30, "High damping", TR_NOOP ("Damp"), 100));
+    v.push_back (label (334, 118, 90, 36, "Reeverb 2", dim));
+    v.push_back (section (430, 2, 106, 160, nullptr, boxed));
+    v.push_back (slider (Item::vslider, 440, 6, 20, 98, "Dry", TR_NOOP ("Dry")));
+    v.push_back (slider (Item::vslider, 471, 6, 20, 98, "Early ref.", TR_NOOP ("ER")));
+    v.push_back (slider (Item::vslider, 503, 6, 20, 98, "Wet", TR_NOOP ("Wet")));
+    v.push_back (knob (481, 124, 30, "Stereo sep.", TR_NOOP ("Sep"), 151, bipolar));
+    return l;
+}
+
+Layout luxeVerb()
+{
+    // INPUT | REVERB | PITCH | OUTPUT on top, ENVELOPE and the analyser below; every knob has its value on a plate above
+    Layout l;
+    l.fl = "LuxeVerb";
+    l.width = 947;
+    l.height = 456;
+    auto& v = l.items;
+    const auto tile = [&v] (float cx, float cy, const char* param, const char* caption, float captionY, std::uint16_t style = 0) {
+        v.push_back (knob (cx, cy, 34, param, caption, captionY, style | valueAbove));
+    };
+    const auto fader = [&v] (float cx, const char* param, const char* caption) {
+        v.push_back (value (cx - 19, 46, 38, 13, param, 0));
+        v.push_back (slider (Item::vslider, cx - 12, 62, 24, 145, param, caption));
+    };
+
+    v.push_back (section (8, 14, 116, 200, TR_NOOP ("Input")));
+    fader (37, "Input wet gain", TR_NOOP ("Wet gain"));
+    tile (93, 82, "Input high cut", TR_NOOP ("High cut"), 108);
+    tile (93, 174, "Input low cut", TR_NOOP ("Low cut"), 200);
+
+    v.push_back (section (130, 14, 326, 200, TR_NOOP ("Reverb")));
+    v.push_back (toggle (430, 16, 22, 12, "Reverb", nullptr));
+    v.push_back (value (140, 46, 70, 13, "Decay", 0));
+    v.push_back (knob (174, 125, 62, "Decay", TR_NOOP ("Decay"), 200, big));
+    tile (244, 82, "Brightness", TR_NOOP ("Brightness"), 108);
+    tile (303, 82, "Size", TR_NOOP ("Size"), 108);
+    tile (363, 82, "Diffusion", TR_NOOP ("Diffusion"), 108);
+    tile (422, 82, "Character", TR_NOOP ("Character"), 108);
+    v.push_back (when (knob (244, 174, 34, "Pre-delay", TR_NOOP ("P. delay"), 200, valueAbove), "Pre-delay sync", 0.0f, 0.5f));
+    v.push_back (when (knob (244, 174, 34, "Pre-delay (sync)", TR_NOOP ("P. delay"), 200, valueAbove), "Pre-delay sync", 0.5f, 1.0f));
+    v.push_back (toggle (262, 194, 11, 11, "Pre-delay sync", "T", boxed));
+    tile (303, 174, "Mod amount", TR_NOOP ("Mod amp"), 200);
+    tile (363, 174, "Mod frequency", TR_NOOP ("Mod freq"), 200);
+    v.push_back (radio (397, 130, 56, 54, "Freeze mode", TR_NOOP ("Normal|Freeze|Sustain")));
+    v.push_back (toggle (407, 194, 44, 12, "High quality", TR_NOOP ("HQ")));
+
+    v.push_back (section (462, 14, 238, 200, TR_NOOP ("Pitch")));
+    v.push_back (tabs (530, 16, 120, 14, "Pitch type", TR_NOOP ("Feedback|Feedforward")));
+    v.push_back (toggle (672, 16, 22, 12, "Feedback", nullptr));
+    // feed-forward shifters
+    {
+        const auto ff = [] (LayoutItem i) { return when (std::move (i), "Pitch type", 0.5f, 1.0f); };
+        v.push_back (ff (value (476, 46, 38, 13, "Feed-forward unpitched", 0)));
+        v.push_back (ff (slider (Item::vslider, 483, 62, 24, 145, "Feed-forward unpitched", TR_NOOP ("Direct amp"))));
+        v.push_back (ff (knob (552, 82, 34, "Feed-forward pitch 1", TR_NOOP ("Pitch 1"), 108, valueAbove | bipolar)));
+        v.push_back (ff (knob (607, 82, 34, "Feed-forward amount 1", TR_NOOP ("Amp 1"), 108, valueAbove)));
+        v.push_back (ff (when (knob (664, 82, 34, "Feed-forward delay 1", TR_NOOP ("Delay 1"), 108, valueAbove), "Feed-forward delay 1 sync", 0.0f, 0.5f)));
+        v.push_back (ff (knob (552, 174, 34, "Feed-forward pitch 2", TR_NOOP ("Pitch 2"), 200, valueAbove | bipolar)));
+        v.push_back (ff (knob (607, 174, 34, "Feed-forward amount 2", TR_NOOP ("Amp 2"), 200, valueAbove)));
+        v.push_back (ff (when (knob (664, 174, 34, "Feed-forward delay 2", TR_NOOP ("Delay 2"), 200, valueAbove), "Feed-forward delay 2 sync", 0.0f, 0.5f)));
+        // (the synced delays replace the free ones while T is on)
+        v.push_back (ff (when (knob (664, 82, 34, "Feed-forward delay 1 (sync)", TR_NOOP ("Delay 1"), 108, valueAbove), "Feed-forward delay 1 sync", 0.5f, 1.0f)));
+        v.push_back (ff (when (knob (664, 174, 34, "Feed-forward delay 2 (sync)", TR_NOOP ("Delay 2"), 200, valueAbove), "Feed-forward delay 2 sync", 0.5f, 1.0f)));
+        v.push_back (ff (toggle (683, 102, 11, 11, "Feed-forward delay 1 sync", "T", boxed)));
+        v.push_back (ff (toggle (683, 194, 11, 11, "Feed-forward delay 2 sync", "T", boxed)));
+    }
+    // feedback shifter: cuts, pitch shift and gain faders, delay, reverb mix
+    {
+        const auto fb = [] (LayoutItem i) { return when (std::move (i), "Pitch type", 0.0f, 0.5f); };
+        v.push_back (fb (knob (496, 82, 34, "Feedback high cut", TR_NOOP ("High cut"), 108, valueAbove)));
+        v.push_back (fb (knob (496, 174, 34, "Feedback low cut", TR_NOOP ("Low cut"), 200, valueAbove)));
+        v.push_back (fb (value (534, 46, 38, 13, "Feedback pitch", 0)));
+        v.push_back (fb (slider (Item::vslider, 541, 62, 24, 145, "Feedback pitch", TR_NOOP ("Pitch shift"), bipolar)));
+        v.push_back (fb (value (589, 46, 38, 13, "Feedback gain", 0)));
+        v.push_back (fb (slider (Item::vslider, 596, 62, 24, 145, "Feedback gain", TR_NOOP ("Gain"))));
+        v.push_back (fb (when (knob (665, 82, 34, "Feedback delay", TR_NOOP ("Delay"), 108, valueAbove), "Feedback delay sync", 0.0f, 0.5f)));
+        v.push_back (fb (when (knob (665, 82, 34, "Feedback delay (sync)", TR_NOOP ("Delay"), 108, valueAbove), "Feedback delay sync", 0.5f, 1.0f)));
+        v.push_back (fb (toggle (683, 102, 11, 11, "Feedback delay sync", "T", boxed)));
+        v.push_back (fb (knob (665, 174, 34, "Feedback reverb mix", TR_NOOP ("Reverb mix"), 200, valueAbove)));
+    }
+
+    v.push_back (section (706, 14, 234, 200, TR_NOOP ("Output")));
+    fader (736, "Dry level", TR_NOOP ("Dry"));
+    fader (791, "Wet level", TR_NOOP ("Wet"));
+    v.push_back (toggle (802, 194, 11, 11, "Limiter", "L", boxed));
+    tile (847, 82, "Peak frequency", TR_NOOP ("Peak freq"), 108);
+    tile (907, 82, "Peak gain", TR_NOOP ("Peak gain"), 108, bipolar);
+    tile (847, 174, "Peak Q", TR_NOOP ("Peak Q"), 200);
+    tile (907, 174, "Stereo width", TR_NOOP ("Width"), 200);
+
+    v.push_back (section (8, 236, 932, 216, TR_NOOP ("Envelope")));
+    v.push_back (radio (16, 278, 48, 54, "Envelope mode", TR_NOOP ("Off|Wet|Decay")));
+    tile (93, 309, "Envelope threshold", TR_NOOP ("Threshold"), 335);
+    tile (150, 309, "Envelope scale", TR_NOOP ("Scale"), 335, bipolar);
+    tile (207, 309, "Envelope low cut", TR_NOOP ("Low cut"), 335);
+    tile (264, 309, "Envelope offset", TR_NOOP ("Offset"), 335, bipolar);
+    v.push_back (stepper (20, 380, 32, 34, "Envelope sidechain", TR_NOOP ("Sidechain"), 0));
+    tile (93, 399, "Envelope attack", TR_NOOP ("Attack"), 425);
+    tile (150, 399, "Envelope decay", TR_NOOP ("Decay"), 425);
+    tile (207, 399, "Envelope smoothing", TR_NOOP ("Smooth"), 425);
+    v.push_back (display (298, 262, 636, 184, "envelope", "Decay"));
+    return l;
+}
+
+Layout parametricEq2()
+{
+    // the response curve (octave and band-name rows above, frequencies below, dB scale at its right), the output
+    // fader, then one column per band: type button, gain fader, FREQ and BW knobs
+    Layout l;
+    l.fl = "Fruity Parametric EQ 2";
+    l.width = 707;
+    l.height = 356;
+    auto& v = l.items;
+    v.push_back (display (8, 4, 524, 292, "eq"));
+    v.push_back (slider (Item::vslider, 532, 22, 16, 270, "Output", nullptr, noCaption | bipolar));
+    v.push_back (label (510, 310, 38, 12, TR_NOOP ("Freq"), dim));
+    v.push_back (label (510, 334, 38, 12, TR_NOOP ("BW"), dim));
+    static const char* const names[peq::bands][5] = {
+        { "B1 type", "B1 freq.", "B1 gain", "B1 Q", "B1 slope" }, { "B2 type", "B2 freq.", "B2 gain", "B2 Q", "B2 slope" },
+        { "B3 type", "B3 freq.", "B3 gain", "B3 Q", "B3 slope" }, { "B4 type", "B4 freq.", "B4 gain", "B4 Q", "B4 slope" },
+        { "B5 type", "B5 freq.", "B5 gain", "B5 Q", "B5 slope" }, { "B6 type", "B6 freq.", "B6 gain", "B6 Q", "B6 slope" },
+        { "B7 type", "B7 freq.", "B7 gain", "B7 Q", "B7 slope" } };
+    std::vector<float> typeValues;
+    for (int t = 0; t < peq::bandTypes; ++t)
+        typeValues.push_back (peq::typeValue ((peq::BandType) t));
+    for (int b = 0; b < peq::bands; ++b)
+    {
+        const auto x = 552.0f + 21.0f * (float) b;
+        LayoutItem type;
+        type.type = Item::menu;
+        type.x = x, type.y = 4, type.w = 16, type.h = 24;
+        type.param = names[b][0];
+        type.options = TR_NOOP ("Off|Peak|Low shelf|High shelf|Low cut|High cut|Band-pass|Notch");
+        type.values = typeValues;
+        type.colour = b;
+        v.push_back (type);
+        auto gain = slider (Item::vslider, x, 30, 16, 262, names[b][2], nullptr, noCaption | bipolar);
+        gain.colour = b;
+        v.push_back (gain);
+        auto freq = knob (x + 8, 316, 19, names[b][1], nullptr, 0, noCaption);
+        freq.colour = b;
+        v.push_back (freq);
+        auto width = knob (x + 8, 340, 19, names[b][3], nullptr, 0, noCaption);
+        width.colour = b;
+        v.push_back (width);
+    }
+    v.push_back (display (8, 300, 492, 52, "eqinfo"));
+    for (int b = 0; b < peq::bands; ++b)
+        l.editedElsewhere.push_back (names[b][4]); // the band menu (right-click a handle or the type button)
+    return l;
+}
+
+Layout grossBeat()
+{
+    // left: the time panel (mix knob), HOLD, the time slots, the volume slots, ATT / REL / TNS, the volume panel; right:
+    // the envelope of the selected slots and the slot's settings under it
+    Layout l;
+    l.fl = "Gross Beat";
+    l.width = 840;
+    l.height = 563;
+    auto& v = l.items;
+    static const std::string slots = [] {
+        std::string out;
+        for (int i = 1; i <= 36; ++i)
+            out += (i > 1 ? "|" : "") + std::string ("Slot ") + std::to_string (i);
+        return out;
+    }();
+    v.push_back (section (0, 0, 268, 563, nullptr, boxed));
+    v.push_back (section (6, 7, 128, 46, nullptr, boxed | raised));
+    v.push_back (knob (31, 30, 40, "Time mix", nullptr, 0, noCaption));
+    v.push_back (label (56, 20, 70, 20, TR_NOOP ("Time"), alignLeft));
+    v.push_back (display (189, 12, 72, 72, "gbjog"));
+    v.push_back (toggle (113, 62, 62, 28, "Hold", TR_NOOP ("Hold"), boxed));
+    auto timeSlots = radio (13, 103, 246, 162, "Time slot", slots.c_str());
+    timeSlots.columns = 4;
+    v.push_back (timeSlots);
+    auto volumeSlots = radio (13, 276, 246, 162, "Volume slot", slots.c_str());
+    volumeSlots.columns = 4;
+    volumeSlots.colour = 1;
+    v.push_back (volumeSlots);
+    v.push_back (knob (80, 467, 38, "Attack", TR_NOOP ("Att"), 492));
+    v.push_back (knob (130, 467, 38, "Release", TR_NOOP ("Rel"), 492));
+    v.push_back (knob (186, 467, 38, "Tension", TR_NOOP ("Tns"), 492, bipolar));
+    v.push_back (section (6, 509, 128, 46, nullptr, boxed | raised));
+    v.push_back (knob (31, 531, 40, "Volume mix", nullptr, 0, noCaption));
+    v.push_back (label (56, 521, 70, 20, TR_NOOP ("Volume"), alignLeft));
+    v.push_back (display (272, 4, 556, 530, "grossbeat"));
+    v.push_back (display (272, 537, 556, 22, "gbinfo"));
+    return l;
+}
+
+Layout reeverb1()
+{
+    auto l = fruityGrid ("Fruity Reeverb", 5, 2);
+    auto& v = l.items;
+    fruityCell (v, 0, 0, "Low cut", TR_NOOP ("Lowcut"));
+    fruityCell (v, 1, 0, "High cut", TR_NOOP ("Highcut"));
+    fruityCell (v, 0, 1, "Predelay", TR_NOOP ("Predelay"));
+    fruityCell (v, 1, 1, "Room size", TR_NOOP ("Room size"));
+    fruityCell (v, 0, 2, "Diffusion", TR_NOOP ("Diffusion"));
+    fruityCell (v, 1, 2, "Color", TR_NOOP ("Color"));
+    fruityCell (v, 0, 3, "Decay", TR_NOOP ("Decay"));
+    fruityCell (v, 1, 3, "High damping", TR_NOOP ("High damping"));
+    fruityCell (v, 0, 4, "Dry", TR_NOOP ("Dry"));
+    fruityCell (v, 1, 4, "Wet", TR_NOOP ("Reverb"));
+    return l;
+}
+
+Layout fruityFlangus()
+{
+    // the order bar, then seven tall faders in their columns
+    Layout l;
+    l.fl = "Fruity Flangus";
+    l.width = 366;
+    l.height = 176;
+    auto& v = l.items;
+    auto order = slider (Item::vslider, 8, 75, 31, 76, "Order", nullptr, noCaption);
+    order.steps = 8;
+    v.push_back (order);
+    v.push_back (label (2, 158, 44, 16, TR_NOOP ("Ord")));
+    static const char* const params[] = { "Depth", "Speed", "Delay", "Spread", "Cross", "Dry", "Wet" };
+    static const char* const captions[] = { TR_NOOP ("Depth"), TR_NOOP ("Spd"), TR_NOOP ("Del"), TR_NOOP ("Sprd"), TR_NOOP ("Cross"),
+                                            TR_NOOP ("Dry"), TR_NOOP ("Wet") };
+    for (int i = 0; i < 7; ++i)
+    {
+        const auto x = 43.0f + 46.0f * (float) i;
+        v.push_back (section (x, 9, 40, 142, nullptr, boxed));
+        v.push_back (slider (Item::vslider, x + 6, 14, 28, 132, params[i], nullptr, noCaption));
+        v.push_back (label (x - 4, 158, 48, 16, captions[i]));
+    }
+    return l;
+}
+
+Layout fruitySoftClipper()
+{
+    // THRES and POST, the plugin's name plate, the output meter strip and the transfer curve
+    Layout l;
+    l.fl = "Fruity Soft Clipper";
+    l.width = 274;
+    l.height = 133;
+    auto& v = l.items;
+    v.push_back (section (0, 0, 116, 133, nullptr, boxed));
+    v.push_back (knob (37, 55, 36, "Threshold", TR_NOOP ("Thres"), 88));
+    v.push_back (knob (89, 55, 36, "Post", TR_NOOP ("Post"), 88));
+    v.push_back (label (6, 102, 104, 24, TR_NOOP ("Soft clipper"), boxed));
+    v.push_back (display (118, 3, 24, 127, "meter"));
+    v.push_back (display (144, 3, 130, 127, "softclip", "Threshold"));
+    return l;
+}
+
+Layout fruityBloodOverdrive()
+{
+    // PRE BAND and COLOR | the big PRE AMP with its x100 switch | POST FILTER and POST GAIN; captions on plates
+    Layout l;
+    l.fl = "Fruity Blood Overdrive";
+    l.width = 428;
+    l.height = 186;
+    auto& v = l.items;
+    v.push_back (section (0, 0, 133, 186, nullptr, boxed));
+    v.push_back (section (135, 0, 158, 186, nullptr, boxed | raised));
+    v.push_back (section (295, 0, 133, 186, nullptr, boxed));
+    v.push_back (knob (69, 37, 52, "Pre band", nullptr, 0, noCaption));
+    v.push_back (label (30, 69, 78, 15, TR_NOOP ("Pre band"), boxed));
+    v.push_back (knob (69, 124, 52, "Color", nullptr, 0, noCaption | bipolar));
+    v.push_back (label (30, 157, 78, 15, TR_NOOP ("Color"), boxed));
+    v.push_back (knob (209, 86, 96, "Pre amp", nullptr, 0, noCaption | big));
+    v.push_back (label (174, 157, 66, 15, TR_NOOP ("Pre amp"), boxed));
+    v.push_back (toggle (244, 157, 44, 15, "x100", "x100"));
+    v.push_back (knob (362, 36, 52, "Post filter", nullptr, 0, noCaption));
+    v.push_back (label (323, 68, 78, 15, TR_NOOP ("Post filter"), boxed));
+    v.push_back (knob (362, 124, 52, "Post gain", nullptr, 0, noCaption));
+    v.push_back (label (323, 157, 78, 15, TR_NOOP ("Post gain"), boxed));
+    return l;
+}
+
+Layout fruityPanOMatic()
+{
+    // PAN and VOL; the LFO (shape buttons, amount, speed, off / pan / volume target); the pan / volume pad
+    Layout l;
+    l.fl = "Fruity PanOMatic";
+    l.width = 307;
+    l.height = 166;
+    auto& v = l.items;
+    v.push_back (section (0, 0, 144, 166, nullptr, boxed));
+    v.push_back (knob (34, 32, 30, "Pan", TR_NOOP ("Pan"), 53, bipolar));
+    v.push_back (knob (77, 32, 30, "Volume", TR_NOOP ("Vol"), 53));
+    v.push_back (section (0, 66, 144, 100, nullptr, boxed | raised));
+    v.push_back (label (4, 70, 40, 20, TR_NOOP ("LFO"), alignLeft));
+    auto shapes = radio (60, 80, 78, 24, "LFO shape", TR_NOOP ("Sine|Triangle|Square"));
+    shapes.columns = 3;
+    v.push_back (shapes);
+    v.push_back (knob (34, 124, 30, "LFO amount", TR_NOOP ("Amt"), 150, bipolar));
+    v.push_back (knob (77, 124, 30, "LFO speed", TR_NOOP ("Spd"), 150));
+    v.push_back (radio (101, 112, 40, 40, "LFO target", TR_NOOP ("Off|Pan|Vol")));
+    v.push_back (display (146, 3, 158, 160, "panpad"));
+    return l;
+}
+
+Layout stereoShaper()
+{
+    // MIXER MATRIX: the four faders (R→L, left, right, L→R) with the LEFT / RIGHT sums under them; EFFECTS: pre / post,
+    // DELAY and PHASE; the in / out difference switch
+    Layout l;
+    l.fl = "Fruity Stereo Shaper";
+    l.width = 276;
+    l.height = 316;
+    auto& v = l.items;
+    v.push_back (label (6, 0, 110, 24, TR_NOOP ("Mixer matrix"), alignLeft));
+    v.push_back (label (190, 0, 80, 24, TR_NOOP ("Effects")));
+    v.push_back (section (20, 30, 160, 270, nullptr, boxed));
+    static const char* const faders[] = { "R > L", "Left", "Right", "L > R" };
+    for (int i = 0; i < 4; ++i)
+        v.push_back (slider (Item::vslider, 31.0f + 39.0f * (float) i, 64, 20, 216, faders[i], nullptr, noCaption | bipolar));
+    v.push_back (label (30, 286, 60, 14, TR_NOOP ("Left")));
+    v.push_back (label (108, 286, 60, 14, TR_NOOP ("Right")));
+    v.push_back (radio (190, 44, 84, 26, "Effects post", TR_NOOP ("Pre|Post")));
+    v.push_back (knob (233, 129, 50, "Delay", TR_NOOP ("Delay"), 164, bipolar));
+    v.push_back (knob (233, 221, 50, "Phase", TR_NOOP ("Phase"), 257, bipolar));
+    v.push_back (label (178, 280, 60, 26, TR_NOOP ("In/out difference"), alignLeft));
+    v.push_back (toggle (238, 284, 34, 18, "Difference", TR_NOOP ("On"), boxed));
+    return l;
+}
+
+Layout transientProcessor()
+{
+    // IN meter | SPLIT FREQ; ATTACK panel (knob, shape); DRIVE, SPLIT BALANCE; RELEASE panel (knob, shape); GAIN | OUT
+    // meter; on / off; the gain view under it
+    Layout l;
+    l.fl = "Transient Processor";
+    l.width = 553;
+    l.height = 325;
+    auto& v = l.items;
+    v.push_back (display (2, 3, 30, 172, "meter"));
+    v.push_back (display (518, 3, 32, 172, "meter"));
+    v.push_back (section (34, 3, 482, 172, nullptr, boxed));
+    v.push_back (label (150, 6, 250, 20, "Transient Processor", dim));
+    v.push_back (knob (80, 52, 40, "Split freq.", TR_NOOP ("Split freq."), 86));
+    v.push_back (section (126, 27, 110, 148, nullptr, boxed | raised));
+    v.push_back (knob (181, 72, 66, "Attack", TR_NOOP ("Attack"), 129, big | bipolar));
+    v.push_back (slider (Item::hslider, 156, 143, 50, 22, "Attack shape", nullptr, noCaption | bipolar));
+    v.push_back (knob (279, 52, 40, "Drive", TR_NOOP ("Drive"), 86));
+    v.push_back (knob (279, 140, 40, "Split balance", TR_NOOP ("Split balance"), 168, bipolar));
+    v.push_back (section (322, 27, 110, 148, nullptr, boxed | raised));
+    v.push_back (knob (377, 72, 66, "Release", TR_NOOP ("Release"), 129, big | bipolar));
+    v.push_back (slider (Item::hslider, 352, 143, 50, 22, "Release shape", nullptr, noCaption | bipolar));
+    v.push_back (knob (469, 52, 40, "Gain", TR_NOOP ("Gain"), 86, bipolar));
+    v.push_back (radio (40, 146, 44, 28, "On", TR_NOOP ("Off|On")));
+    v.push_back (display (8, 180, 542, 142, "envelope", "Release"));
+    return l;
+}
+
+Layout fruityFreeFilter()
+{
+    auto l = fruityGrid ("Fruity Free Filter", 2, 3);
+    l.width = 418;
+    auto& v = l.items;
+    fruityCell (v, 0, 0, "Type", TR_NOOP ("Type"));
+    fruityCell (v, 1, 0, "Frequency", TR_NOOP ("Freq"));
+    fruityHalfCell (v, 2, 0, 0, "Center", TR_NOOP ("Center"));
+    fruityCell (v, 0, 1, "Q", TR_NOOP ("Q"), Cell::slider);
+    fruityCell (v, 1, 1, "Gain", TR_NOOP ("Gain"));
+    v.push_back (display (340, 60, 70, 40, "filter"));
+    return l;
+}
+
+Layout fruityWaveShaper()
+{
+    // the shaping curve; the plugin's name, unipolar / bipolar, PRE, MIX, POST; smooth, oversample, HQ, center
+    Layout l;
+    l.fl = "Fruity WaveShaper";
+    l.width = 277;
+    l.height = 358;
+    auto& v = l.items;
+    v.push_back (display (8, 3, 258, 234, "waveshaper"));
+    v.push_back (section (0, 254, 277, 104, nullptr, boxed));
+    v.push_back (label (4, 262, 62, 40, "WaveShaper", dim));
+    v.push_back (radio (72, 266, 46, 34, "Unipolar", TR_NOOP ("Bipolar|Unipolar")));
+    v.push_back (knob (165, 279, 30, "Pre amp", TR_NOOP ("Pre"), 302));
+    v.push_back (knob (210, 279, 30, "Mix", TR_NOOP ("Mix"), 302));
+    v.push_back (knob (253, 279, 30, "Post gain", TR_NOOP ("Post"), 302));
+    v.push_back (toggle (150, 312, 34, 14, "Smooth", TR_NOOP ("Smooth")));
+    v.push_back (toggle (150, 332, 34, 14, "HQ", TR_NOOP ("HQ")));
+    v.push_back (toggle (190, 332, 60, 14, "Center", TR_NOOP ("Center")));
+    v.push_back (label (188, 312, 60, 14, TR_NOOP ("Oversample"), alignLeft));
+    v.push_back (stepper (250, 310, 24, 18, "Oversampling", nullptr, 4));
+    return l;
+}
+
+Layout vintageChorus()
+{
+    // MODE (I / II / edit) | DELAYS (time 1, time 2, feedback, high-pass faders) | MODULATION (start phase, wave,
+    // L/R phase, tempo sync, speed fader) | LEVELS (mono input, invert wet, noise gate, noise, gain, mix fader)
+    Layout l;
+    l.fl = "Vintage Chorus";
+    l.width = 754;
+    l.height = 214;
+    auto& v = l.items;
+    v.push_back (label (420, 2, 326, 36, "Vintage Chorus", dim));
+    v.push_back (section (14, 47, 173, 160, TR_NOOP ("Mode")));
+    v.push_back (tabs (28, 90, 146, 64, "Mode", TR_NOOP ("I|II|Edit")));
+    v.push_back (section (190, 47, 174, 160, TR_NOOP ("Delays")));
+    static const char* const delays[] = { "Delay time 1", "Delay time 2", "Feedback", "Wet HP freq" };
+    static const char* const delayCaptions[] = { "1", "2", TR_NOOP ("Feedback"), TR_NOOP ("H.pass") };
+    for (int i = 0; i < 4; ++i)
+    {
+        const auto x = i < 2 ? 210.0f + 33.0f * (float) i : 282.0f + 39.0f * (float) (i - 2);
+        v.push_back (slider (Item::vslider, x, 70, 20, 112, delays[i], nullptr, noCaption));
+        v.push_back (label (x - 14, 183, 48, 12, delayCaptions[i]));
+    }
+    v.push_back (label (214, 195, 48, 10, TR_NOOP ("Time"), dim));
+    v.push_back (section (367, 47, 195, 160, TR_NOOP ("Modulation")));
+    v.push_back (knob (401, 96, 30, "LFO start phase", TR_NOOP ("Start phase"), 127));
+    v.push_back (radio (444, 82, 40, 34, "LFO wave", TR_NOOP ("Triangle|Sine")));
+    v.push_back (knob (401, 158, 30, "LFO L/R phase", TR_NOOP ("L/R phase"), 189));
+    v.push_back (toggle (436, 160, 70, 14, "LFO sync", TR_NOOP ("Tempo sync")));
+    v.push_back (slider (Item::vslider, 516, 70, 20, 124, "LFO speed", TR_NOOP ("Speed")));
+    v.push_back (section (565, 47, 177, 160, TR_NOOP ("Levels")));
+    v.push_back (toggle (574, 118, 76, 14, "Mono input", TR_NOOP ("Mono input")));
+    v.push_back (toggle (574, 140, 76, 14, "Wet polarity", TR_NOOP ("Invert wet")));
+    v.push_back (toggle (574, 162, 76, 14, "Noise gate", TR_NOOP ("Noise gate")));
+    v.push_back (knob (663, 96, 30, "Hiss", TR_NOOP ("Noise"), 127));
+    v.push_back (knob (663, 158, 30, "Gain", TR_NOOP ("Gain"), 189));
+    v.push_back (slider (Item::vslider, 698, 70, 20, 124, "Wet/dry mix", TR_NOOP ("Mix")));
+    l.menuSwitches = { "Link Chorus 1&2" };
+    return l;
+}
+
+Layout hyperChorus()
+{
+    // three movement pads and the voices' view on top, one row of knobs under them
+    Layout l;
+    l.fl = "Hyper Chorus";
+    l.width = 754;
+    l.height = 214;
+    auto& v = l.items;
+    v.push_back (label (500, 2, 246, 32, "Hyper Chorus", dim));
+    v.push_back (display (27, 38, 100, 102, "xy", "Delay", "Feedback"));
+    v.push_back (display (157, 38, 100, 102, "xy", "Mod amount", "Mod rate"));
+    v.push_back (display (288, 38, 100, 102, "xy", "Movement", "Movement speed"));
+    v.push_back (display (420, 38, 300, 102, "voices"));
+    v.push_back (section (2, 146, 750, 66, nullptr, boxed | raised));
+    struct K { float x; const char* param; const char* caption; };
+    const K knobs[] = { { 44, "Delay", TR_NOOP ("Delay") }, { 108, "Feedback", TR_NOOP ("Feedback") }, { 175, "Mod amount", TR_NOOP ("Modulation") },
+                        { 239, "Mod rate", TR_NOOP ("Mod rate") }, { 304, "Movement", TR_NOOP ("Movement") },
+                        { 369, "Movement speed", TR_NOOP ("Move rate") }, { 514, "High pass", TR_NOOP ("High pass") },
+                        { 569, "Low pass", TR_NOOP ("Low pass") }, { 644, "LFO phase difference", TR_NOOP ("LFO phase dif") },
+                        { 710, "Dry/wet", TR_NOOP ("Mix") } };
+    for (const auto& k : knobs)
+        v.push_back (knob (k.x, 171, 32, k.param, k.caption, 202));
+    v.push_back (toggle (436, 162, 30, 18, "ArachnaChor mode", nullptr));
+    v.push_back (label (420, 196, 60, 12, TR_NOOP ("Delay lines")));
+    return l;
+}
+
+Layout fruityBalance()
+{
+    // Balance and Volume knobs (captions above, values under them) around the level meter
+    Layout l;
+    l.fl = "Fruity Balance";
+    l.width = 232;
+    l.height = 150;
+    auto& v = l.items;
+    v.push_back (section (0, 0, 232, 150, nullptr, boxed));
+    v.push_back (label (8, 18, 80, 20, TR_NOOP ("Balance")));
+    v.push_back (knob (48, 77, 46, "Balance", nullptr, 0, noCaption | bipolar));
+    v.push_back (value (8, 112, 80, 20, "Balance", 0));
+    v.push_back (display (90, 16, 40, 118, "meter"));
+    v.push_back (label (130, 18, 80, 20, TR_NOOP ("Volume")));
+    v.push_back (knob (170, 77, 46, "Volume", nullptr, 0, noCaption));
+    v.push_back (value (130, 112, 80, 20, "Volume", 0));
+    return l;
+}
+
+Layout fruitySqueeze()
+{
+    // SQUARIZE (amount), PUNCHER (preserve, impact, relation, amount) on plates; FILTER (on, type, freq, res, pre / post);
+    // MIX and GAIN faders
+    Layout l;
+    l.fl = "Fruity Squeeze";
+    l.width = 282;
+    l.height = 223;
+    auto& v = l.items;
+    v.push_back (section (2, 2, 105, 52, nullptr, boxed));
+    v.push_back (label (10, 6, 90, 16, TR_NOOP ("Squarize"), alignLeft));
+    const auto row = [&v] (float y, const char* param, const char* caption) {
+        v.push_back (label (13, y - 9, 60, 17, caption, boxed));
+        v.push_back (knob (87, y, 24, param, nullptr, 0, noCaption));
+    };
+    row (39, "Steps", TR_NOOP ("Amount"));
+    v.push_back (section (2, 58, 105, 162, nullptr, boxed));
+    v.push_back (label (10, 62, 90, 16, TR_NOOP ("Puncher"), alignLeft));
+    row (100, "Preserve", TR_NOOP ("Preserve"));
+    row (133, "Impact", TR_NOOP ("Impact"));
+    row (165, "Relation", TR_NOOP ("Relation"));
+    row (198, "Amount", TR_NOOP ("Amount"));
+    v.push_back (section (110, 2, 100, 164, nullptr, boxed));
+    v.push_back (toggle (116, 6, 90, 16, "Filter", TR_NOOP ("Filter")));
+    v.push_back (section (116, 30, 88, 19, nullptr, boxed | raised));
+    v.push_back (value (116, 30, 88, 19, "Filter type", 0));
+    v.push_back (label (116, 66, 40, 14, TR_NOOP ("Freq.")));
+    v.push_back (knob (136, 102, 34, "Cutoff", nullptr, 0, noCaption));
+    v.push_back (label (162, 66, 40, 14, TR_NOOP ("Res.")));
+    v.push_back (knob (182, 102, 34, "Resonance", nullptr, 0, noCaption));
+    v.push_back (tabs (117, 137, 88, 18, "Filter post", TR_NOOP ("Pre|Pos")));
+    v.push_back (section (213, 2, 67, 164, nullptr, boxed));
+    v.push_back (slider (Item::vslider, 219, 12, 20, 148, "Mix", TR_NOOP ("Mix")));
+    v.push_back (slider (Item::vslider, 251, 12, 20, 148, "Volume", TR_NOOP ("Gain")));
+    v.push_back (label (112, 170, 168, 48, "Fruity Squeeze", dim));
+    return l;
+}
+
+Layout fruityDelay2()
+{
+    // INPUT (pan, volume) | FEEDBACK (normal / invert / ping-pong, volume, cutoff) | TIME (time, offset) | DRY (volume)
+    Layout l;
+    l.fl = "Fruity Delay 2";
+    l.width = 404;
+    l.height = 102;
+    auto& v = l.items;
+    v.push_back (section (2, 2, 99, 74, TR_NOOP ("Input")));
+    v.push_back (knob (28, 45, 33, "Input pan", TR_NOOP ("Pan"), 68, bipolar));
+    v.push_back (knob (73, 45, 33, "Input volume", TR_NOOP ("Vol"), 68));
+    v.push_back (section (103, 2, 148, 74, TR_NOOP ("Feedback")));
+    v.push_back (radio (109, 24, 52, 46, "Mode", TR_NOOP ("Normal|Invert|P.pong")));
+    v.push_back (knob (183, 45, 33, "Feedback", TR_NOOP ("Vol"), 68));
+    v.push_back (knob (223, 45, 33, "Cutoff", TR_NOOP ("Cut"), 68));
+    v.push_back (section (253, 2, 97, 74, TR_NOOP ("Time")));
+    v.push_back (knob (279, 45, 33, "Time", TR_NOOP ("Time"), 68));
+    v.push_back (knob (325, 45, 33, "Stereo offset", TR_NOOP ("Ofs"), 68, bipolar));
+    v.push_back (section (352, 2, 50, 74, TR_NOOP ("Dry")));
+    v.push_back (knob (378, 45, 33, "Dry", TR_NOOP ("Vol"), 68));
+    v.push_back (label (104, 78, 296, 22, "Fruity Delay 2", dim));
+    return l;
+}
+
+// --- generators (the channel's plugin page): items name the knobs of ChannelSettings' model panel ------------
+
+Layout threeOsc()
+{
+    // three oscillator rows: shape buttons (sine, square, rounded, custom / triangle, saw, noise) and the invert switch,
+    // PHASE OFS and DETUNE faders, COARSE, FINE, pan and (oscillators 2 and 3) volume; AM OSC 3, HQ and PHASE RAND below
+    Layout l;
+    l.fl = "3x Osc";
+    l.width = 560;
+    l.height = 390;
+    auto& v = l.items;
+    v.push_back (section (0, 0, 560, 310, nullptr, boxed));
+    static const char* const names[3][7] = { { "Osc 1 shape", "Osc 1 phase", "Osc 1 detune", "Osc 1 coarse", "Osc 1 fine", "Osc 1 pan", nullptr },
+                                             { "Osc 2 shape", "Osc 2 phase", "Osc 2 detune", "Osc 2 coarse", "Osc 2 fine", "Osc 2 pan", "Osc 2 mix" },
+                                             { "Osc 3 shape", "Osc 3 phase", "Osc 3 detune", "Osc 3 coarse", "Osc 3 fine", "Osc 3 pan", "Osc 3 mix" } };
+    static const char* const inverts[3] = { "Invert 1", "Invert 2", "Invert 3" };
+    static const char* const numbers[3] = { "1", "2", "3" };
+    for (int o = 0; o < 3; ++o)
+    {
+        const auto dy = 107.5f * (float) o;
+        const auto captions = o < 2; // FL writes the captions between the rows
+        v.push_back (label (2, 20 + dy, 30, 36, numbers[o], dim));
+        // shape buttons in FL's order; the values are the engine's shapes 0…6 over 0..1
+        auto shape = radio (37, 9 + dy, 152, 76, names[o][0], "Sine|Square|Rounded|Custom|Triangle|Saw|Noise",
+                            { 0.0f, 2.0f / 6.0f, 4.0f / 6.0f, 1.0f, 1.0f / 6.0f, 3.0f / 6.0f, 5.0f / 6.0f });
+        shape.columns = 4;
+        v.push_back (shape);
+        v.push_back (toggle (153, 52 + dy, 32, 28, inverts[o], "+/-", boxed));
+        v.push_back (slider (Item::vslider, 222, 6 + dy, 20, 82, names[o][1], nullptr, noCaption | bipolar));
+        v.push_back (slider (Item::vslider, 252, 6 + dy, 20, 82, names[o][2], nullptr, noCaption | bipolar));
+        if (captions)
+        {
+            v.push_back (label (190, 95 + dy, 58, 14, TR_NOOP ("Phase ofs"), dim));
+            v.push_back (label (250, 95 + dy, 40, 14, TR_NOOP ("Detune"), dim));
+        }
+        v.push_back (knob (338, 48 + dy, 46, names[o][3], captions ? TR_NOOP ("Coarse") : nullptr, 102 + dy, captions ? 0 : noCaption));
+        v.push_back (knob (401, 48 + dy, 34, names[o][4], captions ? TR_NOOP ("Fine") : nullptr, 102 + dy, captions ? 0 : noCaption));
+        v.push_back (knob (465, 48 + dy, 34, names[o][5], captions ? TR_NOOP ("Pan") : nullptr, 102 + dy, bipolar | (captions ? 0 : noCaption)));
+        if (names[o][6] != nullptr)
+            v.push_back (knob (523, 48 + dy, 46, names[o][6], o == 1 ? TR_NOOP ("Vol") : nullptr, 102 + dy, o == 1 ? 0 : noCaption));
+    }
+    v.push_back (section (0, 312, 560, 78, nullptr, boxed | raised));
+    v.push_back (toggle (14, 342, 72, 16, "Osc 3 AM", TR_NOOP ("AM osc 3")));
+    v.push_back (toggle (94, 342, 44, 16, "HQ", TR_NOOP ("HQ")));
+    v.push_back (knob (165, 350, 44, "Phase rand", nullptr, 0, noCaption));
+    v.push_back (label (192, 342, 80, 16, TR_NOOP ("Phase rand"), alignLeft));
+    v.push_back (label (380, 326, 170, 50, "3x Osc", dim));
+    return l;
+}
+
+Layout flKeys()
+{
+    // ENVIRONMENT, MISC, VELOCITY and TUNING over two rows of knobs; the sample set's name at the top right
+    Layout l;
+    l.fl = "FL Keys";
+    l.width = 480;
+    l.height = 186;
+    auto& v = l.items;
+    v.push_back (label (8, 2, 200, 34, "FL Keys", dim | alignLeft));
+    v.push_back (display (333, 9, 141, 18, "flkeysname"));
+    v.push_back (section (12, 37, 110, 145, TR_NOOP ("Environment")));
+    v.push_back (section (132, 37, 111, 145, TR_NOOP ("Misc")));
+    v.push_back (section (253, 37, 159, 145, TR_NOOP ("Velocity")));
+    v.push_back (section (422, 37, 52, 145, TR_NOOP ("Tuning")));
+    v.push_back (knob (37, 87, 34, "Decay", TR_NOOP ("Decay"), 110, bipolar));
+    v.push_back (knob (95, 87, 34, "Release", TR_NOOP ("Release"), 110, bipolar));
+    v.push_back (knob (37, 149, 34, "Pan/Trem", TR_NOOP ("Pan"), 172, bipolar));
+    v.push_back (knob (95, 149, 34, "Stereo", TR_NOOP ("Stereo"), 172));
+    v.push_back (knob (158, 87, 34, "Overdrive", TR_NOOP ("Overdrive"), 110));
+    v.push_back (knob (216, 87, 34, "LFO rate", TR_NOOP ("LFO"), 110));
+    v.push_back (knob (158, 149, 34, "Treble", TR_NOOP ("Treble"), 172, bipolar));
+    v.push_back (knob (216, 149, 34, "Stretch", TR_NOOP ("Stretch"), 172, bipolar));
+    v.push_back (knob (278, 87, 34, "Vel > Muffle", TR_NOOP ("Vel"), 110));
+    v.push_back (knob (336, 87, 34, "Muffle", TR_NOOP ("Muffle"), 110));
+    v.push_back (knob (278, 149, 34, "Vel > Hard", TR_NOOP ("Vel"), 172, bipolar));
+    v.push_back (knob (336, 149, 34, "Hardness", TR_NOOP ("Hardness"), 172, bipolar));
+    v.push_back (knob (394, 149, 34, "Vel sens", TR_NOOP ("Sens"), 172, bipolar));
+    v.push_back (knob (447, 87, 34, "Tune", TR_NOOP ("Tune"), 110, bipolar));
+    v.push_back (knob (447, 149, 34, "Detune", TR_NOOP ("Detune"), 172));
+    return l;
+}
+
+Layout booBass()
+{
+    // BASS, MID and TREBLE stepping down along the instrument's body
+    Layout l;
+    l.fl = "BooBass";
+    l.width = 343;
+    l.height = 154;
+    auto& v = l.items;
+    v.push_back (label (180, 0, 160, 34, "BooBass", dim));
+    v.push_back (section (40, 36, 300, 116, nullptr, boxed));
+    v.push_back (knob (79, 74, 40, "Bass", TR_NOOP ("Bass"), 107));
+    v.push_back (knob (151, 92, 40, "Mid", TR_NOOP ("Mid"), 128));
+    v.push_back (knob (222, 102, 40, "Treble", TR_NOOP ("Treble"), 138));
+    return l;
+}
+
+Layout sytrusMain()
+{
+    // Sytrus' MAIN page: master faders, volume and filter envelopes, unison, the modulation X/Y pad, quality and porta.
+    // The operator, filter and effect pages and the FM / RM matrix keep the saved patch (not editable in LYNX).
+    Layout l;
+    l.fl = "Sytrus";
+    l.width = 850;
+    l.height = 346;
+    auto& v = l.items;
+    v.push_back (label (8, 4, 80, 22, TR_NOOP ("Main"), boxed));
+    const auto fader = [&v] (float cx, const char* param, const char* caption, bool bipolarFader) {
+        v.push_back (slider (Item::vslider, cx - 9, 54, 18, 70, param, nullptr, noCaption | (bipolarFader ? bipolar : 0)));
+        v.push_back (label (cx - 16, 38, 32, 13, caption));
+    };
+    v.push_back (section (12, 34, 136, 98, nullptr, boxed));
+    fader (38, "Master level", TR_NOOP ("Vol"), false);
+    fader (81, "Master LFO", TR_NOOP ("LFO"), true);
+    fader (124, "Master pitch", TR_NOOP ("Pitch"), true);
+    v.push_back (section (152, 34, 98, 98, nullptr, boxed));
+    fader (165, "Vol attack", "A", false);
+    fader (189, "Vol decay", "D", false);
+    fader (213, "Vol sustain", "S", true);
+    fader (237, "Vol release", "R", false);
+    v.push_back (label (156, 122, 80, 10, TR_NOOP ("Vol"), dim | alignLeft));
+    v.push_back (section (256, 34, 98, 98, nullptr, boxed));
+    fader (269, "Flt attack", "A", false);
+    fader (293, "Flt decay", "D", false);
+    fader (317, "Flt sustain", "S", true);
+    fader (341, "Flt release", "R", false);
+    v.push_back (label (260, 122, 80, 10, TR_NOOP ("Filter"), dim | alignLeft));
+    v.push_back (section (360, 34, 180, 98, nullptr, boxed));
+    v.push_back (stepper (366, 38, 30, 34, "Unison", TR_NOOP ("Ord"), 8));
+    fader (410, "Uni pan", TR_NOOP ("Pn"), false);
+    fader (434, "Uni volume", TR_NOOP ("Vl"), false);
+    fader (458, "Uni pitch", TR_NOOP ("Pt"), false);
+    fader (481, "Uni sub", TR_NOOP ("Sb"), false);
+    fader (504, "Uni phase", TR_NOOP ("Ph"), false);
+    fader (527, "Uni env var", TR_NOOP ("En"), false);
+    v.push_back (label (470, 122, 66, 10, TR_NOOP ("Unison"), dim));
+    v.push_back (section (12, 138, 168, 160, TR_NOOP ("Modulation")));
+    v.push_back (display (18, 160, 128, 130, "xy", "Mod X", "Mod Y"));
+    v.push_back (knob (164, 185, 24, "Mod X", "X", 205));
+    v.push_back (knob (164, 232, 24, "Mod Y", "Y", 252));
+    v.push_back (section (362, 138, 178, 86, TR_NOOP ("Quality")));
+    v.push_back (label (462, 156, 34, 12, TR_NOOP ("Draft")));
+    v.push_back (label (500, 156, 34, 12, TR_NOOP ("Render")));
+    v.push_back (label (368, 174, 92, 16, TR_NOOP ("HQ envelopes"), alignLeft));
+    v.push_back (toggle (470, 175, 16, 14, "Live env accuracy", nullptr));
+    v.push_back (toggle (508, 175, 16, 14, "Export env accuracy", nullptr));
+    v.push_back (label (368, 198, 92, 16, TR_NOOP ("Oversampling"), alignLeft));
+    v.push_back (stepper (462, 196, 32, 22, "Live oversampling", nullptr, 4));
+    v.push_back (stepper (500, 196, 32, 22, "Export oversampling", nullptr, 4));
+    v.push_back (toggle (450, 270, 70, 16, "Porta", TR_NOOP ("Porta")));
+    v.push_back (section (553, 34, 294, 260, nullptr, boxed));
+    v.push_back (label (560, 150, 280, 16, TR_NOOP ("Operators, filters, effects and the matrix"), dim));
+    v.push_back (label (560, 168, 280, 16, TR_NOOP ("keep the saved patch"), dim));
+    v.push_back (label (560, 300, 286, 40, "Sytrus", dim));
+    return l;
+}
+
+Layout harmorMain()
+{
+    // Harmor's part page and global section, with the controls LYNX edits at FL's places (timbre mix, blur, tremolo,
+    // harmonizer, unison order and detune, vibrato, filter cutoff and resonance, pluck, phaser, part volume, A/B
+    // crossfade and the global volume); the rest of the panel keeps the saved patch
+    Layout l;
+    l.fl = "Harmor";
+    l.width = 1000;
+    l.height = 600;
+    auto& v = l.items;
+    v.push_back (section (12, 0, 976, 330, nullptr, boxed));
+    const auto title = [&v] (float x, float y, const char* text) { v.push_back (label (x, y, 110, 18, text, alignLeft)); };
+    title (100, 70, TR_NOOP ("Timbre"));
+    title (18, 104, TR_NOOP ("Blur"));
+    title (228, 104, TR_NOOP ("Trem"));
+    title (60, 180, TR_NOOP ("Prism"));
+    title (210, 180, TR_NOOP ("Harmonizer"));
+    title (380, 160, TR_NOOP ("Unison"));
+    title (40, 278, TR_NOOP ("Pitch"));
+    title (270, 270, TR_NOOP ("Vibrato"));
+    title (400, 270, TR_NOOP ("Legato"));
+    title (555, 238, TR_NOOP ("Pluck"));
+    title (655, 238, TR_NOOP ("Phaser"));
+    title (900, 238, TR_NOOP ("EQ"));
+    title (555, 20, TR_NOOP ("Filter 1"));
+    v.push_back (knob (177, 40, 30, "Timbre mix", TR_NOOP ("Mix"), 63));
+    v.push_back (knob (61, 135, 30, "Harm. blur", TR_NOOP ("Mix"), 160));
+    v.push_back (knob (277, 135, 30, "Tremolo", TR_NOOP ("Depth"), 160));
+    v.push_back (knob (181, 219, 34, "Harmonizer", TR_NOOP ("Amt"), 247));
+    v.push_back (stepper (414, 196, 30, 22, "Unison", TR_NOOP ("Order"), 8));
+    v.push_back (slider (Item::vslider, 476, 182, 18, 80, "Uni detune", TR_NOOP ("Pitch")));
+    v.push_back (knob (335, 291, 28, "Vibrato", TR_NOOP ("Depth"), 312));
+    v.push_back (slider (Item::vslider, 455, 40, 18, 100, "A volume", TR_NOOP ("Vol"), bipolar));
+    v.push_back (knob (725, 71, 44, "Cutoff", TR_NOOP ("Freq"), 106));
+    v.push_back (knob (828, 71, 34, "Resonance", TR_NOOP ("Res"), 106));
+    v.push_back (knob (587, 283, 40, "Pluck", TR_NOOP ("Time"), 313));
+    v.push_back (knob (686, 283, 34, "Phaser mix", TR_NOOP ("Mix"), 313));
+    v.push_back (section (12, 334, 380, 266, nullptr, boxed));
+    title (22, 342, TR_NOOP ("Global"));
+    v.push_back (slider (Item::vslider, 172, 410, 20, 110, "Master vol", TR_NOOP ("Vol")));
+    v.push_back (slider (Item::hslider, 280, 368, 90, 26, "A/B mix", TR_NOOP ("Part A / B")));
+    v.push_back (section (396, 334, 592, 266, nullptr, boxed));
+    v.push_back (label (420, 450, 540, 16, TR_NOOP ("The other Harmor controls keep the saved patch"), dim));
+    v.push_back (label (820, 556, 160, 40, "Harmor", dim));
+    return l;
+}
+
+Layout maximus()
+{
+    // FL Studio 2026 Maximus (measured on its window, body origin under the wrapper title): the selected band's
+    // compression curve at the top-left and the bands view across the rest of the top; under them the band selector
+    // (LOW / MID / HIGH / MASTER), the band's mode switch, PRE / POST gain, stereo separation, THRES / CEIL saturation
+    // inset, the envelope (ATT, REL, SUSTAIN, the two CURVE steppers, PEAK / RMS, REL 2); LMH DEL / LMH MIX; the
+    // crossover (LOW / HIGH frequency, 12 / 24 dB slopes) and LOW CUT. The values live in the slot's Maximus state
+    // (core/MaximusFx.h stateParams: "Low mode", "Master pre gain", ...).
+    Layout l;
+    l.fl = "Maximus";
+    l.width = 633;
+    l.height = 391;
+    l.pages = { TR_NOOP ("Low"), TR_NOOP ("Mid"), TR_NOOP ("High"), TR_NOOP ("Master") };
+    auto& v = l.items;
+    v.push_back (display (8, 4, 181, 181, "maxcurve"));
+    v.push_back (display (192, 4, 433, 181, "maxbands"));
+    v.push_back (section (2, 205, 248, 183, nullptr, boxed));
+    v.push_back (section (252, 205, 176, 183, nullptr, boxed));
+    v.push_back (section (430, 205, 67, 183, nullptr, boxed));
+    v.push_back (section (499, 205, 132, 183, nullptr, boxed));
+    auto bandSelector = pageTabs (4, 209, 70, 99, TR_NOOP ("Low|Mid|High|Master"));
+    v.push_back (bandSelector);
+    v.push_back (section (142, 294, 106, 74, nullptr, boxed | raised));
+
+    static const char* bandNames[4] { "Low", "Mid", "High", "Master" };
+    static std::vector<std::string> names; // "<Band> <control>" (core/MaximusFx.h), kept for the items' pointers
+    if (names.empty())
+    {
+        static const char* controls[13] { "mode", "pre gain", "post gain", "stereo separation", "saturation threshold",
+                                          "saturation ceiling", "attack", "release 2", "attack curve", "release",
+                                          "release curve", "sustain", "envelope mode" };
+        names.reserve (52);
+        for (const auto* b : bandNames)
+            for (const auto* c : controls)
+                names.push_back (std::string (b) + " " + c);
+    }
+    for (int b = 0; b < 4; ++b)
+    {
+        auto n = [&] (int j) { return names[(std::size_t) (13 * b + j)].c_str(); };
+        auto add = [&] (LayoutItem i) { i.colour = b; v.push_back (onPage (std::move (i), b)); };
+        add (radio (81, 216, 64, 60, n (0), TR_NOOP ("On|Comp off|Muted|Off")));
+        add (knob (169.5f, 243, 42, n (1), TR_NOOP ("Pre"), 272));
+        add (knob (223, 243, 42, n (2), TR_NOOP ("Post"), 272));
+        add (label (185, 266, 24, 13, TR_NOOP ("Gain"), boxed));
+        add (knob (105.5f, 323, 38, n (3), TR_NOOP ("Sep"), 349, bipolar));
+        add (knob (168.5f, 322, 36, n (4), TR_NOOP ("Thres"), 349, bipolar));
+        add (knob (223, 322, 36, n (5), TR_NOOP ("Ceil"), 349));
+        add (label (186, 343, 22, 13, TR_NOOP ("Sat"), boxed));
+        add (knob (280.5f, 243, 42, n (6), TR_NOOP ("Att"), 272));
+        add (knob (343.5f, 243, 42, n (9), TR_NOOP ("Rel"), 272));
+        add (knob (395.5f, 243, 42, n (11), TR_NOOP ("Sustain"), 272));
+        add (label (300, 266, 24, 13, TR_NOOP ("Env"), boxed));
+        add (stepper (268, 292, 27, 22, n (8), nullptr, 7));
+        add (label (296, 297, 34, 13, TR_NOOP ("Curve")));
+        add (stepper (331, 292, 27, 22, n (10), nullptr, 7));
+        add (radio (368, 292, 46, 30, n (12), TR_NOOP ("Peak|RMS")));
+        add (knob (281, 353, 34, n (7), TR_NOOP ("Rel 2"), 377));
+    }
+    v.push_back (knob (463, 243, 42, "LMH lookahead delay", TR_NOOP ("LMH del"), 272));
+    v.push_back (knob (463, 323, 42, "LMH mix", TR_NOOP ("LMH mix"), 349));
+    v.push_back (knob (534, 243, 42, "Low band frequency", TR_NOOP ("Low"), 272));
+    v.push_back (knob (593, 243, 42, "High band frequency", TR_NOOP ("High"), 272));
+    v.push_back (label (551, 266, 25, 13, TR_NOOP ("Freq"), boxed));
+    v.push_back (radio (503, 292, 42, 28, "Low band slope", "12dB|24dB"));
+    v.push_back (radio (584, 292, 42, 28, "High band slope", "12dB|24dB"));
+    v.push_back (knob (538, 349, 34, "Low cut", TR_NOOP ("Low cut"), 377));
+    return l;
+}
+
+Layout vintagePhaser()
+{
+    // PHASING (MIN, MAX faders, HQ, MANUAL, FEEDBACK fader) | MODULATION (START PHASE, TYPE switch, L/R PHASE,
+    // TENSION, SPEED fader with T) | DELAY (on LED; MIX, STEREO, big TIME with T; FEEDBACK, LP, HP, KEEP PITCH) |
+    // LEVELS (NOISE, NOISE GATE, MONO INPUT, MIX fader). The engine's remaining controls (FL keeps them out of the
+    // panel; where FL shows them is not confirmed) are on a second page.
+    Layout l;
+    l.fl = "Vintage Phaser";
+    l.width = 754;
+    l.height = 214;
+    l.pages = { TR_NOOP ("Main"), TR_NOOP ("Advanced") };
+    auto& v = l.items;
+    v.push_back (pageTabs (13, 14, 120, 20, TR_NOOP ("Main|Advanced")));
+    v.push_back (label (420, 6, 326, 34, "Vintage Phaser", dim));
+    auto main = [&] (LayoutItem i) { v.push_back (onPage (std::move (i), 0)); };
+    auto fader = [&] (float x, const char* param, const char* caption) {
+        main (slider (Item::vslider, x - 10, 72, 20, 104, param, nullptr, noCaption));
+        main (label (x - 24, 180, 48, 12, caption));
+    };
+    main (section (13, 45, 162, 165, TR_NOOP ("Phasing")));
+    fader (38, "Min freq.", TR_NOOP ("Min"));
+    fader (71, "Max freq.", TR_NOOP ("Max"));
+    main (toggle (95, 132, 20, 12, "HQ", nullptr));
+    main (label (88, 146, 34, 11, TR_NOOP ("HQ")));
+    main (toggle (95, 164, 20, 12, "Manual", nullptr));
+    main (label (82, 180, 46, 12, TR_NOOP ("Manual")));
+    fader (143, "Feedback", TR_NOOP ("Feedback"));
+
+    main (section (181, 45, 209, 165, TR_NOOP ("Modulation")));
+    main (knob (220, 92, 30, "Start phase", TR_NOOP ("Start phase"), 124));
+    main (radio (256, 76, 52, 30, "Sine", TR_NOOP ("Triangle|Sine")));
+    main (label (252, 112, 50, 12, TR_NOOP ("Type")));
+    main (knob (220, 157, 30, "L/R phase", TR_NOOP ("L/R phase"), 186));
+    main (knob (281, 157, 30, "Tension", TR_NOOP ("Tension"), 186));
+    fader (348, "LFO speed", TR_NOOP ("Speed"));
+    main (toggle (364, 180, 14, 12, "Tempo sync", "T", boxed));
+
+    main (section (396, 45, 217, 165, TR_NOOP ("Delay")));
+    main (toggle (582, 49, 20, 10, "Delay", nullptr));
+    main (knob (428, 92, 30, "Delay mix", TR_NOOP ("Mix"), 124));
+    main (knob (472, 92, 30, "Delay stereo", TR_NOOP ("Stereo"), 124, bipolar));
+    main (knob (548, 100, 44, "Delay time", TR_NOOP ("Time"), 136, big));
+    main (toggle (576, 130, 14, 12, "Delay sync", "T", boxed));
+    main (knob (428, 157, 30, "Delay fdbk", TR_NOOP ("Feedback"), 186));
+    main (knob (472, 157, 30, "Delay LP", TR_NOOP ("LP"), 186));
+    main (knob (527, 157, 30, "Delay HP", TR_NOOP ("HP"), 186));
+    main (toggle (562, 164, 20, 12, "Keep pitch", nullptr));
+    main (label (550, 180, 56, 12, TR_NOOP ("Keep pitch")));
+
+    main (section (619, 45, 119, 165, TR_NOOP ("Levels")));
+    main (knob (654, 90, 28, "Noise", TR_NOOP ("Noise"), 120));
+    main (toggle (644, 134, 20, 12, "Gate", nullptr));
+    main (label (626, 148, 56, 11, TR_NOOP ("Noise gate")));
+    main (toggle (644, 164, 20, 12, "Mono input", nullptr));
+    main (label (626, 180, 56, 12, TR_NOOP ("Mono input")));
+    fader (708, "Mix", TR_NOOP ("Mix"));
+
+    // second page: the engine's other controls
+    auto adv = [&] (int k, const char* param, const char* caption, std::uint16_t style = 0) {
+        const auto cx = 50.0f + 92.0f * (float) (k % 8), cy = 82.0f + 70.0f * (float) (k / 8);
+        v.push_back (onPage (knob (cx, cy, 34, param, caption, cy + 26, style | showValue), 1));
+    };
+    v.push_back (onPage (section (13, 45, 725, 165, nullptr, boxed), 1));
+    adv (0, "Manual freq.", TR_NOOP ("Manual freq."));
+    adv (1, "Rate 1", TR_NOOP ("Rate 1"));
+    adv (2, "Rate 2", TR_NOOP ("Rate 2"));
+    adv (3, "Depth scale", TR_NOOP ("Depth scale"));
+    adv (4, "Pull-down", TR_NOOP ("Pull-down"));
+    adv (5, "Drive", TR_NOOP ("Drive"), bipolar);
+    adv (6, "Colour gain", TR_NOOP ("Colour gain"));
+    adv (7, "Colour freq.", TR_NOOP ("Colour freq."));
+    adv (8, "Input HP", TR_NOOP ("Input HP"));
+    adv (9, "Fdbk HP", TR_NOOP ("Feedback HP"));
+    v.push_back (onPage (toggle (230, 140, 110, 14, "Engine V2", TR_NOOP ("Engine V2")), 1));
+    v.push_back (onPage (toggle (230, 166, 110, 14, "Invert fdbk", TR_NOOP ("Invert feedback")), 1));
+    return l;
+}
+
+Layout soundgoodizer()
+{
+    // one big Amount knob and the four presets A–D (the slot's state, core/MaximusFx.h)
+    Layout l;
+    l.fl = "Soundgoodizer";
+    l.width = 215;
+    l.height = 300;
+    auto& v = l.items;
+    v.push_back (label (10, 6, 195, 36, "Soundgoodizer", dim));
+    v.push_back (display (28, 64, 152, 152, "sgamount"));
+    v.push_back (display (14, 228, 186, 50, "sgpresets"));
+    return l;
+}
+
+// --- generated layouts ------------------------------------------------------------------------------
+
+Layout generated (EffectKind kind)
+{
+    // knobs in rows of up to 6 (FL's wrapper shows unknown plugins as a list of knobs too)
+    const auto& info = effectInfo (kind);
+    Layout l;
+    const auto count = (int) info.params.size();
+    const auto columns = count <= 4 ? std::max (1, count) : count <= 12 ? 6 : 8;
+    const auto rows = (count + columns - 1) / columns;
+    constexpr float cellW = 74.0f, cellH = 84.0f;
+    l.width = (int) (columns * cellW + 12.0f);
+    l.height = (int) std::max (60.0f, (float) rows * cellH + 12.0f);
+
+    if (count > 0)
+        l.items.push_back (section (4, 4, (float) l.width - 8.0f, (float) l.height - 8.0f, nullptr, boxed));
+    for (int i = 0; i < count; ++i)
+    {
+        const auto cx = 6.0f + cellW * ((float) (i % columns) + 0.5f);
+        const auto cy = 6.0f + cellH * (float) (i / columns) + 26.0f;
+        l.items.push_back (knob (cx, cy, 36, info.params[(std::size_t) i].name, info.params[(std::size_t) i].name, cy + 30.0f, showValue));
+    }
+    if (count == 0)
+        l.items.push_back (display (6, 6, (float) l.width - 12.0f, (float) l.height - 12.0f, "name"));
+    return l;
+}
+} // namespace
+
+const std::vector<EffectKind>& flLayoutKinds()
+{
+    static const std::vector<EffectKind> kinds { EffectKind::fruityLimiter, EffectKind::fruityDelay3, EffectKind::fruityMultiband,
+                                                 EffectKind::reeverb2, EffectKind::luxeVerb, EffectKind::fruityCompressor,
+                                                 EffectKind::fruityFilter, EffectKind::fruityFastDist, EffectKind::fruityChorus,
+                                                 EffectKind::fruityFlanger, EffectKind::stereoEnhancer, EffectKind::parametricEq,
+                                                 EffectKind::grossBeat, EffectKind::fruityDelay2, EffectKind::reeverb1,
+                                                 EffectKind::fruityFlangus, EffectKind::fruitySoftClipper,
+                                                 EffectKind::fruityBloodOverdrive, EffectKind::fruityPanOMatic, EffectKind::stereoShaper,
+                                                 EffectKind::transientProcessor, EffectKind::fruityFreeFilter, EffectKind::fruityWaveShaper,
+                                                 EffectKind::vintageChorus, EffectKind::hyperChorus, EffectKind::fruityBalance,
+                                                 EffectKind::squeeze, EffectKind::maximus,
+                                                 EffectKind::vintagePhaser };
+    return kinds;
+}
+
+const Layout& layoutFor (EffectKind kind)
+{
+    static std::mutex lock;
+    static std::map<EffectKind, Layout> cache;
+    const std::lock_guard<std::mutex> guard (lock);
+
+    if (auto it = cache.find (kind); it != cache.end())
+        return it->second;
+
+    Layout l;
+    switch (kind)
+    {
+        case EffectKind::fruityLimiter: l = fruityLimiter(); break;
+        case EffectKind::fruityCompressor: l = fruityCompressor(); break;
+        case EffectKind::fruityFilter: l = fruityFilter(); break;
+        case EffectKind::fruityChorus: l = fruityChorus(); break;
+        case EffectKind::fruityFlanger: l = fruityFlanger(); break;
+        case EffectKind::fruityFastDist: l = fruityFastDist(); break;
+        case EffectKind::stereoEnhancer: l = stereoEnhancer(); break;
+        case EffectKind::fruityDelay3: l = fruityDelay3(); break;
+        case EffectKind::fruityMultiband: l = fruityMultiband(); break;
+        case EffectKind::reeverb2: l = reeverb2(); break;
+        case EffectKind::luxeVerb: l = luxeVerb(); break;
+        case EffectKind::parametricEq: l = parametricEq2(); break;
+        case EffectKind::grossBeat: l = grossBeat(); break;
+        case EffectKind::fruityDelay2: l = fruityDelay2(); break;
+        case EffectKind::reeverb1: l = reeverb1(); break;
+        case EffectKind::fruityFlangus: l = fruityFlangus(); break;
+        case EffectKind::fruitySoftClipper: l = fruitySoftClipper(); break;
+        case EffectKind::fruityBloodOverdrive: l = fruityBloodOverdrive(); break;
+        case EffectKind::fruityPanOMatic: l = fruityPanOMatic(); break;
+        case EffectKind::stereoShaper: l = stereoShaper(); break;
+        case EffectKind::transientProcessor: l = transientProcessor(); break;
+        case EffectKind::fruityFreeFilter: l = fruityFreeFilter(); break;
+        case EffectKind::fruityWaveShaper: l = fruityWaveShaper(); break;
+        case EffectKind::vintageChorus: l = vintageChorus(); break;
+        case EffectKind::hyperChorus: l = hyperChorus(); break;
+        case EffectKind::fruityBalance: l = fruityBalance(); break;
+        case EffectKind::squeeze: l = fruitySqueeze(); break;
+        case EffectKind::maximus: l = maximus(); break;
+        case EffectKind::vintagePhaser: l = vintagePhaser(); break;
+        default: l = generated (kind); break;
+    }
+    return cache.emplace (kind, std::move (l)).first->second;
+}
+
+const Layout* instrumentLayout (InstrumentKind kind)
+{
+    static const Layout osc = threeOsc(), keys = flKeys(), boo = booBass(), sytrus = sytrusMain(), harmor = harmorMain();
+    switch (kind)
+    {
+        case InstrumentKind::threeosc: return &osc;
+        case InstrumentKind::flkeys: return &keys;
+        case InstrumentKind::boobass: return &boo;
+        case InstrumentKind::sytrus: return &sytrus;
+        case InstrumentKind::harmor: return &harmor;
+        default: return nullptr;
+    }
+}
+
+const std::vector<InstrumentKind>& instrumentLayoutKinds()
+{
+    static const std::vector<InstrumentKind> kinds { InstrumentKind::threeosc, InstrumentKind::flkeys, InstrumentKind::boobass, InstrumentKind::sytrus, InstrumentKind::harmor };
+    return kinds;
+}
+
+const Layout& soundgoodizerLayout()
+{
+    static const Layout l = soundgoodizer();
+    return l;
+}
+
+bool hasFlLayout (EffectKind kind)
+{
+    return *layoutFor (kind).fl != 0;
+}
+
+bool usesStateParams (EffectKind kind) noexcept
+{
+    return kind == EffectKind::maximus;
+}
+
+int paramCount (EffectKind kind)
+{
+    return usesStateParams (kind) ? (int) maximusfx::stateParams().size() : (int) effectInfo (kind).params.size();
+}
+
+const char* paramName (EffectKind kind, int index)
+{
+    if (index < 0 || index >= paramCount (kind))
+        return "";
+    return usesStateParams (kind) ? maximusfx::stateParams()[(std::size_t) index].name : effectInfo (kind).params[(std::size_t) index].name;
+}
+
+int paramIndex (EffectKind kind, const char* name)
+{
+    if (name == nullptr)
+        return -1;
+    if (usesStateParams (kind))
+        return maximusfx::stateParamIndex (name);
+    const auto& params = effectInfo (kind).params;
+    for (int i = 0; i < (int) params.size(); ++i)
+        if (std::strcmp (params[(std::size_t) i].name, name) == 0)
+            return i;
+    return -1;
+}
+
+std::vector<std::string> optionLabels (const LayoutItem& item)
+{
+    std::vector<std::string> out;
+    if (item.options == nullptr)
+        return out;
+    std::string current;
+    for (const char* p = item.options; *p != 0; ++p)
+    {
+        if (*p == '|')
+        {
+            out.push_back (current);
+            current.clear();
+        }
+        else
+            current += *p;
+    }
+    out.push_back (current);
+    return out;
+}
+
+float optionValue (const LayoutItem& item, int option)
+{
+    if (option >= 0 && option < (int) item.values.size())
+        return item.values[(std::size_t) option];
+    const auto n = (int) optionLabels (item).size();
+    return n > 1 ? (float) option / (float) (n - 1) : 0.0f;
+}
+
+int optionAt (const LayoutItem& item, float value)
+{
+    const auto n = (int) optionLabels (item).size();
+    auto best = 0;
+    auto distance = 2.0f;
+    for (int o = 0; o < n; ++o)
+        if (const auto d = std::abs (optionValue (item, o) - value); d < distance)
+        {
+            distance = d;
+            best = o;
+        }
+    return best;
+}
+
+bool isShown (EffectKind kind, const LayoutItem& item, int page, const EffectParams& params)
+{
+    if (item.page >= 0 && item.page != page)
+        return false;
+    const auto inRange = [&] (const char* param, float lo, float hi) {
+        if (param == nullptr)
+            return true;
+        const auto i = paramIndex (kind, param);
+        const auto v = i >= 0 && i < (int) params.size() ? params[(std::size_t) i] : 0.0f;
+        return v >= lo && (v < hi || hi >= 1.0f); // [lo, hi), the top end included at 1
+    };
+    return inRange (item.whenParam, item.whenMin, item.whenMax) && inRange (item.when2Param, item.when2Min, item.when2Max);
+}
+
+bool isValueControl (Item type) noexcept
+{
+    return type != Item::section && type != Item::label && type != Item::display;
+}
+} // namespace lynx::plugui

+ 117 - 0
src/core/PluginLayout.h

@@ -0,0 +1,117 @@
+#pragma once
+
+// Layouts of LYNX's native plugin editors (no JUCE: the data is tested in tests/tests.cpp).
+//
+// Each native plugin that is compatible with an FL Studio plugin gets an editor window with the same
+// controls, sections, labels and arrangement as that plugin, so FL users find everything where they
+// expect it; the drawing is LYNX's own (src/ui/PluginEditors.cpp). The positions below were measured on
+// the FL Studio 2026 windows (docs/analise/UI_STUDY_plugins93.md): one design unit = one pixel of FL's
+// window at 100 % zoom, body only (FL's wrapper title bar excluded). The editor scales them.
+//
+// Value controls name the effect parameter they edit (EffectInfo::params[].name of their EffectKind), so a
+// layout never depends on parameter indices.
+
+#include <string>
+#include <vector>
+
+#include "core/Song.h"
+
+namespace lynx::plugui
+{
+enum class Item : std::uint8_t
+{
+    section,  // a titled panel (FL's grey header strip with a caps title); `label` = title ("" = no header)
+    label,    // static caption text
+    knob,     // rotary control; caption under it (`label`)
+    hslider,  // horizontal slider (thin track, thumb)
+    vslider,  // vertical fader
+    radio,    // a column of options with LEDs (`options` = "A|B|C"); option i sets the value `values[i]`
+    tabs,     // a row of segmented buttons (`options`), like radio but horizontal
+    toggle,   // an on/off switch with a caption (value 0 / 1)
+    stepper,  // a number box with small up/down arrows (drag, wheel or click the arrows)
+    display,  // a custom graph drawn by the editor (`display` names it)
+    value,    // the parameter's value as text (FL's read-outs next to a knob)
+    menu,     // a button that opens a list of choices (`options` / `values`), showing the current one's mark
+};
+
+// style flags
+enum : std::uint16_t
+{
+    bipolar = 1 << 0,     // knob arc grows from the centre
+    showValue = 1 << 1,   // the value is written under the caption (FL's compressor style)
+    valueAbove = 1 << 2,  // the value sits in a small box above the knob (FL's LuxeVerb style)
+    big = 1 << 3,         // a big knob (main control of a section)
+    noCaption = 1 << 4,   // no caption (FL draws none, or the section title names it)
+    captionLeft = 1 << 5, // caption at the left of a slider instead of under it
+    dim = 1 << 6,         // secondary caption colour (FL's greyed labels)
+    pageTabs = 1 << 7,    // tabs that switch the editor's page instead of editing a parameter
+    boxed = 1 << 8,       // label: drawn as a header box (FL's caption plates); section: a plain cell without a title strip
+    alignLeft = 1 << 9,   // value / label text aligned left
+    raised = 1 << 10,     // section: a lighter inset panel inside another one
+};
+
+struct LayoutItem
+{
+    Item type = Item::label;
+    float x = 0, y = 0, w = 0, h = 0;  // design units
+    const char* param = nullptr;       // value controls: the parameter's EffectInfo name
+    const char* label = nullptr;       // caption / title (English; translated by the editor)
+    const char* options = nullptr;     // radio / tabs: "|"-separated captions
+    std::vector<float> values {};      // radio / tabs: the value of each option (empty = i / (n − 1))
+    std::uint16_t style = 0;
+    int page = -1;                     // only shown on this page (−1 = always)
+    const char* display = nullptr;     // display: which graph ("limiter", "compressor", "eq", ...)
+    int steps = 0;                     // discrete values: number of steps over 0..1 (stepper, stepped knobs)
+    const char* whenParam = nullptr;   // only shown while this parameter is within [whenMin, whenMax) (1 included)
+    float whenMin = 0.0f, whenMax = 1.0f;
+    const char* when2Param = nullptr;  // a second condition
+    float when2Min = 0.0f, when2Max = 1.0f;
+    int colour = -1;                   // ≥ 0: one of the editor's band colours (EQ bands, multiband bands)
+    int columns = 0;                   // radio: options in a grid of this many columns (0 = one column)
+    const char* param2 = nullptr;      // display "xy": the parameter on the vertical axis (`param` is the horizontal one)
+};
+
+struct Layout
+{
+    const char* fl = "";   // the FL Studio plugin it follows ("" = a generated layout)
+    int width = 0, height = 0;
+    std::vector<LayoutItem> items;
+    std::vector<const char*> pages {}; // page names when the plugin has pages (tabs with `pageTabs`)
+    std::vector<const char*> menuSwitches {}; // on / off parameters FL keeps in a menu: listed in the options menu
+    std::vector<const char*> editedElsewhere {}; // parameters edited from another control's menu (EQ band slopes)
+};
+
+// The editor layout of an effect: FL's arrangement for the plugins studied so far, otherwise a generated grid
+// of knobs (sections of up to 6) so that every native effect gets a window.
+const Layout& layoutFor (EffectKind kind);
+bool hasFlLayout (EffectKind kind);
+
+// The kinds that have an FL arrangement (in the order of docs/analise/UI_STUDY_plugins93.md).
+const std::vector<EffectKind>& flLayoutKinds();
+
+// Generators: FL's arrangement of the channel's plugin page (nullptr = the plain grid of knobs). Value items name
+// the knobs of the channel settings' model panel (their juce::Slider names); values are 0..1 over the knob's range.
+const Layout* instrumentLayout (InstrumentKind kind);
+const std::vector<InstrumentKind>& instrumentLayoutKinds();
+
+// Soundgoodizer slots (EffectKind::maximus with the Soundgoodizer build): its own page, edited in the slot's state.
+const Layout& soundgoodizerLayout();
+
+// Parameter index of `name` in effectInfo(kind) (−1 = no such parameter). For kinds whose controls live in the slot's
+// state (usesStateParams: Maximus), the index of core/MaximusFx.h's stateParams instead.
+int paramIndex (EffectKind kind, const char* name);
+bool usesStateParams (EffectKind kind) noexcept;
+int paramCount (EffectKind kind);
+const char* paramName (EffectKind kind, int index);
+
+// Options of a radio / tabs item and the value each one sets.
+std::vector<std::string> optionLabels (const LayoutItem& item);
+float optionValue (const LayoutItem& item, int option);
+// The option whose value is closest to `value`.
+int optionAt (const LayoutItem& item, float value);
+
+bool isValueControl (Item type) noexcept;
+
+// Is the item shown on `page` with these parameter values? (pages and the conditions on other parameters)
+bool isShown (EffectKind kind, const LayoutItem& item, int page, const EffectParams& params);
+} // namespace lynx::plugui

+ 350 - 1
src/ui/ChannelSettings.cpp

@@ -28,6 +28,7 @@
 #include "core/Slayer.h"
 #include "core/SytrusEngine.h"
 #include "core/SynthPresets.h"
+#include "core/PluginLayout.h"
 #include "engine/Text.h"
 #include "ui/I18n.h"
 #include "ui/Theme.h"
@@ -1074,13 +1075,349 @@ public:
                 add (index, name);
         const auto rows = ((int) knobs.size() + 6) / 7; // the grid of resized()
         setSize (720, std::max (dx10 || threeOsc ? 500 : 384, 46 + rows * 110 + 8));
+
+        // FL's arrangement of the plugin's page (core/PluginLayout.cpp): the knobs at FL's places, faders and
+        // switches drawn by the panel
+        layout = plugui::instrumentLayout (def.instrument);
+        // a state the engine cannot read gives no knobs: keep the plain page then
+        if (layout != nullptr && std::none_of (knobs.begin(), knobs.end(), [this] (const auto& k) { return itemFor (k->getName()) != nullptr; }))
+            layout = nullptr;
+        if (layout != nullptr)
+        {
+            for (auto& k : knobs)
+            {
+                const auto* item = itemFor (k->getName());
+                if (item == nullptr || (item->type != plugui::Item::knob && item->type != plugui::Item::vslider && item->type != plugui::Item::hslider))
+                {
+                    k->setVisible (false); // edited by a switch of the panel (or not shown by FL)
+                    continue;
+                }
+                k->setTextBoxStyle (juce::Slider::NoTextBox, false, 0, 0);
+                if (item->type == plugui::Item::vslider)
+                    k->setSliderStyle (juce::Slider::LinearVertical);
+                if (item->type == plugui::Item::hslider)
+                    k->setSliderStyle (juce::Slider::LinearHorizontal);
+                k->setPopupDisplayEnabled (true, true, this);
+                k->setTooltip (k->getName());
+            }
+            // FL's size × 1.25, at most about 1200 × 760 (big pages such as Harmor's fit a laptop screen)
+            const auto f = juce::jmin (layoutScale, 1200.0f / (float) layout->width, 720.0f / (float) layout->height);
+            setSize ((int) std::ceil (f * (float) layout->width) + 16, (int) std::ceil (f * (float) layout->height) + layoutTop + 8);
+        }
+    }
+
+    // --- FL's arrangement ------------------------------------------------------------------------------
+
+    static constexpr float layoutScale = 1.25f;
+    static constexpr int layoutTop = 34;
+
+    const plugui::LayoutItem* itemFor (const juce::String& name) const
+    {
+        if (layout == nullptr)
+            return nullptr;
+        const plugui::LayoutItem* any = nullptr;
+        for (const auto& item : layout->items) // the knob / fader of the parameter first (a pad may share it)
+            if (item.param != nullptr && name == item.param)
+            {
+                if (item.type == plugui::Item::knob || item.type == plugui::Item::vslider)
+                    return &item;
+                if (any == nullptr && item.type != plugui::Item::display)
+                    any = &item;
+            }
+        return any;
+    }
+
+    juce::Slider* knobFor (const char* name) const
+    {
+        for (const auto& k : knobs)
+            if (name != nullptr && k->getName() == name)
+                return k.get();
+        return nullptr;
+    }
+
+    float layoutFactor() const
+    {
+        if (layout == nullptr)
+            return 1.0f;
+        return juce::jmax (0.4f, juce::jmin ((float) (getWidth() - 16) / (float) layout->width, (float) (getHeight() - layoutTop - 8) / (float) layout->height));
+    }
+
+    juce::Rectangle<float> layoutRect (const plugui::LayoutItem& item) const
+    {
+        const auto f = layoutFactor();
+        return { 8.0f + item.x * f, (float) layoutTop + item.y * f, item.w * f, item.h * f };
+    }
+
+    static float normalised (const juce::Slider& k)
+    {
+        const auto range = k.getMaximum() - k.getMinimum();
+        return range > 0.0 ? (float) ((k.getValue() - k.getMinimum()) / range) : 0.0f;
+    }
+
+    static void setNormalised (juce::Slider& k, float v)
+    {
+        k.setValue (k.getMinimum() + (double) v * (k.getMaximum() - k.getMinimum()), juce::sendNotificationSync);
+    }
+
+    // the radio's option cell (grids fill row by row)
+    juce::Rectangle<float> optionCell (const plugui::LayoutItem& item, int o, int count) const
+    {
+        const auto r = layoutRect (item);
+        const auto columns = juce::jmax (1, item.columns);
+        const auto rows = (count + columns - 1) / columns;
+        const auto w = r.getWidth() / (float) columns, h = r.getHeight() / (float) juce::jmax (1, rows);
+        return { r.getX() + w * (float) (o % columns), r.getY() + h * (float) (o / columns), w, h };
+    }
+
+    // a small drawing of an oscillator shape (3x Osc's shape buttons)
+    static void drawShape (juce::Graphics& g, juce::Rectangle<float> r, const juce::String& name)
+    {
+        juce::Path p;
+        const auto x0 = r.getX(), w = r.getWidth(), yc = r.getCentreY(), a = r.getHeight() * 0.5f;
+        const auto n = 48;
+        for (int i = 0; i <= n; ++i)
+        {
+            const auto t = (float) i / (float) n;
+            float y = 0.0f;
+            if (name == "Sine") y = std::sin (t * juce::MathConstants<float>::twoPi);
+            else if (name == "Square") y = t < 0.5f ? 1.0f : -1.0f;
+            else if (name == "Rounded") y = t < 0.46f ? 1.0f - 2.0f * std::pow (0.997f, t * 16384.0f) : (t < 0.83f ? 1.0f : -1.0f);
+            else if (name == "Triangle") y = t < 0.25f ? 4.0f * t : (t < 0.75f ? 2.0f - 4.0f * t : 4.0f * t - 4.0f);
+            else if (name == "Saw") y = 2.0f * t - 1.0f;
+            else if (name == "Noise") y = std::sin ((float) i * 12.9898f) * std::cos ((float) i * 4.1414f) * 1.6f;
+            else /* custom */ y = std::sin (t * juce::MathConstants<float>::twoPi * 3.0f) * std::exp (-std::abs (t - 0.5f) * 5.0f);
+            y = juce::jlimit (-1.0f, 1.0f, y);
+            const juce::Point<float> pt { x0 + w * t, yc - a * y };
+            if (i == 0)
+                p.startNewSubPath (pt);
+            else
+                p.lineTo (pt);
+        }
+        g.strokePath (p, juce::PathStrokeType (1.5f, juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
+    }
+
+    void paintLayout (juce::Graphics& g)
+    {
+        using namespace theme;
+        const auto f = layoutFactor();
+        const auto& def = engine.getSong().channels[(std::size_t) channel];
+        const auto caption = [&] (const char* text, juce::Rectangle<float> r, bool dimmed, juce::Justification j) {
+            if (text == nullptr || *text == 0)
+                return;
+            g.setColour (dimmed ? colour::textDisabled : colour::textSecondary);
+            g.setFont (font (juce::jmax (8.0f, 9.5f * f), true));
+            g.drawFittedText (caps (tr (text)), r.toNearestInt(), j, 1, 0.7f);
+        };
+
+        for (const auto& item : layout->items)
+        {
+            const auto r = layoutRect (item);
+            const auto dimmed = (item.style & plugui::dim) != 0;
+            auto* k = knobFor (item.param);
+            switch (item.type)
+            {
+                case plugui::Item::section:
+                    g.setColour ((item.style & plugui::raised) != 0 ? colour::bg3 : colour::bg1);
+                    g.fillRoundedRectangle (r, radius::md * f);
+                    if (item.label != nullptr && (item.style & plugui::boxed) == 0)
+                    {
+                        auto head = r.withHeight (16.0f * f);
+                        g.setColour (colour::bg3);
+                        g.fillRoundedRectangle (head, radius::md * f);
+                        g.setColour (colour::textSecondary);
+                        g.setFont (font (juce::jmax (8.0f, 10.5f * f), true));
+                        g.drawFittedText (caps (tr (item.label)), head.toNearestInt(), juce::Justification::centred, 1, 0.7f);
+                    }
+                    break;
+                case plugui::Item::label:
+                    if (item.label != nullptr && juce::String (item.label).length() <= 2 && dimmed) // big dim numbers (3x Osc rows)
+                    {
+                        g.setColour (colour::bg4);
+                        g.setFont (font (r.getHeight() * 0.9f, true));
+                        g.drawText (item.label, r, juce::Justification::centred, false);
+                    }
+                    else if (dimmed && r.getHeight() > 30.0f * f) // the plugin's name, big and quiet
+                    {
+                        g.setColour (colour::bg4);
+                        g.setFont (font (r.getHeight() * 0.6f, true));
+                        g.drawFittedText (item.label, r.toNearestInt(),
+                                          (item.style & plugui::alignLeft) != 0 ? juce::Justification::centredLeft : juce::Justification::centredRight, 1, 0.8f);
+                    }
+                    else
+                        caption (item.label, r, dimmed, (item.style & plugui::alignLeft) != 0 ? juce::Justification::centredLeft : juce::Justification::centred);
+                    break;
+                case plugui::Item::knob:
+                    if ((item.style & plugui::noCaption) == 0)
+                        caption (item.label, r.withTop (r.getBottom() - 12.0f * f), dimmed, juce::Justification::centred);
+                    break;
+                case plugui::Item::vslider:
+                case plugui::Item::hslider:
+                    if ((item.style & plugui::noCaption) == 0)
+                        caption (item.label, r.withTop (r.getBottom() - 12.0f * f).expanded (16.0f * f, 0.0f), dimmed, juce::Justification::centred);
+                    break;
+                case plugui::Item::radio:
+                    if (k != nullptr)
+                    {
+                        const auto labels = plugui::optionLabels (item);
+                        const auto chosen = plugui::optionAt (item, normalised (*k));
+                        for (int o = 0; o < (int) labels.size(); ++o)
+                        {
+                            const auto cell = optionCell (item, o, (int) labels.size()).reduced (3.0f * f);
+                            g.setColour (o == chosen ? colour::bg5 : colour::bg2);
+                            g.fillRoundedRectangle (cell, radius::md * f);
+                            g.setColour (o == chosen ? colour::accent : colour::textSecondary);
+                            if (item.columns > 0)
+                                drawShape (g, cell.reduced (cell.getWidth() * 0.22f, cell.getHeight() * 0.3f), labels[(std::size_t) o]);
+                            else
+                                g.drawFittedText (tr (labels[(std::size_t) o]), cell.toNearestInt(), juce::Justification::centred, 1, 0.7f);
+                        }
+                    }
+                    break;
+                case plugui::Item::toggle:
+                    if (k != nullptr)
+                    {
+                        const auto on = normalised (*k) >= 0.5f;
+                        if ((item.style & plugui::boxed) != 0)
+                        {
+                            const auto box = r.reduced (3.0f * f);
+                            g.setColour (on ? colour::accent : colour::bg2);
+                            g.fillRoundedRectangle (box, radius::md * f);
+                            g.setColour (on ? colour::onAccent : colour::textSecondary);
+                            g.setFont (font (juce::jmax (8.0f, 11.0f * f), true));
+                            g.drawText (item.label != nullptr ? item.label : "", box, juce::Justification::centred, false);
+                        }
+                        else
+                        {
+                            const auto dot = juce::Rectangle<float> (10.0f * f, 10.0f * f).withCentre ({ r.getX() + 6.0f * f, r.getCentreY() });
+                            g.setColour (on ? colour::accent : colour::ledOff);
+                            g.fillEllipse (dot);
+                            caption (item.label, r.withTrimmedLeft (14.0f * f), false, juce::Justification::centredLeft);
+                        }
+                    }
+                    break;
+                case plugui::Item::stepper:
+                    if (k != nullptr)
+                    {
+                        auto box = r;
+                        if (item.label != nullptr)
+                            caption (item.label, box.removeFromTop (12.0f * f), false, juce::Justification::centred);
+                        g.setColour (colour::bg0);
+                        g.fillRoundedRectangle (box, radius::sm * f);
+                        g.setColour (colour::textPrimary);
+                        g.setFont (font (juce::jmax (9.0f, 12.0f * f), true));
+                        // oversampling orders read as FL shows them (0 → 1x … 3 → 8x)
+                        const auto text = juce::String (item.param).containsIgnoreCase ("oversampling") ? juce::String (1 << juce::jlimit (0, 8, (int) k->getValue())) + "x"
+                                                                                                       : juce::String ((int) k->getValue());
+                        g.drawText (text, box.withTrimmedRight (8.0f * f), juce::Justification::centred, false);
+                        g.setColour (colour::textSecondary);
+                        g.drawText (juce::String::fromUTF8 ("\xe2\x96\xb4"), box.withTrimmedLeft (box.getWidth() - 10.0f * f).withHeight (box.getHeight() * 0.5f), juce::Justification::centred, false);
+                        g.drawText (juce::String::fromUTF8 ("\xe2\x96\xbe"), box.withTrimmedLeft (box.getWidth() - 10.0f * f).withTrimmedTop (box.getHeight() * 0.5f), juce::Justification::centred, false);
+                    }
+                    break;
+                case plugui::Item::display:
+                    g.setColour (colour::bg0);
+                    g.fillRoundedRectangle (r, radius::sm * f);
+                    if (juce::String (item.display) == "xy")
+                        if (auto* kx = knobFor (item.param); kx != nullptr)
+                            if (auto* ky = knobFor (item.param2); ky != nullptr)
+                            {
+                                g.setColour (colour::gridBeat);
+                                g.drawVerticalLine ((int) r.getCentreX(), r.getY(), r.getBottom());
+                                g.drawHorizontalLine ((int) r.getCentreY(), r.getX(), r.getRight());
+                                const juce::Point<float> pt { r.getX() + r.getWidth() * normalised (*kx), r.getBottom() - r.getHeight() * normalised (*ky) };
+                                g.setColour (colour::accent);
+                                g.drawEllipse (juce::Rectangle<float> (10.0f * f, 10.0f * f).withCentre (pt), 2.0f);
+                            }
+                    if (juce::String (item.display) == "flkeysname")
+                        if (const auto st = flkeys::parseState (def.pluginState))
+                        {
+                            g.setColour (colour::textPrimary);
+                            g.setFont (font (juce::jmax (9.0f, 11.0f * f)));
+                            g.drawFittedText (juce::String::fromUTF8 (st->wavetable.c_str()), r.reduced (6.0f * f, 0.0f).toNearestInt(),
+                                              juce::Justification::centredLeft, 1, 0.8f);
+                        }
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+
+    void resizeLayout()
+    {
+        for (auto& k : knobs)
+        {
+            const auto* item = itemFor (k->getName());
+            if (item == nullptr || ! k->isVisible())
+                continue;
+            auto r = layoutRect (*item);
+            if ((item->type == plugui::Item::vslider || item->type == plugui::Item::hslider) && (item->style & plugui::noCaption) == 0 && item->label != nullptr)
+                r.removeFromBottom (13.0f * layoutFactor());
+            if (item->type == plugui::Item::knob)
+            {
+                if ((item->style & plugui::noCaption) == 0)
+                    r.removeFromBottom (14.0f * layoutFactor());
+                const auto d = juce::jmin (r.getWidth(), r.getHeight());
+                r = r.withSizeKeepingCentre (d, d).withY (r.getY());
+            }
+            k->setBounds (r.toNearestInt());
+        }
+    }
+
+    void mouseDrag (const juce::MouseEvent& e) override
+    {
+        if (xyItem == nullptr)
+            return;
+        const auto r = layoutRect (*xyItem);
+        if (auto* kx = knobFor (xyItem->param))
+            setNormalised (*kx, juce::jlimit (0.0f, 1.0f, (e.position.x - r.getX()) / r.getWidth()));
+        if (auto* ky = knobFor (xyItem->param2))
+            setNormalised (*ky, juce::jlimit (0.0f, 1.0f, (r.getBottom() - e.position.y) / r.getHeight()));
+        repaint();
+    }
+
+    void mouseUp (const juce::MouseEvent&) override { xyItem = nullptr; }
+
+    void mouseDown (const juce::MouseEvent& e) override
+    {
+        if (layout == nullptr)
+            return;
+        for (const auto& item : layout->items)
+        {
+            auto* k = knobFor (item.param);
+            if (k == nullptr || ! layoutRect (item).contains (e.position))
+                continue;
+            if (item.type == plugui::Item::display && juce::String (item.display) == "xy")
+            {
+                xyItem = &item;
+                mouseDrag (e);
+                return;
+            }
+            if (item.type == plugui::Item::stepper)
+            {
+                const auto r = layoutRect (item);
+                const auto up = e.position.y < r.getY() + (item.label != nullptr ? 12.0f * layoutFactor() : 0.0f) + (r.getHeight() - (item.label != nullptr ? 12.0f * layoutFactor() : 0.0f)) * 0.5f;
+                k->setValue (k->getValue() + (up ? 1.0 : -1.0), juce::sendNotificationSync);
+            }
+            else if (item.type == plugui::Item::toggle)
+                setNormalised (*k, normalised (*k) >= 0.5f ? 0.0f : 1.0f);
+            else if (item.type == plugui::Item::radio)
+            {
+                const auto count = (int) plugui::optionLabels (item).size();
+                for (int o = 0; o < count; ++o)
+                    if (optionCell (item, o, count).contains (e.position))
+                        setNormalised (*k, plugui::optionValue (item, o));
+            }
+            repaint();
+            return;
+        }
     }
 
     void paint (juce::Graphics& g) override
     {
         g.fillAll (theme::colour::bg2);
         g.setColour (theme::colour::textPrimary);
-        g.setFont (theme::font (theme::type::title));
+        g.setFont (theme::font (layout != nullptr ? theme::type::body : theme::type::title));
         g.drawText (drumsynth ? tr ("DrumSynth Live — FL's engine, patch on key {0}", { juce::String (editorKey) })
                                     + (wavesFound ? tr (" (next hit; recorded waves from your FL installation)")
                                                   : tr (" (next hit; recorded waves not found: silent)"))
@@ -1114,6 +1451,11 @@ public:
                     : sakura ? tr ("Sakura — physical strings (FL's engine; new parameters apply to the next note)")
                              : tr ("Drumpad — physical drum (FL's engine; new parameters apply to the next hit)"),
                     10, 6, getWidth() - 20, 20, juce::Justification::centredLeft);
+        if (layout != nullptr)
+        {
+            paintLayout (g);
+            return;
+        }
         g.setFont (theme::font (theme::type::small));
         for (const auto& k : knobs)
             g.drawText (k->getName(), k->getBounds().withHeight (14).translated (0, -14), juce::Justification::centred);
@@ -1121,6 +1463,11 @@ public:
 
     void resized() override
     {
+        if (layout != nullptr)
+        {
+            resizeLayout();
+            return;
+        }
         constexpr int columns = 7, w = 96, h = 92;
         for (std::size_t i = 0; i < knobs.size(); ++i)
             knobs[i]->setBounds (12 + (int) (i % columns) * (w + 4), 46 + (int) (i / columns) * (h + 18), w, h);
@@ -1134,6 +1481,8 @@ private:
          sawer = false, flKeys = false, granulizer = false, drumaxx = false, slayer = false, fruityDance = false, sytrus = false, wavesFound = false;
     int editorKey = 60;
     std::vector<std::unique_ptr<juce::Slider>> knobs;
+    const plugui::Layout* layout = nullptr;
+    const plugui::LayoutItem* xyItem = nullptr; // the pad being dragged
 };
 
 class SettingsPanel final : public juce::Component,

+ 322 - 0
src/ui/I18nData.h

@@ -5103,5 +5103,327 @@ inline constexpr unsigned char ptBR[] = {
 116, 32, 97, 32, 99, 104, 97, 110, 110, 101, 108, 32, 105, 110, 32, 116, 104, 101, 32, 67, 104, 97, 110, 110,
 101, 108, 32, 82, 97, 99, 107, 34, 32, 61, 32, 34, 83, 101, 108, 101, 99, 105, 111, 110, 101, 32, 117, 109,
 32, 99, 97, 110, 97, 108, 32, 110, 111, 32, 67, 104, 97, 110, 110, 101, 108, 32, 82, 97, 99, 107, 34, 10,
+10, 35, 32, 45, 45, 45, 32, 78, 97, 116, 105, 118, 101, 32, 112, 108, 117, 103, 105, 110, 32, 119, 105, 110,
+100, 111, 119, 115, 32, 105, 110, 32, 70, 76, 39, 115, 32, 97, 114, 114, 97, 110, 103, 101, 109, 101, 110, 116,
+32, 40, 114, 111, 117, 110, 100, 32, 57, 51, 41, 10, 34, 40, 110, 111, 32, 112, 114, 101, 115, 101, 116, 41,
+34, 32, 61, 32, 34, 40, 115, 101, 109, 32, 112, 114, 101, 115, 101, 116, 41, 34, 10, 34, 65, 109, 112, 32,
+49, 34, 32, 61, 32, 34, 65, 109, 112, 32, 49, 34, 10, 34, 65, 109, 112, 32, 50, 34, 32, 61, 32, 34,
+65, 109, 112, 32, 50, 34, 10, 34, 65, 116, 116, 34, 32, 61, 32, 34, 65, 116, 116, 34, 10, 34, 66, 87,
+34, 32, 61, 32, 34, 76, 97, 114, 103, 46, 34, 10, 34, 66, 97, 110, 100, 32, 112, 97, 115, 115, 34, 32,
+61, 32, 34, 80, 97, 115, 115, 97, 45, 98, 97, 110, 100, 97, 34, 10, 34, 66, 97, 115, 115, 34, 32, 61,
+32, 34, 71, 114, 97, 118, 101, 115, 34, 10, 34, 66, 105, 116, 115, 34, 32, 61, 32, 34, 66, 105, 116, 115,
+34, 10, 34, 66, 114, 105, 103, 104, 116, 110, 101, 115, 115, 34, 32, 61, 32, 34, 66, 114, 105, 108, 104, 111,
+34, 10, 34, 66, 121, 112, 97, 115, 115, 34, 32, 61, 32, 34, 66, 121, 112, 97, 115, 115, 34, 10, 34, 67,
+101, 105, 108, 34, 32, 61, 32, 34, 84, 101, 116, 111, 34, 10, 34, 67, 101, 110, 116, 101, 114, 34, 32, 61,
+32, 34, 67, 101, 110, 116, 114, 111, 34, 10, 34, 67, 104, 97, 114, 97, 99, 116, 101, 114, 34, 32, 61, 32,
+34, 67, 97, 114, 195, 161, 116, 101, 114, 34, 10, 34, 67, 111, 109, 112, 34, 32, 61, 32, 34, 67, 111, 109,
+112, 34, 10, 34, 67, 114, 111, 115, 115, 32, 99, 117, 116, 111, 102, 102, 34, 32, 61, 32, 34, 67, 111, 114,
+116, 101, 32, 99, 114, 117, 122, 97, 100, 111, 34, 10, 34, 67, 114, 111, 115, 115, 32, 116, 121, 112, 101, 34,
+32, 61, 32, 34, 84, 105, 112, 111, 32, 99, 114, 117, 122, 97, 100, 111, 34, 10, 34, 67, 114, 111, 115, 115,
+34, 32, 61, 32, 34, 67, 114, 117, 122, 97, 100, 111, 34, 10, 34, 67, 114, 111, 115, 115, 111, 118, 101, 114,
+115, 34, 32, 61, 32, 34, 67, 114, 111, 115, 115, 111, 118, 101, 114, 115, 34, 10, 34, 67, 117, 116, 111, 102,
+102, 32, 102, 114, 101, 113, 34, 32, 61, 32, 34, 70, 114, 101, 113, 46, 32, 100, 101, 32, 99, 111, 114, 116,
+101, 34, 10, 34, 68, 97, 109, 112, 34, 32, 61, 32, 34, 65, 109, 111, 114, 116, 101, 99, 46, 34, 10, 34,
+68, 101, 99, 34, 32, 61, 32, 34, 68, 101, 99, 97, 105, 109, 46, 34, 10, 34, 68, 101, 108, 97, 121, 32,
+49, 34, 32, 61, 32, 34, 68, 101, 108, 97, 121, 32, 49, 34, 10, 34, 68, 101, 108, 97, 121, 32, 50, 34,
+32, 61, 32, 34, 68, 101, 108, 97, 121, 32, 50, 34, 10, 34, 68, 101, 108, 97, 121, 32, 109, 111, 100, 101,
+108, 34, 32, 61, 32, 34, 77, 111, 100, 101, 108, 111, 32, 100, 111, 32, 100, 101, 108, 97, 121, 34, 10, 34,
+68, 101, 108, 97, 121, 32, 116, 105, 109, 101, 34, 32, 61, 32, 34, 84, 101, 109, 112, 111, 32, 100, 111, 32,
+100, 101, 108, 97, 121, 34, 10, 34, 68, 101, 112, 116, 104, 34, 32, 61, 32, 34, 80, 114, 111, 102, 117, 110,
+100, 105, 100, 97, 100, 101, 34, 10, 34, 68, 105, 102, 102, 34, 32, 61, 32, 34, 68, 105, 102, 117, 115, 195,
+163, 111, 34, 10, 34, 68, 105, 102, 102, 117, 115, 105, 111, 110, 34, 32, 61, 32, 34, 68, 105, 102, 117, 115,
+195, 163, 111, 34, 10, 34, 68, 105, 114, 101, 99, 116, 32, 97, 109, 112, 34, 32, 61, 32, 34, 65, 109, 112,
+32, 100, 105, 114, 101, 116, 111, 34, 10, 34, 68, 114, 121, 34, 32, 61, 32, 34, 83, 101, 99, 111, 34, 10,
+34, 69, 82, 34, 32, 61, 32, 34, 82, 80, 34, 10, 34, 69, 100, 105, 116, 111, 114, 34, 32, 61, 32, 34,
+69, 100, 105, 116, 111, 114, 34, 10, 34, 69, 110, 118, 101, 108, 111, 112, 101, 34, 32, 61, 32, 34, 69, 110,
+118, 101, 108, 111, 112, 101, 34, 10, 34, 70, 97, 115, 116, 32, 100, 105, 115, 116, 34, 32, 61, 32, 34, 70,
+97, 115, 116, 32, 100, 105, 115, 116, 34, 10, 34, 70, 101, 101, 100, 34, 32, 61, 32, 34, 82, 101, 97, 108,
+105, 109, 46, 34, 10, 34, 70, 101, 101, 100, 98, 97, 99, 107, 32, 100, 105, 115, 116, 111, 114, 116, 105, 111,
+110, 34, 32, 61, 32, 34, 68, 105, 115, 116, 111, 114, 195, 167, 195, 163, 111, 32, 100, 97, 32, 114, 101, 97,
+108, 105, 109, 101, 110, 116, 97, 195, 167, 195, 163, 111, 34, 10, 34, 70, 101, 101, 100, 98, 97, 99, 107, 34,
+32, 61, 32, 34, 82, 101, 97, 108, 105, 109, 101, 110, 116, 97, 195, 167, 195, 163, 111, 34, 10, 34, 70, 101,
+101, 100, 98, 97, 99, 107, 124, 70, 101, 101, 100, 102, 111, 114, 119, 97, 114, 100, 34, 32, 61, 32, 34, 82,
+101, 97, 108, 105, 109, 101, 110, 116, 97, 195, 167, 195, 163, 111, 124, 65, 108, 105, 109, 101, 110, 116, 97, 195,
+167, 195, 163, 111, 32, 100, 105, 114, 101, 116, 97, 34, 10, 34, 70, 114, 101, 113, 34, 32, 61, 32, 34, 70,
+114, 101, 113, 46, 34, 10, 34, 72, 46, 99, 117, 116, 34, 32, 61, 32, 34, 67, 111, 114, 116, 101, 32, 65,
+46, 34, 10, 34, 72, 81, 34, 32, 61, 32, 34, 72, 81, 34, 10, 34, 72, 105, 103, 104, 32, 98, 97, 110,
+100, 34, 32, 61, 32, 34, 66, 97, 110, 100, 97, 32, 97, 108, 116, 97, 34, 10, 34, 72, 105, 103, 104, 32,
+109, 105, 100, 34, 32, 61, 32, 34, 77, 195, 169, 100, 105, 111, 45, 97, 103, 117, 100, 111, 34, 10, 34, 72,
+105, 103, 104, 32, 112, 97, 115, 115, 34, 32, 61, 32, 34, 80, 97, 115, 115, 97, 45, 97, 108, 116, 97, 115,
+34, 10, 34, 73, 110, 112, 117, 116, 34, 32, 61, 32, 34, 69, 110, 116, 114, 97, 100, 97, 34, 10, 34, 73,
+110, 118, 32, 102, 101, 101, 100, 98, 97, 99, 107, 34, 32, 61, 32, 34, 73, 110, 118, 46, 32, 114, 101, 97,
+108, 105, 109, 46, 34, 10, 34, 73, 110, 118, 32, 119, 101, 116, 34, 32, 61, 32, 34, 73, 110, 118, 46, 32,
+109, 111, 108, 104, 97, 100, 111, 34, 10, 34, 73, 110, 118, 101, 114, 116, 34, 32, 61, 32, 34, 73, 110, 118,
+101, 114, 116, 101, 114, 34, 10, 34, 75, 101, 101, 112, 32, 112, 105, 116, 99, 104, 34, 32, 61, 32, 34, 77,
+97, 110, 116, 101, 114, 32, 116, 111, 109, 34, 10, 34, 75, 110, 101, 101, 34, 32, 61, 32, 34, 74, 111, 101,
+108, 104, 111, 34, 10, 34, 76, 46, 99, 117, 116, 34, 32, 61, 32, 34, 67, 111, 114, 116, 101, 32, 66, 46,
+34, 10, 34, 76, 70, 79, 32, 49, 32, 102, 114, 101, 113, 34, 32, 61, 32, 34, 70, 114, 101, 113, 46, 32,
+76, 70, 79, 32, 49, 34, 10, 34, 76, 70, 79, 32, 49, 32, 119, 97, 118, 101, 34, 32, 61, 32, 34, 79,
+110, 100, 97, 32, 76, 70, 79, 32, 49, 34, 10, 34, 76, 70, 79, 32, 50, 32, 102, 114, 101, 113, 34, 32,
+61, 32, 34, 70, 114, 101, 113, 46, 32, 76, 70, 79, 32, 50, 34, 10, 34, 76, 70, 79, 32, 50, 32, 119,
+97, 118, 101, 34, 32, 61, 32, 34, 79, 110, 100, 97, 32, 76, 70, 79, 32, 50, 34, 10, 34, 76, 70, 79,
+32, 51, 32, 102, 114, 101, 113, 34, 32, 61, 32, 34, 70, 114, 101, 113, 46, 32, 76, 70, 79, 32, 51, 34,
+10, 34, 76, 70, 79, 32, 51, 32, 119, 97, 118, 101, 34, 32, 61, 32, 34, 79, 110, 100, 97, 32, 76, 70,
+79, 32, 51, 34, 10, 34, 76, 80, 124, 72, 80, 124, 66, 80, 124, 79, 102, 102, 34, 32, 61, 32, 34, 80,
+66, 124, 80, 65, 124, 80, 70, 124, 68, 101, 115, 108, 46, 34, 10, 34, 76, 105, 109, 105, 116, 101, 114, 34,
+32, 61, 32, 34, 76, 105, 109, 105, 116, 97, 100, 111, 114, 34, 10, 34, 76, 105, 109, 105, 116, 124, 67, 111,
+109, 112, 34, 32, 61, 32, 34, 76, 105, 109, 105, 116, 46, 124, 67, 111, 109, 112, 46, 34, 10, 34, 76, 105,
+109, 105, 116, 124, 83, 97, 116, 34, 32, 61, 32, 34, 76, 105, 109, 105, 116, 97, 114, 124, 83, 97, 116, 117,
+114, 97, 114, 34, 10, 34, 76, 111, 117, 100, 110, 101, 115, 115, 34, 32, 61, 32, 34, 86, 111, 108, 117, 109,
+101, 34, 10, 34, 76, 111, 119, 32, 98, 97, 110, 100, 34, 32, 61, 32, 34, 66, 97, 110, 100, 97, 32, 98,
+97, 105, 120, 97, 34, 10, 34, 76, 111, 119, 32, 109, 105, 100, 34, 32, 61, 32, 34, 77, 195, 169, 100, 105,
+111, 45, 103, 114, 97, 118, 101, 34, 10, 34, 76, 111, 119, 32, 112, 97, 115, 115, 34, 32, 61, 32, 34, 80,
+97, 115, 115, 97, 45, 98, 97, 105, 120, 97, 115, 34, 10, 34, 77, 105, 100, 32, 98, 97, 110, 100, 34, 32,
+61, 32, 34, 66, 97, 110, 100, 97, 32, 109, 195, 169, 100, 105, 97, 34, 10, 34, 77, 105, 100, 124, 83, 105,
+100, 101, 34, 32, 61, 32, 34, 77, 105, 100, 124, 83, 105, 100, 101, 34, 10, 34, 77, 111, 100, 32, 97, 109,
+112, 34, 32, 61, 32, 34, 65, 109, 112, 32, 109, 111, 100, 46, 34, 10, 34, 77, 111, 100, 32, 102, 114, 101,
+113, 34, 32, 61, 32, 34, 70, 114, 101, 113, 46, 32, 109, 111, 100, 46, 34, 10, 34, 77, 111, 100, 34, 32,
+61, 32, 34, 77, 111, 100, 46, 34, 10, 34, 77, 111, 100, 117, 108, 97, 116, 105, 111, 110, 34, 32, 61, 32,
+34, 77, 111, 100, 117, 108, 97, 195, 167, 195, 163, 111, 34, 10, 34, 77, 111, 110, 111, 124, 83, 116, 101, 114,
+101, 111, 124, 80, 105, 110, 103, 32, 112, 111, 110, 103, 124, 79, 102, 102, 34, 32, 61, 32, 34, 77, 111, 110,
+111, 124, 69, 115, 116, 195, 169, 114, 101, 111, 124, 80, 105, 110, 103, 117, 101, 45, 112, 111, 110, 103, 117, 101,
+124, 68, 101, 115, 108, 46, 34, 10, 34, 78, 101, 120, 116, 32, 112, 114, 101, 115, 101, 116, 34, 32, 61, 32,
+34, 80, 114, 195, 179, 120, 105, 109, 111, 32, 112, 114, 101, 115, 101, 116, 34, 10, 34, 78, 111, 32, 70, 76,
+32, 112, 114, 101, 115, 101, 116, 115, 32, 102, 111, 117, 110, 100, 32, 102, 111, 114, 32, 116, 104, 105, 115, 32,
+112, 108, 117, 103, 105, 110, 34, 32, 61, 32, 34, 78, 101, 110, 104, 117, 109, 32, 112, 114, 101, 115, 101, 116,
+32, 100, 111, 32, 70, 76, 32, 101, 110, 99, 111, 110, 116, 114, 97, 100, 111, 32, 112, 97, 114, 97, 32, 101,
+115, 116, 101, 32, 112, 108, 117, 103, 105, 110, 34, 10, 34, 78, 111, 105, 115, 101, 32, 103, 97, 116, 101, 34,
+32, 61, 32, 34, 78, 111, 105, 115, 101, 32, 103, 97, 116, 101, 34, 10, 34, 78, 111, 110, 101, 124, 76, 101,
+102, 116, 124, 82, 105, 103, 104, 116, 34, 32, 61, 32, 34, 78, 101, 110, 104, 117, 109, 124, 69, 115, 113, 117,
+101, 114, 100, 111, 124, 68, 105, 114, 101, 105, 116, 111, 34, 10, 34, 78, 111, 114, 109, 97, 108, 124, 70, 114,
+101, 101, 122, 101, 124, 83, 117, 115, 116, 97, 105, 110, 34, 32, 61, 32, 34, 78, 111, 114, 109, 97, 108, 124,
+67, 111, 110, 103, 101, 108, 97, 114, 124, 83, 117, 115, 116, 101, 110, 116, 97, 114, 34, 10, 34, 79, 102, 102,
+124, 79, 110, 34, 32, 61, 32, 34, 68, 101, 115, 108, 46, 124, 76, 105, 103, 46, 34, 10, 34, 79, 102, 102,
+124, 80, 101, 97, 107, 124, 76, 111, 119, 32, 115, 104, 101, 108, 102, 124, 72, 105, 103, 104, 32, 115, 104, 101,
+108, 102, 124, 76, 111, 119, 32, 99, 117, 116, 124, 72, 105, 103, 104, 32, 99, 117, 116, 124, 66, 97, 110, 100,
+45, 112, 97, 115, 115, 124, 78, 111, 116, 99, 104, 34, 32, 61, 32, 34, 68, 101, 115, 108, 105, 103, 97, 100,
+97, 124, 80, 105, 99, 111, 124, 80, 114, 97, 116, 101, 108, 101, 105, 114, 97, 32, 103, 114, 97, 118, 101, 124,
+80, 114, 97, 116, 101, 108, 101, 105, 114, 97, 32, 97, 103, 117, 100, 97, 124, 67, 111, 114, 116, 101, 32, 100,
+101, 32, 103, 114, 97, 118, 101, 115, 124, 67, 111, 114, 116, 101, 32, 100, 101, 32, 97, 103, 117, 100, 111, 115,
+124, 80, 97, 115, 115, 97, 45, 98, 97, 110, 100, 97, 124, 78, 111, 116, 99, 104, 34, 10, 34, 79, 102, 102,
+124, 87, 101, 116, 124, 68, 101, 99, 97, 121, 34, 32, 61, 32, 34, 68, 101, 115, 108, 46, 124, 77, 111, 108,
+104, 97, 100, 111, 124, 68, 101, 99, 97, 105, 109, 101, 110, 116, 111, 34, 10, 34, 79, 112, 101, 110, 32, 116,
+104, 101, 32, 101, 102, 102, 101, 99, 116, 39, 115, 32, 119, 105, 110, 100, 111, 119, 32, 40, 105, 116, 115, 32,
+102, 117, 108, 108, 32, 99, 111, 110, 116, 114, 111, 108, 115, 44, 32, 97, 115, 32, 105, 110, 32, 70, 76, 41,
+59, 32, 100, 111, 117, 98, 108, 101, 45, 99, 108, 105, 99, 107, 105, 110, 103, 32, 116, 104, 101, 32, 115, 108,
+111, 116, 32, 100, 111, 101, 115, 32, 116, 104, 101, 32, 115, 97, 109, 101, 34, 32, 61, 32, 34, 65, 98, 114,
+101, 32, 97, 32, 106, 97, 110, 101, 108, 97, 32, 100, 111, 32, 101, 102, 101, 105, 116, 111, 32, 40, 116, 111,
+100, 111, 115, 32, 111, 115, 32, 99, 111, 110, 116, 114, 111, 108, 101, 115, 44, 32, 99, 111, 109, 111, 32, 110,
+111, 32, 70, 76, 41, 59, 32, 99, 108, 105, 99, 97, 114, 32, 100, 117, 97, 115, 32, 118, 101, 122, 101, 115,
+32, 110, 111, 32, 115, 108, 111, 116, 32, 102, 97, 122, 32, 111, 32, 109, 101, 115, 109, 111, 34, 10, 34, 79,
+112, 116, 105, 111, 110, 115, 58, 32, 112, 114, 101, 115, 101, 116, 115, 44, 32, 114, 101, 115, 101, 116, 44, 32,
+98, 121, 112, 97, 115, 115, 34, 32, 61, 32, 34, 79, 112, 195, 167, 195, 181, 101, 115, 58, 32, 112, 114, 101,
+115, 101, 116, 115, 44, 32, 114, 101, 115, 116, 97, 117, 114, 97, 114, 44, 32, 98, 121, 112, 97, 115, 115, 34,
+10, 34, 79, 117, 116, 112, 117, 116, 34, 32, 61, 32, 34, 83, 97, 195, 173, 100, 97, 34, 10, 34, 80, 46,
+32, 100, 101, 108, 97, 121, 34, 32, 61, 32, 34, 80, 114, 195, 169, 45, 100, 101, 108, 97, 121, 34, 10, 34,
+80, 97, 103, 101, 58, 32, 115, 119, 105, 116, 99, 104, 32, 116, 104, 101, 32, 99, 111, 110, 116, 114, 111, 108,
+115, 32, 115, 104, 111, 119, 110, 34, 32, 61, 32, 34, 80, 195, 161, 103, 105, 110, 97, 58, 32, 116, 114, 111,
+99, 97, 32, 111, 115, 32, 99, 111, 110, 116, 114, 111, 108, 101, 115, 32, 109, 111, 115, 116, 114, 97, 100, 111,
+115, 34, 10, 34, 80, 101, 97, 107, 32, 81, 34, 32, 61, 32, 34, 81, 32, 100, 111, 32, 112, 105, 99, 111,
+34, 10, 34, 80, 101, 97, 107, 32, 102, 114, 101, 113, 34, 32, 61, 32, 34, 70, 114, 101, 113, 46, 32, 100,
+111, 32, 112, 105, 99, 111, 34, 10, 34, 80, 101, 97, 107, 32, 103, 97, 105, 110, 34, 32, 61, 32, 34, 71,
+97, 110, 104, 111, 32, 100, 111, 32, 112, 105, 99, 111, 34, 10, 34, 80, 104, 97, 115, 101, 32, 111, 102, 102,
+115, 101, 116, 34, 32, 61, 32, 34, 68, 101, 115, 118, 105, 111, 32, 100, 101, 32, 102, 97, 115, 101, 34, 10,
+34, 80, 105, 116, 99, 104, 32, 49, 34, 32, 61, 32, 34, 84, 111, 109, 32, 49, 34, 10, 34, 80, 105, 116,
+99, 104, 32, 50, 34, 32, 61, 32, 34, 84, 111, 109, 32, 50, 34, 10, 34, 80, 105, 116, 99, 104, 32, 115,
+104, 105, 102, 116, 34, 32, 61, 32, 34, 68, 101, 115, 118, 105, 111, 32, 100, 101, 32, 116, 111, 109, 34, 10,
+34, 80, 111, 115, 116, 34, 32, 61, 32, 34, 80, 195, 179, 115, 34, 10, 34, 80, 114, 101, 34, 32, 61, 32,
+34, 80, 114, 195, 169, 34, 10, 34, 80, 114, 101, 115, 101, 116, 58, 32, 99, 108, 105, 99, 107, 32, 102, 111,
+114, 32, 116, 104, 101, 32, 108, 105, 115, 116, 32, 111, 102, 32, 70, 76, 32, 112, 114, 101, 115, 101, 116, 115,
+32, 111, 102, 32, 116, 104, 105, 115, 32, 112, 108, 117, 103, 105, 110, 34, 32, 61, 32, 34, 80, 114, 101, 115,
+101, 116, 58, 32, 99, 108, 105, 113, 117, 101, 32, 112, 97, 114, 97, 32, 97, 32, 108, 105, 115, 116, 97, 32,
+100, 101, 32, 112, 114, 101, 115, 101, 116, 115, 32, 100, 111, 32, 70, 76, 32, 100, 101, 115, 116, 101, 32, 112,
+108, 117, 103, 105, 110, 34, 10, 34, 80, 114, 101, 115, 101, 116, 115, 34, 32, 61, 32, 34, 80, 114, 101, 115,
+101, 116, 115, 34, 10, 34, 80, 114, 101, 118, 105, 111, 117, 115, 32, 112, 114, 101, 115, 101, 116, 34, 32, 61,
+32, 34, 80, 114, 101, 115, 101, 116, 32, 97, 110, 116, 101, 114, 105, 111, 114, 34, 10, 34, 80, 114, 101, 124,
+80, 111, 115, 116, 34, 32, 61, 32, 34, 80, 114, 195, 169, 124, 80, 195, 179, 115, 34, 10, 34, 80, 114, 115,
+34, 32, 61, 32, 34, 80, 114, 101, 115, 46, 34, 10, 34, 82, 97, 116, 101, 34, 32, 61, 32, 34, 84, 97,
+120, 97, 34, 10, 34, 82, 97, 116, 105, 111, 34, 32, 61, 32, 34, 82, 97, 122, 195, 163, 111, 34, 10, 34,
+82, 101, 108, 34, 32, 61, 32, 34, 82, 101, 108, 34, 10, 34, 82, 101, 115, 34, 32, 61, 32, 34, 82, 101,
+115, 34, 10, 34, 82, 101, 115, 101, 116, 32, 116, 111, 32, 100, 101, 102, 97, 117, 108, 116, 115, 34, 32, 61,
+32, 34, 82, 101, 115, 116, 97, 117, 114, 97, 114, 32, 111, 32, 112, 97, 100, 114, 195, 163, 111, 34, 10, 34,
+82, 101, 118, 101, 114, 98, 32, 109, 105, 120, 34, 32, 61, 32, 34, 77, 105, 120, 32, 100, 111, 32, 114, 101,
+118, 101, 114, 98, 34, 10, 34, 82, 101, 118, 101, 114, 98, 34, 32, 61, 32, 34, 82, 101, 118, 101, 114, 98,
+34, 10, 34, 83, 97, 116, 34, 32, 61, 32, 34, 83, 97, 116, 34, 10, 34, 83, 101, 112, 34, 32, 61, 32,
+34, 83, 101, 112, 46, 34, 10, 34, 83, 105, 122, 101, 34, 32, 61, 32, 34, 84, 97, 109, 97, 110, 104, 111,
+34, 10, 34, 83, 109, 111, 111, 116, 104, 34, 32, 61, 32, 34, 83, 117, 97, 118, 105, 122, 97, 114, 34, 10,
+34, 83, 109, 111, 111, 116, 104, 105, 110, 103, 34, 32, 61, 32, 34, 83, 117, 97, 118, 105, 122, 97, 195, 167,
+195, 163, 111, 34, 10, 34, 83, 109, 112, 32, 114, 97, 116, 101, 34, 32, 61, 32, 34, 84, 97, 120, 97, 32,
+97, 109, 111, 115, 116, 114, 46, 34, 10, 34, 83, 116, 101, 114, 101, 111, 32, 101, 110, 104, 97, 110, 99, 101,
+114, 34, 32, 61, 32, 34, 82, 101, 97, 108, 99, 101, 32, 101, 115, 116, 195, 169, 114, 101, 111, 34, 10, 34,
+83, 116, 101, 114, 101, 111, 32, 115, 101, 112, 34, 32, 61, 32, 34, 83, 101, 112, 97, 114, 97, 195, 167, 195,
+163, 111, 32, 101, 115, 116, 195, 169, 114, 101, 111, 34, 10, 34, 83, 117, 98, 34, 32, 61, 32, 34, 83, 117,
+98, 34, 10, 34, 83, 121, 109, 109, 101, 116, 114, 121, 34, 32, 61, 32, 34, 83, 105, 109, 101, 116, 114, 105,
+97, 34, 10, 34, 84, 101, 109, 112, 111, 32, 115, 121, 110, 99, 34, 32, 61, 32, 34, 83, 105, 110, 99, 46,
+32, 97, 111, 32, 116, 101, 109, 112, 111, 34, 10, 34, 84, 104, 101, 32, 101, 102, 102, 101, 99, 116, 32, 119,
+97, 115, 32, 114, 101, 109, 111, 118, 101, 100, 32, 102, 114, 111, 109, 32, 116, 104, 105, 115, 32, 115, 108, 111,
+116, 46, 34, 32, 61, 32, 34, 79, 32, 101, 102, 101, 105, 116, 111, 32, 102, 111, 105, 32, 114, 101, 109, 111,
+118, 105, 100, 111, 32, 100, 101, 115, 116, 101, 32, 115, 108, 111, 116, 46, 34, 10, 34, 84, 104, 114, 101, 115,
+34, 32, 61, 32, 34, 76, 105, 109, 105, 97, 114, 34, 10, 34, 84, 104, 114, 101, 115, 104, 34, 32, 61, 32,
+34, 76, 105, 109, 105, 97, 114, 34, 10, 34, 84, 104, 114, 101, 115, 104, 111, 108, 100, 34, 32, 61, 32, 34,
+76, 105, 109, 105, 97, 114, 34, 10, 34, 84, 111, 110, 101, 34, 32, 61, 32, 34, 84, 105, 109, 98, 114, 101,
+34, 10, 34, 84, 114, 101, 98, 108, 101, 34, 32, 61, 32, 34, 65, 103, 117, 100, 111, 115, 34, 10, 34, 86,
+111, 108, 34, 32, 61, 32, 34, 86, 111, 108, 34, 10, 34, 87, 101, 116, 32, 103, 97, 105, 110, 34, 32, 61,
+32, 34, 71, 97, 110, 104, 111, 32, 109, 111, 108, 104, 97, 100, 111, 34, 10, 34, 87, 101, 116, 32, 111, 110,
+108, 121, 34, 32, 61, 32, 34, 83, 195, 179, 32, 109, 111, 108, 104, 97, 100, 111, 34, 10, 34, 87, 101, 116,
+34, 32, 61, 32, 34, 77, 111, 108, 104, 97, 100, 111, 34, 10, 34, 87, 105, 100, 116, 104, 34, 32, 61, 32,
+34, 76, 97, 114, 103, 117, 114, 97, 34, 10, 34, 88, 32, 50, 34, 32, 61, 32, 34, 88, 32, 50, 34, 10,
+34, 84, 105, 109, 101, 58, 32, 123, 48, 125, 34, 32, 61, 32, 34, 84, 101, 109, 112, 111, 58, 32, 123, 48,
+125, 34, 10, 34, 72, 111, 108, 100, 58, 32, 123, 48, 125, 34, 32, 61, 32, 34, 72, 111, 108, 100, 58, 32,
+123, 48, 125, 34, 10, 34, 84, 114, 105, 103, 32, 115, 121, 110, 99, 58, 32, 123, 48, 125, 34, 32, 61, 32,
+34, 83, 105, 110, 99, 46, 32, 100, 111, 32, 100, 105, 115, 112, 97, 114, 111, 58, 32, 123, 48, 125, 34, 10,
+34, 80, 111, 115, 32, 115, 121, 110, 99, 58, 32, 123, 48, 125, 34, 32, 61, 32, 34, 83, 105, 110, 99, 46,
+32, 100, 97, 32, 112, 111, 115, 105, 195, 167, 195, 163, 111, 58, 32, 123, 48, 125, 34, 10, 34, 84, 110, 115,
+34, 32, 61, 32, 34, 84, 101, 110, 115, 195, 163, 111, 34, 10, 34, 65, 77, 32, 111, 115, 99, 32, 51, 34,
+32, 61, 32, 34, 65, 77, 32, 111, 115, 99, 32, 51, 34, 10, 34, 65, 109, 116, 34, 32, 61, 32, 34, 81,
+116, 100, 46, 34, 10, 34, 66, 105, 112, 111, 108, 97, 114, 124, 85, 110, 105, 112, 111, 108, 97, 114, 34, 32,
+61, 32, 34, 66, 105, 112, 111, 108, 97, 114, 124, 85, 110, 105, 112, 111, 108, 97, 114, 34, 10, 34, 67, 111,
+97, 114, 115, 101, 34, 32, 61, 32, 34, 71, 114, 111, 115, 115, 111, 34, 10, 34, 68, 101, 108, 34, 32, 61,
+32, 34, 65, 116, 114, 97, 115, 111, 34, 10, 34, 68, 101, 116, 117, 110, 101, 34, 32, 61, 32, 34, 68, 101,
+115, 97, 102, 105, 110, 97, 114, 34, 10, 34, 68, 114, 105, 118, 101, 34, 32, 61, 32, 34, 68, 114, 105, 118,
+101, 34, 10, 34, 69, 110, 118, 105, 114, 111, 110, 109, 101, 110, 116, 34, 32, 61, 32, 34, 65, 109, 98, 105,
+101, 110, 116, 101, 34, 10, 34, 72, 97, 114, 100, 110, 101, 115, 115, 34, 32, 61, 32, 34, 68, 117, 114, 101,
+122, 97, 34, 10, 34, 72, 105, 103, 104, 32, 100, 97, 109, 112, 105, 110, 103, 34, 32, 61, 32, 34, 65, 109,
+111, 114, 116, 101, 99, 105, 109, 101, 110, 116, 111, 32, 97, 103, 117, 100, 111, 34, 10, 34, 72, 105, 103, 104,
+99, 117, 116, 34, 32, 61, 32, 34, 67, 111, 114, 116, 101, 32, 97, 103, 117, 100, 111, 34, 10, 34, 73, 110,
+47, 111, 117, 116, 32, 100, 105, 102, 102, 101, 114, 101, 110, 99, 101, 34, 32, 61, 32, 34, 68, 105, 102, 101,
+114, 101, 110, 195, 167, 97, 32, 101, 110, 116, 114, 97, 100, 97, 47, 115, 97, 195, 173, 100, 97, 34, 10, 34,
+76, 101, 102, 116, 34, 32, 61, 32, 34, 69, 115, 113, 117, 101, 114, 100, 111, 34, 10, 34, 76, 111, 119, 99,
+117, 116, 34, 32, 61, 32, 34, 67, 111, 114, 116, 101, 32, 103, 114, 97, 118, 101, 34, 10, 34, 77, 105, 115,
+99, 34, 32, 61, 32, 34, 68, 105, 118, 101, 114, 115, 111, 115, 34, 10, 34, 77, 105, 120, 101, 114, 32, 109,
+97, 116, 114, 105, 120, 34, 32, 61, 32, 34, 77, 97, 116, 114, 105, 122, 32, 100, 101, 32, 109, 105, 120, 97,
+103, 101, 109, 34, 10, 34, 77, 117, 102, 102, 108, 101, 34, 32, 61, 32, 34, 65, 98, 97, 102, 97, 114, 34,
+10, 34, 78, 111, 114, 109, 97, 108, 124, 73, 110, 118, 101, 114, 116, 124, 80, 46, 112, 111, 110, 103, 34, 32,
+61, 32, 34, 78, 111, 114, 109, 97, 108, 124, 73, 110, 118, 101, 114, 116, 101, 114, 124, 80, 105, 110, 103, 117,
+101, 45, 112, 46, 34, 10, 34, 79, 102, 102, 124, 80, 97, 110, 124, 86, 111, 108, 34, 32, 61, 32, 34, 68,
+101, 115, 108, 46, 124, 80, 97, 110, 124, 86, 111, 108, 34, 10, 34, 79, 102, 115, 34, 32, 61, 32, 34, 68,
+101, 115, 108, 46, 34, 10, 34, 79, 114, 100, 34, 32, 61, 32, 34, 79, 114, 100, 101, 109, 34, 10, 34, 79,
+118, 101, 114, 100, 114, 105, 118, 101, 34, 32, 61, 32, 34, 79, 118, 101, 114, 100, 114, 105, 118, 101, 34, 10,
+34, 79, 118, 101, 114, 115, 97, 109, 112, 108, 101, 34, 32, 61, 32, 34, 83, 111, 98, 114, 101, 97, 109, 111,
+115, 116, 114, 97, 103, 101, 109, 34, 10, 34, 80, 104, 97, 115, 101, 32, 111, 102, 115, 34, 32, 61, 32, 34,
+68, 101, 115, 118, 105, 111, 32, 100, 101, 32, 102, 97, 115, 101, 34, 10, 34, 80, 104, 97, 115, 101, 32, 114,
+97, 110, 100, 34, 32, 61, 32, 34, 70, 97, 115, 101, 32, 97, 108, 101, 97, 116, 195, 179, 114, 105, 97, 34,
+10, 34, 80, 111, 115, 116, 32, 102, 105, 108, 116, 101, 114, 34, 32, 61, 32, 34, 70, 105, 108, 116, 114, 111,
+32, 112, 195, 179, 115, 34, 10, 34, 80, 111, 115, 116, 32, 103, 97, 105, 110, 34, 32, 61, 32, 34, 71, 97,
+110, 104, 111, 32, 112, 195, 179, 115, 34, 10, 34, 80, 114, 101, 32, 97, 109, 112, 34, 32, 61, 32, 34, 80,
+114, 195, 169, 45, 97, 109, 112, 34, 10, 34, 80, 114, 101, 32, 98, 97, 110, 100, 34, 32, 61, 32, 34, 66,
+97, 110, 100, 97, 32, 112, 114, 195, 169, 34, 10, 34, 80, 114, 101, 100, 101, 108, 97, 121, 34, 32, 61, 32,
+34, 80, 114, 195, 169, 45, 100, 101, 108, 97, 121, 34, 10, 34, 81, 34, 32, 61, 32, 34, 81, 34, 10, 34,
+82, 105, 103, 104, 116, 34, 32, 61, 32, 34, 68, 105, 114, 101, 105, 116, 111, 34, 10, 34, 82, 111, 111, 109,
+32, 115, 105, 122, 101, 34, 32, 61, 32, 34, 84, 97, 109, 97, 110, 104, 111, 32, 100, 97, 32, 115, 97, 108,
+97, 34, 10, 34, 83, 101, 110, 115, 34, 32, 61, 32, 34, 83, 101, 110, 115, 46, 34, 10, 34, 83, 105, 110,
+101, 124, 84, 114, 105, 97, 110, 103, 108, 101, 124, 83, 113, 117, 97, 114, 101, 34, 32, 61, 32, 34, 83, 101,
+110, 111, 105, 100, 101, 124, 84, 114, 105, 195, 162, 110, 103, 117, 108, 111, 124, 81, 117, 97, 100, 114, 97, 100,
+97, 34, 10, 34, 83, 111, 102, 116, 32, 99, 108, 105, 112, 112, 101, 114, 34, 32, 61, 32, 34, 83, 111, 102,
+116, 32, 99, 108, 105, 112, 112, 101, 114, 34, 10, 34, 83, 112, 100, 34, 32, 61, 32, 34, 86, 101, 108, 111,
+99, 46, 34, 10, 34, 83, 112, 108, 105, 116, 32, 98, 97, 108, 97, 110, 99, 101, 34, 32, 61, 32, 34, 69,
+113, 117, 105, 108, 195, 173, 98, 114, 105, 111, 32, 100, 97, 32, 100, 105, 118, 105, 115, 195, 163, 111, 34, 10,
+34, 83, 112, 108, 105, 116, 32, 102, 114, 101, 113, 46, 34, 32, 61, 32, 34, 70, 114, 101, 113, 46, 32, 100,
+97, 32, 100, 105, 118, 105, 115, 195, 163, 111, 34, 10, 34, 83, 112, 114, 100, 34, 32, 61, 32, 34, 69, 115,
+112, 97, 108, 104, 46, 34, 10, 34, 84, 117, 110, 101, 34, 32, 61, 32, 34, 65, 102, 105, 110, 97, 195, 167,
+195, 163, 111, 34, 10, 34, 84, 117, 110, 105, 110, 103, 34, 32, 61, 32, 34, 65, 102, 105, 110, 97, 195, 167,
+195, 163, 111, 34, 10, 34, 86, 101, 108, 34, 32, 61, 32, 34, 86, 101, 108, 34, 10, 34, 83, 116, 97, 114,
+116, 32, 112, 104, 97, 115, 101, 34, 32, 61, 32, 34, 70, 97, 115, 101, 32, 105, 110, 105, 99, 105, 97, 108,
+34, 10, 34, 76, 47, 82, 32, 112, 104, 97, 115, 101, 34, 32, 61, 32, 34, 70, 97, 115, 101, 32, 69, 47,
+68, 34, 10, 34, 76, 101, 118, 101, 108, 115, 34, 32, 61, 32, 34, 78, 195, 173, 118, 101, 105, 115, 34, 10,
+34, 77, 111, 110, 111, 32, 105, 110, 112, 117, 116, 34, 32, 61, 32, 34, 69, 110, 116, 114, 97, 100, 97, 32,
+109, 111, 110, 111, 34, 10, 34, 68, 101, 108, 97, 121, 115, 34, 32, 61, 32, 34, 68, 101, 108, 97, 121, 115,
+34, 10, 34, 73, 124, 73, 73, 124, 69, 100, 105, 116, 34, 32, 61, 32, 34, 73, 124, 73, 73, 124, 69, 100,
+105, 116, 97, 114, 34, 10, 34, 84, 114, 105, 97, 110, 103, 108, 101, 124, 83, 105, 110, 101, 34, 32, 61, 32,
+34, 84, 114, 105, 195, 162, 110, 103, 117, 108, 111, 124, 83, 101, 110, 111, 105, 100, 101, 34, 10, 34, 72, 46,
+112, 97, 115, 115, 34, 32, 61, 32, 34, 80, 97, 115, 115, 97, 45, 65, 46, 34, 10, 34, 77, 111, 118, 101,
+109, 101, 110, 116, 34, 32, 61, 32, 34, 77, 111, 118, 105, 109, 101, 110, 116, 111, 34, 10, 34, 77, 111, 118,
+101, 32, 114, 97, 116, 101, 34, 32, 61, 32, 34, 84, 97, 120, 97, 32, 100, 111, 32, 109, 111, 118, 46, 34,
+10, 34, 77, 111, 100, 32, 114, 97, 116, 101, 34, 32, 61, 32, 34, 84, 97, 120, 97, 32, 100, 97, 32, 109,
+111, 100, 46, 34, 10, 34, 76, 70, 79, 32, 112, 104, 97, 115, 101, 32, 100, 105, 102, 34, 32, 61, 32, 34,
+68, 105, 102, 46, 32, 100, 101, 32, 102, 97, 115, 101, 32, 76, 70, 79, 34, 10, 34, 68, 101, 108, 97, 121,
+32, 108, 105, 110, 101, 115, 34, 32, 61, 32, 34, 76, 105, 110, 104, 97, 115, 32, 100, 101, 32, 100, 101, 108,
+97, 121, 34, 10, 34, 73, 110, 118, 101, 114, 116, 32, 119, 101, 116, 34, 32, 61, 32, 34, 73, 110, 118, 101,
+114, 116, 101, 114, 32, 109, 111, 108, 104, 97, 100, 111, 34, 10, 34, 65, 109, 111, 117, 110, 116, 58, 32, 100,
+114, 97, 103, 32, 117, 112, 32, 111, 114, 32, 100, 111, 119, 110, 32, 40, 67, 116, 114, 108, 58, 32, 102, 105,
+110, 101, 41, 34, 32, 61, 32, 34, 81, 117, 97, 110, 116, 105, 100, 97, 100, 101, 58, 32, 97, 114, 114, 97,
+115, 116, 101, 32, 112, 97, 114, 97, 32, 99, 105, 109, 97, 32, 111, 117, 32, 112, 97, 114, 97, 32, 98, 97,
+105, 120, 111, 32, 40, 67, 116, 114, 108, 58, 32, 102, 105, 110, 111, 41, 34, 10, 34, 83, 111, 117, 110, 100,
+103, 111, 111, 100, 105, 122, 101, 114, 32, 112, 114, 101, 115, 101, 116, 32, 65, 32, 116, 111, 32, 68, 32, 40,
+114, 101, 97, 100, 32, 102, 114, 111, 109, 32, 121, 111, 117, 114, 32, 70, 76, 32, 105, 110, 115, 116, 97, 108,
+108, 97, 116, 105, 111, 110, 41, 34, 32, 61, 32, 34, 80, 114, 101, 115, 101, 116, 32, 65, 32, 97, 32, 68,
+32, 100, 111, 32, 83, 111, 117, 110, 100, 103, 111, 111, 100, 105, 122, 101, 114, 32, 40, 108, 105, 100, 111, 32,
+100, 97, 32, 115, 117, 97, 32, 105, 110, 115, 116, 97, 108, 97, 195, 167, 195, 163, 111, 32, 100, 111, 32, 70,
+76, 41, 34, 10, 34, 68, 114, 97, 103, 32, 116, 104, 101, 32, 112, 111, 105, 110, 116, 58, 32, 98, 111, 116,
+104, 32, 118, 97, 108, 117, 101, 115, 32, 97, 116, 32, 111, 110, 99, 101, 34, 32, 61, 32, 34, 65, 114, 114,
+97, 115, 116, 101, 32, 111, 32, 112, 111, 110, 116, 111, 58, 32, 111, 115, 32, 100, 111, 105, 115, 32, 118, 97,
+108, 111, 114, 101, 115, 32, 100, 101, 32, 117, 109, 97, 32, 118, 101, 122, 34, 10, 34, 66, 97, 108, 97, 110,
+99, 101, 34, 32, 61, 32, 34, 66, 97, 108, 97, 110, 195, 167, 111, 34, 10, 34, 68, 114, 97, 102, 116, 34,
+32, 61, 32, 34, 82, 97, 115, 99, 117, 110, 104, 111, 34, 10, 34, 69, 110, 34, 32, 61, 32, 34, 69, 110,
+34, 10, 34, 70, 105, 108, 116, 101, 114, 34, 32, 61, 32, 34, 70, 105, 108, 116, 114, 111, 34, 10, 34, 72,
+81, 32, 101, 110, 118, 101, 108, 111, 112, 101, 115, 34, 32, 61, 32, 34, 69, 110, 118, 101, 108, 111, 112, 101,
+115, 32, 72, 81, 34, 10, 34, 77, 97, 105, 110, 34, 32, 61, 32, 34, 80, 114, 105, 110, 99, 105, 112, 97,
+108, 34, 10, 34, 79, 112, 101, 114, 97, 116, 111, 114, 115, 44, 32, 102, 105, 108, 116, 101, 114, 115, 44, 32,
+101, 102, 102, 101, 99, 116, 115, 32, 97, 110, 100, 32, 116, 104, 101, 32, 109, 97, 116, 114, 105, 120, 34, 32,
+61, 32, 34, 79, 112, 101, 114, 97, 100, 111, 114, 101, 115, 44, 32, 102, 105, 108, 116, 114, 111, 115, 44, 32,
+101, 102, 101, 105, 116, 111, 115, 32, 101, 32, 97, 32, 109, 97, 116, 114, 105, 122, 34, 10, 34, 79, 118, 101,
+114, 115, 97, 109, 112, 108, 105, 110, 103, 34, 32, 61, 32, 34, 83, 111, 98, 114, 101, 97, 109, 111, 115, 116,
+114, 97, 103, 101, 109, 34, 10, 34, 80, 104, 34, 32, 61, 32, 34, 70, 97, 34, 10, 34, 80, 110, 34, 32,
+61, 32, 34, 80, 110, 34, 10, 34, 80, 116, 34, 32, 61, 32, 34, 84, 109, 34, 10, 34, 81, 117, 97, 108,
+105, 116, 121, 34, 32, 61, 32, 34, 81, 117, 97, 108, 105, 100, 97, 100, 101, 34, 10, 34, 82, 101, 110, 100,
+101, 114, 34, 32, 61, 32, 34, 82, 101, 110, 100, 101, 114, 34, 10, 34, 83, 98, 34, 32, 61, 32, 34, 83,
+98, 34, 10, 34, 85, 110, 105, 115, 111, 110, 34, 32, 61, 32, 34, 85, 110, 195, 173, 115, 115, 111, 110, 111,
+34, 10, 34, 86, 108, 34, 32, 61, 32, 34, 86, 108, 34, 10, 34, 107, 101, 101, 112, 32, 116, 104, 101, 32,
+115, 97, 118, 101, 100, 32, 112, 97, 116, 99, 104, 34, 32, 61, 32, 34, 109, 97, 110, 116, 195, 170, 109, 32,
+111, 32, 112, 97, 116, 99, 104, 32, 115, 97, 108, 118, 111, 34, 10, 34, 84, 105, 109, 98, 114, 101, 34, 32,
+61, 32, 34, 84, 105, 109, 98, 114, 101, 34, 10, 34, 66, 108, 117, 114, 34, 32, 61, 32, 34, 68, 101, 115,
+102, 111, 113, 117, 101, 34, 10, 34, 84, 114, 101, 109, 34, 32, 61, 32, 34, 84, 114, 101, 109, 34, 10, 34,
+80, 114, 105, 115, 109, 34, 32, 61, 32, 34, 80, 114, 105, 115, 109, 97, 34, 10, 34, 72, 97, 114, 109, 111,
+110, 105, 122, 101, 114, 34, 32, 61, 32, 34, 72, 97, 114, 109, 111, 110, 105, 122, 97, 100, 111, 114, 34, 10,
+34, 86, 105, 98, 114, 97, 116, 111, 34, 32, 61, 32, 34, 86, 105, 98, 114, 97, 116, 111, 34, 10, 34, 80,
+108, 117, 99, 107, 34, 32, 61, 32, 34, 80, 108, 117, 99, 107, 34, 10, 34, 80, 104, 97, 115, 101, 114, 34,
+32, 61, 32, 34, 80, 104, 97, 115, 101, 114, 34, 10, 34, 69, 81, 34, 32, 61, 32, 34, 69, 81, 34, 10,
+34, 70, 105, 108, 116, 101, 114, 32, 49, 34, 32, 61, 32, 34, 70, 105, 108, 116, 114, 111, 32, 49, 34, 10,
+34, 79, 114, 100, 101, 114, 34, 32, 61, 32, 34, 79, 114, 100, 101, 109, 34, 10, 34, 80, 97, 114, 116, 32,
+65, 32, 47, 32, 66, 34, 32, 61, 32, 34, 80, 97, 114, 116, 101, 32, 65, 32, 47, 32, 66, 34, 10, 34,
+84, 104, 101, 32, 111, 116, 104, 101, 114, 32, 72, 97, 114, 109, 111, 114, 32, 99, 111, 110, 116, 114, 111, 108,
+115, 32, 107, 101, 101, 112, 32, 116, 104, 101, 32, 115, 97, 118, 101, 100, 32, 112, 97, 116, 99, 104, 34, 32,
+61, 32, 34, 79, 115, 32, 111, 117, 116, 114, 111, 115, 32, 99, 111, 110, 116, 114, 111, 108, 101, 115, 32, 100,
+111, 32, 72, 97, 114, 109, 111, 114, 32, 109, 97, 110, 116, 195, 170, 109, 32, 111, 32, 112, 97, 116, 99, 104,
+32, 115, 97, 108, 118, 111, 34, 10, 34, 83, 113, 117, 97, 114, 105, 122, 101, 34, 32, 61, 32, 34, 81, 117,
+97, 100, 114, 97, 116, 105, 122, 97, 114, 34, 10, 34, 80, 117, 110, 99, 104, 101, 114, 34, 32, 61, 32, 34,
+80, 117, 110, 99, 104, 101, 114, 34, 10, 34, 80, 114, 101, 115, 101, 114, 118, 101, 34, 32, 61, 32, 34, 80,
+114, 101, 115, 101, 114, 118, 97, 114, 34, 10, 34, 73, 109, 112, 97, 99, 116, 34, 32, 61, 32, 34, 73, 109,
+112, 97, 99, 116, 111, 34, 10, 34, 82, 101, 108, 97, 116, 105, 111, 110, 34, 32, 61, 32, 34, 82, 101, 108,
+97, 195, 167, 195, 163, 111, 34, 10, 34, 70, 114, 101, 113, 46, 34, 32, 61, 32, 34, 70, 114, 101, 113, 46,
+34, 10, 34, 82, 101, 115, 46, 34, 32, 61, 32, 34, 82, 101, 115, 46, 34, 10, 34, 80, 114, 101, 124, 80,
+111, 115, 34, 32, 61, 32, 34, 80, 114, 195, 169, 124, 80, 195, 179, 115, 34, 10, 34, 69, 110, 118, 34, 32,
+61, 32, 34, 69, 110, 118, 46, 34, 10, 34, 82, 101, 108, 32, 50, 34, 32, 61, 32, 34, 82, 101, 108, 46,
+32, 50, 34, 10, 34, 76, 77, 72, 32, 100, 101, 108, 34, 32, 61, 32, 34, 65, 116, 114, 97, 115, 111, 32,
+76, 77, 72, 34, 10, 34, 76, 77, 72, 32, 109, 105, 120, 34, 32, 61, 32, 34, 77, 105, 120, 32, 76, 77,
+72, 34, 10, 34, 79, 117, 116, 34, 32, 61, 32, 34, 83, 97, 195, 173, 100, 97, 34, 10, 34, 73, 110, 34,
+32, 61, 32, 34, 69, 110, 116, 114, 97, 100, 97, 34, 10, 34, 79, 110, 124, 67, 111, 109, 112, 32, 111, 102,
+102, 124, 77, 117, 116, 101, 100, 124, 79, 102, 102, 34, 32, 61, 32, 34, 76, 105, 103, 46, 124, 83, 101, 109,
+32, 99, 111, 109, 112, 46, 124, 77, 117, 100, 111, 124, 68, 101, 115, 108, 46, 34, 10, 34, 76, 111, 119, 124,
+77, 105, 100, 124, 72, 105, 103, 104, 124, 77, 97, 115, 116, 101, 114, 34, 32, 61, 32, 34, 71, 114, 97, 118,
+101, 115, 124, 77, 195, 169, 100, 105, 111, 115, 124, 65, 103, 117, 100, 111, 115, 124, 77, 97, 115, 116, 101, 114,
+34, 10, 34, 80, 101, 97, 107, 124, 82, 77, 83, 34, 32, 61, 32, 34, 80, 105, 99, 111, 124, 82, 77, 83,
+34, 10, 34, 65, 100, 118, 97, 110, 99, 101, 100, 34, 32, 61, 32, 34, 65, 118, 97, 110, 195, 167, 97, 100,
+111, 34, 10, 34, 77, 97, 105, 110, 124, 65, 100, 118, 97, 110, 99, 101, 100, 34, 32, 61, 32, 34, 80, 114,
+105, 110, 99, 105, 112, 97, 108, 124, 65, 118, 97, 110, 195, 167, 97, 100, 111, 34, 10, 34, 80, 104, 97, 115,
+105, 110, 103, 34, 32, 61, 32, 34, 80, 104, 97, 115, 105, 110, 103, 34, 10, 34, 77, 105, 110, 34, 32, 61,
+32, 34, 77, 195, 173, 110, 46, 34, 10, 34, 77, 97, 120, 34, 32, 61, 32, 34, 77, 195, 161, 120, 46, 34,
+10, 34, 77, 97, 110, 117, 97, 108, 34, 32, 61, 32, 34, 77, 97, 110, 117, 97, 108, 34, 10, 34, 84, 101,
+110, 115, 105, 111, 110, 34, 32, 61, 32, 34, 84, 101, 110, 115, 195, 163, 111, 34, 10, 34, 76, 80, 34, 32,
+61, 32, 34, 80, 66, 34, 10, 34, 72, 80, 34, 32, 61, 32, 34, 80, 65, 34, 10, 34, 77, 97, 110, 117,
+97, 108, 32, 102, 114, 101, 113, 46, 34, 32, 61, 32, 34, 70, 114, 101, 113, 46, 32, 109, 97, 110, 117, 97,
+108, 34, 10, 34, 82, 97, 116, 101, 32, 49, 34, 32, 61, 32, 34, 84, 97, 120, 97, 32, 49, 34, 10, 34,
+82, 97, 116, 101, 32, 50, 34, 32, 61, 32, 34, 84, 97, 120, 97, 32, 50, 34, 10, 34, 68, 101, 112, 116,
+104, 32, 115, 99, 97, 108, 101, 34, 32, 61, 32, 34, 69, 115, 99, 97, 108, 97, 32, 100, 101, 32, 112, 114,
+111, 102, 46, 34, 10, 34, 80, 117, 108, 108, 45, 100, 111, 119, 110, 34, 32, 61, 32, 34, 80, 117, 108, 108,
+45, 100, 111, 119, 110, 34, 10, 34, 67, 111, 108, 111, 117, 114, 32, 103, 97, 105, 110, 34, 32, 61, 32, 34,
+71, 97, 110, 104, 111, 32, 100, 101, 32, 99, 111, 114, 34, 10, 34, 67, 111, 108, 111, 117, 114, 32, 102, 114,
+101, 113, 46, 34, 32, 61, 32, 34, 70, 114, 101, 113, 46, 32, 100, 101, 32, 99, 111, 114, 34, 10, 34, 73,
+110, 112, 117, 116, 32, 72, 80, 34, 32, 61, 32, 34, 80, 65, 32, 100, 101, 32, 101, 110, 116, 114, 97, 100,
+97, 34, 10, 34, 70, 101, 101, 100, 98, 97, 99, 107, 32, 72, 80, 34, 32, 61, 32, 34, 80, 65, 32, 100,
+111, 32, 102, 101, 101, 100, 98, 97, 99, 107, 34, 10, 34, 69, 110, 103, 105, 110, 101, 32, 86, 50, 34, 32,
+61, 32, 34, 77, 111, 116, 111, 114, 32, 86, 50, 34, 10, 34, 73, 110, 118, 101, 114, 116, 32, 102, 101, 101,
+100, 98, 97, 99, 107, 34, 32, 61, 32, 34, 73, 110, 118, 101, 114, 116, 101, 114, 32, 102, 101, 101, 100, 98,
+97, 99, 107, 34, 10,
 };
 } // namespace lynx::i18n::data

+ 54 - 1
src/ui/MixerComponent.cpp

@@ -11,6 +11,7 @@
 #include "core/Effects.h"
 #include "engine/Text.h"
 #include "ui/ParametricEqEditor.h"
+#include "ui/PluginEditors.h"
 #include "ui/PluginWindow.h"
 #include "ui/HintBar.h"
 #include "ui/I18n.h"
@@ -1915,8 +1916,21 @@ void EffectsPanel::paint (juce::Graphics& g)
     const auto vocoder = slot.kind == EffectKind::vocoder;
     g.setColour (colour::textPrimary);
     g.setFont (font (type::title, true));
+    const auto editorButton = ! gate && ! vocoder && NativeEffectWindows::canOpen (slot.kind);
     g.drawText (juce::String::fromUTF8 (info.name), 10, (gate ? gateStepsBounds().getY() : vocoder ? bandLevelsBounds().getY() : knobBounds (0).getY()) - 28,
-                getWidth() - 20, 20, juce::Justification::centredLeft);
+                getWidth() - 20 - (editorButton ? editorButtonBounds().getWidth() + 6 : 0), 20, juce::Justification::centredLeft, true);
+
+    if (editorButton) // the effect's own window (FL's plugin window)
+    {
+        const auto b = editorButtonBounds().toFloat();
+        const auto hover = getMouseXYRelative().toFloat();
+        g.setColour (b.contains (hover) ? colour::bg5 : colour::bg4);
+        g.fillRoundedRectangle (b, radius::md);
+        icons::draw (g, Icon::plugin, b.withWidth (22.0f).withSizeKeepingCentre (13.0f, 13.0f).translated (4.0f, 0.0f), colour::textSecondary);
+        g.setColour (colour::textPrimary);
+        g.setFont (font (type::small));
+        g.drawFittedText (tr ("Editor"), b.withTrimmedLeft (24.0f).toNearestInt(), juce::Justification::centredLeft, 1, 0.8f);
+    }
 
     if (vocoder) // the analysis bands' levels, low to high (FL's band level strip)
     {
@@ -2076,6 +2090,14 @@ void EffectsPanel::mouseDown (const juce::MouseEvent& e)
         return;
     }
 
+    if (selectedSlot >= 0 && selectedSlot < (int) s->size() && (*s)[(std::size_t) selectedSlot].kind != EffectKind::volumeGate
+        && ! vocoderSelected() && NativeEffectWindows::canOpen ((*s)[(std::size_t) selectedSlot].kind)
+        && editorButtonBounds().contains (e.getPosition()))
+    {
+        openEditor (selectedSlot);
+        return;
+    }
+
     if (vocoderSelected() && bandLevelsBounds().contains (e.getPosition()))
     {
         if (e.mods.isPopupMenu())
@@ -2245,6 +2267,12 @@ ui::Hint EffectsPanel::hintAt (juce::Point<int> p)
         return ui::valueHint (specFor (param, selectedSlot), valueOf (param, selectedSlot), gesture);
 
     ui::Hint h;
+    if (const auto* s = slots(); s != nullptr && selectedSlot >= 0 && selectedSlot < (int) s->size()
+                                 && NativeEffectWindows::canOpen ((*s)[(std::size_t) selectedSlot].kind) && editorButtonBounds().contains (p))
+    {
+        h.text = tr ("Open the effect's window (its full controls, as in FL); double-clicking the slot does the same");
+        return h;
+    }
     if (track > 0 && armBounds().contains (p))
     {
         h.text = tr ("Record arm: Rec + Play records this insert's audio input into a Playlist clip  [RMB] input and monitoring");
@@ -2413,6 +2441,11 @@ void EffectsPanel::mouseDoubleClick (const juce::MouseEvent& e)
             engine.editSong ([t = track, i] (Song& song) { song.mixer[(std::size_t) t].effects[(std::size_t) i].mix = 1.0f; });
             return;
         }
+        else if (slotBounds (i).contains (e.getPosition()) && e.x >= slotBounds (i).getX() + 22)
+        {
+            openEditor (i); // double-click on the name: the effect's window (as clicking a slot in FL)
+            return;
+        }
 
     const auto p = knobAt (e.getPosition());
 
@@ -2525,6 +2558,26 @@ juce::Rectangle<int> EffectsPanel::pluginButtonBounds() const
     return { 20, slotsTop + maxEffectSlots * slotHeight + 30, getWidth() - 40, 30 };
 }
 
+void EffectsPanel::openEditor (int slot)
+{
+    const auto* s = slots();
+    if (s == nullptr || slot < 0 || slot >= (int) s->size())
+        return;
+    const auto kind = (*s)[(std::size_t) slot].kind;
+    if (kind == EffectKind::plugin)
+        openPluginWindow (slot);
+    else if (kind == EffectKind::parametricEq)
+        ParametricEqWindows::open (engine, track, slot);
+    else if (NativeEffectWindows::canOpen (kind))
+        NativeEffectWindows::open (engine, track, slot);
+}
+
+juce::Rectangle<int> EffectsPanel::editorButtonBounds() const
+{
+    // on the title row of the selected effect's knobs
+    return { getWidth() - 96, knobBounds (0).getY() - 29, 86, 20 };
+}
+
 void EffectsPanel::openPluginWindow (int slot)
 {
     auto effect = engine.getEffect (track, slot);

+ 2 - 0
src/ui/MixerComponent.h

@@ -213,6 +213,8 @@ private:
     void showAddMenu (int slot);
     void showSlotMenu (int slot);
     juce::Rectangle<int> pluginButtonBounds() const;
+    void openEditor (int slot);
+    juce::Rectangle<int> editorButtonBounds() const;
     void openPluginWindow (int slot);
     juce::Rectangle<int> fxSwitchBounds() const; // all effects on/off; right-click opens/closes their windows
     void toggleAllWindows();

+ 100 - 348
src/ui/ParametricEqEditor.cpp

@@ -1,8 +1,7 @@
-#include "ui/WindowOwner.h"
 #include "ui/ParametricEqEditor.h"
+#include "ui/PluginEditors.h"
 #include "core/ParametricEqFl.h"
 
-#include <map>
 
 #include "core/Effects.h"
 #include "engine/Text.h"
@@ -14,7 +13,6 @@ namespace lynx
 namespace
 {
 constexpr double minHz = 20.0, maxHz = 20000.0;
-constexpr double rangeDb = 24.0; // the graph spans -24 to +24 dB
 
 juce::Colour bandColour (int band)
 {
@@ -35,12 +33,12 @@ double hzForX (juce::Rectangle<float> area, float x)
     return minHz * std::pow (maxHz / minHz, juce::jlimit (0.0, 1.0, (double) ((x - area.getX()) / area.getWidth())));
 }
 
-float yForDb (juce::Rectangle<float> area, double db)
+float yForDb (juce::Rectangle<float> area, double db, double rangeDb)
 {
     return area.getCentreY() - area.getHeight() * 0.5f * (float) (juce::jlimit (-rangeDb, rangeDb, db) / rangeDb);
 }
 
-double dbForY (juce::Rectangle<float> area, float y)
+double dbForY (juce::Rectangle<float> area, float y, double rangeDb)
 {
     return juce::jlimit (-18.0, 18.0, (double) ((area.getCentreY() - y) / (area.getHeight() * 0.5f)) * rangeDb);
 }
@@ -60,333 +58,10 @@ bool hasGain (peq::BandType t)
     return t == peq::BandType::peak || t == peq::BandType::lowShelf || t == peq::BandType::highShelf;
 }
 
-// --- the editor -----------------------------------------------------------------------------
-
-class ParametricEqEditor final : public juce::Component,
-                                 private juce::ChangeListener
-{
-public:
-    ParametricEqEditor (AudioEngine& e, int t, int s)
-        : engine (e),
-          track (t),
-          slot (s)
-    {
-        engine.addChangeListener (this);
-        setSize (760, 380);
-    }
-
-    ~ParametricEqEditor() override { engine.removeChangeListener (this); }
-
-    // is the slot still a parametric EQ? (it may have been removed or replaced)
-    const EffectSlot* current() const
-    {
-        const auto& mixer = engine.getSong().mixer;
-
-        if (track < 0 || track >= (int) mixer.size() || slot < 0 || slot >= (int) mixer[(std::size_t) track].effects.size())
-            return nullptr;
-
-        const auto& s = mixer[(std::size_t) track].effects[(std::size_t) slot];
-        return s.kind == EffectKind::parametricEq ? &s : nullptr;
-    }
-
-    void paint (juce::Graphics& g) override
-    {
-        using namespace theme;
-        g.fillAll (colour::bg1);
-        const auto* s = current();
-
-        if (s == nullptr)
-        {
-            g.setColour (colour::textSecondary);
-            g.setFont (font (type::body));
-            g.drawText (tr ("The EQ was removed from this slot."), getLocalBounds(), juce::Justification::centred);
-            return;
-        }
-
-        const auto area = graphArea();
-        drawParametricEqCurve (g, area, s->params, sampleRate(), s->enabled, selected);
-
-        // handles
-        for (int b = 0; b < peq::bands; ++b)
-        {
-            const auto t = peq::type (s->params[(std::size_t) peq::param (b, 0)]);
-
-            if (t == peq::BandType::off)
-                continue;
-
-            const auto centre = handlePosition (*s, b);
-            const auto r = juce::Rectangle<float> (16.0f, 16.0f).withCentre (centre);
-            if (b == selected)
-            {
-                g.setColour (bandColour (b).withAlpha (0.25f));
-                g.fillEllipse (r.expanded (4.0f));
-            }
-            g.setColour (bandColour (b).withAlpha (b == selected ? 1.0f : 0.8f));
-            g.fillEllipse (r);
-            g.setColour (colour::bg0);
-            g.setFont (font (type::caption, true));
-            g.drawText (juce::String (b + 1), r, juce::Justification::centred);
-        }
-
-        // footer: the selected band and the output
-        auto footer = getLocalBounds().removeFromBottom (54).reduced (12, 6);
-        g.setFont (font (type::body));
-
-        if (selected >= 0)
-        {
-            const auto& p = s->params;
-            const auto t = peq::type (p[(std::size_t) peq::param (selected, 0)]);
-            juce::String text;
-            text << tr ("Band {0}: {1}", { juce::String (selected + 1), bandTypeName (t) }) << "   "
-                 << juce::String::fromUTF8 (formatEffectParam (EffectKind::parametricEq, peq::param (selected, 1), p[(std::size_t) peq::param (selected, 1)], 120.0).c_str());
-
-            if (hasGain (t))
-                text << "   " << juce::String::fromUTF8 (formatEffectParam (EffectKind::parametricEq, peq::param (selected, 2), p[(std::size_t) peq::param (selected, 2)], 120.0).c_str());
-
-            // FL's modes (imported Parametric EQ 2): bandwidth and FL's order for every band type
-            if (peq::flLaw (p))
-                text << "   " << juce::String::fromUTF8 (peq::widthText (p, selected).c_str()) << "   "
-                     << juce::String::fromUTF8 (peq::orderText (p, selected).c_str());
-            else if (t == peq::BandType::lowCut || t == peq::BandType::highCut)
-                text << "   " << juce::String::fromUTF8 (peq::orderText (p, selected).c_str());
-            else
-                text << "   " << juce::String::fromUTF8 (peq::widthText (p, selected).c_str());
-
-            g.setColour (bandColour (selected));
-            g.drawText (text, footer.removeFromTop (20), juce::Justification::centredLeft);
-        }
-        else
-        {
-            g.setColour (colour::textSecondary);
-            g.drawFittedText (tr ("Drag a handle (frequency and gain); mouse wheel = Q; right-click = type; double-click = 0 dB"),
-                              footer.removeFromTop (20), juce::Justification::centredLeft, 1, 0.8f);
-        }
-
-        g.setColour (colour::textPrimary);
-        g.drawFittedText (tr ("Output: {0}   (drag vertically here)",
-                              { juce::String::fromUTF8 (formatEffectParam (EffectKind::parametricEq, peq::outputParam, s->params[peq::outputParam], 120.0).c_str()) }),
-                          outputArea(), juce::Justification::centredLeft, 1, 0.8f);
-    }
-
-    void mouseDown (const juce::MouseEvent& e) override
-    {
-        const auto* s = current();
-
-        if (s == nullptr)
-            return;
-
-        dragOutput = outputArea().contains (e.getPosition());
-
-        if (dragOutput)
-        {
-            dragStartValue = s->params[peq::outputParam];
-            return;
-        }
-
-        selected = bandAt (*s, e.position);
-
-        if (selected < 0)
-        {
-            repaint();
-            return;
-        }
-
-        if (e.mods.isPopupMenu())
-        {
-            showBandMenu (selected);
-            return;
-        }
-
-        dragOffset = handlePosition (*s, selected) - e.position;
-        repaint();
-    }
-
-    void mouseDrag (const juce::MouseEvent& e) override
-    {
-        const auto* s = current();
-
-        if (s == nullptr)
-            return;
-
-        if (dragOutput)
-        {
-            const auto v = juce::jlimit (0.0f, 1.0f, dragStartValue - (float) e.getDistanceFromDragStartY() / 200.0f);
-            setParams ({ { peq::outputParam, v } });
-            return;
-        }
-
-        if (selected < 0 || e.mods.isPopupMenu())
-            return;
-
-        const auto area = graphArea();
-        const auto p = e.position + dragOffset;
-        const auto t = peq::type (s->params[(std::size_t) peq::param (selected, 0)]);
-        std::vector<std::pair<int, float>> changes { { peq::param (selected, 1), peq::hzValue (hzForX (area, p.x)) } };
-
-        if (hasGain (t))
-            changes.push_back ({ peq::param (selected, 2), peq::gainValue (dbForY (area, p.y)) });
-
-        setParams (changes);
-    }
-
-    void mouseDoubleClick (const juce::MouseEvent& e) override
-    {
-        const auto* s = current();
-
-        if (s == nullptr)
-            return;
-
-        if (const auto b = bandAt (*s, e.position); b >= 0)
-            setParams ({ { peq::param (b, 2), 0.5f } });
-        else if (outputArea().contains (e.getPosition()))
-            setParams ({ { peq::outputParam, 0.5f } });
-    }
-
-    void mouseWheelMove (const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel) override
-    {
-        const auto* s = current();
-
-        if (s == nullptr)
-            return;
-
-        auto b = bandAt (*s, e.position);
-        if (b < 0)
-            b = selected;
-        if (b < 0)
-            return;
-
-        selected = b;
-        const auto q = s->params[(std::size_t) peq::param (b, 3)];
-        // wheel up = narrower; FL's width grows the other way
-        const auto step = peq::flLaw (s->params) ? -wheel.deltaY * 0.15f : wheel.deltaY * 0.15f;
-        setParams ({ { peq::param (b, 3), juce::jlimit (0.0f, 1.0f, q + step) } });
-    }
-
-private:
-    void changeListenerCallback (juce::ChangeBroadcaster*) override { repaint(); }
-
-    double sampleRate() const { return juce::jmax (8000.0, engine.getTransport().sampleRate.load()); }
-
-    juce::Rectangle<float> graphArea() const { return getLocalBounds().reduced (12).withTrimmedBottom (54).toFloat(); }
-    juce::Rectangle<int> outputArea() const { return getLocalBounds().removeFromBottom (30).reduced (12, 4); }
-
-    juce::Point<float> handlePosition (const EffectSlot& s, int band) const
-    {
-        const auto area = graphArea();
-        const auto t = peq::type (s.params[(std::size_t) peq::param (band, 0)]);
-        const auto hz = peq::hz (s.params[(std::size_t) peq::param (band, 1)]);
-        const auto db = hasGain (t) ? peq::gainDb (s.params[(std::size_t) peq::param (band, 2)]) : 0.0;
-        return { xForHz (area, hz), yForDb (area, db) };
-    }
-
-    int bandAt (const EffectSlot& s, juce::Point<float> p) const
-    {
-        int best = -1;
-        float bestDistance = 12.0f;
-
-        for (int b = 0; b < peq::bands; ++b)
-            if (peq::type (s.params[(std::size_t) peq::param (b, 0)]) != peq::BandType::off)
-                if (const auto d = handlePosition (s, b).getDistanceFrom (p); d < bestDistance)
-                {
-                    best = b;
-                    bestDistance = d;
-                }
-
-        return best;
-    }
-
-    void setParams (const std::vector<std::pair<int, float>>& changes)
-    {
-        engine.editSong ([t = track, sl = slot, changes] (Song& song) {
-            if (t >= (int) song.mixer.size() || sl >= (int) song.mixer[(std::size_t) t].effects.size())
-                return;
-
-            auto& params = song.mixer[(std::size_t) t].effects[(std::size_t) sl].params;
-            for (auto [p, v] : changes)
-                params[(std::size_t) p] = v;
-        });
-    }
-
-    void showBandMenu (int band)
-    {
-        juce::PopupMenu menu;
-        menu.addSectionHeader (tr ("Band {0}", { juce::String (band + 1) }));
-        const auto* s = current();
-        const auto currentType = peq::type (s->params[(std::size_t) peq::param (band, 0)]);
-
-        for (int t = 0; t < peq::bandTypes; ++t)
-            menu.addItem (bandTypeName ((peq::BandType) t), true, (int) currentType == t, [this, band, t] {
-                setParams ({ { peq::param (band, 0), peq::typeValue ((peq::BandType) t) } });
-            });
-
-        if (peq::flLaw (s->params) && ! (peqfl::lawOf (s->params) == peqfl::Law::peq1))
-        {
-            // FL's Parametric EQ 2 orders (Steep 8 … 2 … Gentle 8) apply to every band type
-            menu.addSeparator();
-            auto p = s->params;
-            for (int order = 0; order < 7; ++order)
-            {
-                p[(std::size_t) (peq::slopeParam + band)] = (float) order / 6.0f;
-                const auto current = (int) std::lround (s->params[(std::size_t) (peq::slopeParam + band)] * 6.0f) == order;
-                menu.addItem (juce::String::fromUTF8 (peq::orderText (p, band).c_str()), true, current,
-                              [this, band, order] { setParams ({ { peq::slopeParam + band, (float) order / 6.0f } }); });
-            }
-        }
-        else if (! peq::flLaw (s->params) && (currentType == peq::BandType::lowCut || currentType == peq::BandType::highCut))
-        {
-            menu.addSeparator();
-            for (int stages = 1; stages <= 4; ++stages)
-                menu.addItem (juce::String (12 * stages) + " dB/oct", true, peq::slopeStages (s->params[(std::size_t) (peq::slopeParam + band)]) == stages,
-                              [this, band, stages] { setParams ({ { peq::slopeParam + band, peq::slopeValue (stages) } }); });
-        }
-
-        menu.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (this).withMousePosition());
-    }
-
-    AudioEngine& engine;
-    int track, slot;
-    int selected = -1;
-    juce::Point<float> dragOffset;
-    bool dragOutput = false;
-    float dragStartValue = 0.5f;
-};
-
-class ParametricEqWindow final : public juce::DocumentWindow
-{
-public:
-    ParametricEqWindow (AudioEngine& engine, int track, int slot, const juce::String& title)
-        : DocumentWindow (title, theme::colour::bg1, DocumentWindow::closeButton | DocumentWindow::minimiseButton)
-    {
-        setUsingNativeTitleBar (true);
-        setContentOwned (new ParametricEqEditor (engine, track, slot), true);
-        setResizable (true, false);
-        centreWithSize (getWidth(), getHeight());
-        setVisible (true);
-        keepAboveMainWindow (*this);
-    }
-
-    void closeButtonPressed() override;
-};
-
-std::map<std::pair<int, int>, std::unique_ptr<ParametricEqWindow>>& windows()
-{
-    static std::map<std::pair<int, int>, std::unique_ptr<ParametricEqWindow>> open;
-    return open;
-}
-
-void ParametricEqWindow::closeButtonPressed()
-{
-    for (auto& [key, window] : windows())
-        if (window.get() == this)
-        {
-            juce::MessageManager::callAsync ([k = key] { windows().erase (k); });
-            return;
-        }
-}
 } // namespace
 
 void drawParametricEqCurve (juce::Graphics& g, juce::Rectangle<float> area, const EffectParams& params, double sampleRate,
-                            bool enabled, int highlightBand)
+                            bool enabled, int highlightBand, double rangeDb, bool labels)
 {
     using namespace theme;
     g.setColour (colour::bg0);
@@ -397,11 +72,12 @@ void drawParametricEqCurve (juce::Graphics& g, juce::Rectangle<float> area, cons
     for (double hz : { 50.0, 100.0, 200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0 })
         g.drawVerticalLine ((int) xForHz (area, hz), area.getY(), area.getBottom());
     for (double db : { -18.0, -12.0, -6.0, 6.0, 12.0, 18.0 })
-        g.drawHorizontalLine ((int) yForDb (area, db), area.getX(), area.getRight());
+        if (std::abs (db) < rangeDb)
+        g.drawHorizontalLine ((int) yForDb (area, db, rangeDb), area.getX(), area.getRight());
     g.setColour (colour::gridBar);
-    g.drawHorizontalLine ((int) yForDb (area, 0.0), area.getX(), area.getRight());
+    g.drawHorizontalLine ((int) yForDb (area, 0.0, rangeDb), area.getX(), area.getRight());
 
-    if (area.getWidth() > 300.0f)
+    if (labels && area.getWidth() > 300.0f)
     {
         g.setColour (colour::textDisabled);
         g.setFont (font (10.0f));
@@ -416,7 +92,7 @@ void drawParametricEqCurve (juce::Graphics& g, juce::Rectangle<float> area, cons
     for (int i = 0; i <= steps; ++i)
     {
         const auto x = area.getX() + area.getWidth() * (float) i / (float) steps;
-        const auto y = yForDb (area, peq::responseDb (params, sampleRate, hzForX (area, x)));
+        const auto y = yForDb (area, peq::responseDb (params, sampleRate, hzForX (area, x)), rangeDb);
 
         if (i == 0)
             curve.startNewSubPath (x, y);
@@ -438,32 +114,108 @@ void drawParametricEqCurve (juce::Graphics& g, juce::Rectangle<float> area, cons
 
 std::unique_ptr<juce::Component> makeParametricEqEditor (AudioEngine& engine, int track, int slot)
 {
-    return std::make_unique<ParametricEqEditor> (engine, track, slot);
+    return makeNativeEffectEditor (engine, track, slot, 1.25f);
 }
 
 namespace ParametricEqWindows
 {
 void open (AudioEngine& engine, int track, int slot)
 {
-    auto& open = windows();
-    const auto key = std::make_pair (track, slot);
+    NativeEffectWindows::open (engine, track, slot);
+}
+
+void closeAll()
+{
+    NativeEffectWindows::closeAll();
+}
+} // namespace ParametricEqWindows
+
+namespace peqview
+{
+juce::Colour bandColour (int band) { return lynx::bandColour (band); }
+float xForHz (juce::Rectangle<float> area, double hz) { return lynx::xForHz (area, hz); }
+double hzForX (juce::Rectangle<float> area, float x) { return lynx::hzForX (area, x); }
+float yForDb (juce::Rectangle<float> area, double db, double rangeDb) { return lynx::yForDb (area, db, rangeDb); }
+double dbForY (juce::Rectangle<float> area, float y, double rangeDb) { return lynx::dbForY (area, y, rangeDb); }
+juce::String bandTypeName (int type) { return lynx::bandTypeName ((peq::BandType) type); }
+
+bool hasGain (const EffectParams& params, int band)
+{
+    return lynx::hasGain (peq::type (params[(std::size_t) peq::param (band, 0)]));
+}
+
+juce::Point<float> handlePosition (juce::Rectangle<float> area, const EffectParams& params, int band, double rangeDb)
+{
+    const auto hz = peq::hz (params[(std::size_t) peq::param (band, 1)]);
+    const auto db = hasGain (params, band) ? peq::gainDb (params[(std::size_t) peq::param (band, 2)]) : 0.0;
+    return { xForHz (area, hz), yForDb (area, db, rangeDb) };
+}
+
+int bandAt (juce::Rectangle<float> area, const EffectParams& params, juce::Point<float> p, double rangeDb)
+{
+    int best = -1;
+    float bestDistance = 12.0f;
+    for (int b = 0; b < peq::bands; ++b)
+        if (peq::type (params[(std::size_t) peq::param (b, 0)]) != peq::BandType::off)
+            if (const auto d = handlePosition (area, params, b, rangeDb).getDistanceFrom (p); d < bestDistance)
+            {
+                best = b;
+                bestDistance = d;
+            }
+    return best;
+}
+
+void showBandMenu (juce::Component& target, const EffectParams& params, int band, std::function<void (std::vector<std::pair<int, float>>)> set)
+{
+    juce::PopupMenu menu;
+    menu.addSectionHeader (tr ("Band {0}", { juce::String (band + 1) }));
+    const auto currentType = peq::type (params[(std::size_t) peq::param (band, 0)]);
 
-    if (auto it = open.find (key); it != open.end())
+    for (int t = 0; t < peq::bandTypes; ++t)
+        menu.addItem (lynx::bandTypeName ((peq::BandType) t), true, (int) currentType == t, [set, band, t] {
+            set ({ { peq::param (band, 0), peq::typeValue ((peq::BandType) t) } });
+        });
+
+    if (peq::flLaw (params) && ! (peqfl::lawOf (params) == peqfl::Law::peq1))
     {
-        it->second->toFront (true);
-        return;
+        // FL's Parametric EQ 2 orders (Steep 8 … 2 … Gentle 8) apply to every band type
+        menu.addSeparator();
+        auto p = params;
+        for (int order = 0; order < 7; ++order)
+        {
+            p[(std::size_t) (peq::slopeParam + band)] = (float) order / 6.0f;
+            const auto current = (int) std::lround (params[(std::size_t) (peq::slopeParam + band)] * 6.0f) == order;
+            menu.addItem (juce::String::fromUTF8 (peq::orderText (p, band).c_str()), true, current,
+                          [set, band, order] { set ({ { peq::slopeParam + band, (float) order / 6.0f } }); });
+        }
+    }
+    else if (! peq::flLaw (params) && (currentType == peq::BandType::lowCut || currentType == peq::BandType::highCut))
+    {
+        menu.addSeparator();
+        for (int stages = 1; stages <= 4; ++stages)
+            menu.addItem (juce::String (12 * stages) + " dB/oct", true, peq::slopeStages (params[(std::size_t) (peq::slopeParam + band)]) == stages,
+                          [set, band, stages] { set ({ { peq::slopeParam + band, peq::slopeValue (stages) } }); });
     }
 
-    const auto& mixer = engine.getSong().mixer;
-    const auto name = track < (int) mixer.size() ? juce::String::fromUTF8 (mixer[(std::size_t) track].name.c_str()) : juce::String();
-    const auto title = tr ("Parametric EQ - {0} (slot {1})",
-                           { track == 0 ? juce::String ("Master") : name.isNotEmpty() ? name : "Insert " + juce::String (track), juce::String (slot + 1) });
-    open[key] = std::make_unique<ParametricEqWindow> (engine, track, slot, title);
+    menu.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (&target).withMousePosition());
 }
 
-void closeAll()
-{
-    windows().clear();
+juce::String bandText (const EffectParams& p, int band)
+{
+    const auto t = peq::type (p[(std::size_t) peq::param (band, 0)]);
+    juce::String text;
+    text << tr ("Band {0}: {1}", { juce::String (band + 1), lynx::bandTypeName (t) }) << "   "
+         << juce::String::fromUTF8 (formatEffectParam (EffectKind::parametricEq, peq::param (band, 1), p[(std::size_t) peq::param (band, 1)], 120.0).c_str());
+    if (lynx::hasGain (t))
+        text << "   " << juce::String::fromUTF8 (formatEffectParam (EffectKind::parametricEq, peq::param (band, 2), p[(std::size_t) peq::param (band, 2)], 120.0).c_str());
+    // FL's modes (imported Parametric EQ 2): bandwidth and FL's order for every band type
+    if (peq::flLaw (p))
+        text << "   " << juce::String::fromUTF8 (peq::widthText (p, band).c_str()) << "   " << juce::String::fromUTF8 (peq::orderText (p, band).c_str());
+    else if (t == peq::BandType::lowCut || t == peq::BandType::highCut)
+        text << "   " << juce::String::fromUTF8 (peq::orderText (p, band).c_str());
+    else
+        text << "   " << juce::String::fromUTF8 (peq::widthText (p, band).c_str());
+    return text;
 }
-} // namespace ParametricEqWindows
+} // namespace peqview
 } // namespace lynx

+ 27 - 6
src/ui/ParametricEqEditor.h

@@ -1,24 +1,45 @@
 #pragma once
 
+#include <functional>
+
 #include <juce_gui_basics/juce_gui_basics.h>
 
 #include "engine/AudioEngine.h"
 
 namespace lynx
 {
-// 7-band parametric EQ editor (like FL's Parametric EQ 2): response curve with one
-// handle per band. Dragging a handle changes frequency and gain; the mouse wheel changes Q; right-click
-// picks the type and slope; double-click resets the gain.
+// 7-band parametric EQ (like FL's Parametric EQ 2). Its window is the native effect editor in FL's arrangement
+// (ui/PluginEditors.h, core/PluginLayout.cpp): the response curve with one handle per band (drag = frequency and gain,
+// wheel = Q / bandwidth, right-click = type and slope, double-click = 0 dB), the output fader and one column per band
+// (type, gain fader, FREQ and BW knobs). These are the EQ's drawing helpers and the window entry points.
 namespace ParametricEqWindows
 {
 void open (AudioEngine& engine, int track, int slot);
-void closeAll();
+void closeAll(); // closes every native effect window
 } // namespace ParametricEqWindows
 
 // The editor alone (for --snapshot).
 std::unique_ptr<juce::Component> makeParametricEqEditor (AudioEngine& engine, int track, int slot);
 
-// Draws the EQ curve (also used in the mixer panel thumbnail).
+// Draws the EQ curve (also used in the mixer panel thumbnail); the graph spans ±rangeDb.
 void drawParametricEqCurve (juce::Graphics& g, juce::Rectangle<float> area, const EffectParams& params, double sampleRate,
-                            bool enabled, int highlightBand = -1);
+                            bool enabled, int highlightBand = -1, double rangeDb = 24.0, bool labels = true);
+
+namespace peqview
+{
+juce::Colour bandColour (int band);
+float xForHz (juce::Rectangle<float> area, double hz);
+double hzForX (juce::Rectangle<float> area, float x);
+float yForDb (juce::Rectangle<float> area, double db, double rangeDb);
+double dbForY (juce::Rectangle<float> area, float y, double rangeDb);
+juce::String bandTypeName (int type);
+bool hasGain (const EffectParams& params, int band);
+// the handle of a band in the graph
+juce::Point<float> handlePosition (juce::Rectangle<float> area, const EffectParams& params, int band, double rangeDb);
+int bandAt (juce::Rectangle<float> area, const EffectParams& params, juce::Point<float> p, double rangeDb);
+// right-click menu of a band: type, then FL's orders or the cut slope; `set` applies (param, value) changes
+void showBandMenu (juce::Component& target, const EffectParams& params, int band, std::function<void (std::vector<std::pair<int, float>>)> set);
+// one line about the band (type, frequency, gain, width / order)
+juce::String bandText (const EffectParams& params, int band);
+} // namespace peqview
 } // namespace lynx

+ 1944 - 0
src/ui/PluginEditors.cpp

@@ -0,0 +1,1944 @@
+#include "ui/PluginEditors.h"
+
+#include <cstring>
+#include <map>
+#include <array>
+#include <optional>
+
+#include "core/Effects.h"
+#include "core/FlEffects.h"
+#include "core/FruityShapers.h"
+#include "core/GrossBeat.h"
+#include "core/MaximusFx.h"
+#include "core/ParametricEqFl.h"
+#include "core/PluginLayout.h"
+#include "engine/Text.h"
+#include "ui/I18n.h"
+#include "ui/Icons.h"
+#include "ui/ParametricEqEditor.h"
+#include "ui/Theme.h"
+#include "ui/ValueControl.h"
+#include "ui/WindowOwner.h"
+
+namespace lynx
+{
+namespace
+{
+using plugui::Item;
+using plugui::LayoutItem;
+
+constexpr float headerHeight = 26.0f; // the presets bar (not scaled with the body)
+
+bool hasStyle (const LayoutItem& item, std::uint16_t flag) noexcept
+{
+    return (item.style & flag) != 0;
+}
+
+// a row of tabs drawn as a column (taller than wide: Maximus' band selector)
+bool isVertical (const LayoutItem& item) noexcept
+{
+    return item.type == Item::tabs && item.h > item.w * 1.2f;
+}
+
+// --- the editor ----------------------------------------------------------------------------------
+
+class NativeEffectEditor final : public juce::Component,
+                                 public ui::HintSource,
+                                 private juce::ChangeListener
+{
+public:
+    NativeEffectEditor (AudioEngine& e, int t, int s, float initialScale, int initialPage)
+        : engine (e),
+          track (t),
+          slot (s)
+    {
+        if (const auto* fx = current())
+        {
+            kind = fx->kind;
+            layout = &plugui::layoutFor (kind);
+            if (kind == EffectKind::maximus) // Soundgoodizer runs on the Maximus engine: its own page
+                if (const auto blob = maximusfx::unpack (fx->state); blob && blob->build == hlfx::MaximusBuild::soundgoodizer)
+                    layout = &plugui::soundgoodizerLayout();
+        }
+
+        page = initialPage;
+        if (stateBacked() && initialPage == 0)
+            if (const auto* fx = current())
+                page = maximusfx::selectedBand (fx->state); // FL reopens Maximus on the band selected when it was saved
+        engine.addChangeListener (this);
+        const auto& l = activeLayout();
+        setSize ((int) std::ceil ((float) l.width * initialScale), (int) std::ceil ((float) l.height * initialScale + headerHeight));
+    }
+
+    ~NativeEffectEditor() override
+    {
+        engine.removeChangeListener (this);
+        ui::hideValueTip();
+    }
+
+    // the design size (for the window's aspect ratio)
+    juce::Point<int> designSize() const { return { activeLayout().width, activeLayout().height }; }
+
+    const EffectSlot* current() const
+    {
+        const auto& mixer = engine.getSong().mixer;
+
+        if (track < 0 || track >= (int) mixer.size() || slot < 0 || slot >= (int) mixer[(std::size_t) track].effects.size())
+            return nullptr;
+
+        const auto& fx = mixer[(std::size_t) track].effects[(std::size_t) slot];
+        return layout == nullptr || fx.kind == kind ? &fx : nullptr;
+    }
+
+    // --- geometry ----------------------------------------------------------------------------------
+
+    const plugui::Layout& activeLayout() const
+    {
+        static const plugui::Layout empty { "", 360, 120, {} };
+        return layout != nullptr ? *layout : empty;
+    }
+
+    float scale() const
+    {
+        const auto& l = activeLayout();
+        return juce::jmax (0.25f, juce::jmin ((float) getWidth() / (float) l.width, ((float) getHeight() - headerHeight) / (float) l.height));
+    }
+
+    juce::Rectangle<float> rectOf (const LayoutItem& item) const
+    {
+        const auto s = scale();
+        return { item.x * s, headerHeight + item.y * s, item.w * s, item.h * s };
+    }
+
+    bool visible (const LayoutItem& item) const
+    {
+        const auto* fx = current();
+        return fx != nullptr && plugui::isShown (kind, item, page, fx->params);
+    }
+
+    // the knob's circle inside its cell (the caption takes the rest)
+    juce::Rectangle<float> knobCircle (const LayoutItem& item) const
+    {
+        auto r = rectOf (item);
+        const auto s = scale();
+        if (hasStyle (item, plugui::valueAbove))
+            r.removeFromTop (16.0f * s);
+        if (! hasStyle (item, plugui::noCaption))
+            r.removeFromBottom ((hasStyle (item, plugui::showValue) ? 26.0f : 14.0f) * s);
+        const auto d = juce::jmin (r.getWidth(), r.getHeight());
+        return r.withSizeKeepingCentre (d, d).withY (r.getY());
+    }
+
+    int itemAt (juce::Point<float> p) const
+    {
+        const auto& items = activeLayout().items;
+
+        for (int i = (int) items.size(); --i >= 0;)
+        {
+            const auto& item = items[(std::size_t) i];
+            if (! visible (item) || item.type == Item::section || item.type == Item::label)
+                continue;
+            if (item.type == Item::display && rectOf (item).contains (p) && (juce::String (item.display) == "eq" || juce::String (item.display) == "xy"
+                                                                    || juce::String (item.display) == "sgamount" || juce::String (item.display) == "sgpresets"))
+                return i;
+            if (item.type == Item::display || (item.param == nullptr && ! hasStyle (item, plugui::pageTabs)))
+                continue;
+            if (rectOf (item).contains (p))
+                return i;
+        }
+        return -1;
+    }
+
+    int paramOf (const LayoutItem& item) const { return item.param != nullptr ? plugui::paramIndex (kind, item.param) : -1; }
+
+    // --- values --------------------------------------------------------------------------------------
+
+    // Maximus: the controls edit the parameters stored in the slot's state (core/MaximusFx.h), not EffectSlot::params
+    bool stateBacked() const { return plugui::usesStateParams (kind) && layout != &plugui::soundgoodizerLayout(); }
+
+    static float stateNormalised (int param, int raw)
+    {
+        const auto& p = maximusfx::stateParams()[(std::size_t) param];
+        return p.maximum > p.minimum ? (float) (raw - p.minimum) / (float) (p.maximum - p.minimum) : 0.0f;
+    }
+
+    static int stateRaw (int param, float value)
+    {
+        const auto& p = maximusfx::stateParams()[(std::size_t) param];
+        return p.minimum + juce::roundToInt (juce::jlimit (0.0f, 1.0f, value) * (float) (p.maximum - p.minimum));
+    }
+
+    float valueOf (int param) const
+    {
+        const auto* fx = current();
+        if (stateBacked())
+        {
+            if (fx == nullptr || param < 0 || param >= plugui::paramCount (kind))
+                return 0.0f;
+            const auto raw = maximusfx::stateParam (fx->state, param);
+            return stateNormalised (param, raw.value_or (maximusfx::stateParams()[(std::size_t) param].defaultValue));
+        }
+        return fx != nullptr && param >= 0 && param < maxEffectParams ? fx->params[(std::size_t) param] : 0.0f;
+    }
+
+    void setValue (int param, float value)
+    {
+        if (stateBacked())
+        {
+            const auto* fx = current();
+            if (fx == nullptr || param < 0 || param >= plugui::paramCount (kind))
+                return;
+            const auto raw = stateRaw (param, value);
+            if (maximusfx::stateParam (fx->state, param) == raw)
+                return;
+            engine.editSong ([t = track, s = slot, bytes = maximusfx::withStateParam (fx->state, param, raw)] (Song& song) {
+                song.mixer[(std::size_t) t].effects[(std::size_t) s].state = bytes;
+            });
+            return;
+        }
+        if (current() == nullptr || param < 0 || param >= maxEffectParams)
+            return;
+        engine.editSong ([t = track, s = slot, param, v = juce::jlimit (0.0f, 1.0f, value)] (Song& song) {
+            song.mixer[(std::size_t) t].effects[(std::size_t) s].params[(std::size_t) param] = v;
+        });
+    }
+
+    juce::String valueText (int param, float value) const
+    {
+        const auto* fx = current();
+        if (fx == nullptr || param < 0)
+            return {};
+        if (stateBacked())
+            return param < plugui::paramCount (kind) ? utf8 (maximusfx::stateParamText (param, stateRaw (param, value)).c_str()) : juce::String();
+        return utf8 (formatEffectParam (kind, param, value, engine.getSong().bpm, fx->params).c_str());
+    }
+
+    juce::String trackName() const
+    {
+        const auto& mixer = engine.getSong().mixer;
+        if (track == 0)
+            return tr ("Master");
+        const auto name = track < (int) mixer.size() ? juce::String::fromUTF8 (mixer[(std::size_t) track].name.c_str()) : juce::String();
+        return name.isNotEmpty() ? name : tr ("Insert {0}", { juce::String (track) });
+    }
+
+    ui::ValueSpec specFor (const LayoutItem& item) const
+    {
+        ui::ValueSpec spec;
+        const auto param = paramOf (item);
+        const auto& info = effectInfo (kind);
+
+        if (stateBacked())
+        {
+            // not automatable (the values live in the state): drag, wheel, reset and type-in only
+            if (param < 0 || param >= plugui::paramCount (kind))
+                return spec;
+            const auto& p = maximusfx::stateParams()[(std::size_t) param];
+            spec.name = trackName() + " - " + utf8 (info.name) + " - " + utf8 (p.name);
+            spec.defaultValue = stateNormalised (param, p.defaultValue);
+            spec.pixelsForRange = item.type == Item::hslider ? juce::jmax (60.0, (double) rectOf (item).getWidth()) : 180.0;
+            if (item.steps > 0)
+                spec.interval = 1.0 / item.steps;
+            else if (p.maximum - p.minimum <= 8)
+                spec.interval = 1.0 / (p.maximum - p.minimum);
+            spec.toText = [this, param] (double v) { return valueText (param, (float) v); };
+            spec.fromText = ui::inverseOf (spec.toText, 0.0, 1.0);
+            return spec;
+        }
+
+        if (param < 0 || param >= (int) info.params.size())
+            return spec;
+
+        spec.name = trackName() + " - " + utf8 (info.name) + " - " + utf8 (info.params[(std::size_t) param].name);
+        spec.defaultValue = info.params[(std::size_t) param].defaultValue;
+        spec.pixelsForRange = item.type == Item::hslider ? juce::jmax (60.0, (double) rectOf (item).getWidth())
+                              : item.type == Item::vslider ? juce::jmax (60.0, (double) rectOf (item).getHeight())
+                                                           : 180.0;
+        if (item.steps > 0)
+            spec.interval = 1.0 / item.steps;
+        spec.toText = [this, param] (double v) { return valueText (param, (float) v); };
+        spec.fromText = ui::inverseOf (spec.toText, 0.0, 1.0);
+        spec.target = AutomationTarget { AutomationTargetKind::effectParam, track, slot, param };
+        return spec;
+    }
+
+    // --- painting ------------------------------------------------------------------------------------
+
+    void paint (juce::Graphics& g) override
+    {
+        using namespace theme;
+        g.fillAll (colour::bg1);
+        const auto* fx = current();
+
+        if (fx == nullptr)
+        {
+            g.setColour (colour::textSecondary);
+            g.setFont (font (type::body));
+            g.drawText (tr ("The effect was removed from this slot."), getLocalBounds(), juce::Justification::centred);
+            return;
+        }
+
+        paintHeader (g, *fx);
+
+        const auto& items = activeLayout().items;
+        for (int i = 0; i < (int) items.size(); ++i)
+            if (visible (items[(std::size_t) i]))
+                paintItem (g, items[(std::size_t) i], i, *fx);
+    }
+
+    juce::Rectangle<float> headerArea() const { return { 0.0f, 0.0f, (float) getWidth(), headerHeight }; }
+    juce::Rectangle<float> menuButton() const { return { 4.0f, 3.0f, 22.0f, 20.0f }; }
+    juce::Rectangle<float> nextButton() const { return { (float) getWidth() - 26.0f, 3.0f, 20.0f, 20.0f }; }
+    juce::Rectangle<float> prevButton() const { return nextButton().translated (-22.0f, 0.0f); }
+    juce::Rectangle<float> presetBox() const
+    {
+        const auto w = juce::jlimit (90.0f, 220.0f, (float) getWidth() * 0.32f);
+        return { prevButton().getX() - w - 4.0f, 3.0f, w, 20.0f };
+    }
+
+    void paintHeader (juce::Graphics& g, const EffectSlot& fx)
+    {
+        using namespace theme;
+        const auto area = headerArea();
+        g.setColour (colour::bg3);
+        g.fillRect (area);
+        g.setColour (colour::border);
+        g.drawHorizontalLine ((int) area.getBottom() - 1, 0.0f, area.getRight());
+
+        // options menu (FL's arrow at the left of the plugin's title)
+        drawArrow (g, menuButton(), 0.0f, hoverHeader == 1 ? colour::textPrimary : colour::textSecondary);
+
+        // bypass LED + name + where it is
+        const auto led = juce::Rectangle<float> (8.0f, 8.0f).withCentre ({ menuButton().getRight() + 9.0f, area.getCentreY() });
+        g.setColour (fx.enabled ? colour::ledOn : colour::ledOff);
+        g.fillEllipse (led);
+        auto text = area.withLeft (led.getRight() + 8.0f).withRight (presetBox().getX() - 6.0f);
+        const auto name = layout == &plugui::soundgoodizerLayout() ? juce::String ("Soundgoodizer") : utf8 (effectInfo (kind).name);
+        g.setFont (font (type::body, true));
+        g.setColour (colour::textPrimary);
+        const auto nameWidth = juce::jmin (text.getWidth(), juce::GlyphArrangement::getStringWidth (g.getCurrentFont(), name) + 2.0f);
+        g.drawText (name, text.removeFromLeft (nameWidth), juce::Justification::centredLeft, true);
+        g.setFont (font (type::small));
+        g.setColour (colour::textSecondary);
+        g.drawText ("(" + trackName() + ")", text.withTrimmedLeft (6.0f), juce::Justification::centredLeft, true);
+
+        // presets: name, previous, next
+        const auto box = presetBox();
+        g.setColour (hoverHeader == 2 ? colour::bg5 : colour::bg2);
+        g.fillRoundedRectangle (box, radius::sm);
+        g.setColour (colour::textSecondary);
+        g.setFont (font (type::small));
+        g.drawText (presetName.isNotEmpty() ? presetName : tr ("(no preset)"), box.reduced (8.0f, 0.0f), juce::Justification::centredRight, true);
+        drawArrow (g, prevButton(), juce::MathConstants<float>::pi, hoverHeader == 3 ? colour::accent : colour::textSecondary);
+        drawArrow (g, nextButton(), 0.0f, hoverHeader == 4 ? colour::accent : colour::textSecondary);
+    }
+
+    static void drawArrow (juce::Graphics& g, juce::Rectangle<float> r, float angle, juce::Colour c)
+    {
+        juce::Path p;
+        p.addTriangle (-3.0f, -5.0f, -3.0f, 5.0f, 4.0f, 0.0f);
+        p.applyTransform (juce::AffineTransform::rotation (angle).translated (r.getCentreX(), r.getCentreY()));
+        g.setColour (c);
+        g.fillPath (p);
+    }
+
+    juce::Colour arcColour (const EffectSlot& fx, int colourIndex = -1) const
+    {
+        if (! fx.enabled)
+            return theme::colour::textDisabled;
+        return colourIndex >= 0 ? peqview::bandColour (colourIndex) : theme::colour::knobArc;
+    }
+
+    void caption (juce::Graphics& g, const LayoutItem& item, juce::Rectangle<float> r, juce::Justification j = juce::Justification::centred)
+    {
+        using namespace theme;
+        if (item.label == nullptr || *item.label == 0)
+            return;
+        g.setColour (hasStyle (item, plugui::dim) ? colour::textDisabled : colour::textSecondary);
+        g.setFont (font (juce::jmax (8.0f, 9.5f * scale()), true));
+        g.drawFittedText (caps (tr (item.label)), r.toNearestInt(), j, 1, 0.7f);
+    }
+
+    void paintItem (juce::Graphics& g, const LayoutItem& item, int index, const EffectSlot& fx)
+    {
+        using namespace theme;
+        const auto r = rectOf (item);
+        const auto s = scale();
+        const auto param = paramOf (item);
+        const auto value = valueOf (param);
+        const auto hot = index == hoverItem || index == dragItem;
+
+        switch (item.type)
+        {
+            case Item::section:
+            {
+                g.setColour (hasStyle (item, plugui::raised) ? colour::bg3 : colour::bg2);
+                g.fillRoundedRectangle (r, radius::md * s);
+                if (item.label != nullptr && *item.label != 0 && ! hasStyle (item, plugui::boxed))
+                {
+                    auto head = r.withHeight (16.0f * s);
+                    g.setColour (colour::bg3);
+                    g.fillRoundedRectangle (head, radius::md * s);
+                    g.fillRect (head.withTrimmedTop (head.getHeight() * 0.5f));
+                    g.setColour (colour::textSecondary);
+                    g.setFont (font (juce::jmax (8.0f, 10.5f * s), true));
+                    g.drawFittedText (caps (tr (item.label)), head.toNearestInt(), juce::Justification::centred, 1, 0.7f);
+                }
+                break;
+            }
+
+            case Item::label:
+                if (hasStyle (item, plugui::dim) && ! hasStyle (item, plugui::boxed) && item.h > 30.0f && item.label != nullptr)
+                {
+                    // the plugin's name, big and quiet (FL's logos are not reproduced)
+                    g.setColour (colour::bg4);
+                    g.setFont (font (r.getHeight() * 0.62f, true));
+                    g.drawFittedText (item.label, r.toNearestInt(),
+                                      hasStyle (item, plugui::alignLeft) ? juce::Justification::centredLeft : juce::Justification::centredRight, 1, 0.8f);
+                    break;
+                }
+                if (hasStyle (item, plugui::boxed))
+                {
+                    g.setColour (colour::bg3);
+                    g.fillRoundedRectangle (r, radius::sm * s);
+                }
+                caption (g, item, r, hasStyle (item, plugui::captionLeft | plugui::alignLeft) ? juce::Justification::centredLeft : juce::Justification::centred);
+                break;
+
+            case Item::value:
+                g.setColour (hot ? colour::accent : (fx.enabled ? colour::textPrimary : colour::textDisabled));
+                g.setFont (font (juce::jmax (8.0f, 11.0f * s)));
+                g.drawFittedText (valueText (param, value), r.toNearestInt(),
+                                  hasStyle (item, plugui::alignLeft) ? juce::Justification::centredLeft : juce::Justification::centred, 1, 0.7f);
+                break;
+
+            case Item::knob:
+            {
+                const auto circle = knobCircle (item);
+                drawKnob (g, circle, value, hasStyle (item, plugui::bipolar), arcColour (fx, item.colour), hot && item.colour < 0);
+                if (circle.getWidth() > 56.0f) // big knobs: a body that fills the ring (the theme's body stops at 22 px)
+                {
+                    const auto size = circle.getWidth() - 2.0f;
+                    const auto thickness = juce::jlimit (2.0f, 4.0f, size * 0.09f);
+                    const auto radius = size * 0.5f - thickness * 2.2f;
+                    const auto centre = circle.getCentre();
+                    const auto body = juce::Rectangle<float> (radius * 2.0f, radius * 2.0f).withCentre (centre);
+                    g.setGradientFill (juce::ColourGradient (hot ? colour::bg6 : colour::bg5, centre.x, body.getY(), colour::bg4, centre.x, body.getBottom(), false));
+                    g.fillEllipse (body);
+                    g.setColour (colour::borderStrong);
+                    g.drawEllipse (body, 1.0f);
+                    const auto angle = -juce::MathConstants<float>::pi * 0.75f + juce::MathConstants<float>::pi * 1.5f * juce::jlimit (0.0f, 1.0f, value);
+                    const juce::Point<float> dir { std::sin (angle), -std::cos (angle) };
+                    g.setColour (hot ? colour::accent : colour::textPrimary);
+                    g.drawLine ({ centre + dir * (radius * 0.55f), centre + dir * (radius * 0.88f) }, juce::jmax (2.0f, size * 0.035f));
+                }
+                auto below = r.withTop (circle.getBottom() + 1.0f * s);
+                if (hasStyle (item, plugui::valueAbove))
+                {
+                    const auto box = r.withHeight (13.0f * s).reduced (juce::jmax (0.0f, (r.getWidth() - 40.0f * s) * 0.5f), 0.0f);
+                    g.setColour (colour::bg0);
+                    g.fillRoundedRectangle (box, radius::sm);
+                    g.setColour (hot ? colour::textPrimary : colour::textSecondary);
+                    g.setFont (font (juce::jmax (8.0f, 9.0f * s)));
+                    g.drawFittedText (valueText (param, value), box.toNearestInt(), juce::Justification::centred, 1, 0.6f);
+                }
+                if (! hasStyle (item, plugui::noCaption))
+                {
+                    caption (g, item, below.withHeight (12.0f * s));
+                    if (hasStyle (item, plugui::showValue))
+                    {
+                        g.setColour (hot ? colour::accent : colour::textPrimary);
+                        g.setFont (font (juce::jmax (8.0f, 10.5f * s)));
+                        g.drawFittedText (valueText (param, value), below.withTrimmedTop (12.0f * s).withHeight (13.0f * s).toNearestInt(),
+                                          juce::Justification::centred, 1, 0.7f);
+                    }
+                }
+                break;
+            }
+
+            case Item::hslider:
+            case Item::vslider:
+            {
+                const auto vertical = item.type == Item::vslider;
+                auto area = r;
+                if (item.label != nullptr && ! hasStyle (item, plugui::noCaption))
+                {
+                    if (hasStyle (item, plugui::captionLeft))
+                        caption (g, item, area.removeFromLeft (area.getWidth() * 0.4f), juce::Justification::centredLeft);
+                    else if (vertical)
+                        caption (g, item, area.removeFromBottom (13.0f * s).expanded (18.0f * s, 0.0f));
+                    else
+                        caption (g, item, area.removeFromBottom (12.0f * s));
+                }
+                const auto thick = juce::jmax (3.0f, 4.0f * s);
+                const auto trackRect = vertical ? area.withSizeKeepingCentre (thick, area.getHeight() - 10.0f * s)
+                                                : area.withSizeKeepingCentre (area.getWidth() - 8.0f * s, thick);
+                g.setColour (colour::bg0);
+                g.fillRoundedRectangle (trackRect, thick * 0.5f);
+                const auto bip = hasStyle (item, plugui::bipolar);
+                juce::Rectangle<float> fill;
+                juce::Point<float> thumb;
+                if (vertical)
+                {
+                    const auto y = trackRect.getBottom() - trackRect.getHeight() * value;
+                    const auto from = bip ? trackRect.getCentreY() : trackRect.getBottom();
+                    fill = { trackRect.getX(), juce::jmin (y, from), trackRect.getWidth(), std::abs (from - y) };
+                    thumb = { trackRect.getCentreX(), y };
+                }
+                else
+                {
+                    const auto x = trackRect.getX() + trackRect.getWidth() * value;
+                    const auto from = bip ? trackRect.getCentreX() : trackRect.getX();
+                    fill = { juce::jmin (x, from), trackRect.getY(), std::abs (from - x), trackRect.getHeight() };
+                    thumb = { x, trackRect.getCentreY() };
+                }
+                g.setColour (hot && item.colour < 0 ? colour::accent : arcColour (fx, item.colour));
+                g.fillRoundedRectangle (fill, thick * 0.5f);
+                const auto thumbRect = vertical ? juce::Rectangle<float> (juce::jmin (area.getWidth(), 20.0f * s), 9.0f * s).withCentre (thumb)
+                                                : juce::Rectangle<float> (9.0f * s, juce::jmin (area.getHeight(), 16.0f * s)).withCentre (thumb);
+                g.setColour (hot ? colour::bg6 : colour::bg5);
+                g.fillRoundedRectangle (thumbRect, radius::sm);
+                g.setColour (hot ? colour::accent : colour::textSecondary);
+                if (vertical)
+                    g.drawHorizontalLine ((int) thumb.y, thumbRect.getX() + 3.0f, thumbRect.getRight() - 3.0f);
+                else
+                    g.drawVerticalLine ((int) thumb.x, thumbRect.getY() + 3.0f, thumbRect.getBottom() - 3.0f);
+                break;
+            }
+
+            case Item::radio:
+            {
+                const auto labels = plugui::optionLabels (item);
+                const auto chosen = plugui::optionAt (item, value);
+                const auto texts = optionTexts (item);
+                if (item.columns > 0) // a grid of named cells (Gross Beat's slots)
+                {
+                    const auto accent = item.colour >= 0 ? colour::info : colour::accent;
+                    g.setFont (font (juce::jmax (8.0f, 10.0f * s)));
+                    for (int o = 0; o < (int) texts.size(); ++o)
+                    {
+                        const auto cell = gridCell (item, o, (int) texts.size()).reduced (0.5f);
+                        g.setColour (o == chosen ? accent.withAlpha (0.22f) : ((o / item.columns) % 2 == 0 ? colour::bg0 : colour::bg1));
+                        g.fillRect (cell);
+                        if (o == chosen)
+                        {
+                            g.setColour (fx.enabled ? accent : colour::textSecondary);
+                            g.drawRect (cell, 1.0f);
+                        }
+                        g.setColour (o == chosen ? colour::textPrimary : colour::textSecondary);
+                        if (! drawWaveGlyph (g, cell.reduced (cell.getWidth() * 0.25f, cell.getHeight() * 0.28f), juce::String::fromUTF8 (labels[(std::size_t) o].c_str())))
+                            g.drawFittedText (texts[(std::size_t) o], cell.reduced (2.0f, 0.0f).toNearestInt(), juce::Justification::centred, 1, 0.6f);
+                    }
+                    break;
+                }
+                const auto rowH = r.getHeight() / (float) juce::jmax (1, (int) labels.size());
+                for (int o = 0; o < (int) labels.size(); ++o)
+                {
+                    const auto row = juce::Rectangle<float> (r.getX(), r.getY() + rowH * (float) o, r.getWidth(), rowH);
+                    const auto dot = juce::Rectangle<float> (7.0f * s, 7.0f * s).withCentre ({ row.getX() + 5.0f * s, row.getCentreY() });
+                    g.setColour (o == chosen ? (fx.enabled ? colour::accent : colour::textSecondary) : colour::ledOff);
+                    g.fillEllipse (dot);
+                    g.setColour (o == chosen ? colour::textPrimary : (hot ? colour::textSecondary : colour::textDisabled));
+                    g.setFont (font (juce::jmax (8.0f, 9.5f * s)));
+                    g.drawFittedText (texts[(std::size_t) o], row.withTrimmedLeft (12.0f * s).toNearestInt(),
+                                      juce::Justification::centredLeft, 1, 0.7f);
+                }
+                break;
+            }
+
+            case Item::tabs:
+            {
+                const auto labels = plugui::optionLabels (item);
+                const auto texts = optionTexts (item);
+                const auto chosen = hasStyle (item, plugui::pageTabs) ? page : plugui::optionAt (item, value);
+                const auto vertical = isVertical (item);
+                const auto count = (float) juce::jmax (1, (int) labels.size());
+                const auto w = vertical ? r.getWidth() : r.getWidth() / count;
+                const auto h = vertical ? r.getHeight() / count : r.getHeight();
+                g.setColour (colour::bg0);
+                g.fillRoundedRectangle (r, radius::sm);
+                for (int o = 0; o < (int) labels.size(); ++o)
+                {
+                    const auto cell = (vertical ? juce::Rectangle<float> (r.getX(), r.getY() + h * (float) o, w, h)
+                                                : juce::Rectangle<float> (r.getX() + w * (float) o, r.getY(), w, h)).reduced (1.0f);
+                    if (vertical) // a band selector (Maximus): the band's colour on the left edge
+                    {
+                        g.setColour (peqview::bandColour (o).withAlpha (o == chosen ? 1.0f : 0.45f));
+                        g.fillRect (cell.withWidth (juce::jmax (2.0f, 3.0f * s)));
+                    }
+                    if (o == chosen)
+                    {
+                        g.setColour (colour::bg6);
+                        g.fillRoundedRectangle (vertical ? cell.withTrimmedLeft (juce::jmax (2.0f, 3.0f * s)) : cell, radius::sm);
+                        g.setColour (colour::accent);
+                        if (! vertical)
+                            g.fillRect (cell.withTop (cell.getBottom() - juce::jmax (1.5f, 2.0f * s)).reduced (3.0f * s, 0.0f));
+                    }
+                    g.setColour (o == chosen ? colour::textPrimary : colour::textSecondary);
+                    g.setFont (font (juce::jmax (8.0f, 10.0f * s), true));
+                    g.drawFittedText (caps (texts[(std::size_t) o]), cell.toNearestInt(),
+                                      juce::Justification::centred, 1, 0.7f);
+                }
+                break;
+            }
+
+            case Item::toggle:
+            {
+                const auto on = value >= 0.5f;
+                if (hasStyle (item, plugui::boxed)) // a small lit button with its letter (FL's T / L buttons)
+                {
+                    g.setColour (on ? (fx.enabled ? colour::accent : colour::textSecondary) : (hot ? colour::bg6 : colour::bg5));
+                    g.fillRoundedRectangle (r, radius::sm);
+                    g.setColour (on ? colour::onAccent : colour::textSecondary);
+                    g.setFont (font (juce::jmax (8.0f, r.getHeight() * 0.8f), true));
+                    if (item.label != nullptr)
+                        g.drawText (caps (tr (item.label)), r, juce::Justification::centred, false);
+                    break;
+                }
+                const auto box = juce::Rectangle<float> (16.0f * s, 9.0f * s).withCentre ({ r.getX() + 9.0f * s, r.getCentreY() });
+                g.setColour (on ? (fx.enabled ? colour::accent : colour::textSecondary) : colour::bg0);
+                g.fillRoundedRectangle (box, box.getHeight() * 0.5f);
+                g.setColour (on ? colour::onAccent : colour::bg5);
+                const auto knobD = box.getHeight() - 2.0f;
+                g.fillEllipse (juce::Rectangle<float> (knobD, knobD).withCentre ({ on ? box.getRight() - knobD * 0.5f - 1.0f : box.getX() + knobD * 0.5f + 1.0f,
+                                                                                   box.getCentreY() }));
+                auto text = r.withTrimmedLeft (21.0f * s);
+                g.setColour (on ? colour::textPrimary : (hot ? colour::textSecondary : colour::textDisabled));
+                g.setFont (font (juce::jmax (8.0f, 9.5f * s), true));
+                if (item.label != nullptr)
+                    g.drawFittedText (caps (tr (item.label)), text.toNearestInt(), juce::Justification::centredLeft, 1, 0.7f);
+                break;
+            }
+
+            case Item::stepper:
+            {
+                auto box = r;
+                if (item.label != nullptr && ! hasStyle (item, plugui::noCaption))
+                    caption (g, item, box.removeFromTop (12.0f * s));
+                g.setColour (hot ? colour::bg5 : colour::bg0);
+                g.fillRoundedRectangle (box, radius::sm);
+                auto arrows = box.removeFromRight (juce::jmin (12.0f * s, box.getWidth() * 0.4f));
+                g.setColour (colour::textSecondary);
+                drawSmallArrow (g, arrows.removeFromTop (arrows.getHeight() * 0.5f), true);
+                drawSmallArrow (g, arrows, false);
+                g.setColour (colour::textPrimary);
+                g.setFont (font (juce::jmax (8.0f, 11.0f * s), true));
+                g.drawFittedText (valueText (param, value), box.toNearestInt(), juce::Justification::centred, 1, 0.6f);
+                break;
+            }
+
+            case Item::display:
+                paintDisplay (g, item, r, fx);
+                break;
+
+            case Item::menu:
+            {
+                const auto c = item.colour >= 0 ? peqview::bandColour (item.colour) : colour::bg5;
+                const auto chosen = plugui::optionAt (item, value);
+                const auto off = chosen == 0 && kind == EffectKind::parametricEq;
+                g.setColour ((fx.enabled && ! off ? c : c.withSaturation (0.0f).darker (0.6f)).withAlpha (hot ? 1.0f : 0.85f));
+                g.fillRoundedRectangle (r, radius::sm * s);
+                g.setColour (colour::bg0);
+                if (kind == EffectKind::parametricEq)
+                    drawBandShape (g, r.reduced (2.0f * s, 4.0f * s), chosen);
+                else
+                {
+                    g.setFont (font (juce::jmax (8.0f, 9.0f * s), true));
+                    const auto labels = plugui::optionLabels (item);
+                    if (chosen < (int) labels.size())
+                        g.drawFittedText (tr (juce::String::fromUTF8 (labels[(std::size_t) chosen].c_str())), r.toNearestInt(), juce::Justification::centred, 1, 0.6f);
+                }
+                break;
+            }
+        }
+    }
+
+    // a small drawing of an EQ band's response (peak, shelves, cuts, band-pass, notch)
+    static void drawBandShape (juce::Graphics& g, juce::Rectangle<float> r, int type)
+    {
+        juce::Path p;
+        const auto x0 = r.getX(), x1 = r.getRight(), xm = r.getCentreX(), y0 = r.getY(), y1 = r.getBottom(), ym = r.getCentreY();
+        switch (type)
+        {
+            case 1: p.startNewSubPath (x0, ym); p.quadraticTo (xm, y0 - (y1 - y0) * 0.3f, x1, ym); break;            // peak
+            case 2: p.startNewSubPath (x0, y0); p.lineTo (xm - 2, y0); p.lineTo (xm + 2, ym); p.lineTo (x1, ym); break; // low shelf
+            case 3: p.startNewSubPath (x0, ym); p.lineTo (xm - 2, ym); p.lineTo (xm + 2, y0); p.lineTo (x1, y0); break; // high shelf
+            case 4: p.startNewSubPath (x0 + 2, y1); p.quadraticTo (xm - 1, y0, x1, y0); break;                          // low cut
+            case 5: p.startNewSubPath (x0, y0); p.quadraticTo (xm + 1, y0, x1 - 2, y1); break;                          // high cut
+            case 6: p.startNewSubPath (x0, y1); p.quadraticTo (xm, y0 - (y1 - y0) * 0.6f, x1, y1); break;                // band-pass
+            case 7: p.startNewSubPath (x0, y0); p.quadraticTo (xm, y1 + (y1 - y0) * 0.6f, x1, y0); break;                // notch
+            default: p.startNewSubPath (x0, ym); p.lineTo (x1, ym); break;                                             // off
+        }
+        g.strokePath (p, juce::PathStrokeType (1.4f, juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
+    }
+
+    // a small drawing of an LFO / oscillator wave named in English (false: not a wave name)
+    static bool drawWaveGlyph (juce::Graphics& g, juce::Rectangle<float> r, const juce::String& name)
+    {
+        if (name != "Sine" && name != "Triangle" && name != "Square" && name != "Saw")
+            return false;
+        juce::Path p;
+        constexpr int n = 32;
+        for (int i = 0; i <= n; ++i)
+        {
+            const auto t = (float) i / (float) n;
+            const auto y = name == "Sine" ? std::sin (t * juce::MathConstants<float>::twoPi)
+                           : name == "Triangle" ? (t < 0.25f ? 4.0f * t : (t < 0.75f ? 2.0f - 4.0f * t : 4.0f * t - 4.0f))
+                           : name == "Square" ? (t < 0.5f ? 1.0f : -1.0f)
+                                              : 2.0f * t - 1.0f;
+            const juce::Point<float> pt { r.getX() + r.getWidth() * t, r.getCentreY() - r.getHeight() * 0.5f * y };
+            if (i == 0)
+                p.startNewSubPath (pt);
+            else
+                p.lineTo (pt);
+        }
+        g.strokePath (p, juce::PathStrokeType (1.5f, juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
+        return true;
+    }
+
+    static void drawSmallArrow (juce::Graphics& g, juce::Rectangle<float> r, bool up)
+    {
+        const auto c = r.getCentre();
+        const auto w = juce::jmin (r.getWidth(), r.getHeight() * 2.0f) * 0.32f;
+        juce::Path p;
+        if (up)
+            p.addTriangle (c.x - w, c.y + w * 0.5f, c.x + w, c.y + w * 0.5f, c.x, c.y - w * 0.5f);
+        else
+            p.addTriangle (c.x - w, c.y - w * 0.5f, c.x + w, c.y - w * 0.5f, c.x, c.y + w * 0.5f);
+        g.fillPath (p);
+    }
+
+    // --- displays (graphs drawn from the parameters; FL's live analysers are not reproduced) -------------
+
+    float param01 (const char* name) const { return valueOf (plugui::paramIndex (kind, name)); }
+
+    // the captions of a radio's options (Gross Beat: the slot names saved in the state)
+    std::vector<juce::String> optionTexts (const LayoutItem& item) const
+    {
+        std::vector<juce::String> out;
+        const auto labels = plugui::optionLabels (item);
+        // the whole list is one translation ("Mono|Stereo|Ping pong|Off"); single words are translated alone
+        const auto whole = juce::StringArray::fromTokens (tr (juce::String::fromUTF8 (item.options != nullptr ? item.options : "")), "|", "");
+        for (std::size_t o = 0; o < labels.size(); ++o)
+            out.push_back (whole.size() == (int) labels.size() ? whole[(int) o] : tr (juce::String::fromUTF8 (labels[o].c_str())));
+        if (kind == EffectKind::grossBeat && item.columns > 0)
+            if (const auto* fx = current())
+            {
+                const auto names = grossbeat::slotNames (fx->state, std::strcmp (item.param, "Volume slot") == 0);
+                for (std::size_t i = 0; i < names.size() && i < out.size(); ++i)
+                    if (! names[i].empty())
+                        out[i] = juce::String::fromUTF8 (names[i].c_str());
+            }
+        return out;
+    }
+
+    // the cell of option `o` in a radio grid
+    juce::Rectangle<float> gridCell (const LayoutItem& item, int o, int count) const
+    {
+        const auto r = rectOf (item);
+        const auto rows = (count + item.columns - 1) / item.columns;
+        const auto w = r.getWidth() / (float) item.columns, h = r.getHeight() / (float) juce::jmax (1, rows);
+        return { r.getX() + w * (float) (o % item.columns), r.getY() + h * (float) (o / item.columns), w, h };
+    }
+
+    void paintDisplay (juce::Graphics& g, const LayoutItem& item, juce::Rectangle<float> r, const EffectSlot& fx)
+    {
+        using namespace theme;
+        const auto s = scale();
+        g.setColour (colour::bg0);
+        g.fillRoundedRectangle (r, radius::md * s);
+        const juce::String id (item.display != nullptr ? item.display : "");
+        const auto curveColour = fx.enabled ? colour::accent : colour::textDisabled;
+        const auto inner = r.reduced (6.0f * s);
+
+        auto grid = [&] (int columns, int rows) {
+            g.setColour (colour::gridBeat);
+            for (int i = 1; i < columns; ++i)
+                g.drawVerticalLine ((int) (inner.getX() + inner.getWidth() * (float) i / (float) columns), inner.getY(), inner.getBottom());
+            for (int i = 1; i < rows; ++i)
+                g.drawHorizontalLine ((int) (inner.getY() + inner.getHeight() * (float) i / (float) rows), inner.getX(), inner.getRight());
+        };
+
+        auto strokeCurve = [&] (const std::function<float (float)>& f, juce::Rectangle<float> area, bool fillBelow) {
+            juce::Path p;
+            const auto steps = juce::jmax (16, (int) area.getWidth() / 2);
+            for (int i = 0; i <= steps; ++i)
+            {
+                const auto x = (float) i / (float) steps;
+                const auto y = juce::jlimit (0.0f, 1.0f, f (x));
+                const juce::Point<float> pt { area.getX() + area.getWidth() * x, area.getBottom() - area.getHeight() * y };
+                if (i == 0)
+                    p.startNewSubPath (pt);
+                else
+                    p.lineTo (pt);
+            }
+            if (fillBelow)
+            {
+                auto fill = p;
+                fill.lineTo (area.getRight(), area.getBottom());
+                fill.lineTo (area.getX(), area.getBottom());
+                fill.closeSubPath();
+                g.setColour (curveColour.withAlpha (0.14f));
+                g.fillPath (fill);
+            }
+            g.setColour (curveColour);
+            g.strokePath (p, juce::PathStrokeType (juce::jmax (1.5f, 2.0f * s)));
+        };
+
+        if (id == "limiter" || id == "compressor" || id == "dynamics")
+        {
+            // static transfer curve: input level (x, −60…0 dB) to output level (y)
+            grid (6, 4);
+            const auto threshold01 = id == "limiter" ? param01 ("Ceiling") : param01 (id == "compressor" ? "Threshold" : "Comp. threshold");
+            const auto ratio01 = id == "limiter" ? 1.0f : param01 ("Ratio");
+            const auto t = juce::jlimit (0.05f, 1.0f, threshold01);
+            const auto ratio = 1.0f + ratio01 * 19.0f;
+            strokeCurve ([t, ratio] (float x) { return x <= t ? x : t + (x - t) / ratio; }, inner, true);
+            g.setColour (colour::gridBar);
+            g.drawHorizontalLine ((int) (inner.getBottom() - inner.getHeight() * t), inner.getX(), inner.getRight());
+        }
+        else if (id == "shaper") // the feedback saturation: drive from the level, knee and symmetry
+        {
+            grid (4, 4);
+            const auto drive = 1.0f + 5.0f * param01 (item.param != nullptr ? item.param : "Distortion");
+            const auto knee = 0.5f + 3.0f * param01 ("Hardness");
+            const auto bias = (param01 ("Symmetry") - 0.5f) * 0.6f;
+            strokeCurve ([drive, knee, bias] (float x) {
+                const auto u = (x * 2.0f - 1.0f) * drive + bias;
+                const auto y = u / std::pow (1.0f + std::pow (std::abs (u), knee * 2.0f), 1.0f / (knee * 2.0f));
+                return 0.5f + 0.5f * y;
+            }, inner, false);
+        }
+        else if (id == "multiband")
+        {
+            // the three bands between the crossovers
+            grid (8, 4);
+            const auto low = param01 ("Low crossover"), high = param01 ("High crossover");
+            const juce::Colour bandColours[] = { peqview::bandColour (0), peqview::bandColour (2), peqview::bandColour (5) };
+            const float edges[] = { 0.0f, juce::jlimit (0.05f, 0.95f, low), juce::jlimit (0.05f, 0.95f, juce::jmax (low + 0.02f, high)), 1.0f };
+            for (int b = 0; b < 3; ++b)
+            {
+                const auto band = juce::Rectangle<float> (inner.getX() + inner.getWidth() * edges[b], inner.getY() + inner.getHeight() * 0.35f,
+                                                          inner.getWidth() * (edges[b + 1] - edges[b]), inner.getHeight() * 0.65f);
+                g.setColour (bandColours[b].withAlpha (fx.enabled ? 0.18f : 0.06f));
+                g.fillRect (band);
+                g.setColour (bandColours[b].withAlpha (fx.enabled ? 0.9f : 0.3f));
+                g.drawHorizontalLine ((int) band.getY(), band.getX(), band.getRight());
+            }
+        }
+        else if (id == "envelope") // decay shape of a reverb / delay tail
+        {
+            grid (8, 4);
+            const auto decay = 0.15f + param01 (item.param != nullptr ? item.param : "Decay") * 3.0f;
+            strokeCurve ([decay] (float x) { return std::exp (-x * 4.0f / decay) * 0.9f; }, inner, true);
+        }
+        else if (id == "meter") // level meter well (FL's live meters; LYNX shows the levels in the mixer)
+        {
+            g.setColour (colour::gridBeat);
+            for (int i = 1; i < 12; ++i)
+                g.drawHorizontalLine ((int) (r.getY() + r.getHeight() * (float) i / 12.0f), r.getX() + 2.0f, r.getRight() - 2.0f);
+        }
+        else if (id == "clip") // hard / soft clipping at the threshold
+        {
+            grid (4, 4);
+            const auto t = juce::jlimit (0.02f, 1.0f, param01 (item.param != nullptr ? item.param : "Threshold"));
+            const auto soft = param01 ("Type") >= 0.5f;
+            const auto pre = 1.0f + 30.0f * param01 ("Pre amp") * param01 ("Pre amp");
+            const auto post = 0.25f + 0.75f * param01 ("Post gain");
+            strokeCurve ([t, soft, pre, post] (float x) {
+                const auto u = x * pre;
+                return post * (soft ? t * std::tanh (u / t) : juce::jmin (u, t));
+            }, inner, false);
+        }
+        else if (id == "softclip") // linear up to the threshold, then a soft knee into the ceiling
+        {
+            grid (4, 4);
+            const auto t = juce::jlimit (0.05f, 0.98f, 0.3f + 0.7f * param01 ("Threshold"));
+            const auto post = 0.4f + 0.6f * param01 ("Post");
+            strokeCurve ([t, post] (float x) {
+                const auto y = x <= t ? x : t + (1.0f - t) * std::tanh ((x - t) / (1.0f - t));
+                return y * post;
+            }, inner, false);
+        }
+        else if (id == "sgamount" || id == "sgpresets")
+        {
+            paintSoundgoodizer (g, id, r, fx);
+            return;
+        }
+        else if (id == "xy") // a pad: `param` across, `param2` up (drag the point)
+        {
+            grid (4, 4);
+            const auto x = inner.getX() + inner.getWidth() * param01 (item.param);
+            const auto y = inner.getBottom() - inner.getHeight() * param01 (item.param2);
+            g.setColour (curveColour);
+            g.drawEllipse (juce::Rectangle<float> (10.0f * s, 10.0f * s).withCentre ({ x, y }), juce::jmax (1.5f, 2.0f * s));
+        }
+        else if (id == "voices") // the chorus voices spread across the stereo field (a static picture)
+        {
+            g.setColour (colour::gridBeat);
+            g.drawVerticalLine ((int) inner.getCentreX(), inner.getY(), inner.getBottom());
+            const auto spread = 0.2f + 0.8f * param01 ("Movement");
+            for (int i = 0; i < 8; ++i)
+            {
+                const auto t = (float) i / 7.0f;
+                const auto x = inner.getCentreX() + (t - 0.5f) * inner.getWidth() * spread;
+                g.setColour (curveColour.withAlpha (0.35f + 0.5f * (1.0f - std::abs (t - 0.5f))));
+                g.fillRoundedRectangle (juce::Rectangle<float> (3.0f * s, inner.getHeight() * (0.3f + 0.4f * std::abs (std::sin ((float) i * 1.7f)))).withCentre ({ x, inner.getCentreY() }), 1.5f);
+            }
+        }
+        else if (id == "panpad") // pan (x) and volume (y) as a crosshair
+        {
+            grid (6, 6);
+            const auto x = inner.getX() + inner.getWidth() * param01 ("Pan");
+            const auto y = inner.getBottom() - inner.getHeight() * param01 ("Volume");
+            g.setColour (curveColour);
+            g.drawVerticalLine ((int) x, inner.getY(), inner.getBottom());
+            g.drawHorizontalLine ((int) y, inner.getX(), inner.getRight());
+            g.fillEllipse (juce::Rectangle<float> (7.0f * s, 7.0f * s).withCentre ({ x, y }));
+        }
+        else if (id == "waveshaper") // the saved shaping curve (FL's point editor is not reproduced)
+        {
+            grid (8, 8);
+            std::vector<std::int16_t> table;
+            auto unipolar = false;
+            if (const auto st = flshape::parseWaveShaper (fx.state))
+            {
+                unipolar = st->unipolar;
+                table = flshape::shaperTable (st->points, st->unipolar);
+            }
+            if (table.size() > 4)
+                strokeCurve ([&table, unipolar] (float x) {
+                    const auto i = juce::jlimit<std::size_t> (1, table.size() - 2, (std::size_t) (1.0f + x * (float) (table.size() - 3)));
+                    const auto v = (float) table[i] / 32767.0f;
+                    return unipolar ? v : 0.5f + 0.5f * v;
+                }, inner, false);
+            else
+                strokeCurve ([] (float x) { return x; }, inner, false);
+        }
+        else if (id == "room") // nested walls: the room size and the decay
+        {
+            const auto size = 0.25f + 0.7f * param01 (item.param != nullptr ? item.param : "Room size");
+            const auto c = inner.getCentre();
+            for (int i = 0; i < 6; ++i)
+            {
+                const auto k = size * (1.0f - 0.14f * (float) i);
+                const auto box = juce::Rectangle<float> (inner.getWidth() * k, inner.getHeight() * k * 0.8f).withCentre (c);
+                g.setColour (curveColour.withAlpha (0.75f - 0.11f * (float) i));
+                g.drawRoundedRectangle (box, 4.0f * s, juce::jmax (1.0f, 1.5f * s));
+            }
+        }
+        else if (id == "maxcurve") // Maximus: the selected band's drawn compression curve (input → output, 0.5 = 0 dBFS)
+        {
+            grid (4, 4);
+            const auto band = juce::jlimit (0, 3, page);
+            const auto c = fx.enabled ? peqview::bandColour (band) : colour::textDisabled;
+            g.setColour (colour::gridBar);
+            g.drawLine ({ inner.getBottomLeft(), inner.getTopRight() }, 1.0f);
+            g.drawVerticalLine ((int) inner.getCentreX(), inner.getY(), inner.getBottom());
+            g.drawHorizontalLine ((int) inner.getCentreY(), inner.getX(), inner.getRight());
+            const auto pts = maximusfx::curvePoints (fx.state, band);
+            if (pts.size() >= 2)
+            {
+                juce::Path p;
+                auto at = [&] (const std::pair<float, float>& q) { return juce::Point<float> (inner.getX() + inner.getWidth() * q.first, inner.getBottom() - inner.getHeight() * q.second); };
+                p.startNewSubPath (at (pts.front()));
+                for (std::size_t i = 1; i < pts.size(); ++i)
+                    p.lineTo (at (pts[i]));
+                auto fill = p;
+                fill.lineTo (at (pts.back()).withY (inner.getBottom()));
+                fill.lineTo (at (pts.front()).withY (inner.getBottom()));
+                fill.closeSubPath();
+                g.setColour (c.withAlpha (0.14f));
+                g.fillPath (fill);
+                g.setColour (c);
+                g.strokePath (p, juce::PathStrokeType (juce::jmax (1.5f, 2.0f * s)));
+                for (const auto& q : pts)
+                    g.fillEllipse (juce::Rectangle<float> (5.0f * s, 5.0f * s).withCentre (at (q)));
+            }
+            g.setColour (colour::textSecondary);
+            g.setFont (font (juce::jmax (8.0f, 9.0f * s)));
+            g.drawText (tr ("Out"), inner.withHeight (12.0f * s).toNearestInt(), juce::Justification::topLeft, false);
+            g.drawText (tr ("In"), inner.withTop (inner.getBottom() - 12.0f * s).toNearestInt(), juce::Justification::bottomRight, false);
+        }
+        else if (id == "maxbands") // Maximus: the three bands over 20 Hz…20 kHz with their crossovers and the low cut
+        {
+            const auto raw = [&] (int p) { return maximusfx::stateParam (fx.state, p).value_or (maximusfx::stateParams()[(std::size_t) p].defaultValue); };
+            const auto xOf = [&] (double hz) { return inner.getX() + inner.getWidth() * (float) (std::log (juce::jlimit (20.0, 20000.0, hz) / 20.0) / std::log (1000.0)); };
+            auto lo = 30.0 * std::pow (533.33, raw (0) / 65536.0), hi = 30.0 * std::pow (533.33, raw (2) / 65536.0);
+            if (lo > hi)
+                std::swap (lo, hi);
+            const float edges[4] { inner.getX(), xOf (lo), xOf (hi), inner.getRight() };
+            static const char* names[3] { "Low", "Mid", "High" };
+            for (int b = 0; b < 3; ++b)
+            {
+                const auto mode = raw (7 + 13 * b);
+                const auto area = juce::Rectangle<float> (edges[b], inner.getY(), edges[b + 1] - edges[b], inner.getHeight());
+                const auto c = peqview::bandColour (b);
+                g.setColour (c.withAlpha (! fx.enabled || mode >= 2 ? 0.05f : (b == page ? 0.24f : 0.12f)));
+                g.fillRect (area);
+                g.setColour (b == page ? colour::textPrimary : colour::textSecondary);
+                g.setFont (font (juce::jmax (8.0f, 10.0f * s), true));
+                g.drawFittedText (caps (tr (names[b])) + (mode == 2 ? " · " + tr ("Muted") : mode == 3 ? " · " + tr ("Off") : juce::String()),
+                                  area.reduced (2.0f * s).withHeight (14.0f * s).toNearestInt(), juce::Justification::centred, 1, 0.6f);
+            }
+            g.setColour (colour::textSecondary);
+            for (int k = 1; k <= 2; ++k)
+                g.drawVerticalLine ((int) edges[k], inner.getY(), inner.getBottom());
+            if (raw (6) >= 0) // low cut
+            {
+                const auto x = xOf (5.0 * std::pow (16.0, raw (6) / 65536.0));
+                g.setColour (colour::accent.withAlpha (0.6f));
+                g.drawVerticalLine ((int) x, inner.getY(), inner.getBottom());
+            }
+            g.setColour (colour::textDisabled);
+            g.setFont (font (juce::jmax (8.0f, 9.0f * s)));
+            for (const auto hz : { 100.0, 1000.0, 10000.0 })
+                g.drawText (hz >= 1000.0 ? juce::String ((int) (hz / 1000.0)) + "k" : juce::String ((int) hz),
+                            juce::Rectangle<float> (30.0f * s, 12.0f * s).withCentre ({ xOf (hz), inner.getBottom() - 6.0f * s }).toNearestInt(),
+                            juce::Justification::centred, false);
+        }
+        else if (id == "eq")
+        {
+            paintEq (g, r, fx);
+            return;
+        }
+        else if (id == "grossbeat" || id == "gbinfo" || id == "gbjog")
+        {
+            paintGrossBeat (g, id, r, fx);
+            return;
+        }
+        else if (id == "eqinfo") // the selected band, or how to use the graph
+        {
+            g.setColour (colour::bg1);
+            g.fillRect (r);
+            g.setFont (font (juce::jmax (9.0f, 11.0f * s)));
+            if (eqSelected >= 0)
+            {
+                g.setColour (peqview::bandColour (eqSelected));
+                g.drawFittedText (peqview::bandText (fx.params, eqSelected), r.reduced (4.0f * s, 0.0f).toNearestInt(), juce::Justification::centredLeft, 2, 0.8f);
+            }
+            else
+            {
+                g.setColour (colour::textSecondary);
+                g.drawFittedText (tr ("Drag a handle (frequency and gain); mouse wheel = Q; right-click = type; double-click = 0 dB"),
+                                  r.reduced (4.0f * s, 0.0f).toNearestInt(), juce::Justification::centredLeft, 2, 0.8f);
+            }
+            return;
+        }
+        else if (id == "filter")
+        {
+            grid (8, 4);
+            const auto cutoff = param01 ("Cutoff");
+            const auto reso = param01 ("Resonance");
+            strokeCurve ([cutoff, reso] (float x) {
+                const auto d = (x - cutoff) * 8.0f;
+                const auto bump = reso * 0.35f * std::exp (-d * d);
+                return 0.6f + bump - (x > cutoff ? (x - cutoff) * 2.2f : 0.0f);
+            }, inner, true);
+        }
+        else // a plain well with the plugin's name (FL's scopes / animations are not reproduced)
+        {
+            g.setColour (colour::bg2);
+            g.setFont (font (juce::jmax (10.0f, juce::jmin (28.0f, r.getHeight() * 0.22f)), true));
+            g.drawFittedText (caps (utf8 (effectInfo (kind).name)), r.toNearestInt(), juce::Justification::centred, 1, 0.8f);
+        }
+
+        if (item.label != nullptr && *item.label != 0)
+        {
+            g.setColour (colour::textDisabled);
+            g.setFont (font (juce::jmax (8.0f, 9.0f * s), true));
+            g.drawText (caps (tr (item.label)), inner.withHeight (12.0f * s), juce::Justification::topLeft);
+        }
+    }
+
+    // --- Gross Beat: the selected slots' envelopes ------------------------------------------------------
+
+    void paintGrossBeat (juce::Graphics& g, const juce::String& id, juce::Rectangle<float> r, const EffectSlot& fx)
+    {
+        using namespace theme;
+        const auto s = scale();
+        std::vector<std::uint8_t> flState;
+        int ppq = 96;
+        std::optional<grossbeat::State> state;
+        if (grossbeat::unpack (fx.state, flState, ppq))
+            state = grossbeat::parseState (flState.data(), flState.size());
+        const auto timeSlot = grossbeat::rawFromParam (0, param01 ("Time slot"));
+        const auto volumeSlot = grossbeat::rawFromParam (1, param01 ("Volume slot"));
+
+        if (id == "gbjog") // a dial with the beat positions (FL's scratch indicator)
+        {
+            const auto c = r.getCentre();
+            const auto radius = juce::jmin (r.getWidth(), r.getHeight()) * 0.4f;
+            g.setColour (colour::bg3);
+            g.fillEllipse (juce::Rectangle<float> (radius * 2.0f, radius * 2.0f).withCentre (c));
+            for (int i = 0; i < 12; ++i)
+            {
+                const auto a = juce::MathConstants<float>::twoPi * (float) i / 12.0f;
+                g.setColour (i == 0 ? (fx.enabled ? colour::accent : colour::textSecondary) : colour::textDisabled);
+                g.fillEllipse (juce::Rectangle<float> (4.0f * s, 4.0f * s).withCentre ({ c.x + std::sin (a) * radius * 0.85f, c.y - std::cos (a) * radius * 0.85f }));
+            }
+            return;
+        }
+
+        if (id == "gbinfo")
+        {
+            juce::String text = tr ("Time: {0}", { "Slot " + juce::String (timeSlot + 1) });
+            if (state)
+            {
+                const auto& slot = state->slots[(std::size_t) timeSlot];
+                if (! slot.name.empty())
+                    text = tr ("Time: {0}", { juce::String::fromUTF8 (slot.name.c_str()) });
+                static const char* const syncs[] = { "off", "1/4 beat", "1/2 beat", "1 beat", "2 beats", "4 beats" };
+                const auto sync = [] (int v) { return juce::String (syncs[juce::jlimit (0, 5, v)]); };
+                text << "     " << tr ("Hold: {0}", { slot.hold > 0 ? juce::String (slot.hold) : tr ("Off") }) << "   "
+                     << tr ("Trig sync: {0}", { sync (slot.triggerSync) }) << "   " << tr ("Pos sync: {0}", { sync (slot.positionSync) });
+            }
+            g.setColour (colour::textSecondary);
+            g.setFont (font (juce::jmax (9.0f, 11.0f * s)));
+            g.drawFittedText (text, r.reduced (6.0f * s, 0.0f).toNearestInt(), juce::Justification::centredLeft, 1, 0.8f);
+            return;
+        }
+
+        // the editor area: beat grid, then the time slot's envelope (accent) and the volume slot's (blue)
+        g.setColour (colour::bg0);
+        g.fillRoundedRectangle (r, radius::md * s);
+        const auto inner = r.reduced (8.0f * s);
+        g.setColour (colour::gridBeat);
+        for (int i = 1; i < 16; ++i)
+            g.drawVerticalLine ((int) (inner.getX() + inner.getWidth() * (float) i / 16.0f), inner.getY(), inner.getBottom());
+        g.setColour (colour::gridBar);
+        for (int i = 1; i < 4; ++i)
+            g.drawVerticalLine ((int) (inner.getX() + inner.getWidth() * (float) i / 4.0f), inner.getY(), inner.getBottom());
+        for (int i = 1; i < 8; ++i)
+            g.drawHorizontalLine ((int) (inner.getY() + inner.getHeight() * (float) i / 8.0f), inner.getX(), inner.getRight());
+        const auto drawSlot = [&] (const grossbeat::Slot& slot, juce::Colour c, bool time) {
+            if (slot.points.empty()) // an empty slot does nothing: time plays straight on, volume stays at full
+            {
+                g.setColour (c.withAlpha (0.5f));
+                if (time)
+                    g.drawLine (inner.getX(), inner.getY(), inner.getRight(), inner.getY() + inner.getHeight() * 0.5f, juce::jmax (1.0f, 1.5f * s));
+                else
+                    g.drawHorizontalLine ((int) inner.getY() + 1, inner.getX(), inner.getRight());
+                return;
+            }
+            double length = 0.0;
+            for (const auto& p : slot.points)
+                length += p.dx;
+            length = juce::jmax (length, 1.0e-6);
+            juce::Path path;
+            double x = 0.0;
+            for (std::size_t i = 0; i < slot.points.size(); ++i)
+            {
+                x += slot.points[i].dx;
+                const juce::Point<float> pt { inner.getX() + inner.getWidth() * (float) (x / length),
+                                              inner.getBottom() - inner.getHeight() * juce::jlimit (0.0f, 1.0f, slot.points[i].y) };
+                if (i == 0)
+                    path.startNewSubPath (pt);
+                else
+                    path.lineTo (pt);
+                g.setColour (c);
+                g.fillEllipse (juce::Rectangle<float> (5.0f * s, 5.0f * s).withCentre (pt));
+            }
+            g.setColour (c);
+            g.strokePath (path, juce::PathStrokeType (juce::jmax (1.5f, 2.0f * s)));
+        };
+        drawSlot (state ? state->slots[(std::size_t) (grossbeat::slotsPerKind + volumeSlot)] : grossbeat::Slot {}, colour::info.withAlpha (fx.enabled ? 0.9f : 0.3f), false);
+        drawSlot (state ? state->slots[(std::size_t) timeSlot] : grossbeat::Slot {}, (fx.enabled ? colour::accent : colour::textDisabled), true);
+    }
+
+    // --- the parametric EQ's graph (FL's Parametric EQ 2 arrangement) -----------------------------------
+
+    static constexpr double eqRange = 18.0; // FL's graph spans ±18 dB
+
+    // rows above the graph (octaves, band names), frequencies under it, dB scale at its right
+    juce::Rectangle<float> eqGraph (juce::Rectangle<float> r) const
+    {
+        const auto s = scale();
+        return r.withTrimmedTop (29.0f * s).withTrimmedBottom (16.0f * s).withTrimmedRight (22.0f * s);
+    }
+
+    void paintEq (juce::Graphics& g, juce::Rectangle<float> r, const EffectSlot& fx)
+    {
+        using namespace theme;
+        const auto s = scale();
+        const auto graph = eqGraph (r);
+        g.setFont (font (juce::jmax (7.5f, 9.0f * s), true));
+
+        // octave marks (C1…C9) and the usual band names, on plates like FL's
+        const auto octaveRow = juce::Rectangle<float> (graph.getX(), r.getY() + 1.0f * s, graph.getWidth(), 11.0f * s);
+        for (int o = 1; o <= 9; ++o)
+        {
+            const auto x = peqview::xForHz (graph, 32.703 * std::pow (2.0, o - 1));
+            const auto next = peqview::xForHz (graph, 32.703 * std::pow (2.0, o));
+            const auto plate = juce::Rectangle<float> (x, octaveRow.getY(), juce::jmin (next, graph.getRight()) - x - 1.0f, octaveRow.getHeight());
+            g.setColour (colour::bg2);
+            g.fillRect (plate);
+            g.setColour (colour::textDisabled);
+            g.drawText ("C" + juce::String (o), plate.withTrimmedLeft (2.0f), juce::Justification::centredLeft, false);
+        }
+        struct Range { double lo, hi; const char* name; };
+        static const Range ranges[] = { { 20, 60, TR_NOOP ("Sub") }, { 60, 250, TR_NOOP ("Bass") }, { 250, 500, TR_NOOP ("Low mid") },
+                                        { 500, 2000, TR_NOOP ("Mid") }, { 2000, 4000, TR_NOOP ("High mid") }, { 4000, 6000, TR_NOOP ("Prs") },
+                                        { 6000, 20000, TR_NOOP ("Treble") } };
+        for (const auto& range : ranges)
+        {
+            const auto x0 = peqview::xForHz (graph, range.lo), x1 = peqview::xForHz (graph, range.hi);
+            const auto plate = juce::Rectangle<float> (x0, r.getY() + 15.0f * s, x1 - x0 - 1.0f, 11.0f * s);
+            g.setColour (colour::bg3);
+            g.fillRect (plate);
+            g.setColour (colour::textSecondary);
+            g.drawFittedText (caps (tr (range.name)), plate.toNearestInt(), juce::Justification::centred, 1, 0.6f);
+        }
+
+        drawParametricEqCurve (g, graph, fx.params, juce::jmax (8000.0, engine.getTransport().sampleRate.load()), fx.enabled, eqSelected, eqRange, false);
+
+        // frequencies under the graph, dB at its right
+        g.setColour (colour::textDisabled);
+        for (auto [hz, text] : { std::pair { 20.0, "20" }, { 50.0, "50" }, { 100.0, "100" }, { 200.0, "200" }, { 500.0, "500" },
+                                 { 1000.0, "1k" }, { 2000.0, "2k" }, { 5000.0, "5k" }, { 10000.0, "10k" } })
+            g.drawText (text, juce::Rectangle<float> (peqview::xForHz (graph, hz) + 2.0f, graph.getBottom() + 2.0f * s, 40.0f * s, 11.0f * s),
+                        juce::Justification::centredLeft, false);
+        for (int db = -18; db <= 18; db += 6)
+            g.drawText ((db > 0 ? "+" : "") + juce::String (db),
+                        juce::Rectangle<float> (graph.getRight() + 1.0f, peqview::yForDb (graph, db, eqRange) - 6.0f * s, 21.0f * s, 12.0f * s),
+                        juce::Justification::centredRight, false);
+
+        // the band handles
+        for (int b = 0; b < peq::bands; ++b)
+        {
+            if (peq::type (fx.params[(std::size_t) peq::param (b, 0)]) == peq::BandType::off)
+                continue;
+            const auto centre = peqview::handlePosition (graph, fx.params, b, eqRange);
+            const auto d = juce::jmax (12.0f, 16.0f * s);
+            const auto h = juce::Rectangle<float> (d, d).withCentre (centre);
+            const auto c = peqview::bandColour (b);
+            if (b == eqSelected)
+            {
+                g.setColour (c.withAlpha (0.25f));
+                g.fillEllipse (h.expanded (4.0f));
+            }
+            g.setColour (colour::bg0.withAlpha (0.7f));
+            g.fillEllipse (h);
+            g.setColour (c.withAlpha (fx.enabled ? 1.0f : 0.4f));
+            g.drawEllipse (h.reduced (1.0f), juce::jmax (1.5f, 2.0f * s));
+            g.setFont (font (juce::jmax (8.0f, 9.5f * s), true));
+            g.drawText (juce::String (b + 1), h, juce::Justification::centred);
+        }
+    }
+
+    void setParams (const std::vector<std::pair<int, float>>& changes)
+    {
+        if (current() == nullptr)
+            return;
+        engine.editSong ([t = track, sl = slot, changes] (Song& song) {
+            auto& params = song.mixer[(std::size_t) t].effects[(std::size_t) sl].params;
+            for (auto [p, v] : changes)
+                if (p >= 0 && p < maxEffectParams)
+                    params[(std::size_t) p] = juce::jlimit (0.0f, 1.0f, v);
+        });
+    }
+
+    bool eqMouseDown (const juce::MouseEvent& e, const LayoutItem& item)
+    {
+        const auto* fx = current();
+        const auto graph = eqGraph (rectOf (item));
+        const auto band = peqview::bandAt (graph, fx->params, e.position, eqRange);
+        eqSelected = band;
+        repaint();
+        if (band < 0)
+            return true;
+        if (e.mods.isPopupMenu())
+        {
+            peqview::showBandMenu (*this, fx->params, band, [this] (std::vector<std::pair<int, float>> changes) { setParams (changes); });
+            return true;
+        }
+        eqDragOffset = peqview::handlePosition (graph, fx->params, band, eqRange) - e.position;
+        eqDragging = true;
+        return true;
+    }
+
+    void eqMouseDrag (const juce::MouseEvent& e)
+    {
+        const auto* fx = current();
+        if (fx == nullptr || eqSelected < 0 || dragItem < 0)
+            return;
+        const auto graph = eqGraph (rectOf (activeLayout().items[(std::size_t) dragItem]));
+        const auto p = e.position + eqDragOffset;
+        std::vector<std::pair<int, float>> changes { { peq::param (eqSelected, 1), peq::hzValue (peqview::hzForX (graph, p.x)) } };
+        if (peqview::hasGain (fx->params, eqSelected))
+            changes.push_back ({ peq::param (eqSelected, 2), peq::gainValue (peqview::dbForY (graph, p.y, eqRange)) });
+        setParams (changes);
+        ui::showValueTip (*this, juce::Rectangle<int> (6, 6).withCentre (e.getPosition()), peqview::bandText (fx->params, eqSelected));
+    }
+
+    // --- Soundgoodizer: Amount and the preset A–D live in the slot's state ---------------------------------
+
+    std::optional<maximusfx::Blob> soundgoodizerBlob() const
+    {
+        const auto* fx = current();
+        return fx != nullptr ? maximusfx::unpack (fx->state) : std::nullopt;
+    }
+
+    float soundgoodizerAmount() const
+    {
+        const auto blob = soundgoodizerBlob();
+        return blob && blob->mix >= 0 ? (float) blob->mix / 1000.0f : 0.6f;
+    }
+
+    void writeSoundgoodizer (const maximusfx::Blob& blob)
+    {
+        engine.editSong ([t = track, sl = slot, bytes = maximusfx::pack (blob)] (Song& song) {
+            song.mixer[(std::size_t) t].effects[(std::size_t) sl].state = bytes;
+        });
+    }
+
+    void setSoundgoodizerAmount (float v)
+    {
+        if (auto blob = soundgoodizerBlob())
+        {
+            blob->mix = juce::roundToInt (v * 1000.0f);
+            writeSoundgoodizer (*blob);
+        }
+    }
+
+    const std::vector<std::uint8_t>& soundgoodizerPresetBytes (int preset)
+    {
+        auto& bytes = sgPresets[(std::size_t) preset];
+        if (bytes.empty())
+        {
+            const auto roots = findFlStudioRoots();
+            juce::MemoryBlock data;
+            if (! roots.factoryData.empty()
+                && juce::File (juce::String::fromUTF8 (roots.factoryData.c_str()))
+                       .getChildFile ("Plugins/Fruity/Effects/Soundgoodizer/Data/Presets")
+                       .getChildFile (maximusfx::soundgoodizerPresetFile (preset))
+                       .loadFileAsData (data))
+            {
+                const auto* b = static_cast<const std::uint8_t*> (data.getData());
+                bytes.assign (b, b + data.getSize());
+            }
+        }
+        return bytes;
+    }
+
+    int soundgoodizerPreset()
+    {
+        const auto blob = soundgoodizerBlob();
+        for (int p = 0; blob && p < 4; ++p)
+            if (const auto& bytes = soundgoodizerPresetBytes (p); ! bytes.empty() && bytes == blob->state)
+                return p;
+        return -1;
+    }
+
+    void setSoundgoodizerPreset (int preset)
+    {
+        auto blob = soundgoodizerBlob();
+        const auto& bytes = soundgoodizerPresetBytes (preset);
+        if (! blob || bytes.empty())
+            return;
+        blob->state = bytes;
+        writeSoundgoodizer (*blob);
+    }
+
+    void paintSoundgoodizer (juce::Graphics& g, const juce::String& id, juce::Rectangle<float> r, const EffectSlot& fx)
+    {
+        using namespace theme;
+        const auto s = scale();
+        if (id == "sgamount")
+        {
+            const auto amount = soundgoodizerAmount();
+            drawKnob (g, r, amount, false, fx.enabled ? colour::accent : colour::textDisabled, sgDragging);
+            const auto body = r.reduced (r.getWidth() * 0.16f);
+            g.setGradientFill (juce::ColourGradient (colour::bg6, body.getCentreX(), body.getY(), colour::bg4, body.getCentreX(), body.getBottom(), false));
+            g.fillEllipse (body);
+            g.setColour (colour::borderStrong);
+            g.drawEllipse (body, 1.0f);
+            g.setColour (colour::textPrimary);
+            g.setFont (font (juce::jmax (10.0f, 18.0f * s), true));
+            g.drawText (juce::String (amount * 100.0f, 0) + "%", body, juce::Justification::centred, false);
+            return;
+        }
+        const auto chosen = soundgoodizerPreset();
+        for (int p = 0; p < 4; ++p)
+        {
+            const auto cell = juce::Rectangle<float> (r.getX() + r.getWidth() * (float) p / 4.0f, r.getY(), r.getWidth() / 4.0f, r.getHeight());
+            const auto led = juce::Rectangle<float> (8.0f * s, 8.0f * s).withCentre ({ cell.getCentreX(), cell.getY() + 8.0f * s });
+            g.setColour (p == chosen ? (fx.enabled ? colour::accent : colour::textSecondary) : colour::ledOff);
+            g.fillEllipse (led);
+            g.setColour (p == chosen ? colour::textPrimary : colour::textSecondary);
+            g.setFont (font (juce::jmax (10.0f, 20.0f * s), true));
+            g.drawText (juce::String::charToString ((juce::juce_wchar) ('A' + p)), cell.withTrimmedTop (16.0f * s), juce::Justification::centred, false);
+        }
+    }
+
+    // a pad sets two parameters at once
+    void xyMouse (const juce::MouseEvent& e, const LayoutItem& item)
+    {
+        const auto inner = rectOf (item).reduced (6.0f * scale());
+        const auto px = plugui::paramIndex (kind, item.param), py = plugui::paramIndex (kind, item.param2);
+        const auto x = juce::jlimit (0.0f, 1.0f, (e.position.x - inner.getX()) / inner.getWidth());
+        const auto y = juce::jlimit (0.0f, 1.0f, (inner.getBottom() - e.position.y) / inner.getHeight());
+        setParams ({ { px, x }, { py, y } });
+        ui::showValueTip (*this, rectOf (item).toNearestInt(), valueText (px, x) + " / " + valueText (py, y));
+    }
+
+    // --- mouse -----------------------------------------------------------------------------------------
+
+    int headerItemAt (juce::Point<float> p) const
+    {
+        if (! headerArea().contains (p))
+            return 0;
+        if (menuButton().expanded (2.0f).contains (p))
+            return 1;
+        if (presetBox().contains (p))
+            return 2;
+        if (prevButton().contains (p))
+            return 3;
+        if (nextButton().contains (p))
+            return 4;
+        return 0;
+    }
+
+    void mouseMove (const juce::MouseEvent& e) override
+    {
+        const auto p = e.position;
+        const auto h = headerItemAt (p);
+        const auto i = h == 0 ? itemAt (p) : -1;
+        if (h != hoverHeader || i != hoverItem)
+        {
+            hoverHeader = h;
+            hoverItem = i;
+            repaint();
+        }
+        setMouseCursor (i >= 0 || h > 0 ? juce::MouseCursor::PointingHandCursor : juce::MouseCursor::NormalCursor);
+    }
+
+    void mouseExit (const juce::MouseEvent&) override
+    {
+        hoverHeader = 0;
+        hoverItem = -1;
+        repaint();
+    }
+
+    void mouseDown (const juce::MouseEvent& e) override
+    {
+        if (current() == nullptr)
+            return;
+
+        if (const auto h = headerItemAt (e.position); h > 0)
+        {
+            if (h == 1 || h == 2 || e.mods.isPopupMenu())
+                showOptionsMenu (h == 2);
+            else
+                stepPreset (h == 3 ? -1 : 1);
+            return;
+        }
+
+        const auto index = itemAt (e.position);
+        if (index < 0)
+            return;
+
+        const auto& item = activeLayout().items[(std::size_t) index];
+        const auto r = rectOf (item);
+
+        if (hasStyle (item, plugui::pageTabs))
+        {
+            const auto n = juce::jmax (1, (int) plugui::optionLabels (item).size());
+            const auto along = isVertical (item) ? (e.position.y - r.getY()) / r.getHeight() : (e.position.x - r.getX()) / r.getWidth();
+            page = juce::jlimit (0, n - 1, (int) (along * (float) n));
+            hoverItem = -1;
+            repaint();
+            return;
+        }
+
+        if (item.type == Item::display && juce::String (item.display) == "sgpresets")
+        {
+            const auto r = rectOf (item);
+            setSoundgoodizerPreset (juce::jlimit (0, 3, (int) ((e.position.x - r.getX()) / r.getWidth() * 4.0f)));
+            return;
+        }
+        if (item.type == Item::display && juce::String (item.display) == "sgamount")
+        {
+            dragItem = index;
+            sgDragging = true;
+            sgStart = soundgoodizerAmount();
+            ui::showValueTip (*this, rectOf (item).toNearestInt(), juce::String (sgStart * 100.0f, 0) + "%");
+            return;
+        }
+        if (item.type == Item::display && juce::String (item.display) == "xy")
+        {
+            dragItem = index;
+            xyDragging = true;
+            xyMouse (e, item);
+            return;
+        }
+        if (item.type == Item::display) // the EQ graph
+        {
+            if (eqMouseDown (e, item) && eqDragging)
+                dragItem = index;
+            return;
+        }
+
+        const auto param = paramOf (item);
+        if (param < 0)
+            return;
+
+        const auto spec = specFor (item);
+
+        if (item.type == Item::menu && ! ui::isResetClick (e))
+        {
+            if (kind == EffectKind::parametricEq && item.colour >= 0)
+            {
+                eqSelected = item.colour;
+                repaint();
+                peqview::showBandMenu (*this, current()->params, item.colour, [this] (std::vector<std::pair<int, float>> changes) { setParams (changes); });
+                return;
+            }
+            juce::PopupMenu menu;
+            const auto labels = plugui::optionLabels (item);
+            const auto chosen = plugui::optionAt (item, valueOf (param));
+            for (int o = 0; o < (int) labels.size(); ++o)
+                menu.addItem (optionTexts (item)[(std::size_t) o], true, o == chosen,
+                              [this, param, v = plugui::optionValue (item, o)] { setValue (param, v); });
+            menu.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (this).withTargetScreenArea (localAreaToGlobal (r.toNearestInt())));
+            return;
+        }
+
+        if (e.mods.isPopupMenu())
+        {
+            ui::showValueMenu (*this, &engine, spec, valueOf (param), [this, param] (double v) { setValue (param, (float) v); });
+            return;
+        }
+
+        if (ui::isResetClick (e))
+        {
+            setValue (param, (float) spec.defaultValue);
+            ui::flashValueTip (*this, r.toNearestInt(), spec.text (spec.defaultValue));
+            return;
+        }
+
+        switch (item.type)
+        {
+            case Item::radio:
+            case Item::tabs:
+            {
+                const auto n = juce::jmax (1, (int) plugui::optionLabels (item).size());
+                auto o = item.type == Item::radio || isVertical (item) ? (int) ((e.position.y - r.getY()) / r.getHeight() * (float) n)
+                                                  : (int) ((e.position.x - r.getX()) / r.getWidth() * (float) n);
+                if (item.type == Item::radio && item.columns > 0)
+                    for (int k = 0; k < n; ++k)
+                        if (gridCell (item, k, n).contains (e.position))
+                            o = k;
+                setValue (param, plugui::optionValue (item, juce::jlimit (0, n - 1, o)));
+                return;
+            }
+            case Item::toggle:
+                setValue (param, valueOf (param) >= 0.5f ? 0.0f : 1.0f);
+                return;
+            case Item::stepper:
+                if (e.position.x > r.getRight() - juce::jmin (12.0f * scale(), r.getWidth() * 0.4f))
+                {
+                    const auto up = e.position.y < r.getY() + (item.label != nullptr ? 12.0f * scale() : 0.0f) + (r.getBottom() - r.getY()) * 0.5f;
+                    const auto step = item.steps > 0 ? 1.0f / (float) item.steps : 0.01f;
+                    setValue (param, valueOf (param) + (up ? step : -step));
+                    ui::flashValueTip (*this, r.toNearestInt(), valueText (param, valueOf (param)));
+                    return;
+                }
+                break;
+            case Item::hslider:
+            case Item::vslider:
+            case Item::knob:
+            case Item::value:
+            case Item::menu:
+            case Item::section:
+            case Item::label:
+            case Item::display:
+                break;
+        }
+
+        dragItem = index;
+        drag.begin (e, valueOf (param));
+        ui::showValueTip (*this, r.toNearestInt(), spec.text (valueOf (param)));
+        repaint();
+    }
+
+    void mouseDrag (const juce::MouseEvent& e) override
+    {
+        if (eqDragging)
+        {
+            eqMouseDrag (e);
+            return;
+        }
+        if (sgDragging && dragItem >= 0)
+        {
+            const auto v = juce::jlimit (0.0f, 1.0f, sgStart - (float) e.getDistanceFromDragStartY() / (e.mods.isCtrlDown() ? 800.0f : 200.0f));
+            setSoundgoodizerAmount (v);
+            ui::showValueTip (*this, rectOf (activeLayout().items[(std::size_t) dragItem]).toNearestInt(), juce::String (v * 100.0f, 0) + "%");
+            return;
+        }
+        if (xyDragging && dragItem >= 0)
+        {
+            xyMouse (e, activeLayout().items[(std::size_t) dragItem]);
+            return;
+        }
+        if (dragItem < 0 || ! drag.isActive())
+            return;
+        const auto& item = activeLayout().items[(std::size_t) dragItem];
+        const auto param = paramOf (item);
+        const auto spec = specFor (item);
+        auto v = drag.update (e, spec);
+        if (item.type == Item::hslider) // horizontal sliders follow the mouse sideways too
+        {
+            const auto r = rectOf (item);
+            v = juce::jlimit (0.0, 1.0, (double) ((e.position.x - r.getX() - 4.0f * scale()) / juce::jmax (1.0f, r.getWidth() - 8.0f * scale())));
+            if (e.mods.isCtrlDown())
+                v = drag.update (e, spec);
+        }
+        setValue (param, (float) v);
+        ui::showValueTip (*this, rectOf (item).toNearestInt(), spec.text (v));
+    }
+
+    void mouseUp (const juce::MouseEvent&) override
+    {
+        eqDragging = false;
+        if (xyDragging || sgDragging)
+        {
+            xyDragging = sgDragging = false;
+            dragItem = -1;
+            ui::hideValueTip();
+        }
+        if (dragItem >= 0)
+        {
+            drag.end();
+            dragItem = -1;
+            ui::hideValueTip();
+            repaint();
+        }
+    }
+
+    void mouseDoubleClick (const juce::MouseEvent& e) override
+    {
+        const auto index = itemAt (e.position);
+        if (index < 0)
+            return;
+        const auto& item = activeLayout().items[(std::size_t) index];
+        if (item.type == Item::display) // EQ graph: the band under the mouse back to 0 dB
+        {
+            if (const auto* fx = current(); fx != nullptr)
+                if (const auto b = peqview::bandAt (eqGraph (rectOf (item)), fx->params, e.position, eqRange); b >= 0)
+                    setParams ({ { peq::param (b, 2), 0.5f } });
+            return;
+        }
+        if (item.type == Item::radio || item.type == Item::tabs || item.type == Item::toggle || item.type == Item::menu || paramOf (item) < 0)
+            return;
+        const auto spec = specFor (item);
+        setValue (paramOf (item), (float) spec.defaultValue);
+    }
+
+    void mouseWheelMove (const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel) override
+    {
+        const auto index = itemAt (e.position);
+        if (index < 0)
+            return;
+        const auto& item = activeLayout().items[(std::size_t) index];
+        if (item.type == Item::display) // EQ graph: Q / bandwidth of the band under the mouse (or the selected one)
+        {
+            const auto* fx = current();
+            if (fx == nullptr)
+                return;
+            auto b = peqview::bandAt (eqGraph (rectOf (item)), fx->params, e.position, eqRange);
+            if (b < 0)
+                b = eqSelected;
+            if (b < 0)
+                return;
+            eqSelected = b;
+            const auto q = fx->params[(std::size_t) peq::param (b, 3)];
+            // wheel up = narrower; FL's width grows the other way
+            const auto step = peq::flLaw (fx->params) ? -wheel.deltaY * 0.15f : wheel.deltaY * 0.15f;
+            setParams ({ { peq::param (b, 3), q + step } });
+            return;
+        }
+        const auto param = paramOf (item);
+        if (param < 0)
+            return;
+        auto spec = specFor (item);
+        if (item.type == Item::radio || item.type == Item::tabs)
+        {
+            const auto n = (int) plugui::optionLabels (item).size();
+            const auto o = plugui::optionAt (item, valueOf (param)) + (wheel.deltaY > 0 ? (item.type == Item::radio ? -1 : 1) : (item.type == Item::radio ? 1 : -1));
+            setValue (param, plugui::optionValue (item, juce::jlimit (0, n - 1, o)));
+            return;
+        }
+        if (const auto v = ui::wheelValue (valueOf (param), e, wheel, spec))
+        {
+            setValue (param, (float) *v);
+            ui::flashValueTip (*this, rectOf (item).toNearestInt(), spec.text (*v));
+        }
+    }
+
+    ui::Hint hintAt (juce::Point<int> position) override
+    {
+        const auto p = position.toFloat();
+        switch (headerItemAt (p))
+        {
+            case 1: return { tr ("Options: presets, reset, bypass"), {}, false, true };
+            case 2: return { tr ("Preset: click for the list of FL presets of this plugin"), presetName, false, true };
+            case 3: return { tr ("Previous preset"), {}, false, false };
+            case 4: return { tr ("Next preset"), {}, false, false };
+            default: break;
+        }
+        const auto index = itemAt (p);
+        if (index < 0)
+            return {};
+        const auto& item = activeLayout().items[(std::size_t) index];
+        if (item.type == Item::display && juce::String (item.display) == "sgamount")
+            return { tr ("Amount: drag up or down (Ctrl: fine)"), juce::String (soundgoodizerAmount() * 100.0f, 0) + "%", false, false };
+        if (item.type == Item::display && juce::String (item.display) == "sgpresets")
+            return { tr ("Soundgoodizer preset A to D (read from your FL installation)"), {}, false, false };
+        if (item.type == Item::display && juce::String (item.display) == "xy")
+            return { tr ("Drag the point: both values at once"), {}, false, false };
+        if (item.type == Item::display)
+            return { tr ("Drag a handle (frequency and gain); mouse wheel = Q; right-click = type; double-click = 0 dB"), {}, false, true };
+        if (hasStyle (item, plugui::pageTabs))
+            return { tr ("Page: switch the controls shown"), {}, false, false };
+        const auto spec = specFor (item);
+        return ui::valueHint (spec, valueOf (paramOf (item)));
+    }
+
+    // --- presets ---------------------------------------------------------------------------------------
+
+    juce::Array<juce::File> presetFiles() const
+    {
+        juce::Array<juce::File> all;
+        const auto roots = findFlStudioRoots();
+        if (roots.data.empty())
+            return all;
+        const auto base = juce::File (juce::String::fromUTF8 (roots.data.c_str())).getChildFile ("Patches/Plugin presets/Effects");
+        for (const auto& plugin : flPluginsForEffect (kind))
+        {
+            auto files = base.getChildFile (juce::String::fromUTF8 (plugin.c_str())).findChildFiles (juce::File::findFiles, true, "*.fst");
+            std::sort (files.begin(), files.end(), [] (const juce::File& a, const juce::File& b) { return a.getFullPathName().compareNatural (b.getFullPathName()) < 0; });
+            all.addArray (files);
+        }
+        return all;
+    }
+
+    void loadPreset (const juce::File& f)
+    {
+        juce::MemoryBlock data;
+        if (! f.loadFileAsData (data))
+            return;
+        const auto* bytes = static_cast<const std::uint8_t*> (data.getData());
+        auto fx = effectFromFlPreset (std::vector<std::uint8_t> (bytes, bytes + data.getSize()), engine.getSong().bpm);
+        if (! fx || fx->kind != kind)
+            return;
+        presetName = f.getFileNameWithoutExtension();
+        engine.editSong ([t = track, s = slot, fx = *fx] (Song& song) {
+            auto& target = song.mixer[(std::size_t) t].effects[(std::size_t) s];
+            const auto enabled = target.enabled;
+            const auto mix = target.mix;
+            target = fx;
+            target.enabled = enabled;
+            target.mix = mix;
+        });
+        repaint();
+    }
+
+    void stepPreset (int delta)
+    {
+        const auto files = presetFiles();
+        if (files.isEmpty())
+            return;
+        auto at = -1;
+        for (int i = 0; i < files.size(); ++i)
+            if (files[i].getFileNameWithoutExtension() == presetName)
+                at = i;
+        at = at < 0 ? (delta > 0 ? 0 : files.size() - 1) : (at + delta + files.size()) % files.size();
+        loadPreset (files[at]);
+    }
+
+    void showOptionsMenu (bool presetsOnly)
+    {
+        juce::PopupMenu presets;
+        const auto files = presetFiles();
+        std::map<juce::String, juce::PopupMenu> folders;
+        const auto roots = findFlStudioRoots();
+        for (const auto& f : files)
+        {
+            const auto folder = f.getParentDirectory().getFileName();
+            auto& menu = folders[folder];
+            menu.addItem (f.getFileNameWithoutExtension(), true, f.getFileNameWithoutExtension() == presetName, [this, f] { loadPreset (f); });
+        }
+        if (folders.size() == 1)
+            presets = folders.begin()->second;
+        else
+            for (auto& [name, menu] : folders)
+                presets.addSubMenu (name, menu);
+
+        if (presetsOnly)
+        {
+            if (presets.getNumItems() == 0)
+                presets.addItem (tr ("No FL presets found for this plugin"), false, false, [] {});
+            presets.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (this).withTargetScreenArea (localAreaToGlobal (presetBox().toNearestInt())));
+            return;
+        }
+
+        juce::PopupMenu menu;
+        if (presets.getNumItems() > 0)
+            menu.addSubMenu (tr ("Presets"), presets);
+        menu.addItem (tr ("Reset to defaults"), [this] {
+            const auto& info = effectInfo (kind);
+            presetName = {};
+            if (stateBacked())
+            {
+                if (const auto* fx = current())
+                {
+                    auto bytes = fx->state;
+                    for (int p = 0; p < plugui::paramCount (kind); ++p)
+                        bytes = maximusfx::withStateParam (bytes, p, maximusfx::stateParams()[(std::size_t) p].defaultValue);
+                    engine.editSong ([t = track, s = slot, bytes] (Song& song) { song.mixer[(std::size_t) t].effects[(std::size_t) s].state = bytes; });
+                }
+                return;
+            }
+            engine.editSong ([t = track, s = slot, info] (Song& song) {
+                auto& params = song.mixer[(std::size_t) t].effects[(std::size_t) s].params;
+                for (std::size_t i = 0; i < info.params.size() && i < params.size(); ++i)
+                    params[i] = info.params[i].defaultValue;
+            });
+        });
+        // switches that FL keeps out of the panel (in its own menus): on / off here
+        if (! activeLayout().menuSwitches.empty())
+        {
+            menu.addSeparator();
+            for (const auto* name : activeLayout().menuSwitches)
+                if (const auto p = plugui::paramIndex (kind, name); p >= 0)
+                {
+                    const auto on = valueOf (p) >= 0.5f;
+                    menu.addItem (utf8 (name), true, on, [this, p, on] { setValue (p, on ? 0.0f : 1.0f); });
+                }
+            menu.addSeparator();
+        }
+        const auto* fx = current();
+        menu.addItem (tr ("Bypass"), true, fx != nullptr && ! fx->enabled, [this] {
+            engine.editSong ([t = track, s = slot] (Song& song) {
+                auto& target = song.mixer[(std::size_t) t].effects[(std::size_t) s];
+                target.enabled = ! target.enabled;
+            });
+        });
+        menu.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (this).withTargetScreenArea (localAreaToGlobal (menuButton().toNearestInt())));
+    }
+
+private:
+    void changeListenerCallback (juce::ChangeBroadcaster*) override { repaint(); }
+
+    AudioEngine& engine;
+    int track, slot;
+    EffectKind kind = EffectKind::eq;
+    const plugui::Layout* layout = nullptr;
+    int page = 0;
+    int hoverItem = -1, hoverHeader = 0, dragItem = -1;
+    ui::ValueDrag drag;
+    juce::String presetName;
+    int eqSelected = -1;
+    bool eqDragging = false, xyDragging = false, sgDragging = false;
+    float sgStart = 0.0f;
+    std::array<std::vector<std::uint8_t>, 4> sgPresets {}; // the installation's preset files A–D (read on demand)
+    juce::Point<float> eqDragOffset;
+};
+
+// --- the window ------------------------------------------------------------------------------------
+
+class NativeEffectWindow final : public juce::DocumentWindow
+{
+public:
+    NativeEffectWindow (AudioEngine& engine, int track, int slot, const juce::String& title)
+        : DocumentWindow (title, theme::colour::bg1, DocumentWindow::closeButton | DocumentWindow::minimiseButton)
+    {
+        setUsingNativeTitleBar (true);
+        auto* editor = new NativeEffectEditor (engine, track, slot, 1.25f, 0);
+        const auto design = editor->designSize();
+        setContentOwned (editor, true);
+        setResizable (true, false);
+        // keep FL's proportions while resizing (the presets bar has a fixed height)
+        if (auto* c = getConstrainer())
+        {
+            c->setMinimumSize (design.x / 2, design.y / 2);
+            c->setMaximumSize (design.x * 3, design.y * 3 + 200);
+        }
+        centreWithSize (getWidth(), getHeight());
+        setVisible (true);
+        keepAboveMainWindow (*this);
+    }
+
+    void closeButtonPressed() override;
+};
+
+std::map<std::pair<int, int>, std::unique_ptr<NativeEffectWindow>>& windows()
+{
+    static std::map<std::pair<int, int>, std::unique_ptr<NativeEffectWindow>> open;
+    return open;
+}
+
+void NativeEffectWindow::closeButtonPressed()
+{
+    for (auto& [key, window] : windows())
+        if (window.get() == this)
+        {
+            juce::MessageManager::callAsync ([k = key] { windows().erase (k); });
+            return;
+        }
+}
+} // namespace
+
+std::unique_ptr<juce::Component> makeNativeEffectEditor (AudioEngine& engine, int track, int slot, float scale, int page)
+{
+    return std::make_unique<NativeEffectEditor> (engine, track, slot, scale, page);
+}
+
+namespace NativeEffectWindows
+{
+bool canOpen (EffectKind kind)
+{
+    return kind != EffectKind::plugin && kind != EffectKind::parallel;
+}
+
+void open (AudioEngine& engine, int track, int slot)
+{
+    const auto& mixer = engine.getSong().mixer;
+    if (track < 0 || track >= (int) mixer.size() || slot < 0 || slot >= (int) mixer[(std::size_t) track].effects.size())
+        return;
+
+    const auto kind = mixer[(std::size_t) track].effects[(std::size_t) slot].kind;
+    if (! canOpen (kind))
+        return;
+    if (kind == EffectKind::parametricEq) // its own editor (response curve with handles)
+    {
+        ParametricEqWindows::open (engine, track, slot);
+        return;
+    }
+
+    auto& open = windows();
+    const auto key = std::make_pair (track, slot);
+
+    if (auto it = open.find (key); it != open.end())
+    {
+        if (it->second->getContentComponent() != nullptr && static_cast<NativeEffectEditor*> (it->second->getContentComponent())->current() != nullptr)
+        {
+            it->second->toFront (true);
+            return;
+        }
+        open.erase (it); // the slot now holds another effect
+    }
+
+    const auto name = track == 0 ? tr ("Master") : juce::String::fromUTF8 (mixer[(std::size_t) track].name.c_str());
+    const auto title = utf8 (effectInfo (kind).name) + " - " + (name.isNotEmpty() ? name : tr ("Insert {0}", { juce::String (track) })) + " ("
+                       + tr ("slot {0}", { juce::String (slot + 1) }) + ")";
+    open[key] = std::make_unique<NativeEffectWindow> (engine, track, slot, title);
+}
+
+void closeAll()
+{
+    windows().clear();
+}
+} // namespace NativeEffectWindows
+} // namespace lynx

+ 24 - 0
src/ui/PluginEditors.h

@@ -0,0 +1,24 @@
+#pragma once
+
+#include <juce_gui_basics/juce_gui_basics.h>
+
+#include "engine/AudioEngine.h"
+
+namespace lynx
+{
+// Editor windows of LYNX's native effects (the engines compatible with FL Studio's plugins). Each one follows the
+// FL plugin's arrangement (core/PluginLayout.h: same controls, sections, captions and places) drawn in LYNX's own
+// style, with a presets bar on top (FL presets of the plugin from the user's installation, previous / next) and
+// LYNX's control contract on every control (drag, Ctrl = fine, wheel, Alt+click / double-click = reset, right-click
+// = type value / automation / MIDI link). Effects without a studied arrangement get a generated grid of knobs.
+namespace NativeEffectWindows
+{
+// can the slot's effect be edited in a native editor window? (not external plugins nor the Patcher container)
+bool canOpen (EffectKind kind);
+void open (AudioEngine& engine, int track, int slot);
+void closeAll();
+} // namespace NativeEffectWindows
+
+// The editor alone at `scale` (1 = FL's size; for --snapshot / --plugui).
+std::unique_ptr<juce::Component> makeNativeEffectEditor (AudioEngine& engine, int track, int slot, float scale = 1.0f, int page = 0);
+} // namespace lynx

+ 165 - 0
tests/tests.cpp

@@ -48,6 +48,7 @@
 #include "core/Granulizer.h"
 #include "core/Drumaxx.h"
 #include "core/Wasp.h"
+#include "core/PluginLayout.h"
 #include "core/Plucked.h"
 #include "core/BeepMap.h"
 #include "core/Sawer.h"
@@ -15150,3 +15151,167 @@ TEST (level_audit_demo_imports_round89)
 }
 #include "UiLook90Tests.inc"
 #include "DialogsTests84.inc"
+
+// --- native plugin editors (round 93): FL's arrangements ---------------------------------------------------------
+
+TEST (plugin_layouts_name_real_parameters)
+{
+    using namespace lynx;
+    // every value control edits a parameter of its effect, inside the body; FL arrangements place (or list in a menu)
+    // every parameter of the effect
+    for (const auto kind : plugui::flLayoutKinds())
+    {
+        const auto& l = plugui::layoutFor (kind);
+        const auto& info = effectInfo (kind);
+        CHECK (plugui::hasFlLayout (kind));
+        CHECK (l.width > 100 && l.height > 60);
+        std::vector<bool> placed ((std::size_t) plugui::paramCount (kind), false);
+
+        for (const auto& item : l.items)
+        {
+            CHECK (item.x >= 0.0f && item.y >= 0.0f && item.x + item.w <= (float) l.width + 0.5f && item.y + item.h <= (float) l.height + 0.5f);
+            if (item.param != nullptr)
+            {
+                const auto p = plugui::paramIndex (kind, item.param);
+                CHECK (p >= 0);
+                if (p >= 0)
+                    placed[(std::size_t) p] = true;
+            }
+            if (item.type == plugui::Item::radio || item.type == plugui::Item::tabs || item.type == plugui::Item::menu)
+            {
+                const auto labels = plugui::optionLabels (item);
+                CHECK (labels.size() >= 2);
+                CHECK (item.values.empty() || item.values.size() == labels.size());
+            }
+            if (item.type == plugui::Item::knob && item.h + 0.5f < item.w) // (a caption above its knob would hide it)
+            {
+                std::printf ("  %s: knob '%s' is shorter than it is wide\n", info.name, item.param != nullptr ? item.param : "");
+                CHECK (false);
+            }
+            CHECK (item.param2 == nullptr || plugui::paramIndex (kind, item.param2) >= 0);
+            if (item.param2 != nullptr && plugui::paramIndex (kind, item.param2) >= 0)
+                placed[(std::size_t) plugui::paramIndex (kind, item.param2)] = true;
+            for (const auto* when : { item.whenParam, item.when2Param })
+                CHECK (when == nullptr || plugui::paramIndex (kind, when) >= 0);
+        }
+        for (const auto* name : l.menuSwitches)
+        {
+            const auto p = plugui::paramIndex (kind, name);
+            CHECK (p >= 0);
+            if (p >= 0)
+                placed[(std::size_t) p] = true;
+        }
+        for (const auto* name : l.editedElsewhere)
+        {
+            const auto p = plugui::paramIndex (kind, name);
+            CHECK (p >= 0);
+            if (p >= 0)
+                placed[(std::size_t) p] = true;
+        }
+        for (std::size_t p = 0; p < placed.size(); ++p)
+            if (! placed[p])
+            {
+                std::printf ("  %s: parameter '%s' has no control\n", info.name, plugui::paramName (kind, (int) p));
+                CHECK (false);
+            }
+    }
+}
+
+TEST (maximus_editor_edits_the_slot_state)
+{
+    using namespace lynx;
+    // the Maximus page edits the 59 parameters stored in the slot's state (REA_rodada8 §1.2)
+    std::array<std::array<int, 13>, 4> bands {};
+    for (auto& b : bands)
+        b = { 0, 1000, 1000, 0, 0, 1000, 1115, 0, 2, 5000, 3, 2882, 0 };
+    std::array<std::vector<std::array<double, 4>>, 8> envs;
+    for (auto& e : envs)
+        e = { { 0.0, 0.0, 0.0, 2 }, { 0.5, 0.5, 0.0, 2 }, { 0.5, 0.5, 0.0, 2 } };
+    const auto state = maximusTestState ({ 19800, 1, 48065, 1, 1115, 1000, 32768 }, bands, envs, 0);
+    const auto slot = maximusfx::pack ({ hlfx::MaximusBuild::shared, -1, state });
+
+    CHECK (maximusfx::stateParams().size() == 59);
+    CHECK (plugui::paramIndex (EffectKind::maximus, "Master release") == 7 + 13 * 3 + 9);
+    CHECK (maximusfx::stateParam (slot, 0).value_or (-1) == 19800);
+    CHECK (maximusfx::stateParam (slot, 7 + 13 + 9).value_or (-1) == 5000);
+    CHECK (maximusfx::stateParamText (0, 19800) == "200 Hz");
+    CHECK (maximusfx::stateParamText (2, 48065) == "3000 Hz");
+    CHECK (maximusfx::stateParamText (8, 1000) == "+0.0 dB");
+    CHECK (maximusfx::stateParamText (7 + 6, 0) == "Default");
+    CHECK (maximusfx::stateParamText (7 + 13 * 3 + 6, 1115) == "2.00 ms");
+    CHECK (maximusfx::stateParamText (6, -1) == "Off");
+
+    const auto edited = maximusfx::withStateParam (slot, 7 + 13 + 1, 2000); // mid pre gain → +18 dB
+    CHECK (maximusfx::stateParam (edited, 7 + 13 + 1).value_or (-1) == 2000);
+    CHECK (maximusfx::stateParam (edited, 7 + 1).value_or (-1) == 1000);
+    CHECK (maximusfx::stateParam (maximusfx::withStateParam (slot, 0, 99999), 0).value_or (-1) == 65536); // clamped
+    const auto blob = maximusfx::unpack (edited);
+    const auto original = maximusfx::unpack (slot);
+    CHECK (blob && original && (hlfx::makeMaximusPreset (blob->state) != nullptr) == (hlfx::makeMaximusPreset (original->state) != nullptr));
+
+    const auto curve = maximusfx::curvePoints (slot, 3);
+    CHECK (curve.size() == 3 && std::abs (curve[1].first - 0.5f) < 1e-6f && std::abs (curve[2].first - 1.0f) < 1e-6f);
+    CHECK (maximusfx::selectedBand (slot) >= 0);
+    CHECK (plugui::hasFlLayout (EffectKind::maximus));
+}
+
+TEST (plugin_layout_options_match_the_engine_values)
+{
+    using namespace lynx;
+    // the switches show FL's captions for the engine's own values
+    const auto text = [] (EffectKind kind, const char* param, int option) {
+        for (const auto& item : plugui::layoutFor (kind).items)
+            if (item.param != nullptr && std::strcmp (item.param, param) == 0 && item.options != nullptr)
+                return formatEffectParam (kind, plugui::paramIndex (kind, param), plugui::optionValue (item, option), 120.0);
+        return std::string ("?");
+    };
+    CHECK (text (EffectKind::fruityDelay3, "Delay type", 0) == "Fake stereo");
+    CHECK (text (EffectKind::fruityDelay3, "Delay type", 2) == "Ping pong");
+    CHECK (text (EffectKind::fruityDelay3, "Delay type", 3) == "Off");
+    CHECK (text (EffectKind::fruityDelay3, "Filter mode", 1) == "High pass");
+    CHECK (text (EffectKind::fruityDelay3, "Saturation type", 1) == "Saturate");
+    CHECK (text (EffectKind::fruityMultiband, "Low mode", 1) == "off");
+    CHECK (text (EffectKind::fruityMultiband, "High mode", 2) == "bypass");
+    CHECK (text (EffectKind::luxeVerb, "Pitch type", 1) == "feed-forward");
+    CHECK (text (EffectKind::luxeVerb, "Freeze mode", 2) == "sustain");
+    CHECK (text (EffectKind::stereoEnhancer, "Invert", 2) == "invert R");
+    CHECK (text (EffectKind::parametricEq, "B3 type", 4) == formatEffectParam (EffectKind::parametricEq, peq::param (2, 0), peq::typeValue (peq::BandType::lowCut), 120.0));
+
+    // the option nearest to a value; pages and conditions
+    plugui::LayoutItem radio;
+    radio.type = plugui::Item::radio;
+    radio.options = "A|B|C|D";
+    CHECK (plugui::optionLabels (radio).size() == 4);
+    CHECK (plugui::optionAt (radio, 0.30f) == 1);
+    CHECK (plugui::optionAt (radio, 0.95f) == 3);
+    CHECK (std::abs (plugui::optionValue (radio, 2) - 2.0f / 3.0f) < 1e-6f);
+
+    const auto& lux = plugui::layoutFor (EffectKind::luxeVerb);
+    auto params = makeEffectSlot (EffectKind::luxeVerb).params;
+    const auto pitchType = plugui::paramIndex (EffectKind::luxeVerb, "Pitch type");
+    int feedForward = 0, feedback = 0;
+    for (float v : { 0.0f, 1.0f })
+    {
+        params[(std::size_t) pitchType] = v;
+        for (const auto& item : lux.items)
+            if (item.param != nullptr && std::strcmp (item.param, "Feed-forward pitch 1") == 0 && plugui::isShown (EffectKind::luxeVerb, item, 0, params))
+                ++feedForward;
+            else if (item.param != nullptr && std::strcmp (item.param, "Feedback pitch") == 0 && plugui::isShown (EffectKind::luxeVerb, item, 0, params))
+                ++feedback;
+    }
+    CHECK (feedForward == 1); // only in feed-forward mode
+    CHECK (feedback == 2);    // value plate + fader, only in feedback mode
+
+    const auto& limiter = plugui::layoutFor (EffectKind::fruityLimiter);
+    CHECK (limiter.pages.size() == 2);
+    int ceilingShown = 0;
+    for (int page = 0; page < 2; ++page)
+        for (const auto& item : limiter.items)
+            if (item.param != nullptr && std::strcmp (item.param, "Ceiling") == 0 && plugui::isShown (EffectKind::fruityLimiter, item, page, params))
+                ++ceilingShown;
+    CHECK (ceilingShown == 1); // LIMIT page only
+
+    // every other effect still gets a (generated) window
+    CHECK (! plugui::hasFlLayout (EffectKind::distortion));
+    CHECK (! plugui::layoutFor (EffectKind::distortion).items.empty());
+}