Cut core/ui and core/audio comment bloat ~60% (comments only, zero code change)
This commit is contained in:
+19
-47
@@ -1,44 +1,23 @@
|
||||
#pragma once
|
||||
#include "core/ui/rect.h"
|
||||
// overflow_menu — the REAPER-free layout math behind the bank_panel TOP toolbar's "⋯ / More"
|
||||
// overflow-menu button (Phase L, L5, refinement 1). The rare capture variants (Batch Items /
|
||||
// Batch Razor / Capture RT) move OFF the always-visible top bar into a popup opened by a small
|
||||
// square button pinned to the FAR RIGHT of the top toolbar band. This module owns two things,
|
||||
// both unit-tested outside the DAW:
|
||||
// * WHERE the More button sits in the top toolbar band (right-anchored, vertically inset);
|
||||
// * the horizontal RESERVE the action_bar must leave for it, so the frequent buttons never
|
||||
// run under the menu button (the shell shrinks the action_bar's usable width by this).
|
||||
// The popup itself (TrackPopupMenu) + the command dispatch is shell — a transient OS menu, not
|
||||
// panel chrome (brief §1: "a REAPER/host popup menu is acceptable"). Only the button
|
||||
// geometry + hit-test live here.
|
||||
//
|
||||
// PURE MODULE: NO REAPER types, NO SWELL, NO LICE, NO vendor/ includes. Standard library only.
|
||||
// Mirror of prune_button / mode_switch. The bar rect type it consumes mirrors action_bar's
|
||||
// ActionBarRect shape but is named distinctly to avoid coupling the two modules.
|
||||
// overflow_menu — layout for the bank_panel top toolbar's "..." overflow-menu button: the rare
|
||||
// capture variants (Batch Items / Batch Razor / Capture RT) live in a popup opened by a small
|
||||
// square button right-anchored in the top toolbar band. Owns the button's placement and the
|
||||
// horizontal reserve action_bar must leave so its buttons never run under it. The popup itself
|
||||
// (TrackPopupMenu) and command dispatch are shell concerns.
|
||||
|
||||
namespace reasampler::ui {
|
||||
|
||||
// The toolbar band the button is drawn into, top-left origin (SWELL/LICE convention). The
|
||||
// shell derives this from topToolbarRect(). A distinct type from action_bar::ActionBarRect so
|
||||
// this module stands alone (same shape; deliberate — the two modules are not coupled).
|
||||
using MenuBarRect = Rect; // Q-W1: the shared concrete ui::Rect (core/ui/rect.h), role-aliased
|
||||
// The toolbar band the button draws into, top-left origin.
|
||||
using MenuBarRect = Rect;
|
||||
|
||||
// The More button's pixel rectangle within the band, top-left origin. A zero-area rect
|
||||
// (width <= 0 or height <= 0) means "no button" — the band is degenerate or too narrow to
|
||||
// place the button clear of its left inset; the caller must not draw or hit-test it. The
|
||||
// three variants stay reachable via their bindable commands, so a suppressed button is
|
||||
// graceful, not a lost affordance.
|
||||
using MenuButtonRect = Rect; // Q-W1: the shared concrete ui::Rect (core/ui/rect.h), role-aliased
|
||||
// The More button's rect. Zero-area means "no button" — the three variants stay reachable via
|
||||
// their bindable commands regardless.
|
||||
using MenuButtonRect = Rect;
|
||||
|
||||
// Layout inputs for the More button, in pixels. Defaults match the bank_panel top-toolbar
|
||||
// metrics; the shell passes its own so draw and hit-test share one source of truth.
|
||||
// * buttonWidth — the button's fixed width (a compact square-ish glyph button).
|
||||
// * rightInset — gap from the band's right edge to the button's right edge.
|
||||
// * verticalInset — top/bottom gap inside the band (shorter than the band so it reads as a
|
||||
// raised control, matching the action_bar buttons' verticalInset).
|
||||
// * minLeftInset — the button's left edge must stay at least this far from the band left
|
||||
// edge; if it would encroach past this, computeMenuButton yields an empty
|
||||
// rect (button suppressed).
|
||||
// Layout inputs, in pixels; defaults match the bank_panel top-toolbar metrics.
|
||||
// * minLeftInset — button's left edge must stay at least this far from the band's left edge;
|
||||
// otherwise computeMenuButton suppresses it (empty rect).
|
||||
struct MenuButtonSpec {
|
||||
int buttonWidth = 28;
|
||||
int rightInset = 6;
|
||||
@@ -46,23 +25,16 @@ struct MenuButtonSpec {
|
||||
int minLeftInset = 40;
|
||||
};
|
||||
|
||||
// The horizontal reserve (px) the action_bar must leave at the band's right so its buttons
|
||||
// never run under the More button: the button width + both insets (right gap + a matching
|
||||
// left breathing gap equal to rightInset). The shell subtracts this from the action_bar rect's
|
||||
// width before laying out slots. Returns 0 for a degenerate band (nothing to reserve).
|
||||
// Horizontal reserve (px) action_bar must leave at the band's right: button width + both insets.
|
||||
// 0 for a degenerate band.
|
||||
int menuButtonReserve(const MenuBarRect& bar, const MenuButtonSpec& spec);
|
||||
|
||||
// Computes the More button's rect within `bar` per `spec`. Right-anchored: the button's right
|
||||
// edge is bar.x + bar.width - rightInset, its width is buttonWidth, vertically centred by
|
||||
// verticalInset. Returns an EMPTY rect when: the band is degenerate (width/height <= 0), the
|
||||
// buttonWidth is non-positive, OR the resulting left edge would fall closer to the band left
|
||||
// than minLeftInset. A thin band clamps the button height to the band's own rather than going
|
||||
// negative (mirror of computePruneButton).
|
||||
// The More button's rect within `bar`, right-anchored, vertically centred by verticalInset.
|
||||
// Empty when the band is degenerate, buttonWidth <= 0, or the left edge would fall closer to the
|
||||
// band's left than minLeftInset. A thin band clamps height to the band's own rather than negative.
|
||||
MenuButtonRect computeMenuButton(const MenuBarRect& bar, const MenuButtonSpec& spec);
|
||||
|
||||
// True iff the point (px, py) (SWELL/LICE top-left client coords) falls inside `button`.
|
||||
// Half-open bounds [x, x+width) x [y, y+height) — matches computeMenuButton so draw and
|
||||
// hit-test agree on the same pixels. An empty button never claims a point (always false).
|
||||
// Half-open bounds, matching computeMenuButton. Empty button claims nothing.
|
||||
bool hitTestMenuButton(int px, int py, const MenuButtonRect& button);
|
||||
|
||||
} // namespace reasampler::ui
|
||||
|
||||
Reference in New Issue
Block a user