Skip to content

Commit a5d985b

Browse files
seangoodvibesm-m-adams
authored andcommitted
Update session view detection (#1566)
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.
1 parent c9c9fc0 commit a5d985b

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

src/deluge/gui/ui/sound_editor.cpp

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,8 @@ bool SoundEditor::beginScreen(MenuItem* oldMenuItem) {
574574

575575
// Find param shortcut
576576
currentParamShorcutX = 255;
577-
bool isUISessionView =
578-
(getRootUI() == &performanceSessionView) || (getRootUI() == &sessionView) || (getRootUI() == &arrangerView);
579577

580-
if (isUISessionView) {
578+
if (!rootUIIsClipMinderScreen()) {
581579
int32_t x, y;
582580

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

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

863+
bool isUIPerformanceSessionView =
864+
(getRootUI() == &performanceSessionView) || (getCurrentUI() == &performanceSessionView);
865+
865866
bool ignoreAction = false;
866867
if (!Buttons::isShiftButtonPressed()) {
867868
// if in Performance Session View
868-
if ((getRootUI() == &performanceSessionView) || (getCurrentUI() == &performanceSessionView)) {
869+
if (isUIPerformanceSessionView) {
869870
// ignore if you're not in editing mode or if you're in editing mode but editing a param
870871
ignoreAction = (!performanceSessionView.defaultEditingMode || performanceSessionView.editingParam);
871872
}
@@ -889,8 +890,7 @@ ActionResult SoundEditor::potentialShortcutPadAction(int32_t x, int32_t y, bool
889890
return ActionResult::NOT_DEALT_WITH;
890891
}
891892

892-
bool isUIPerformanceSessionView =
893-
(getRootUI() == &performanceSessionView) || (getCurrentUI() == &performanceSessionView);
893+
bool isUISessionView = isUIPerformanceSessionView || !rootUIIsClipMinderScreen();
894894

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

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

901901
const MenuItem* item = nullptr;
902902

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

13241324
UI* currentUI = getCurrentUI();
1325-
AutomationSubType automationSubType = AutomationSubType::NONE;
1326-
if (currentUI == &automationView) {
1327-
automationSubType = automationView.getAutomationSubType();
1328-
}
13291325

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

1332-
bool isUISessionView = isUIPerformanceView || (currentUI == &sessionView) || (currentUI == &arrangerView)
1333-
|| (automationSubType == AutomationSubType::ARRANGER);
1328+
bool isUISessionView = isUIPerformanceView || !currentUIIsClipMinderScreen();
13341329

13351330
// getParamManager and ModControllable for Performance Session View (and Session View)
13361331
if (isUISessionView) {
@@ -1594,19 +1589,10 @@ AudioFileHolder* SoundEditor::getCurrentAudioFileHolder() {
15941589
}
15951590

15961591
ModelStackWithThreeMainThings* SoundEditor::getCurrentModelStack(void* memory) {
1597-
RootUI* rootUI = getRootUI();
1598-
AutomationSubType automationSubType = AutomationSubType::NONE;
1599-
if (rootUI == &automationView) {
1600-
automationSubType = automationView.getAutomationSubType();
1601-
}
1602-
1603-
bool isUISessionView = (rootUI == &performanceSessionView) || (rootUI == &sessionView) || (rootUI == &arrangerView)
1604-
|| (automationSubType == AutomationSubType::ARRANGER);
1605-
16061592
InstrumentClip* clip = getCurrentInstrumentClip();
16071593
Instrument* instrument = getCurrentInstrument();
16081594

1609-
if (isUISessionView) {
1595+
if (!rootUIIsClipMinderScreen()) {
16101596
return currentSong->setupModelStackWithSongAsTimelineCounter(memory);
16111597
}
16121598
else if (instrument->type == OutputType::KIT && clip->affectEntire) {

src/deluge/gui/ui/ui.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ bool rootUIIsTimelineView() {
146146
return (rootUI && rootUI->isTimelineView());
147147
}
148148

149+
bool currentUIIsClipMinderScreen() {
150+
UI* currentUI = getCurrentUI();
151+
return (currentUI && currentUI->toClipMinder());
152+
}
153+
149154
bool rootUIIsClipMinderScreen() {
150155
UI* rootUI = getRootUI();
151156
return (rootUI && rootUI->toClipMinder());

src/deluge/gui/ui/ui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ void setRootUILowLevel(UI* newUI);
162162
void swapOutRootUILowLevel(UI* newUI);
163163
void nullifyUIs();
164164
bool rootUIIsTimelineView();
165+
bool currentUIIsClipMinderScreen();
165166
bool rootUIIsClipMinderScreen();
166167
std::pair<uint32_t, uint32_t> getUIGreyoutColsAndRows();
167168

0 commit comments

Comments
 (0)