split NoteDataUtil::ShiftRows into InsertRows and DeleteRows
This commit is contained in:
@@ -1894,21 +1894,35 @@ void NoteDataUtil::ScaleRegion( NoteData &nd, float fScale, int iStartIndex, int
|
|||||||
nd.CopyAll( temp1 );
|
nd.CopyAll( temp1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deprecated
|
||||||
void NoteDataUtil::ShiftRows( NoteData &nd, int iStartIndex, int iRowsToShift )
|
void NoteDataUtil::ShiftRows( NoteData &nd, int iStartIndex, int iRowsToShift )
|
||||||
{
|
{
|
||||||
int iTakeFromRow = iStartIndex;
|
if( iRowsToShift > 0 )
|
||||||
int iPasteAtRow = iStartIndex;
|
InsertRows( nd, iStartIndex, iRowsToShift );
|
||||||
|
else
|
||||||
|
DeleteRows( nd, iStartIndex, -iRowsToShift );
|
||||||
|
}
|
||||||
|
|
||||||
if( iRowsToShift > 0 ) // add blank rows
|
void NoteDataUtil::InsertRows( NoteData &nd, int iStartIndex, int iRowsToAdd )
|
||||||
iPasteAtRow += iRowsToShift;
|
{
|
||||||
else // delete rows
|
ASSERT( iRowsToAdd >= 0 );
|
||||||
iTakeFromRow -= iRowsToShift;
|
|
||||||
|
|
||||||
NoteData temp;
|
NoteData temp;
|
||||||
temp.SetNumTracks( nd.GetNumTracks() );
|
temp.SetNumTracks( nd.GetNumTracks() );
|
||||||
temp.CopyRange( nd, iTakeFromRow, MAX_NOTE_ROW );
|
temp.CopyRange( nd, iStartIndex, MAX_NOTE_ROW );
|
||||||
nd.ClearRange( min(iTakeFromRow,iPasteAtRow), MAX_NOTE_ROW );
|
nd.ClearRange( iStartIndex, MAX_NOTE_ROW );
|
||||||
nd.CopyRange( temp, 0, MAX_NOTE_ROW, iPasteAtRow );
|
nd.CopyRange( temp, 0, MAX_NOTE_ROW, iStartIndex + iRowsToAdd );
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoteDataUtil::DeleteRows( NoteData &nd, int iStartIndex, int iRowsToDelete )
|
||||||
|
{
|
||||||
|
ASSERT( iRowsToDelete >= 0 );
|
||||||
|
|
||||||
|
NoteData temp;
|
||||||
|
temp.SetNumTracks( nd.GetNumTracks() );
|
||||||
|
temp.CopyRange( nd, iStartIndex + iRowsToDelete, MAX_NOTE_ROW );
|
||||||
|
nd.ClearRange( iStartIndex, MAX_NOTE_ROW );
|
||||||
|
nd.CopyRange( temp, 0, MAX_NOTE_ROW, iStartIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::RemoveAllTapsOfType( NoteData& ndInOut, TapNote::Type typeToRemove )
|
void NoteDataUtil::RemoveAllTapsOfType( NoteData& ndInOut, TapNote::Type typeToRemove )
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ namespace NoteDataUtil
|
|||||||
void ScaleRegion( NoteData &nd, float fScale, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW );
|
void ScaleRegion( NoteData &nd, float fScale, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW );
|
||||||
inline void Scale( NoteData &nd, float fScale ) { NoteDataUtil::ScaleRegion(nd, fScale); }
|
inline void Scale( NoteData &nd, float fScale ) { NoteDataUtil::ScaleRegion(nd, fScale); }
|
||||||
|
|
||||||
|
void InsertRows( NoteData &nd, int iStartIndex, int iRowsToShift );
|
||||||
|
void DeleteRows( NoteData &nd, int iStartIndex, int iRowsToShift );
|
||||||
|
|
||||||
// If iRowsToShift > 0, add blank rows. If iRowsToShift < 0, delete rows
|
// If iRowsToShift > 0, add blank rows. If iRowsToShift < 0, delete rows
|
||||||
void ShiftRows( NoteData &nd, int iStartIndex, int iRowsToShift );
|
void ShiftRows( NoteData &nd, int iStartIndex, int iRowsToShift );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user