Skip to content

Commit

Permalink
Update session view detection (#1566)
Browse files Browse the repository at this point in the history
Updated code to detect if we're in a session view while entering / already in the menu to ensure that the right menu item gets opened and right model stack gets setup.
  • Loading branch information
seangoodvibes authored and web-flow committed Mar 23, 2024
1 parent e03e6b2 commit da51fc2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
34 changes: 10 additions & 24 deletions src/deluge/gui/ui/sound_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,8 @@ bool SoundEditor::beginScreen(MenuItem* oldMenuItem) {

// Find param shortcut
currentParamShorcutX = 255;
bool isUISessionView =
(getRootUI() == &performanceSessionView) || (getRootUI() == &sessionView) || (getRootUI() == &arrangerView);

if (isUISessionView) {
if (!rootUIIsClipMinderScreen()) {
int32_t x, y;

// First, see if there's a shortcut for the actual MenuItem we're currently on
Expand Down Expand Up @@ -862,10 +860,13 @@ static const uint32_t shortcutPadUIModes[] = {UI_MODE_AUDITIONING, 0};

ActionResult SoundEditor::potentialShortcutPadAction(int32_t x, int32_t y, bool on) {

bool isUIPerformanceSessionView =
(getRootUI() == &performanceSessionView) || (getCurrentUI() == &performanceSessionView);

bool ignoreAction = false;
if (!Buttons::isShiftButtonPressed()) {
// if in Performance Session View
if ((getRootUI() == &performanceSessionView) || (getCurrentUI() == &performanceSessionView)) {
if (isUIPerformanceSessionView) {
// ignore if you're not in editing mode or if you're in editing mode but editing a param
ignoreAction = (!performanceSessionView.defaultEditingMode || performanceSessionView.editingParam);
}
Expand All @@ -889,8 +890,7 @@ ActionResult SoundEditor::potentialShortcutPadAction(int32_t x, int32_t y, bool
return ActionResult::NOT_DEALT_WITH;
}

bool isUIPerformanceSessionView =
(getRootUI() == &performanceSessionView) || (getCurrentUI() == &performanceSessionView);
bool isUISessionView = isUIPerformanceSessionView || !rootUIIsClipMinderScreen();

if (on && (isUIModeWithinRange(shortcutPadUIModes) || isUIPerformanceSessionView)) {

Expand All @@ -900,8 +900,8 @@ ActionResult SoundEditor::potentialShortcutPadAction(int32_t x, int32_t y, bool

const MenuItem* item = nullptr;

// performance session view
if (isUIPerformanceSessionView) {
// session views (arranger, song, performance)
if (isUISessionView) {
if (x <= (kDisplayWidth - 2)) {
item = paramShortcutsForSongView[x][y];
}
Expand Down Expand Up @@ -1322,15 +1322,10 @@ bool SoundEditor::setup(Clip* clip, const MenuItem* item, int32_t sourceIndex) {
ModControllableAudio* newModControllable = nullptr;

UI* currentUI = getCurrentUI();
AutomationSubType automationSubType = AutomationSubType::NONE;
if (currentUI == &automationView) {
automationSubType = automationView.getAutomationSubType();
}

bool isUIPerformanceView = ((getRootUI() == &performanceSessionView) || currentUI == &performanceSessionView);

bool isUISessionView = isUIPerformanceView || (currentUI == &sessionView) || (currentUI == &arrangerView)
|| (automationSubType == AutomationSubType::ARRANGER);
bool isUISessionView = isUIPerformanceView || !currentUIIsClipMinderScreen();

// getParamManager and ModControllable for Performance Session View (and Session View)
if (isUISessionView) {
Expand Down Expand Up @@ -1594,19 +1589,10 @@ AudioFileHolder* SoundEditor::getCurrentAudioFileHolder() {
}

ModelStackWithThreeMainThings* SoundEditor::getCurrentModelStack(void* memory) {
RootUI* rootUI = getRootUI();
AutomationSubType automationSubType = AutomationSubType::NONE;
if (rootUI == &automationView) {
automationSubType = automationView.getAutomationSubType();
}

bool isUISessionView = (rootUI == &performanceSessionView) || (rootUI == &sessionView) || (rootUI == &arrangerView)
|| (automationSubType == AutomationSubType::ARRANGER);

InstrumentClip* clip = getCurrentInstrumentClip();
Instrument* instrument = getCurrentInstrument();

if (isUISessionView) {
if (!rootUIIsClipMinderScreen()) {
return currentSong->setupModelStackWithSongAsTimelineCounter(memory);
}
else if (instrument->type == OutputType::KIT && clip->affectEntire) {
Expand Down
5 changes: 5 additions & 0 deletions src/deluge/gui/ui/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ bool rootUIIsTimelineView() {
return (rootUI && rootUI->isTimelineView());
}

bool currentUIIsClipMinderScreen() {
UI* currentUI = getCurrentUI();
return (currentUI && currentUI->toClipMinder());
}

bool rootUIIsClipMinderScreen() {
UI* rootUI = getRootUI();
return (rootUI && rootUI->toClipMinder());
Expand Down
1 change: 1 addition & 0 deletions src/deluge/gui/ui/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void setRootUILowLevel(UI* newUI);
void swapOutRootUILowLevel(UI* newUI);
void nullifyUIs();
bool rootUIIsTimelineView();
bool currentUIIsClipMinderScreen();
bool rootUIIsClipMinderScreen();
std::pair<uint32_t, uint32_t> getUIGreyoutColsAndRows();

Expand Down

0 comments on commit da51fc2

Please sign in to comment.