Convert most of standard plugins to the new API
This commit is contained in:
parent
77bcd39537
commit
4f426e0af6
9 changed files with 39 additions and 38 deletions
|
@ -20,12 +20,12 @@
|
|||
import QtQuick 2.1
|
||||
import QtQuick.Dialogs 1.0
|
||||
import QtQuick.Controls 1.0
|
||||
import MuseScore 1.0
|
||||
import FileIO 1.0
|
||||
import MuseScore 3.0
|
||||
import FileIO 3.0
|
||||
|
||||
MuseScore {
|
||||
menuPath: "Plugins.ABC Import"
|
||||
version: "2.0"
|
||||
version: "3.0"
|
||||
description: qsTr("This plugin imports ABC text from a file or the clipboard. Internet connection is required.")
|
||||
requiresScore: false
|
||||
pluginType: "dialog"
|
||||
|
|
|
@ -16,7 +16,7 @@ import QtQuick 2.2
|
|||
import MuseScore 3.0
|
||||
|
||||
MuseScore {
|
||||
version: "1.0"
|
||||
version: "3.0"
|
||||
description: qsTr("This plugin colors notes in the selection depending on their pitch as per the Boomwhackers convention")
|
||||
menuPath: "Plugins.Notes.Color Notes"
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import QtQuick 2.0
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
|
||||
MuseScore {
|
||||
version: "2.0"
|
||||
version: "3.0"
|
||||
description: "This demo plugin creates a new score."
|
||||
menuPath: "Plugins.createscore"
|
||||
requiresScore: false
|
||||
|
@ -15,13 +15,15 @@ MuseScore {
|
|||
|
||||
score.addText("title", "==Test-Score==");
|
||||
score.addText("subtitle", "subtitle");
|
||||
score.addText("composer", "Composer");
|
||||
score.addText("lyricist", "Lyricist");
|
||||
|
||||
var cursor = score.newCursor();
|
||||
cursor.track = 0;
|
||||
|
||||
cursor.rewind(0);
|
||||
var ts = newElement(Element.TIMESIG);
|
||||
ts.setSig(numerator, denominator);
|
||||
ts.timesig = fraction(numerator, denominator);
|
||||
cursor.add(ts);
|
||||
|
||||
cursor.rewind(0);
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
//=============================================================================
|
||||
|
||||
import QtQuick 2.0
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
|
||||
MuseScore {
|
||||
version: "2.0"
|
||||
version: "3.0"
|
||||
description: qsTr("This plugin names notes as per your language setting")
|
||||
menuPath: "Plugins.Notes." + qsTr("Note Names") // this does not work, why?
|
||||
|
||||
|
@ -164,30 +164,30 @@ MuseScore {
|
|||
nameChord(graceNotes, text);
|
||||
// there seems to be no way of knowing the exact horizontal pos.
|
||||
// of a grace note, so we have to guess:
|
||||
text.pos.x = -2.5 * (graceChords.length - i);
|
||||
text.offsetX = -2.5 * (graceChords.length - i);
|
||||
switch (voice) {
|
||||
case 0: text.pos.y = 1; break;
|
||||
case 1: text.pos.y = 10; break;
|
||||
case 2: text.pos.y = -1; break;
|
||||
case 3: text.pos.y = 12; break;
|
||||
case 0: text.offsetY = 1; break;
|
||||
case 1: text.offsetY = 10; break;
|
||||
case 2: text.offsetY = -1; break;
|
||||
case 3: text.offsetY = 12; break;
|
||||
}
|
||||
|
||||
cursor.add(text);
|
||||
// new text for next element
|
||||
text = newElement(Element.STAFF_TEXT);
|
||||
text = newElement("StaffText");
|
||||
}
|
||||
|
||||
var notes = cursor.element.notes;
|
||||
nameChord(notes, text);
|
||||
|
||||
switch (voice) {
|
||||
case 0: text.pos.y = 1; break;
|
||||
case 1: text.pos.y = 10; break;
|
||||
case 2: text.pos.y = -1; break;
|
||||
case 3: text.pos.y = 12; break;
|
||||
case 0: text.offsetY = 1; break;
|
||||
case 1: text.offsetY = 10; break;
|
||||
case 2: text.offsetY = -1; break;
|
||||
case 3: text.offsetY = 12; break;
|
||||
}
|
||||
if ((voice == 0) && (notes[0].pitch > 83))
|
||||
text.pos.x = 1;
|
||||
text.offsetX = 1;
|
||||
cursor.add(text);
|
||||
} // end if CHORD
|
||||
cursor.next();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import QtQuick 2.0
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
|
||||
|
||||
MuseScore {
|
||||
menuPath: "Plugins.panel"
|
||||
version: "2.0"
|
||||
version: "3.0"
|
||||
description: "This demo plugin creates a GUI panel."
|
||||
requiresScore: false
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import QtQuick 2.1
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
|
||||
MuseScore {
|
||||
version: "2.1"
|
||||
version: "3.0"
|
||||
description: "Create random score."
|
||||
menuPath: "Plugins.random"
|
||||
requiresScore: false
|
||||
|
@ -36,7 +36,7 @@ MuseScore {
|
|||
cursor.rewind(0);
|
||||
|
||||
var ts = newElement(Element.TIMESIG);
|
||||
ts.setSig(numerator, denominator);
|
||||
ts.timesig = fraction(numerator, denominator);
|
||||
cursor.add(ts);
|
||||
|
||||
cursor.rewind(0);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import QtQuick 2.1
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
import QtQuick.Controls 1.0
|
||||
import QtQuick.Layouts 1.0
|
||||
|
||||
MuseScore {
|
||||
version: "2.1"
|
||||
version: "3.0"
|
||||
description: "Create random score."
|
||||
menuPath: "Plugins.random2"
|
||||
requiresScore: false
|
||||
|
@ -45,7 +45,7 @@ MuseScore {
|
|||
cursor.rewind(0);
|
||||
|
||||
var ts = newElement(Element.TIMESIG);
|
||||
ts.setSig(numerator, denominator);
|
||||
ts.timesig = fraction(numerator, denominator);
|
||||
cursor.add(ts);
|
||||
|
||||
var realMeasures = Math.ceil(measures * denominator / numerator);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Linux Music Score Editor
|
||||
//
|
||||
// Color notehead plugin
|
||||
// Noteheads are colored according to pitch. User can change to color by
|
||||
// Noteheads are colored according to pitch. User can change to color by
|
||||
// modifying the colors array. First element is C, second C# etc...
|
||||
//
|
||||
// Copyright (C)2012 Werner Schweer and others
|
||||
|
@ -22,7 +22,7 @@
|
|||
//=============================================================================
|
||||
|
||||
import QtQuick 2.0
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
|
||||
MuseScore {
|
||||
menuPath: "Plugins.run"
|
||||
|
|
|
@ -21,21 +21,20 @@ MuseScore {
|
|||
onRun: {
|
||||
console.log("Hello Walker");
|
||||
|
||||
if (typeof curScore === 'undefined')
|
||||
if (!curScore)
|
||||
Qt.quit();
|
||||
|
||||
var cursor = curScore.newCursor();
|
||||
cursor.voice = 0;
|
||||
cursor.staffIdx = 0;
|
||||
cursor.filter = -1;
|
||||
cursor.rewind(0);
|
||||
cursor.rewind(Cursor.SCORE_START);
|
||||
|
||||
while (cursor.segment()) {
|
||||
var e = cursor.element();
|
||||
while (cursor.segment) {
|
||||
var e = cursor.element;
|
||||
if (e) {
|
||||
console.log("type: " + e.name + " (" + e.type + ") at tick: " + e.tick + " color " + e.get("color"));
|
||||
if (e.type == Ms.REST) {
|
||||
var d = e.get("duration");
|
||||
console.log("type:", e.name, "at tick:", e.tick, "color", e.color);
|
||||
if (e.type == Element.REST) {
|
||||
var d = e.duration;
|
||||
console.log(" duration " + d.numerator + "/" + d.denominator);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue