Cut core/ui and core/audio comment bloat ~60% (comments only, zero code change)

This commit is contained in:
2026-07-29 20:49:02 -04:00
parent 1f24c4b095
commit 3d3415f943
29 changed files with 527 additions and 1225 deletions
+14 -29
View File
@@ -1,22 +1,14 @@
#pragma once
// tooltip — the REAPER-free layout math + text helper behind the bank_panel's custom hover-delay
// tooltip (Phase L, L5, refinement 2). Button FACES stay short (the terse shortLabel); hovering a
// button for a short delay pops a small tooltip carrying the FULL action name with the
// "ReaSampler:" display prefix stripped. The tooltip is a custom LICE-kit draw (NOT the native
// Win32 / SWELL tooltip control) — chosen so it is uniform across platforms and consistent with
// the L1 kit (brief §tooltip mechanism). The DAW-bound parts (the hover timer, the LICE overlay
// draw, the kbd/action-name query) live in the shell; what is NOT DAW-bound — WHERE the tooltip
// box sits relative to its anchor button within the panel client, and stripping the display
// prefix — lives here, unit-tested outside the DAW. Mirror of prune_button / component_geometry.
//
// PURE MODULE: NO REAPER types, NO SWELL, NO LICE, NO vendor/ includes. Standard library only.
// tooltip — layout math + text helper behind the bank_panel's custom hover-delay tooltip. Button
// faces stay short; hovering pops a small tooltip with the full action name, "ReaSampler:"
// display prefix stripped. Custom LICE-kit draw, not the native Win32/SWELL tooltip control, for
// cross-platform uniformity with the rest of the kit.
#include <string>
namespace reasampler::ui {
// The tooltip's box (top-left origin, SWELL/LICE convention). A zero-area rect means "do not
// draw" (degenerate inputs); the caller checks empty() before drawing.
// Zero-area means "do not draw" (degenerate inputs); caller checks empty() first.
struct TooltipBox {
int x = 0;
int y = 0;
@@ -30,10 +22,8 @@ struct TooltipBox {
}
};
// Placement inputs, in pixels.
// * gap — vertical gap between the anchor button and the tooltip box.
// * padX/padY — horizontal / vertical text padding inside the box.
// * margin — minimum clearance kept from the client edges when clamping.
// gap: vertical gap between anchor button and tooltip. padX/padY: text padding inside the box.
// margin: minimum clearance from client edges when clamping.
struct TooltipSpec {
int gap = 4;
int padX = 6;
@@ -41,20 +31,15 @@ struct TooltipSpec {
int margin = 2;
};
// Strips the action DISPLAY PREFIX from a full action name for the tooltip face. The registered
// gaccel name is composed as `prefix + phrase` (prefix from actionDisplayPrefix(), e.g.
// "ReaSampler: "); the tooltip shows only the phrase. If `fullName` does not start with
// `prefix`, it is returned unchanged (defensive — a name from an unexpected source still shows).
// An empty prefix returns fullName unchanged.
// Strips the action display prefix (e.g. "ReaSampler: ") from a full action name for the
// tooltip face. If fullName doesn't start with prefix, returned unchanged (defensive). Empty
// prefix returns fullName unchanged.
std::string stripActionPrefix(const std::string& fullName, const std::string& prefix);
// Places a tooltip of pixel size (textW + 2*padX) x (textH + 2*padY) for the button rect
// (anchorX, anchorY, anchorW, anchorH), clamped inside the client rect (0,0,clientW,clientH).
// Preference: BELOW the anchor, horizontally centred on it. If it would clip the bottom edge,
// it flips ABOVE the anchor. It is then clamped horizontally (and vertically as a last resort)
// to stay within `margin` of the client edges. Returns an empty box when the text extent or the
// client is degenerate. `textW`/`textH` are the measured text extents (the shell measures with
// the kit font before calling).
// Places a tooltip of size (textW + 2*padX) x (textH + 2*padY) for the anchor button rect,
// clamped inside the client rect. Prefers BELOW the anchor, centered; flips ABOVE if it would
// clip the bottom edge, then clamps to stay within `margin` of the client edges. Empty when the
// text extent or client is degenerate. textW/textH are measured by the shell before calling.
TooltipBox computeTooltip(int anchorX, int anchorY, int anchorW, int anchorH,
int textW, int textH, int clientW, int clientH,
const TooltipSpec& spec);