Q-W1 pt2: core/shell/app relocation + sub-namespaces; one concrete ui::Rect (LTRB fork retired); slot_map split from bank_book; BankIndex→BankModel; 59/59 green

This commit is contained in:
2026-07-28 20:48:56 -04:00
parent 67a41728f3
commit 847936f813
222 changed files with 2247 additions and 2079 deletions
+42
View File
@@ -0,0 +1,42 @@
// overflow_menu — pure implementation. See overflow_menu.h. NO REAPER / SWELL / LICE / vendor.
#include "core/ui/overflow_menu.h"
namespace reasampler::ui {
int menuButtonReserve(const MenuBarRect& bar, const MenuButtonSpec& spec) {
if (bar.width <= 0 || bar.height <= 0 || spec.buttonWidth <= 0) return 0;
// The reserve is the button width plus a right gap (rightInset) and a matching left gap
// (also rightInset) so the frequent buttons have breathing room before the menu button.
return spec.buttonWidth + 2 * spec.rightInset;
}
MenuButtonRect computeMenuButton(const MenuBarRect& bar, const MenuButtonSpec& spec) {
MenuButtonRect btn;
if (bar.width <= 0 || bar.height <= 0 || spec.buttonWidth <= 0) return btn;
const int right = bar.x + bar.width - spec.rightInset;
const int left = right - spec.buttonWidth;
if (left < bar.x + spec.minLeftInset) return btn; // too narrow — suppress
int top = bar.y + spec.verticalInset;
int height = bar.height - 2 * spec.verticalInset;
if (height <= 0) { // thin band: clamp to the band's own extents rather than go negative
top = bar.y;
height = bar.height;
}
btn.x = left;
btn.y = top;
btn.width = spec.buttonWidth;
btn.height = height;
return btn;
}
bool hitTestMenuButton(int px, int py, const MenuButtonRect& button) {
if (button.empty()) return false;
return px >= button.x && px < button.x + button.width &&
py >= button.y && py < button.y + button.height;
}
} // namespace reasampler::ui