-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCreatePageTurns.plg
108 lines (99 loc) · 3.37 KB
/
CreatePageTurns.plg
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
{
Initialize "() {
// v.1.0.0
AddToPluginsMenu('Create Page Turns','Run');}"
Run "() {
pageTurnStyle = 'Page Turns';
score = Sibelius.ActiveScore;
selection = Sibelius.ActiveScore.Selection;
turnText = '';
if (isSelectionEmpty(selection)) {
return false;
}
bottomStaff = score.NthStaff(selection.BottomStaff);
firstBar = bottomStaff.NthBar(selection.FirstBarNumber);
dialogResult = Sibelius.ShowDialog(PageTurnDialog, Self);
if (not dialogResult) {
return false;
}
deleteTextStyleForBar(pageTurnStyle, firstBar);
if (Length(turnText) = 0) {
return false;
}
turnText = '-' & turnText & '-\n↳';
txtInstance = firstBar.AddText(firstBar.Length, turnText, pageTurnStyle);
txtInstance.ShowInParts();
}"
PageTurnDialog "Dialog"
{
Title "Page Turn Text"
X "584"
Y "451"
Width "111"
Height "57"
Controls
{
Edit
{
Title
X "5"
Y "4"
Width "103"
Height "14"
ID "uiTurnText"
Value "turnText"
Method
SetFocus "1"
}
Button
{
Title "Cancel"
X "5"
Y "23"
Width "50"
Height "14"
DefaultButton "0"
ID "uiCancelBtn"
Value
Method
SetFocus "0"
EndDialog "0"
}
Button
{
Title "OK"
X "57"
Y "23"
Width "50"
Height "14"
DefaultButton "1"
ID "uiOkBtn"
Value
Method
SetFocus "0"
EndDialog "1"
}
}
}
isSelectionEmpty "(selection) {
for each obj in selection {
if (IsObject(obj)) {
return false;
}
}
return true;}"
deleteTextStyleForBar "(txtStyle, bar) {
textToDelete = CreateSparseArray();
for each Text txt in bar {
if (txt.StyleAsText = txtStyle) {
textToDelete.Push(txt);
}
}
for each item in textToDelete {
item.Delete();
}
}"
turnText "-Fast-
↳"
}