Q-W2 review follow-ups: anon-namespace TU-private panel helpers, fix stale bank_panel.cpp comments, correct shim-transitivity claim

Wraps ~50 file-local helpers across all eight panel TUs in namespace{} (dissolves the menuAppend default-arg ODR trap); zero behavior change, 60/60 green.
This commit is contained in:
2026-07-29 11:28:48 -04:00
parent 30a4ffd01b
commit 19b12186ac
8 changed files with 64 additions and 6 deletions
+12
View File
@@ -49,6 +49,8 @@ int modeCount() {
// buttons tile into the band MINUS the menu reserve (topToolbarActionRect), so they never run
// under the menu button (L5 refinement 1).
namespace {
ActionBarRect topToolbarRect(int w) {
ActionBarRect s;
s.x = 0;
@@ -67,6 +69,8 @@ MenuBarRect topMenuBarRect(int w) {
// The More button's rect (right-anchored in the top band). Empty when the band is too narrow
// to place it clear of its left inset — the three variants stay reachable via their bindable
// commands (graceful suppression).
} // namespace
MenuButtonRect topMenuButtonRect(int w) {
return computeMenuButton(topMenuBarRect(w), kMenuBtnSpec);
}
@@ -200,6 +204,8 @@ std::vector<ActionBarRow> overflowMenuRows() {
};
}
namespace {
// The active mode id the opposite-mode gate + footer toggle both read (ONE source of truth for
// "which mode is active"). Empty when no session (every button then falls to fail-open live).
std::string activeModeIdOrEmpty() {
@@ -207,6 +213,8 @@ std::string activeModeIdOrEmpty() {
return g_panel.session->view().activeModeId();
}
} // namespace
// The BOTTOM toolbar inventory (L5 refinement 3): FOUR Item/Track x Arrange/Design tag buttons
// then a set-apart Show Both. The suffixes are the ACTUAL registered command-id strings from
// actions.cpp (VIEW_MOVE_ITEMS_ARRANGE / VIEW_MOVE_ITEMS_DESIGN for the item moves;
@@ -290,6 +298,8 @@ int resolveBarCommandId(const ActionBarRow& row) {
return NamedCommandLookup(named.c_str());
}
namespace {
// The current key binding string for a command in the MAIN section, or "" (unbound / not
// registered). Queried via kbd_getTextFromCmd (SectionFromUniqueID(0)).
std::string barBindingText(int cmd) {
@@ -300,6 +310,8 @@ std::string barBindingText(int cmd) {
return {};
}
} // namespace
// The flat action index under (x, y) in `bar` for the given row set, or -1 (miss). Pure hit-test.
int toolbarHit(int x, int y, const ActionBarRect& bar, const std::vector<ActionBarRow>& rows) {
if (bar.height <= 0) return -1;