From 07a8d4003e8c8487f838ed0143f120294b4c647b Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 26 Nov 2024 22:00:25 -0800 Subject: [PATCH] fixed orbit after merge --- .../src/Menus/MenuList/PatternSelect.cpp | 62 +++++++++++++++---- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp index a795263a73..dc7027707c 100644 --- a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp +++ b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp @@ -164,7 +164,7 @@ void PatternSelect::nextPattern() DEBUG_LOGF("Iterated to pattern id %d", m_newPatternID); } -void PatternSelect::previousPatternID() +void PatternSelect::previousPatternID() { // increment to next pattern PatternID endList = PATTERN_SINGLE_LAST; @@ -186,7 +186,7 @@ void PatternSelect::previousPatternID() } } -void PatternSelect::previousPattern() +void PatternSelect::previousPattern() { if (m_started) { previousPatternID(); @@ -212,13 +212,53 @@ void PatternSelect::previousPattern() void PatternSelect::onLongClick() { bool needsSave = false; - Mode *cur = Modes::curMode(); - needsSave = !cur->equals(&m_previewMode); - if (needsSave) { - // update the current mode with the new pattern - Modes::updateCurMode(&m_previewMode); - } - DEBUG_LOGF("Saving pattern %u", m_newPatternID); - // done in the pattern select menu - leaveMenu(needsSave); + switch (m_state) { + case STATE_PICK_LIST: + if (m_curSelection == QUADRANT_5) { + leaveMenu(); + return; + } + // if targeted multi then start at multis and only iterate multis + if ((m_targetLeds == MAP_LED(LED_MULTI))) { + // the selected multi only iterate multis + m_newPatternID = (PatternID)(PATTERN_MULTI_FIRST + (m_curSelection * (PATTERN_MULTI_COUNT / 4))); + } else if ((m_targetLeds != MAP_LED_ALL)) { + // they selected some singles, only iterate single led patterns + m_newPatternID = (PatternID)(PATTERN_SINGLE_FIRST + (m_curSelection * (PATTERN_SINGLE_COUNT / 4))); + } else { + // otherwise they selected all divide the entire list + m_newPatternID = (PatternID)(PATTERN_FIRST + (m_curSelection * (PATTERN_COUNT / 4))); + } + m_state = STATE_PICK_PATTERN; + break; + case STATE_PICK_PATTERN: + // need to save the new pattern if it's different from current + needsSave = !Modes::curMode()->equals(&m_previewMode); + if (needsSave) { + // update the current mode with the new pattern + Modes::updateCurMode(&m_previewMode); + } + DEBUG_LOGF("Saving pattern %u", m_newPatternID); + // go back to beginning for next time + m_state = STATE_PICK_LIST; + // done in the pattern select menu + leaveMenu(needsSave); + break; + } + // reset selection after choosing anything + m_curSelection = QUADRANT_FIRST; +} + +void PatternSelect::onLongClick2() +{ + leaveMenu(false); +} + +void PatternSelect::showExit() +{ + // don't show the exit when picking pattern + if (m_state == STATE_PICK_PATTERN) { + return; + } + Menu::showExit(); }