Rebuild the chrome band: full-width piano strip with uniform key widths, note tooltips, one toolbar font

This commit is contained in:
2026-07-30 09:14:07 -04:00
parent ea52b14f2a
commit ae23ee0882
14 changed files with 656 additions and 386 deletions
+6 -58
View File
@@ -1,8 +1,8 @@
// editor_internal.h — shared helpers for the ReaSamplerEditor TU family. Included ONLY by
// the editor's own shell TUs (editor_session / editor_controls / editor_paint_* /
// editor_input_* / editor_platform) — never a public seam. Holds the Rect<->kit adapters,
// small draw primitives (knob face / spectral strip / root marker / title band), label
// helpers, deck group ids, and the velocity-curve box derivation. All inline.
// small draw primitives (knob face / title band), label helpers, deck group ids, and the
// velocity-curve box derivation. All inline.
#pragma once
@@ -14,6 +14,7 @@
#include "core/instrument/engine/velocity_curve.h" // VelocityCurve::Box (curveBoxFromRect)
#include "core/instrument/map/sample_map.h" // SampleChoice / SampleRefs (sampleLabel)
#include "core/instrument/ui/editor_geometry.h" // Rect (the shared sub-rect type)
#include "core/instrument/ui/keyboard_strip.h" // noteName (the one note-naming source)
#ifdef _WIN32
#include "wdltypes.h"
@@ -22,7 +23,6 @@
#include "core/audio/peaks.h" // Envelope (drawEnvelope)
#include "core/instrument/ui/capture_browser.h" // BrowserLayout / cardThumbnailRect (thumbBins)
#include "core/instrument/ui/param_slider.h" // KnobGeometry / KnobArc (drawKnobFace)
#include "core/instrument/ui/keyboard_strip.h" // StripLayout / keyRect / isNaturalKey (spectral strip)
#include "core/ui/component_geometry.h" // KitBox / waveformColumnCount
#include "core/ui/theme.h" // Role / InteractionState / KitColor / spectralColor
#include "shell/panel/draw_kit.h" // the L1 draw kit: fillSurface/text/drawWaveform/toLice
@@ -55,15 +55,10 @@ inline instrument::engine::VelocityCurve::Box curveBoxFromRect(
(std::max)(0, r.height - 2 * kVelCurveInset)};
}
// A short MIDI-note label ("C4", "F#3") for the root badge. Middle C (60) is C4 (the
// common DAW convention REAPER uses).
// A short MIDI-note label ("C4", "F#3"). The naming itself is the pure strip module's, so
// a browser badge and a strip tooltip can never disagree about what a note is called.
inline std::string noteLabel(int note) {
static const char* kNames[12] = {"C", "C#", "D", "D#", "E", "F",
"F#", "G", "G#", "A", "A#", "B"};
if (note < 0) note = 0;
if (note > 127) note = 127;
const int octave = note / 12 - 1; // MIDI 0 = C-1; 60 = C4
return std::string(kNames[note % 12]) + std::to_string(octave);
return instrument::ui::noteName(note);
}
// A display name for a bank sample id: the snapshotted bank list first, then the
@@ -170,53 +165,6 @@ inline void drawKnobFace(LICE_IBitmap* bmp, const instrument::ui::Rect& knobRect
toLice(ui::roleColor(needleRole)), 1.0f, 0, true);
}
// Draws the pastel spectral keyboard-strip background: each MIDI key column filled with
// its spectral hue, accidentals darkened with an overlay wash so pitch position reads as
// a keyboard at a glance.
inline void drawSpectralStrip(LICE_IBitmap* bmp, const instrument::ui::Rect& stripArea) {
using instrument::ui::StripLayout;
if (stripArea.width <= 0 || stripArea.height <= 0) return;
const StripLayout sl = instrument::ui::layoutStrip(stripArea.width, stripArea.height);
const int sx = stripArea.x;
const int sy = stripArea.y;
const int h = stripArea.height;
const LICE_pixel darkKey = toLice(ui::roleColor(ui::Role::BgBase));
for (int n = 0; n <= 127; ++n) {
const instrument::ui::Rect k = instrument::ui::keyRect(sl, n);
const int x0 = k.x + sx;
const int x1 =
(n < 127) ? instrument::ui::keyRect(sl, n + 1).x + sx : stripArea.right();
const int cw = (std::max)(1, x1 - x0);
const ui::KitColor hue = ui::spectralColor(static_cast<double>(n) / 127.0);
LICE_FillRect(bmp, x0, sy, cw, h, toLice(hue), 0.55f, 0);
if (!instrument::ui::isNaturalKey(n)) {
LICE_FillRect(bmp, x0, sy, cw, h, darkKey, 0.55f, 0);
}
}
// Faint per-octave key ticks (hairline role) for orientation.
const LICE_pixel tick = toLice(ui::roleColor(ui::Role::LineHairline));
for (int n = 0; n <= 127; n += 12) {
const instrument::ui::Rect k = instrument::ui::keyRect(sl, n);
LICE_Line(bmp, k.x + sx, sy, k.x + sx, sy + h, tick, 1.0f, 0, false);
}
}
// Draws the single-capture root marker: an accent-primary bar with a soft static glow —
// the "this is live" mark.
inline void drawRootMarker(LICE_IBitmap* bmp, const instrument::ui::Rect& stripArea,
const instrument::ui::StripLayout& sl, int root) {
const int sx = stripArea.x;
const int sy = stripArea.y;
const int h = stripArea.height;
const instrument::ui::Rect marker = instrument::ui::rootMarkerRect(sl, root);
const int mw = (std::max)(2, marker.width);
const LICE_pixel accent = toLice(ui::roleColor(ui::Role::AccentPrimary));
const LICE_pixel glow = toLice(ui::roleColor(ui::Role::AccentHot));
// Static glow: a wider low-alpha halo behind the crisp bar (a drawn state, not a pulse).
LICE_FillRect(bmp, marker.x + sx - 3, sy, mw + 6, h, glow, 0.30f, 0);
LICE_FillRect(bmp, marker.x + sx, sy, mw, h, accent, 1.0f, 0);
}
#endif // _WIN32
} // namespace reasampler::vst