Fix Insert-as-FX review findings: id rename, selection-count drift, refusal tooltip, success msg, master-only, reserve test
Renames the permanent action id out of the placement family, makes the button's painted state and pressed outcome share one selection count, surfaces panel-known refusals in the tooltip, reports the target track on success, distinguishes a master-only selection, and pins the overflow-reserve test to the real bar spec.
This commit is contained in:
@@ -131,11 +131,14 @@ std::vector<ActionBarRow> topBarRows() {
|
||||
// The one top-bar row with a live/dead gate: it places the PLAYER, and one instance
|
||||
// holds one capture. Only the payload half of the fold is knowable at draw time —
|
||||
// core/ui/insert_fx_enable.h states why the track half stays a press-time message.
|
||||
rows.push_back({"INSERT_AS_FX", "Insert as FX",
|
||||
// Counts through focusedSelectionIds() (not the raw selection) so the drawn state
|
||||
// can't diverge from doInsertAsFx's own count — the raw selection can go stale
|
||||
// against live membership (e.g. an undo/redo book restore) without being cleared.
|
||||
rows.push_back({"LOAD_INSTRUMENT_ON_TRACK", "Insert as FX",
|
||||
"insert selected sample as ReaSampler 9000 on the selected track",
|
||||
ActionCluster::Placement,
|
||||
insertFxButtonEnabled(
|
||||
static_cast<int>(g_panel.selection.indices.size()))});
|
||||
static_cast<int>(focusedSelectionIds().size()))});
|
||||
return rows;
|
||||
}
|
||||
|
||||
@@ -276,12 +279,27 @@ bool currentTooltip(int w, int h, std::string& textOut, int& ax, int& ay, int& a
|
||||
if (s.index == hv.index) { slot = &s; break; }
|
||||
if (!slot) return false;
|
||||
|
||||
const ActionBarRow& row = rows[static_cast<std::size_t>(hv.index)];
|
||||
|
||||
// Insert as FX paints dead only for the payload axis (NoCapture/MultiCapture);
|
||||
// speak that refusal here rather than the generic phrase, so a dead button says
|
||||
// WHY. NoTrack stays a press-time message (insert_fx_enable.h: track selection
|
||||
// has no change callback, so it is only ever knowable at press time).
|
||||
if (row.suffix == "LOAD_INSTRUMENT_ON_TRACK" && !row.enabled) {
|
||||
const InsertFxRefusal refusal =
|
||||
insertFxRefusal(static_cast<int>(focusedSelectionIds().size()), /*trackSelected=*/true);
|
||||
if (refusal != InsertFxRefusal::None) {
|
||||
textOut = insertFxRefusalMessage(refusal);
|
||||
ax = slot->x; ay = slot->y; aw = slot->width; ah = slot->height;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// fullName is stored prefix-free; strip defensively in case a source ever
|
||||
// carries the display prefix. Tooltip carries name + binding when bound
|
||||
// (e.g. "capture selected item — F5"), name only when unbound.
|
||||
const std::string phrase = stripActionPrefix(rows[static_cast<std::size_t>(hv.index)].fullName,
|
||||
actionDisplayPrefix());
|
||||
const int cmd = resolveBarCommandId(rows[static_cast<std::size_t>(hv.index)]);
|
||||
const std::string phrase = stripActionPrefix(row.fullName, actionDisplayPrefix());
|
||||
const int cmd = resolveBarCommandId(row);
|
||||
const std::string binding = barBindingText(cmd);
|
||||
textOut = binding.empty() ? phrase : phrase + " \xe2\x80\x94 " + binding; // " — " (em dash, UTF-8)
|
||||
ax = slot->x; ay = slot->y; aw = slot->width; ah = slot->height;
|
||||
|
||||
@@ -135,6 +135,9 @@ using ui::hitTestPruneButton;
|
||||
using ui::hitTestSlot;
|
||||
using ui::hitTestTabStrip;
|
||||
using ui::insertFxButtonEnabled;
|
||||
using ui::insertFxRefusal;
|
||||
using ui::insertFxRefusalMessage;
|
||||
using ui::InsertFxRefusal;
|
||||
using ui::kCardNameScrimAlpha;
|
||||
using ui::kCardStripHeight;
|
||||
using ui::kCardStripPad;
|
||||
|
||||
Reference in New Issue
Block a user