From e658714b53caec901a2c576417d4b45c84ba7019 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 26 Jun 2011 23:11:57 -0400 Subject: [PATCH] Allow cycling/jumping through all segments. Better to re-use keys we have than add multiple key strokes when I sense we'll need them. --- Docs/Changelog_sm5.txt | 3 + Themes/_fallback/Languages/en.ini | 3 +- Themes/_fallback/metrics.ini | 3 +- src/ScreenEdit.cpp | 147 ++++++++++++++++++++++++++---- src/ScreenEdit.h | 10 +- 5 files changed, 145 insertions(+), 21 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index dc15691f30..f219111c37 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -16,6 +16,9 @@ StepMania 5.0 Preview 2 | 201106?? * [UnlockManager] New metric: SongsNotAdditional. Set to true to keep the default behavior, false to have the AdditionalSongs folder contain unlockable material. This is set to true to start. [Wolfman2000] +* [ScreenEdit] Allow jumping between all segments, not just Label segments. + You still use Ctrl + ,/. to jump, but now you use Ctrl + N/M to cycle the + segments. By default, it starts with Label. [Wolfman2000] 2011/06/24 ---------- diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index 44d676e1b8..d0a35adbfa 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -1264,7 +1264,7 @@ Enter a new min BPM.=Enter the minimum displayed BPM. Enter a new max BPM.=Enter the maximum displayed BPM. More than %d notes per measure is not allowed. This change has been reverted.=More than %d notes per measure is not allowed. This change has been reverted. No backgrounds available=No backgrounds available -EditHelpText=Up/Down:\n change beat\nLeft/Right:\n change snap\nNumber keys:\n add/remove\n tap note\nN and M keys:\n swap tap notes\nCreate hold note:\n Hold a number\n while moving\n Up or Down\nCreate roll note:\n Hold Shift,\n then create a\n hold note.\nSpace bar:\n Set area\n marker\nT key:\n Switch Timing\nEnter:\n Area Menu\nA Key: Alter Menu\nEscape:\n Main Menu\nF4:\n Timing Menu\nF1:\n Show help\n +EditHelpText=Up/Down:\n change beat\nLeft/Right:\n change snap\nNumber keys:\n add/remove\n tap note\nN and M keys:\n swap tap notes\nCtrl + N/M:\n swap cycled segment\nCreate hold note:\n Hold a number\n while moving\n Up or Down\nCreate roll note:\n Hold Shift,\n then create a\n hold note.\nSpace bar:\n Set area\n marker\nT key:\n Switch Timing\nEnter:\n Area Menu\nA Key: Alter Menu\nEscape:\n Main Menu\nF4:\n Timing Menu\nF1:\n Show help\n PlayRecordHelpText=Press START to end Save successful.=Save successful. Saved as SM and DWI.=Saved as SM and DWI. @@ -1288,6 +1288,7 @@ Chart Style=Chart Style Main title=Main title Subtitle=Subtitle Tap Note=Tap Note +Segment=Segment Tap Steps=Tap Steps Jumps=Jumps Hands=Hands diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index cfa9b78afb..e814935e90 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -3651,7 +3651,7 @@ LoopOnChartEnd=true CurrentBeatFormat="%s:\n %.5f\n" CurrentSecondFormat="%s:\n %.5f\n" -SnapToFormat="%s:\n %s\n" +SnapToFormat="%s: %s\n" SelectionBeatBeginFormat="%s:\n %.5f" SelectionBeatUnfinishedFormat=" ...\n" SelectionBeatEndFormat="-%.5f\n" @@ -3662,6 +3662,7 @@ ChartStyleFormat="%s:\n %s\n" MainTitleFormat="%s:\n %s\n" SubtitleFormat="%s:\n %s\n" TapNoteTypeFormat="%s: %s\n" +SegmentTypeFormat="%s: %s\n" NumStepsFormat="%s: %d\n" NumJumpsFormat="%s: %d\n" NumHoldsFormat="%s: %d\n" diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index b6af108d6b..08a0377783 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -146,13 +146,13 @@ void ScreenEdit::InitEditMappings() m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_NEXT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_PERIOD); m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_PREV][0] = DeviceInput(DEVICE_KEYBOARD, KEY_COMMA); - m_EditMappingsDeviceInput.button[EDIT_BUTTON_LABEL_NEXT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_PERIOD); - m_EditMappingsDeviceInput.hold[EDIT_BUTTON_LABEL_NEXT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL); - m_EditMappingsDeviceInput.hold[EDIT_BUTTON_LABEL_NEXT][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL); + m_EditMappingsDeviceInput.button[EDIT_BUTTON_SEGMENT_NEXT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_PERIOD); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_SEGMENT_NEXT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_SEGMENT_NEXT][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL); - m_EditMappingsDeviceInput.button[EDIT_BUTTON_LABEL_PREV][0] = DeviceInput(DEVICE_KEYBOARD, KEY_COMMA); - m_EditMappingsDeviceInput.hold[EDIT_BUTTON_LABEL_PREV][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL); - m_EditMappingsDeviceInput.hold[EDIT_BUTTON_LABEL_PREV][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL); + m_EditMappingsDeviceInput.button[EDIT_BUTTON_SEGMENT_PREV][0] = DeviceInput(DEVICE_KEYBOARD, KEY_COMMA); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_SEGMENT_PREV][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_SEGMENT_PREV][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL); m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_SELECT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT); m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_SELECT][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT); @@ -277,6 +277,14 @@ void ScreenEdit::InitEditMappings() m_EditMappingsDeviceInput.button[EDIT_BUTTON_CYCLE_TAP_LEFT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cn); m_EditMappingsDeviceInput.button[EDIT_BUTTON_CYCLE_TAP_RIGHT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cm); + m_EditMappingsDeviceInput.button[EDIT_BUTTON_CYCLE_SEGMENT_LEFT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cn); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_CYCLE_SEGMENT_LEFT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_CYCLE_SEGMENT_LEFT][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL); + + m_EditMappingsDeviceInput.button[EDIT_BUTTON_CYCLE_SEGMENT_RIGHT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cm); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_CYCLE_SEGMENT_RIGHT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_CYCLE_SEGMENT_RIGHT][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL); + m_EditMappingsDeviceInput.button [EDIT_BUTTON_SCROLL_SPEED_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_UP); m_EditMappingsDeviceInput.hold[EDIT_BUTTON_SCROLL_SPEED_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL); m_EditMappingsDeviceInput.hold[EDIT_BUTTON_SCROLL_SPEED_UP][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL); @@ -772,6 +780,8 @@ void ScreenEdit::Init() ScreenWithMenuElements::Init(); InitEditMappings(); + + currentCycleSegment = "label"; // save the originals for reverting later CopyToLastSave(); @@ -1103,6 +1113,7 @@ static LocalizedString CHART_STYLE("ScreenEdit", "Chart Style"); static LocalizedString MAIN_TITLE("ScreenEdit", "Main title"); static LocalizedString SUBTITLE("ScreenEdit", "Subtitle"); static LocalizedString TAP_NOTE_TYPE("ScreenEdit", "Tap Note"); +static LocalizedString SEGMENT_TYPE("ScreenEdit", "Segment"); static LocalizedString TAP_STEPS("ScreenEdit", "Tap Steps"); static LocalizedString JUMPS("ScreenEdit", "Jumps"); static LocalizedString HANDS("ScreenEdit", "Hands"); @@ -1131,6 +1142,7 @@ static ThemeMetric CHART_STYLE_FORMAT("ScreenEdit", "ChartStyleFormat") static ThemeMetric MAIN_TITLE_FORMAT("ScreenEdit", "MainTitleFormat"); static ThemeMetric SUBTITLE_FORMAT("ScreenEdit", "SubtitleFormat"); static ThemeMetric TAP_NOTE_TYPE_FORMAT("ScreenEdit", "TapNoteTypeFormat"); +static ThemeMetric SEGMENT_TYPE_FORMAT("ScreenEdit", "SegmentTypeFormat"); static ThemeMetric NUM_STEPS_FORMAT("ScreenEdit", "NumStepsFormat"); static ThemeMetric NUM_JUMPS_FORMAT("ScreenEdit", "NumJumpsFormat"); static ThemeMetric NUM_HOLDS_FORMAT("ScreenEdit", "NumHoldsFormat"); @@ -1200,8 +1212,9 @@ void ScreenEdit::UpdateTextInfo() sText += ssprintf( MAIN_TITLE_FORMAT.GetValue(), MAIN_TITLE.GetValue().c_str(), m_pSong->m_sMainTitle.c_str() ); if( m_pSong->m_sSubTitle.size() ) sText += ssprintf( SUBTITLE_FORMAT.GetValue(), SUBTITLE.GetValue().c_str(), m_pSong->m_sSubTitle.c_str() ); + sText += ssprintf( SEGMENT_TYPE_FORMAT.GetValue(), SEGMENT_TYPE.GetValue().c_str(), currentCycleSegment.c_str() ); sText += ssprintf( TAP_NOTE_TYPE_FORMAT.GetValue(), TAP_NOTE_TYPE.GetValue().c_str(), TapNoteTypeToString( m_selectedTap.type ).c_str() ); - break; + break; } GAMESTATE->SetProcessedTimingData(&m_pSteps->m_Timing); @@ -1457,6 +1470,62 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB ) } break; } + case EDIT_BUTTON_CYCLE_SEGMENT_LEFT: + { + if (this->currentCycleSegment == "label") + this->currentCycleSegment = "fake"; + else if (this->currentCycleSegment == "fake") + this->currentCycleSegment = "scroll"; + else if (this->currentCycleSegment == "scroll") + this->currentCycleSegment = "speed"; + else if (this->currentCycleSegment == "speed") + this->currentCycleSegment = "combo"; + else if (this->currentCycleSegment == "combo") + this->currentCycleSegment = "tickcount"; + else if (this->currentCycleSegment == "tickcount") + this->currentCycleSegment = "timeSig"; + else if (this->currentCycleSegment == "timeSig") + this->currentCycleSegment = "warp"; + else if (this->currentCycleSegment == "warp") + this->currentCycleSegment = "delay"; + else if (this->currentCycleSegment == "delay") + this->currentCycleSegment = "stop"; + else if (this->currentCycleSegment == "stop") + this->currentCycleSegment = "bpm"; + else if (this->currentCycleSegment == "bpm") + this->currentCycleSegment = "label"; + // fallback gracefully instead of assert. + else this->currentCycleSegment = "label"; + break; + } + case EDIT_BUTTON_CYCLE_SEGMENT_RIGHT: + { + if (this->currentCycleSegment == "label") + this->currentCycleSegment = "bpm"; + else if (this->currentCycleSegment == "bpm") + this->currentCycleSegment = "stop"; + else if (this->currentCycleSegment == "stop") + this->currentCycleSegment = "delay"; + else if (this->currentCycleSegment == "delay") + this->currentCycleSegment = "warp"; + else if (this->currentCycleSegment == "warp") + this->currentCycleSegment = "timeSig"; + else if (this->currentCycleSegment == "timeSig") + this->currentCycleSegment = "tickcount"; + else if (this->currentCycleSegment == "tickcount") + this->currentCycleSegment = "combo"; + else if (this->currentCycleSegment == "combo") + this->currentCycleSegment = "speed"; + else if (this->currentCycleSegment == "speed") + this->currentCycleSegment = "scroll"; + else if (this->currentCycleSegment == "scroll") + this->currentCycleSegment = "fake"; + else if (this->currentCycleSegment == "fake") + this->currentCycleSegment = "label"; + // fallback gracefully instead of assert. + else this->currentCycleSegment = "label"; + break; + } case EDIT_BUTTON_SCROLL_SPEED_UP: case EDIT_BUTTON_SCROLL_SPEED_DOWN: { @@ -1571,16 +1640,60 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB ) ScrollTo( NoteRowToBeat(iRow) ); } break; - case EDIT_BUTTON_LABEL_NEXT: - { - ScrollTo( GetAppropriateTiming().GetNextLabelSegmentBeatAtBeat( GetBeat() ) ); - } - break; - case EDIT_BUTTON_LABEL_PREV: - { - ScrollTo( GetAppropriateTiming().GetPreviousLabelSegmentBeatAtBeat( GetBeat() ) ); - } - break; + case EDIT_BUTTON_SEGMENT_NEXT: + { + TimingData &timing = GetAppropriateTiming(); + if (this->currentCycleSegment == "label") + ScrollTo(timing.GetNextLabelSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "bpm") + ScrollTo(timing.GetNextBPMSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "stop") + ScrollTo(timing.GetNextStopSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "delay") + ScrollTo(timing.GetNextDelaySegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "warp") + ScrollTo(timing.GetNextWarpSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "timeSig") + ScrollTo(timing.GetNextTimeSignatureSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "tickcount") + ScrollTo(timing.GetNextTickcountSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "combo") + ScrollTo(timing.GetNextComboSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "speed") + ScrollTo(timing.GetNextSpeedSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "scroll") + ScrollTo(timing.GetNextScrollSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "fake") + ScrollTo(timing.GetNextFakeSegmentBeatAtBeat(GetBeat())); + } + break; + case EDIT_BUTTON_SEGMENT_PREV: + { + TimingData &timing = GetAppropriateTiming(); + if (this->currentCycleSegment == "label") + ScrollTo(timing.GetPreviousLabelSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "bpm") + ScrollTo(timing.GetPreviousBPMSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "stop") + ScrollTo(timing.GetPreviousStopSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "delay") + ScrollTo(timing.GetPreviousDelaySegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "warp") + ScrollTo(timing.GetPreviousWarpSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "timeSig") + ScrollTo(timing.GetPreviousTimeSignatureSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "tickcount") + ScrollTo(timing.GetPreviousTickcountSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "combo") + ScrollTo(timing.GetPreviousComboSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "speed") + ScrollTo(timing.GetPreviousSpeedSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "scroll") + ScrollTo(timing.GetPreviousScrollSegmentBeatAtBeat(GetBeat())); + else if (this->currentCycleSegment == "fake") + ScrollTo(timing.GetPreviousFakeSegmentBeatAtBeat(GetBeat())); + } + break; case EDIT_BUTTON_SNAP_NEXT: if( m_SnapDisplay.PrevSnapMode() ) OnSnapModeChange(); diff --git a/src/ScreenEdit.h b/src/ScreenEdit.h index 61c2b4abcc..bdfbdc71f4 100644 --- a/src/ScreenEdit.h +++ b/src/ScreenEdit.h @@ -60,6 +60,9 @@ enum EditButton EDIT_BUTTON_CYCLE_TAP_LEFT, /**< Rotate the available tap notes once to the "left". */ EDIT_BUTTON_CYCLE_TAP_RIGHT, /**< Rotate the available tap notes once to the "right". */ + EDIT_BUTTON_CYCLE_SEGMENT_LEFT, /**< Select one segment to the left for jumping. */ + EDIT_BUTTON_CYCLE_SEGMENT_RIGHT, /**< Select one segment to the right for jumping. */ + EDIT_BUTTON_SCROLL_UP_LINE, EDIT_BUTTON_SCROLL_UP_PAGE, EDIT_BUTTON_SCROLL_UP_TS, @@ -73,8 +76,8 @@ enum EditButton EDIT_BUTTON_SCROLL_NEXT, EDIT_BUTTON_SCROLL_PREV, - EDIT_BUTTON_LABEL_NEXT, /**< Jump to the start of the next label downward. */ - EDIT_BUTTON_LABEL_PREV, /**< Jump to the start of the previous label upward. */ + EDIT_BUTTON_SEGMENT_NEXT, /**< Jump to the start of the next segment downward. */ + EDIT_BUTTON_SEGMENT_PREV, /**< Jump to the start of the previous segment upward. */ // These are modifiers to EDIT_BUTTON_SCROLL_*. EDIT_BUTTON_SCROLL_SELECT, @@ -273,6 +276,9 @@ protected: /** @brief The current TapNote that would be inserted. */ TapNote m_selectedTap; + /** @brief The type of segment users will jump back and forth between. */ + RString currentCycleSegment; + void UpdateTextInfo(); BitmapText m_textInfo; // status information that changes bool m_bTextInfoNeedsUpdate;