Add the copy/paste selected timing data feature.
Not perfect at this stage, but...well, everyone wanted it.
This commit is contained in:
+81
-2
@@ -588,7 +588,8 @@ static MenuDef g_AreaMenu(
|
||||
"ScreenMiniMenuAreaMenu",
|
||||
MenuRowDef( ScreenEdit::paste_at_current_beat, "Paste at current beat", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::paste_at_begin_marker, "Paste at begin marker", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::insert_and_shift, "Insert beat and shift down", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::paste_partial_timing_at_beat, "Paste Partial Timing at current beat", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::insert_and_shift, "Insert beat and shift down", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::delete_and_shift, "Delete beat and shift up", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::shift_pauses_forward, "Shift all timing changes down", true, EditMode_Full, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::shift_pauses_backward, "Shift all timing changes up", true, EditMode_Full, true, true, 0, NULL ),
|
||||
@@ -1742,6 +1743,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
|
||||
// update enabled/disabled in g_AreaMenu
|
||||
g_AreaMenu.rows[paste_at_current_beat].bEnabled = !m_Clipboard.IsEmpty();
|
||||
g_AreaMenu.rows[paste_at_begin_marker].bEnabled = !m_Clipboard.IsEmpty() != 0 && m_NoteFieldEdit.m_iBeginMarker!=-1;
|
||||
g_AreaMenu.rows[paste_partial_timing_at_beat].bEnabled = !this->clipboardTiming.empty();
|
||||
g_AreaMenu.rows[undo].bEnabled = m_bHasUndo;
|
||||
EditMiniMenu( &g_AreaMenu, SM_BackFromAreaMenu );
|
||||
}
|
||||
@@ -2926,7 +2928,9 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
||||
}
|
||||
else if( SM == SM_BackFromAreaMenu )
|
||||
{
|
||||
HandleAreaMenuChoice( (AreaMenuChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_viLastAnswers );
|
||||
AreaMenuChoice amc = static_cast<AreaMenuChoice>(ScreenMiniMenu::s_iLastRowCode);
|
||||
const vector<int> &answers = ScreenMiniMenu::s_viLastAnswers;
|
||||
HandleAreaMenuChoice( amc, answers );
|
||||
}
|
||||
else if( SM == SM_BackFromAlterMenu )
|
||||
{
|
||||
@@ -4305,6 +4309,81 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, const vector<int> &iAns
|
||||
m_NoteDataEdit.CopyRange( m_Clipboard, 0, iRowsToCopy, iDestFirstRow );
|
||||
}
|
||||
break;
|
||||
case paste_partial_timing_at_beat:
|
||||
{
|
||||
int firstRow = BeatToNoteRow(GetAppropriatePosition().m_fSongBeat);
|
||||
FOREACH_ENUM(TimingSegmentType, tst)
|
||||
{
|
||||
/* TODO: Maybe wipe out the already there timing data first?
|
||||
* We need to identify the max row within the timing data first. */
|
||||
for (unsigned i = 0; i < this->clipboardTiming.allTimingSegments[tst].size(); i++)
|
||||
{
|
||||
// TODO: This REALLY needs improving.
|
||||
TimingSegment * org = this->clipboardTiming.allTimingSegments[tst][i];
|
||||
TimingSegment * cpy;
|
||||
|
||||
switch (tst)
|
||||
{
|
||||
case SEGMENT_BPM:
|
||||
{
|
||||
cpy = new BPMSegment(*(static_cast<BPMSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_STOP_DELAY:
|
||||
{
|
||||
cpy = new StopSegment(*(static_cast<StopSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_TIME_SIG:
|
||||
{
|
||||
cpy = new TimeSignatureSegment(*(static_cast<TimeSignatureSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_WARP:
|
||||
{
|
||||
cpy = new WarpSegment(*(static_cast<WarpSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_LABEL:
|
||||
{
|
||||
cpy = new LabelSegment(*(static_cast<LabelSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_TICKCOUNT:
|
||||
{
|
||||
cpy = new TickcountSegment(*(static_cast<TickcountSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_COMBO:
|
||||
{
|
||||
cpy = new ComboSegment(*(static_cast<ComboSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_SPEED:
|
||||
{
|
||||
cpy = new SpeedSegment(*(static_cast<SpeedSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_SCROLL:
|
||||
{
|
||||
cpy = new ScrollSegment(*(static_cast<ScrollSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_FAKE:
|
||||
{
|
||||
cpy = new FakeSegment(*(static_cast<FakeSegment *>(org)));
|
||||
break;
|
||||
}
|
||||
default: FAIL_M(ssprintf("An unknown timing segment type %d can't be copied over!", tst));
|
||||
}
|
||||
int oldRow = cpy->GetRow();
|
||||
int newRow = oldRow + firstRow;
|
||||
cpy->SetRow(newRow);
|
||||
GetAppropriateTiming().AddSegment(tst, cpy);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case insert_and_shift:
|
||||
NoteDataUtil::InsertRows( m_NoteDataEdit, BeatToNoteRow( GetBeat() ), BeatToNoteRow(1) );
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user