diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index bc3fd8b21e..89904c4cbe 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -814,6 +814,7 @@ CoinsPerCredit=Coins Per Credit Connection=Connection Convert pause to beats=Convert pause to beats Convert selection to pause=Convert selection to pause +Convert selection to warp=Convert selection to Warp Segment Copy=Copy CourseSortOrder=Course Sort Create New=Create New diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 7bad89f8b4..116b8762fb 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -537,7 +537,9 @@ static MenuDef g_AlterMenu( MenuRowDef(ScreenEdit::record, "Record in selection", true, EditMode_Practice, true, true, 0, NULL ), MenuRowDef(ScreenEdit::convert_to_pause, "Convert selection to pause", true, - EditMode_Full, true, true, 0, NULL ) + EditMode_Full, true, true, 0, NULL ), + MenuRowDef(ScreenEdit::convert_to_warp, "Convert selection to warp", true, + EditMode_Full, true, true, 0, NULL ) ); static MenuDef g_AreaMenu( @@ -3692,6 +3694,37 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const vector &iAn m_iStopPlayingAt = m_NoteFieldEdit.m_iEndMarker; TransitionEditState( STATE_RECORDING ); break; + case convert_to_pause: + { + ASSERT_M( m_NoteFieldEdit.m_iBeginMarker!=-1 && m_NoteFieldEdit.m_iEndMarker!=-1, "Attempted to convert beats outside the notefield to pauses!" ); + float fMarkerStart = GetAppropriateTiming().GetElapsedTimeFromBeat( NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker) ); + float fMarkerEnd = GetAppropriateTiming().GetElapsedTimeFromBeat( NoteRowToBeat(m_NoteFieldEdit.m_iEndMarker) ); + + // The length of the stop segment we're going to create. This includes time spent in any + // stops in the selection, which will be deleted and subsumed into the new stop. + float fStopLength = fMarkerEnd - fMarkerStart; + + // be sure not to clobber the row at the start - a row at the end + // can be dropped safely, though + NoteDataUtil::DeleteRows( m_NoteDataEdit, + m_NoteFieldEdit.m_iBeginMarker + 1, + m_NoteFieldEdit.m_iEndMarker-m_NoteFieldEdit.m_iBeginMarker + ); + GetAppropriateTiming().DeleteRows( m_NoteFieldEdit.m_iBeginMarker + 1, + m_NoteFieldEdit.m_iEndMarker-m_NoteFieldEdit.m_iBeginMarker ); + GetAppropriateTiming().SetStopAtRow( m_NoteFieldEdit.m_iBeginMarker, fStopLength ); + m_NoteFieldEdit.m_iBeginMarker = -1; + m_NoteFieldEdit.m_iEndMarker = -1; + break; + } + case convert_to_warp: + { + float startBeat = NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker); + float lengthBeat = NoteRowToBeat(m_NoteFieldEdit.m_iEndMarker) - startBeat; + GetAppropriateTiming().SetWarpAtBeat(startBeat,lengthBeat); + SetDirty(true); + break; + } } @@ -3758,29 +3791,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, const vector &iAns case shift_pauses_backward: GetAppropriateTiming().DeleteRows( GetRow() + 1, BeatToNoteRow(1) ); break; - case convert_to_pause: - { - ASSERT_M( m_NoteFieldEdit.m_iBeginMarker!=-1 && m_NoteFieldEdit.m_iEndMarker!=-1, "Attempted to convert beats outside the notefield to pauses!" ); - float fMarkerStart = GetAppropriateTiming().GetElapsedTimeFromBeat( NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker) ); - float fMarkerEnd = GetAppropriateTiming().GetElapsedTimeFromBeat( NoteRowToBeat(m_NoteFieldEdit.m_iEndMarker) ); - // The length of the stop segment we're going to create. This includes time spent in any - // stops in the selection, which will be deleted and subsumed into the new stop. - float fStopLength = fMarkerEnd - fMarkerStart; - - // be sure not to clobber the row at the start - a row at the end - // can be dropped safely, though - NoteDataUtil::DeleteRows( m_NoteDataEdit, - m_NoteFieldEdit.m_iBeginMarker + 1, - m_NoteFieldEdit.m_iEndMarker-m_NoteFieldEdit.m_iBeginMarker - ); - GetAppropriateTiming().DeleteRows( m_NoteFieldEdit.m_iBeginMarker + 1, - m_NoteFieldEdit.m_iEndMarker-m_NoteFieldEdit.m_iBeginMarker ); - GetAppropriateTiming().SetStopAtRow( m_NoteFieldEdit.m_iBeginMarker, fStopLength ); - m_NoteFieldEdit.m_iBeginMarker = -1; - m_NoteFieldEdit.m_iEndMarker = -1; - break; - } case convert_pause_to_beat: { // TODO: Convert both Delays and Stops at once. diff --git a/src/ScreenEdit.h b/src/ScreenEdit.h index 81dc6346fa..e01c332c27 100644 --- a/src/ScreenEdit.h +++ b/src/ScreenEdit.h @@ -385,6 +385,7 @@ public: play, record, convert_to_pause, + convert_to_warp, NUM_ALTER_MENU_CHOICES };