add "jump to next note", "jump to previous note"
This commit is contained in:
@@ -1975,6 +1975,71 @@ bool NoteDataUtil::AnyTapsAndHoldsInTrackRange( const NoteData& in, int iTrack,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find the next row that either starts a TapNote, or ends a previous one. */
|
||||||
|
bool NoteDataUtil::GetNextEditorPosition( const NoteData& in, int &rowInOut )
|
||||||
|
{
|
||||||
|
int iOriginalRow = rowInOut;
|
||||||
|
bool bAnyHaveNextNote = in.GetNextTapNoteRowForAllTracks( rowInOut );
|
||||||
|
|
||||||
|
int iClosestNextRow = rowInOut;
|
||||||
|
if( !bAnyHaveNextNote )
|
||||||
|
iClosestNextRow = MAX_NOTE_ROW;
|
||||||
|
|
||||||
|
for( int t=0; t<in.GetNumTracks(); t++ )
|
||||||
|
{
|
||||||
|
int iHeadRow;
|
||||||
|
if( !in.IsHoldHeadOrBodyAtRow(t, iOriginalRow, &iHeadRow) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const TapNote &tn = in.GetTapNote( t, iHeadRow );
|
||||||
|
int iEndRow = iHeadRow + tn.iDuration;
|
||||||
|
if( iEndRow == iOriginalRow )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bAnyHaveNextNote = true;
|
||||||
|
ASSERT( iEndRow < MAX_NOTE_ROW );
|
||||||
|
iClosestNextRow = min( iClosestNextRow, iEndRow );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !bAnyHaveNextNote )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
rowInOut = iClosestNextRow;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NoteDataUtil::GetPrevEditorPosition( const NoteData& in, int &rowInOut )
|
||||||
|
{
|
||||||
|
int iOriginalRow = rowInOut;
|
||||||
|
bool bAnyHavePrevNote = in.GetPrevTapNoteRowForAllTracks( rowInOut );
|
||||||
|
|
||||||
|
int iClosestPrevRow = rowInOut;
|
||||||
|
for( int t=0; t<in.GetNumTracks(); t++ )
|
||||||
|
{
|
||||||
|
int iHeadRow = iOriginalRow;
|
||||||
|
if( !in.GetPrevTapNoteRowForTrack(t, iHeadRow) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const TapNote &tn = in.GetTapNote( t, iHeadRow );
|
||||||
|
if( tn.type != TapNote::hold_head )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int iEndRow = iHeadRow + tn.iDuration;
|
||||||
|
if( iEndRow >= iOriginalRow )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bAnyHavePrevNote = true;
|
||||||
|
ASSERT( iEndRow < MAX_NOTE_ROW );
|
||||||
|
iClosestPrevRow = max( iClosestPrevRow, iEndRow );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !bAnyHavePrevNote )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
rowInOut = iClosestPrevRow;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
|
|||||||
@@ -108,6 +108,9 @@ namespace NoteDataUtil
|
|||||||
|
|
||||||
int GetNumUsedTracks( const NoteData& in );
|
int GetNumUsedTracks( const NoteData& in );
|
||||||
bool AnyTapsAndHoldsInTrackRange( const NoteData& in, int iTrack, int iStart, int iEnd );
|
bool AnyTapsAndHoldsInTrackRange( const NoteData& in, int iTrack, int iStart, int iEnd );
|
||||||
|
|
||||||
|
bool GetNextEditorPosition( const NoteData& in, int &rowInOut );
|
||||||
|
bool GetPrevEditorPosition( const NoteData& in, int &rowInOut );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ void ScreenEdit::InitEditMappings()
|
|||||||
m_EditMappings.button[EDIT_BUTTON_SCROLL_DOWN_PAGE][0] = DeviceInput(DEVICE_KEYBOARD, KEY_PGDN);
|
m_EditMappings.button[EDIT_BUTTON_SCROLL_DOWN_PAGE][0] = DeviceInput(DEVICE_KEYBOARD, KEY_PGDN);
|
||||||
m_EditMappings.button[EDIT_BUTTON_SCROLL_HOME][0] = DeviceInput(DEVICE_KEYBOARD, KEY_HOME);
|
m_EditMappings.button[EDIT_BUTTON_SCROLL_HOME][0] = DeviceInput(DEVICE_KEYBOARD, KEY_HOME);
|
||||||
m_EditMappings.button[EDIT_BUTTON_SCROLL_END][0] = DeviceInput(DEVICE_KEYBOARD, KEY_END);
|
m_EditMappings.button[EDIT_BUTTON_SCROLL_END][0] = DeviceInput(DEVICE_KEYBOARD, KEY_END);
|
||||||
|
m_EditMappings.button[EDIT_BUTTON_SCROLL_NEXT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_PERIOD);
|
||||||
|
m_EditMappings.button[EDIT_BUTTON_SCROLL_PREV][0] = DeviceInput(DEVICE_KEYBOARD, KEY_COMMA);
|
||||||
|
|
||||||
m_EditMappings.button [EDIT_BUTTON_SCROLL_SPEED_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_UP);
|
m_EditMappings.button [EDIT_BUTTON_SCROLL_SPEED_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_UP);
|
||||||
m_EditMappings.hold[EDIT_BUTTON_SCROLL_SPEED_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL);
|
m_EditMappings.hold[EDIT_BUTTON_SCROLL_SPEED_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL);
|
||||||
@@ -1154,6 +1156,20 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
ScrollTo( fDestinationBeat );
|
ScrollTo( fDestinationBeat );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case EDIT_BUTTON_SCROLL_NEXT:
|
||||||
|
{
|
||||||
|
int iRow = BeatToNoteRow( GAMESTATE->m_fSongBeat );
|
||||||
|
NoteDataUtil::GetNextEditorPosition( m_NoteDataEdit, iRow );
|
||||||
|
ScrollTo( NoteRowToBeat(iRow) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EDIT_BUTTON_SCROLL_PREV:
|
||||||
|
{
|
||||||
|
int iRow = BeatToNoteRow( GAMESTATE->m_fSongBeat );
|
||||||
|
NoteDataUtil::GetPrevEditorPosition( m_NoteDataEdit, iRow );
|
||||||
|
ScrollTo( NoteRowToBeat(iRow) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
case EDIT_BUTTON_SNAP_NEXT:
|
case EDIT_BUTTON_SNAP_NEXT:
|
||||||
if( m_SnapDisplay.PrevSnapMode() )
|
if( m_SnapDisplay.PrevSnapMode() )
|
||||||
OnSnapModeChange();
|
OnSnapModeChange();
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ enum EditButton
|
|||||||
EDIT_BUTTON_SCROLL_DOWN_PAGE,
|
EDIT_BUTTON_SCROLL_DOWN_PAGE,
|
||||||
EDIT_BUTTON_SCROLL_HOME,
|
EDIT_BUTTON_SCROLL_HOME,
|
||||||
EDIT_BUTTON_SCROLL_END,
|
EDIT_BUTTON_SCROLL_END,
|
||||||
|
EDIT_BUTTON_SCROLL_NEXT,
|
||||||
|
EDIT_BUTTON_SCROLL_PREV,
|
||||||
|
|
||||||
/* These are modifiers to EDIT_BUTTON_SCROLL_*. */
|
/* These are modifiers to EDIT_BUTTON_SCROLL_*. */
|
||||||
EDIT_BUTTON_SCROLL_SELECT,
|
EDIT_BUTTON_SCROLL_SELECT,
|
||||||
|
|||||||
Reference in New Issue
Block a user