-
Notifications
You must be signed in to change notification settings - Fork 0
/
TuneWholeScore.qml
129 lines (113 loc) · 3.15 KB
/
TuneWholeScore.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.3
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import MuseScore 3.0
MuseScore {
menuPath: "Plugins.TuneWholeScore"
description: "Description goes here"
version: "1.0"
pluginType: "dialog"
width: 200
height: 200
property var offsetTextWidth: 40
onRun:
{
console.log("hello world")
if (typeof curScore === 'undefined')
{
Qt.quit()
}
}
function applyToNotesInSelection(func)
{
var fullScore = !curScore.selection.elements.length
if (fullScore)
{
cmd("select-all")
curScore.startCmd()
}
for (var i in curScore.selection.elements)
if (curScore.selection.elements[i].pitch)
func(curScore.selection.elements[i])
if (fullScore)
{
curScore.endCmd()
cmd("escape")
}
}
function addtuning(note)
{
var curtuning = note.tuning
var newcents = parseFloat(desiredcents.text)
var newtuning2
var newtuning1
if ( (curtuning+newcents)>100)
{
note.pitch +=1
newtuning1 = ((curtuning+newcents)-100)
note.tuning = newtuning1
console.log("New = "+newtuning1)
}
else
{
newtuning2 = note.tuning + newcents
note.tuning = newtuning2
console.log("New = "+ newtuning2)
}
}
function applychanges()
{
applyToNotesInSelection(addtuning)
Qt.quit()
}
Rectangle
{
color: "lightgrey"
anchors.fill: parent
GridLayout
{
columns: 1
anchors.fill: parent
anchors.margins: 20
GroupBox
{
title: "Enter Desired Tuning (in cents)"
RowLayout
{
TextField
{
Layout.maximumWidth: offsetTextWidth
id: desiredcents
text: "0.00"
readOnly: false
validator: DoubleValidator { bottom: -99.99; decimals: 2; notation: DoubleValidator.StandardNotation; top:99.99 }
property var previousText: "0.00"
property var name: "cents"
}
}
}
GroupBox{
title: "Apply Changes/ Quit"
RowLayout
{
Button {
id: applyButton
text: qsTranslate("PrefsDialogBase", "Apply")
onClicked: {
applychanges()
}
}
Button {
id: quitbutton
text: qsTranslate("PrefsDialogBase", "Quit")
onClicked: {
Qt.quit()
}
}
}
}
}
}
}