Skip to content

Commit

Permalink
fix #39421: fix selection detection of break plugin
Browse files Browse the repository at this point in the history
similar to earlier fixes for colornotes (606b401) and notenames
(df6e8a0)
  • Loading branch information
Jojo-Schmitz committed Nov 18, 2014
1 parent 486ce2c commit 925d82e
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions share/plugins/break.qml
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,32 @@ MuseScore {
var value = nbMeasures.value
console.log(value)
var cursor = curScore.newCursor()
cursor.track = 0
cursor.rewind(2) // go to end
var endTick = cursor.tick // if no selection, go to end of score
cursor.rewind(1) // go to start
console.log(endTick)
cursor.rewind(1) // go to start of selection (if any)
var endTick
console.log(cursor.tick)
var i = 1
var fullScore = false
if (endTick == 0) {
cursor.rewind(0)
if (!cursor.segment) { // no selection
fullScore = true
} else {
cursor.rewind(2) // go to end
if (cursor.tick == 0) {
// this happens when the selection includes
// the last measure of the score.
// rewind(2) goes behind the last segment (where
// there's none) and sets tick=0
endTick = curScore.lastSegment.tick + 1
} else {
endTick = cursor.tick // if no selection, go to end of score
}
}
console.log(endTick)

if (fullScore)
cursor.rewind(0) // if no selection, beginning of score
else
cursor.rewind(1) // go to start of selection

curScore.startCmd()
var m = cursor.measure
while (m && (fullScore || cursor.tick < endTick)) {
Expand Down

0 comments on commit 925d82e

Please sign in to comment.