Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MU4] Notenames plugins: For hidden notes skip notenames #8142

Merged
merged 2 commits into from
Jun 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions share/plugins/notenames-interactive.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import QtQuick.Controls 2.0
import MuseScore 3.0

MuseScore {
version: "3.4"
version: "3.5"
description: qsTr("This plugin names notes as per your language setting")
menuPath: "Plugins.Notes." + qsTr("Note Names (Interactive)")
pluginType: "dock"
Expand Down Expand Up @@ -64,9 +64,11 @@ MuseScore {
function getChordName(chord) {
var text = "";
var notes = chord.notes;
var sep = "\n"; // change to "," if you want them horizontally (anybody?)
for (var i = 0; i < notes.length; i++) {
var sep = "\n"; // change to "," if you want them horizontally (anybody?)
if ( i > 0 )
if ((curScore.selection.elements.length && !notes[i].selected) || !notes[i].visible)
continue // skip notes a that are not selected or invisible
if (text) // only if text isn't empty
text = sep + text; // any but top note
if (typeof notes[i].tpc === "undefined") // like for grace notes ?!?
return;
Expand Down
22 changes: 14 additions & 8 deletions share/plugins/notenames.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ import QtQuick 2.2
import MuseScore 3.0

MuseScore {
version: "3.4.2.1"
version: "3.5"
description: qsTr("This plugin names notes as per your language setting")
menuPath: "Plugins.Notes." + qsTr("Note Names")

// Small note name size is fraction of the full font size.
property var fontSizeMini: 0.7;

function nameChord (notes, text, small) {
var sep = "\n"; // change to "," if you want them horizontally (anybody?)
for (var i = 0; i < notes.length; i++) {
var sep = "\n"; // change to "," if you want them horizontally (anybody?)
if ( i > 0 )
text.text = sep + text.text; // any but top note
if ((curScore.selection.elements.length && !notes[i].selected) || !notes[i].visible)
continue // skip notes that are not selected or invisible
Jojo-Schmitz marked this conversation as resolved.
Show resolved Hide resolved
if (text.text) // only if text isn't empty
text.text = sep + text.text;
if (small)
text.fontSize *= fontSizeMini
if (typeof notes[i].tpc === "undefined") // like for grace notes ?!?
Expand Down Expand Up @@ -135,15 +137,17 @@ MuseScore {
var chord = list[chordNum];
// Set note text, grace notes are shown a bit smaller
nameChord(chord.notes, text, small)
cursor.add(text)
if (text.text)
cursor.add(text)
// X position the note name over the grace chord
text.offsetX = chord.posX
switch (cursor.voice) {
case 1: case 3: text.placement = Placement.BELOW; break;
}

// If we consume a STAFF_TEXT we must manufacture a new one.
text = newElement(Element.STAFF_TEXT); // Make another STAFF_TEXT
if (text.text)
text = newElement(Element.STAFF_TEXT); // Make another STAFF_TEXT
}
}
return text
Expand Down Expand Up @@ -212,13 +216,15 @@ MuseScore {
// Now handle the note names on the main chord...
var notes = cursor.element.notes;
nameChord(notes, text, false);
cursor.add(text);
if (text.text)
cursor.add(text);

switch (cursor.voice) {
case 1: case 3: text.placement = Placement.BELOW; break;
}

text = newElement(Element.STAFF_TEXT) // Make another STAFF_TEXT object
if (text.text)
text = newElement(Element.STAFF_TEXT) // Make another STAFF_TEXT object

// Finally process trailing grace notes if they exist...
text = renderGraceNoteNames(cursor, trailingFifo, text, true)
Expand Down