Add "Convert Selection to Warp Segment" option.
Also, preemptively fix another bug with the menu moving.
This commit is contained in:
@@ -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
|
||||
|
||||
+33
-22
@@ -537,6 +537,8 @@ 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 ),
|
||||
MenuRowDef(ScreenEdit::convert_to_warp, "Convert selection to warp", true,
|
||||
EditMode_Full, true, true, 0, NULL )
|
||||
);
|
||||
|
||||
@@ -3692,6 +3694,37 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const vector<int> &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<int> &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.
|
||||
|
||||
@@ -385,6 +385,7 @@ public:
|
||||
play,
|
||||
record,
|
||||
convert_to_pause,
|
||||
convert_to_warp,
|
||||
NUM_ALTER_MENU_CHOICES
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user