Files
reasampler/src/core/ui/prune_button.h
T

39 lines
1.9 KiB
C++

#pragma once
#include "core/ui/rect.h"
// prune_button — layout for the bank_panel's Prune button in the tail-footer strip. Panel shell
// owns SWELL/LICE/dispatch; this owns whether a click lands on it.
//
// Placement: right-anchored in the footer, inset from the right edge, just left of the version
// readout, set apart from the footer_bar left group (mode toggle / count / Tail). Suppressed
// (empty rect) rather than drawn overlapping when the footer is too narrow — the command stays
// reachable via its binding either way.
namespace reasampler::ui {
using FooterRect = Rect;
using ButtonRect = Rect;
// Layout inputs, in pixels; defaults match the bank_panel footer metrics.
// * rightInset — gap from the footer's right edge to the button's right edge, clearing the
// right-aligned version readout. COUPLED to drawFooter's version-readout
// margin (panel_render.cpp) and to FooterBarSpec::rightReserve, which must
// exceed rightInset + buttonWidth so the left group never runs under this
// button. Update together if either margin changes.
// * minLeftInset — button's left edge must stay this far from the footer left edge (room for
// the footer-left group); otherwise the button is suppressed.
struct PruneButtonSpec {
int buttonWidth = 72;
int rightInset = 84;
int verticalInset = 4;
int minLeftInset = 120;
};
// Right-anchored rect within `footer`, vertically centred. Empty when the footer is degenerate
// or the resulting left edge would fall closer to the footer's left than minLeftInset.
ButtonRect computePruneButton(const FooterRect& footer, const PruneButtonSpec& spec);
// Half-open bounds, matching computePruneButton. Empty button never claims a point.
bool hitTestPruneButton(int px, int py, const ButtonRect& button);
} // namespace reasampler::ui