Add "Convert Selection to Warp Segment" option.

Also, preemptively fix another bug with the menu moving.
This commit is contained in:
Jason Felds
2011-06-10 16:43:38 -04:00
parent 866d72e660
commit 0db9f87b74
3 changed files with 36 additions and 23 deletions
+1
View File
@@ -814,6 +814,7 @@ CoinsPerCredit=Coins Per Credit
Connection=Connection Connection=Connection
Convert pause to beats=Convert pause to beats Convert pause to beats=Convert pause to beats
Convert selection to pause=Convert selection to pause Convert selection to pause=Convert selection to pause
Convert selection to warp=Convert selection to Warp Segment
Copy=Copy Copy=Copy
CourseSortOrder=Course Sort CourseSortOrder=Course Sort
Create New=Create New Create New=Create New
+33 -22
View File
@@ -537,6 +537,8 @@ static MenuDef g_AlterMenu(
MenuRowDef(ScreenEdit::record, "Record in selection", true, MenuRowDef(ScreenEdit::record, "Record in selection", true,
EditMode_Practice, true, true, 0, NULL ), EditMode_Practice, true, true, 0, NULL ),
MenuRowDef(ScreenEdit::convert_to_pause, "Convert selection to pause", true, 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 ) 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; m_iStopPlayingAt = m_NoteFieldEdit.m_iEndMarker;
TransitionEditState( STATE_RECORDING ); TransitionEditState( STATE_RECORDING );
break; 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: case shift_pauses_backward:
GetAppropriateTiming().DeleteRows( GetRow() + 1, BeatToNoteRow(1) ); GetAppropriateTiming().DeleteRows( GetRow() + 1, BeatToNoteRow(1) );
break; 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: case convert_pause_to_beat:
{ {
// TODO: Convert both Delays and Stops at once. // TODO: Convert both Delays and Stops at once.
+1
View File
@@ -385,6 +385,7 @@ public:
play, play,
record, record,
convert_to_pause, convert_to_pause,
convert_to_warp,
NUM_ALTER_MENU_CHOICES NUM_ALTER_MENU_CHOICES
}; };