diff --git a/mscore/plugin/api/cursor.cpp b/mscore/plugin/api/cursor.cpp index 948772140..63ad663d0 100644 --- a/mscore/plugin/api/cursor.cpp +++ b/mscore/plugin/api/cursor.cpp @@ -82,8 +82,9 @@ void Cursor::setScore(Score* s) /// recommended to use RewindMode enumerators instead. //--------------------------------------------------------- -void Cursor::rewind(RewindMode mode) +void Cursor::rewind(RewindMode mode, Integer staffIdx, Integer voice) { + int _staffIdx, _voice; // // rewind to start of score // @@ -92,8 +93,9 @@ void Cursor::rewind(RewindMode mode) Ms::Measure* m = _score->firstMeasure(); if (m) { _segment = m->first(_filter); - nextInTrack(); } + _staffIdx = staffIdx(); + _voice = voice(); } // // rewind to start of selection @@ -102,8 +104,8 @@ void Cursor::rewind(RewindMode mode) if (!_score->selection().isRange()) return; _segment = _score->selection().startSegment(); - _track = _score->selection().staffStart() * VOICES; - nextInTrack(); + _staffIdx = _score->selection().staffStart(); + _voice = 0; } // // rewind to end of selection @@ -112,9 +114,16 @@ void Cursor::rewind(RewindMode mode) if (!_score->selection().isRange()) return; _segment = _score->selection().endSegment(); - _track = (_score->selection().staffEnd() * VOICES) - 1; // be sure _track exists + _staffIdx = _score->selection().staffEnd(); + _voice = VOICES - 1; } - _score->inputState().setTrack(_track); + if (staffIdx != nullptr) + _staffIdx = staffIdx.value; + if (voice != nullptr) + _voice = voice.value; + setTrack(_staffIdx * VOICES + _voice); + if (_segment != nullptr && mode != SELECTION_END) + nextInTrack(); _score->inputState().setSegment(_segment); }