51c7505dc0
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.
42 lines
1.6 KiB
C++
42 lines
1.6 KiB
C++
// insert_fx_enable — pure implementation. See insert_fx_enable.h.
|
|
|
|
#include "core/ui/insert_fx_enable.h"
|
|
|
|
namespace reasampler::ui {
|
|
|
|
InsertFxRefusal insertFxRefusal(int focusedCaptureCount, bool trackSelected,
|
|
bool masterOnlySelected) {
|
|
if (focusedCaptureCount <= 0) return InsertFxRefusal::NoCapture;
|
|
if (focusedCaptureCount > 1) return InsertFxRefusal::MultiCapture;
|
|
if (!trackSelected)
|
|
return masterOnlySelected ? InsertFxRefusal::MasterOnlySelected : InsertFxRefusal::NoTrack;
|
|
return InsertFxRefusal::None;
|
|
}
|
|
|
|
bool insertFxButtonEnabled(int focusedCaptureCount) {
|
|
return insertFxRefusal(focusedCaptureCount, /*trackSelected=*/true) ==
|
|
InsertFxRefusal::None;
|
|
}
|
|
|
|
std::string insertFxRefusalMessage(InsertFxRefusal refusal) {
|
|
switch (refusal) {
|
|
case InsertFxRefusal::None:
|
|
return {};
|
|
case InsertFxRefusal::NoCapture:
|
|
return "select a capture in the bank panel first, then insert it as an "
|
|
"instrument on the selected track";
|
|
case InsertFxRefusal::MultiCapture:
|
|
return "select exactly ONE capture -- a ReaSampler 9000 instance holds one "
|
|
"capture, so a multi-capture selection has no single sound to load";
|
|
case InsertFxRefusal::NoTrack:
|
|
return "select a track first -- the instrument is added to the selected "
|
|
"track's FX chain";
|
|
case InsertFxRefusal::MasterOnlySelected:
|
|
return "select a track other than the master -- the master track cannot "
|
|
"host the instrument";
|
|
}
|
|
return {};
|
|
}
|
|
|
|
} // namespace reasampler::ui
|