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
+19 -13
View File
@@ -1,12 +1,12 @@
// editor_input_chrome.cpp — the CHROME band's input: the Browse nav, the preview trigger,
// the preview-velocity knob grab, the curve-button summon, the channel toggle, and the
// root-marker grab plus its live drag. Windows-only.
// piano strip's root grab plus its live drag. Windows-only.
#include "shell/instrument/reasampler_editor.h"
#ifdef _WIN32
#include "core/instrument/ui/keyboard_strip.h" // keyAtPoint / resolveDragNote (root marker)
#include "core/instrument/ui/keyboard_strip.h" // keyAtPoint / resolveDragNote (root key)
#include "shell/instrument/editor_internal.h"
#include "shell/instrument/reasampler_processor.h"
@@ -69,31 +69,32 @@ bool ReaSamplerEditor::mouseDownChrome(const FaceLayout& fl, int x, int y) {
return true;
}
// The root strip: grab the root marker. A plain click sets the root to the clicked key
// (applied below as the first delta==0 move).
if (cr.rootStrip.width > 0) {
// The piano strip: clicking a key sets the root, and holding tracks the pointer. The
// click itself lands below as the first (unmoved) drag resolve.
if (!cr.rootStrip.empty()) {
const StripLayout sl = layoutStrip(cr.rootStrip.width, cr.rootStrip.height);
const int note = keyAtPoint(sl, x - cr.rootStrip.x, y - cr.rootStrip.y);
if (note >= 0) {
if (keyAtPoint(sl, x - cr.rootStrip.x, y - cr.rootStrip.y) >= 0) {
drag_ = DragKind::kRootMarker;
dragStartX_ = x;
dragStartRoot_ = note;
dragStartParams_ = params_;
onMouseMove(x, y); // apply the click as the first delta==0 set
onMouseMove(x, y);
return true;
}
}
// A click on the control row's background is consumed so it can't fall through to a
// A click on the strip row's background is consumed so it can't fall through to a
// band the user cannot see under the chrome.
return contains(cr.controls, x, y);
}
void ReaSamplerEditor::dragChrome(const FaceLayout& fl, int x, int y) {
(void)y;
const Rect& stripArea = fl.chrome.rootStrip;
if (stripArea.width <= 0) return;
if (stripArea.empty()) return;
// Absolute tracking, not a pixel delta: with black keys overlaying whites there is no
// one pixels-per-semitone rate a delta could use.
const StripLayout sl = layoutStrip(stripArea.width, stripArea.height);
params_.rootOverride = resolveDragNote(sl, dragStartRoot_, x - dragStartX_);
const int note = resolveDragNote(sl, x - stripArea.x, y - stripArea.y);
if (note < 0) return;
params_.rootOverride = note;
invalidate(); // live feedback; the commit lands on WM_LBUTTONUP
}
@@ -107,6 +108,11 @@ ReaSamplerEditor::HoverTarget ReaSamplerEditor::hoverChrome(const FaceLayout& fl
if (contains(cr.curveBtn, x, y)) return {HoverKind::kCurveButton, -1};
if (contains(cr.chanMono, x, y)) return {HoverKind::kChanMono, -1};
if (contains(cr.chanStereo, x, y)) return {HoverKind::kChanStereo, -1};
if (!cr.rootStrip.empty()) {
const StripLayout sl = layoutStrip(cr.rootStrip.width, cr.rootStrip.height);
const int note = keyAtPoint(sl, x - cr.rootStrip.x, y - cr.rootStrip.y);
if (note >= 0) return {HoverKind::kStripKey, note};
}
return {};
}