Skip to content

Commit 54b8106

Browse files
committed
Formatting
1 parent 37f2c9a commit 54b8106

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

blacknotes.qml

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,13 @@ MuseScore {
2828
description: "This plugin paints all chords and rests in black"
2929
menuPath: "Plugins.Notes.Color Notes in Black"
3030

31-
3231
Component.onCompleted : {
33-
if (mscoreMajorVersion >= 4) {
34-
title = qsTr("Black Notes") ;
35-
// thumbnailName = ".png";
36-
categoryCode = "color-notes";
37-
}
38-
}
39-
40-
41-
42-
32+
if (mscoreMajorVersion >= 4) {
33+
title = qsTr("Black Notes") ;
34+
// thumbnailName = ".png";
35+
categoryCode = "color-notes";
36+
}
37+
}
4338

4439
MessageDialog {
4540
id: versionError
@@ -72,7 +67,7 @@ MuseScore {
7267
if (element.dots[i])
7368
element.dots[i].color = "black"
7469
}
75-
}
70+
}
7671
else
7772
console.log("Unknown element type: " + element.type)
7873
}
@@ -81,7 +76,7 @@ MuseScore {
8176
// or, if nothing is selected, in the entire score
8277
function applyToChordsAndRestsInSelection(func) {
8378
var cursor = curScore.newCursor()
84-
cursor.rewind(1)
79+
cursor.rewind(1) // SELECTION_START
8580
var startStaff
8681
var endStaff
8782
var endTick
@@ -93,7 +88,7 @@ MuseScore {
9388
}
9489
else {
9590
startStaff = cursor.staffIdx;
96-
cursor.rewind(2)
91+
cursor.rewind(2) // SELECTION_END
9792
if (cursor.tick === 0) {
9893
// this happens when the selection includes
9994
// the last measure of the score.
@@ -108,11 +103,11 @@ MuseScore {
108103
console.log(startStaff + " - " + endStaff + " - " + endTick)
109104
for (var staff = startStaff; staff <= endStaff; staff++) {
110105
for (var voice = 0; voice < 4; voice++) {
111-
cursor.rewind(1) // sets voice to 0
106+
cursor.rewind(1) // SELECTION_END, sets voice to 0
112107
cursor.voice = voice //voice has to be set after goTo
113108
cursor.staffIdx = staff
114109
if (fullScore)
115-
cursor.rewind(0) // if no selection, beginning of score
110+
cursor.rewind(0) // SCORE_START, if no selection, beginning of score
116111

117112
while (cursor.segment && (fullScore || cursor.tick < endTick)) {
118113
if (cursor.element) {
@@ -142,18 +137,15 @@ MuseScore {
142137
}
143138

144139
onRun: {
145-
146-
curScore.startCmd()
147-
148140
console.log("Hello, Black Notes")
149141
// check MuseScore version
150-
if ((mscoreMajorVersion < 3) || ((mscoreMajorVersion == 3 && mscoreMinorVersion == 0 && mscoreUpdateVersion <= 1)))
151-
versionError.open()
152-
else
153-
applyToChordsAndRestsInSelection(blackenElement)
154-
155-
curScore.endCmd()
156-
142+
if ((mscoreMajorVersion < 3) || ((mscoreMajorVersion == 3 && mscoreMinorVersion == 0 && mscoreUpdateVersion <= 1)))
143+
versionError.open();
144+
else {
145+
curScore.startCmd();
146+
applyToChordsAndRestsInSelection(blackenElement);
147+
curScore.endCmd();
148+
}
157149
(typeof(quit) === 'undefined' ? Qt.quit : quit)()
158150
}
159151
}

0 commit comments

Comments
 (0)