abcjs-rails 2.0 → 2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/abcjs/api/abc_animation.js +0 -19
- data/app/assets/javascripts/abcjs/api/abc_tunebook.js +0 -5
- data/app/assets/javascripts/abcjs/edit/abc_editor.js +0 -10
- data/app/assets/javascripts/abcjs/parse/abc_parse.js +11 -35
- data/app/assets/javascripts/abcjs/parse/abc_parse_directive.js +2 -18
- data/app/assets/javascripts/abcjs/write/abc_absolute_element.js +9 -25
- data/app/assets/javascripts/abcjs/write/abc_abstract_engraver.js +21 -16
- data/app/assets/javascripts/abcjs/write/abc_beam_element.js +5 -94
- data/app/assets/javascripts/abcjs/write/abc_crescendo_element.js +0 -16
- data/app/assets/javascripts/abcjs/write/abc_decoration.js +3 -2
- data/app/assets/javascripts/abcjs/write/abc_dynamic_decoration.js +0 -8
- data/app/assets/javascripts/abcjs/write/abc_ending_element.js +0 -20
- data/app/assets/javascripts/abcjs/write/abc_engraver_controller.js +1 -1
- data/app/assets/javascripts/abcjs/write/abc_relative_element.js +9 -46
- data/app/assets/javascripts/abcjs/write/abc_renderer.js +1 -1
- data/app/assets/javascripts/abcjs/write/abc_staff_group_element.js +4 -67
- data/app/assets/javascripts/abcjs/write/abc_tie_element.js +0 -24
- data/app/assets/javascripts/abcjs/write/abc_triplet_element.js +0 -54
- data/app/assets/javascripts/abcjs/write/abc_voice_element.js +24 -13
- data/lib/abcjs-rails/version.rb +1 -1
- metadata +2 -4
- data/app/assets/javascripts/abcjs/write/abc_layout.js +0 -1040
- data/app/assets/javascripts/abcjs/write/abc_write.js +0 -535
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdcbdb9238f2f1f23907474b552d5de442640107
|
4
|
+
data.tar.gz: ad3934f6f67f4448a726395cb6c6bfe15fe99c47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9731f7c7de5fffeef49346ee6f09355e892a7f830e6b11d117d0c6af05349328a7dcaed6b7d97ddee4cf57ad4652a451ad521551a35e6eb396b48dda1cc7531
|
7
|
+
data.tar.gz: 3310a61ea0d346f45f8b37e2a79cecf354bd009ea4bb83f5d3ca091d2ffb17d2d10ac05fb6a2cc63e6755c0fd7a32b3d506d351b453e4cb5be4f3987893d8034
|
@@ -20,10 +20,7 @@ if (!window.ABCJS)
|
|
20
20
|
window.ABCJS = {};
|
21
21
|
|
22
22
|
(function() {
|
23
|
-
<<<<<<< HEAD
|
24
23
|
"use strict";
|
25
|
-
=======
|
26
|
-
>>>>>>> origin/master
|
27
24
|
|
28
25
|
function hasClass(element, cls) {
|
29
26
|
var elClass = element.getAttribute("class");
|
@@ -83,10 +80,7 @@ if (!window.ABCJS)
|
|
83
80
|
if (options.showCursor) {
|
84
81
|
cursor = $('<div class="cursor" style="position: absolute;"></div>');
|
85
82
|
$(paper).append(cursor);
|
86
|
-
<<<<<<< HEAD
|
87
83
|
$(paper).css({ position: "relative" });
|
88
|
-
=======
|
89
|
-
>>>>>>> origin/master
|
90
84
|
}
|
91
85
|
|
92
86
|
stopNextTime = false;
|
@@ -136,7 +130,6 @@ if (!window.ABCJS)
|
|
136
130
|
for (var line=0;line<engraver.staffgroups.length; line++) {
|
137
131
|
var group = engraver.staffgroups[line];
|
138
132
|
var voices = group.voices;
|
139
|
-
<<<<<<< HEAD
|
140
133
|
var firstStaff = group.staffs[0];
|
141
134
|
var middleC = firstStaff.absoluteY;
|
142
135
|
var top = middleC - firstStaff.top*ABCJS.write.spacing.STEP;
|
@@ -144,10 +137,6 @@ if (!window.ABCJS)
|
|
144
137
|
middleC = lastStaff.absoluteY;
|
145
138
|
var bottom = middleC - lastStaff.bottom*ABCJS.write.spacing.STEP;
|
146
139
|
var height = bottom - top;
|
147
|
-
=======
|
148
|
-
var top = group.y;
|
149
|
-
var height = group.height;
|
150
|
-
>>>>>>> origin/master
|
151
140
|
var maxVoiceTime = 0;
|
152
141
|
// Put in the notes for all voices, then sort them, then remove duplicates
|
153
142
|
for (var v = 0; v < voices.length; v++) {
|
@@ -165,16 +154,12 @@ if (!window.ABCJS)
|
|
165
154
|
// If the note is tied on both sides it can just be ignored.
|
166
155
|
} else {
|
167
156
|
// the last note wasn't tied.
|
168
|
-
<<<<<<< HEAD
|
169
157
|
if (!eventHash["event"+voiceTime])
|
170
158
|
eventHash["event"+voiceTime] = { type: "event", time: voiceTime, top: top, height: height, left: element.x, width: element.w };
|
171
159
|
else {
|
172
160
|
// If there is more than one voice then two notes can fall at the same time. Usually they would be lined up in the same place, but if it is a whole rest, then it is placed funny. In any case, the left most element wins.
|
173
161
|
eventHash["event"+voiceTime].left = Math.min(eventHash["event"+voiceTime].left, element.x);
|
174
162
|
}
|
175
|
-
=======
|
176
|
-
eventHash["event"+voiceTime] = { type: "event", time: voiceTime, top: top, height: height, left: element.x, width: element.w };
|
177
|
-
>>>>>>> origin/master
|
178
163
|
if (isTiedToNext)
|
179
164
|
isTiedState = true;
|
180
165
|
}
|
@@ -218,13 +203,9 @@ if (!window.ABCJS)
|
|
218
203
|
if (currentNote.type === "bar") {
|
219
204
|
if (options.hideFinishedMeasures)
|
220
205
|
processMeasureHider(currentNote.lineNum, currentNote.measureNum);
|
221
|
-
<<<<<<< HEAD
|
222
206
|
if (timingEvents.length > 0)
|
223
207
|
return timingEvents[0].time / beatLength;
|
224
208
|
return 0;
|
225
|
-
=======
|
226
|
-
return processShowCursor();
|
227
|
-
>>>>>>> origin/master
|
228
209
|
}
|
229
210
|
if (options.showCursor)
|
230
211
|
cursor.css({ left: currentNote.left + "px", top: currentNote.top + "px", width: currentNote.width + "px", height: currentNote.height + "px" });
|
@@ -156,13 +156,8 @@ if (!window.ABCJS)
|
|
156
156
|
/* jshint -W064 */ var paper = Raphael(div, width, 400); /* jshint +W064 */
|
157
157
|
if (engraverParams === undefined)
|
158
158
|
engraverParams = {};
|
159
|
-
<<<<<<< HEAD
|
160
159
|
var engraver_controller = new ABCJS.write.EngraverController(paper, engraverParams);
|
161
160
|
engraver_controller.engraveABC(tune);
|
162
|
-
=======
|
163
|
-
var engraver_controller = new ABCJS.write.Printer(paper, engraverParams);
|
164
|
-
engraver_controller.printABC(tune);
|
165
|
-
>>>>>>> origin/master
|
166
161
|
tune.engraver = engraver_controller;
|
167
162
|
}
|
168
163
|
|
@@ -241,13 +241,8 @@ window.ABCJS.Editor.prototype.renderTune = function(abc, params, div) {
|
|
241
241
|
abcParser.parse(tunebook.tunes[0].abc, params); //TODO handle multiple tunes
|
242
242
|
var tune = abcParser.getTune();
|
243
243
|
var paper = Raphael(div, 800, 400);
|
244
|
-
<<<<<<< HEAD
|
245
244
|
var engraver_controller = new ABCJS.write.EngraverController(paper, this.engraverparams);
|
246
245
|
engraver_controller.engraveABC(tune);
|
247
|
-
=======
|
248
|
-
var engraver_controller = new ABCJS.write.Printer(paper, this.engraverparams);
|
249
|
-
engraver_controller.printABC(tune);
|
250
|
-
>>>>>>> origin/master
|
251
246
|
};
|
252
247
|
|
253
248
|
window.ABCJS.Editor.prototype.modelChanged = function() {
|
@@ -264,13 +259,8 @@ window.ABCJS.Editor.prototype.modelChanged = function() {
|
|
264
259
|
this.timerId = null;
|
265
260
|
this.div.innerHTML = "";
|
266
261
|
var paper = Raphael(this.div, 800, 400);
|
267
|
-
<<<<<<< HEAD
|
268
262
|
this.engraver_controller = new ABCJS.write.EngraverController(paper, this.engraverparams);
|
269
263
|
this.engraver_controller.engraveABC(this.tunes);
|
270
|
-
=======
|
271
|
-
this.engraver_controller = new ABCJS.write.Printer(paper, this.engraverparams);
|
272
|
-
this.engraver_controller.printABC(this.tunes);
|
273
|
-
>>>>>>> origin/master
|
274
264
|
this.tunes[0].engraver = this.engraver_controller; // TODO-PER: We actually want an output object for each tune, not the entire controller. When refactoring, don't save data in the controller.
|
275
265
|
if (ABCJS.midi.MidiWriter && this.mididiv) {
|
276
266
|
if (this.mididiv !== this.div)
|
@@ -642,7 +642,7 @@ window.ABCJS.parse.Parse = function() {
|
|
642
642
|
state = 'octave';
|
643
643
|
// At this point we have a valid note. The rest is optional. Set the duration in case we don't get one below
|
644
644
|
if (canHaveBrokenRhythm && multilineVars.next_note_duration !== 0) {
|
645
|
-
el.duration = multilineVars.next_note_duration;
|
645
|
+
el.duration = multilineVars.default_length * multilineVars.next_note_duration;
|
646
646
|
multilineVars.next_note_duration = 0;
|
647
647
|
durationSetByPreviousNote = true;
|
648
648
|
} else
|
@@ -681,7 +681,7 @@ window.ABCJS.parse.Parse = function() {
|
|
681
681
|
state = 'Zduration';
|
682
682
|
} else {
|
683
683
|
if (canHaveBrokenRhythm && multilineVars.next_note_duration !== 0) {
|
684
|
-
el.duration = multilineVars.next_note_duration;
|
684
|
+
el.duration = multilineVars.default_length * multilineVars.next_note_duration;
|
685
685
|
multilineVars.next_note_duration = 0;
|
686
686
|
durationSetByPreviousNote = true;
|
687
687
|
} else
|
@@ -704,7 +704,7 @@ window.ABCJS.parse.Parse = function() {
|
|
704
704
|
case '/':
|
705
705
|
if (state === 'octave' || state === 'duration') {
|
706
706
|
var fraction = tokenizer.getFraction(line, index);
|
707
|
-
if (!durationSetByPreviousNote)
|
707
|
+
//if (!durationSetByPreviousNote)
|
708
708
|
el.duration = el.duration * fraction.value;
|
709
709
|
// TODO-PER: We can test the returned duration here and give a warning if it isn't the one expected.
|
710
710
|
el.endChar = fraction.index;
|
@@ -772,7 +772,7 @@ window.ABCJS.parse.Parse = function() {
|
|
772
772
|
if (canHaveBrokenRhythm) {
|
773
773
|
var br2 = getBrokenRhythm(line, index);
|
774
774
|
index += br2[0] - 1; // index gets incremented below, so we'll let that happen
|
775
|
-
multilineVars.next_note_duration = br2[2]
|
775
|
+
multilineVars.next_note_duration = br2[2];
|
776
776
|
el.duration = br2[1]*el.duration;
|
777
777
|
state = 'end_slur';
|
778
778
|
} else {
|
@@ -902,13 +902,6 @@ window.ABCJS.parse.Parse = function() {
|
|
902
902
|
}
|
903
903
|
if (gracenotes.length)
|
904
904
|
return [gra[0], gracenotes];
|
905
|
-
// for (var ret = letter_to_pitch(gra[1], ii); ret[0]>0 && ii<gra[1].length;
|
906
|
-
// ret = letter_to_pitch(gra[1], ii)) {
|
907
|
-
// //todo get other stuff that could be in a grace note
|
908
|
-
// ii += ret[0];
|
909
|
-
// gracenotes.push({el_type:"gracenote",pitch:ret[1]});
|
910
|
-
// }
|
911
|
-
// return [ gra[0], gracenotes ];
|
912
905
|
}
|
913
906
|
return [ 0 ];
|
914
907
|
};
|
@@ -996,17 +989,11 @@ window.ABCJS.parse.Parse = function() {
|
|
996
989
|
|
997
990
|
// Start with the standard staff, clef and key symbols on each line
|
998
991
|
var delayStartNewLine = multilineVars.start_new_line;
|
999
|
-
// if (multilineVars.start_new_line) {
|
1000
|
-
// startNewLine();
|
1001
|
-
// }
|
1002
992
|
if (multilineVars.continueall === undefined)
|
1003
993
|
multilineVars.start_new_line = true;
|
1004
994
|
else
|
1005
995
|
multilineVars.start_new_line = false;
|
1006
996
|
var tripletNotesLeft = 0;
|
1007
|
-
//var tripletMultiplier = 0;
|
1008
|
-
// var inTie = false;
|
1009
|
-
// var inTieChord = {};
|
1010
997
|
|
1011
998
|
// See if the line starts with a header field
|
1012
999
|
var retHeader = header.letter_to_body_header(line, i);
|
@@ -1033,7 +1020,6 @@ window.ABCJS.parse.Parse = function() {
|
|
1033
1020
|
startNewLine();
|
1034
1021
|
delayStartNewLine = false;
|
1035
1022
|
}
|
1036
|
-
// var el = { };
|
1037
1023
|
|
1038
1024
|
// We need to decide if the following characters are a bar-marking or a note-group.
|
1039
1025
|
// Unfortunately, that is ambiguous. Both can contain chord symbols and decorations.
|
@@ -1194,6 +1180,7 @@ window.ABCJS.parse.Parse = function() {
|
|
1194
1180
|
|
1195
1181
|
// handle chords.
|
1196
1182
|
if (line.charAt(i) === '[') {
|
1183
|
+
var chordStartChar = i;
|
1197
1184
|
i++;
|
1198
1185
|
var chordDuration = null;
|
1199
1186
|
|
@@ -1232,9 +1219,6 @@ window.ABCJS.parse.Parse = function() {
|
|
1232
1219
|
|
1233
1220
|
if (multilineVars.next_note_duration !== 0) {
|
1234
1221
|
el.duration = el.duration * multilineVars.next_note_duration;
|
1235
|
-
// window.ABCJS.parse.each(el.pitches, function(p) {
|
1236
|
-
// p.duration = p.duration * multilineVars.next_note_duration;
|
1237
|
-
// });
|
1238
1222
|
multilineVars.next_note_duration = 0;
|
1239
1223
|
}
|
1240
1224
|
|
@@ -1250,11 +1234,6 @@ window.ABCJS.parse.Parse = function() {
|
|
1250
1234
|
}
|
1251
1235
|
}
|
1252
1236
|
|
1253
|
-
// if (el.startSlur !== undefined) {
|
1254
|
-
// window.ABCJS.parse.each(el.pitches, function(pitch) { if (pitch.startSlur === undefined) pitch.startSlur = el.startSlur; else pitch.startSlur += el.startSlur; });
|
1255
|
-
// delete el.startSlur;
|
1256
|
-
// }
|
1257
|
-
|
1258
1237
|
var postChordDone = false;
|
1259
1238
|
while (i < line.length && !postChordDone) {
|
1260
1239
|
switch (line.charAt(i)) {
|
@@ -1264,7 +1243,6 @@ window.ABCJS.parse.Parse = function() {
|
|
1264
1243
|
break;
|
1265
1244
|
case ')':
|
1266
1245
|
if (el.endSlur === undefined) el.endSlur = 1; else el.endSlur++;
|
1267
|
-
//window.ABCJS.parse.each(el.pitches, function(pitch) { if (pitch.endSlur === undefined) pitch.endSlur = 1; else pitch.endSlur++; });
|
1268
1246
|
break;
|
1269
1247
|
case '-':
|
1270
1248
|
window.ABCJS.parse.each(el.pitches, function(pitch) { pitch.startTie = {}; });
|
@@ -1275,7 +1253,10 @@ window.ABCJS.parse.Parse = function() {
|
|
1275
1253
|
var br2 = getBrokenRhythm(line, i);
|
1276
1254
|
i += br2[0] - 1; // index gets incremented below, so we'll let that happen
|
1277
1255
|
multilineVars.next_note_duration = br2[2];
|
1278
|
-
chordDuration
|
1256
|
+
if (chordDuration)
|
1257
|
+
chordDuration = chordDuration * br2[1];
|
1258
|
+
else
|
1259
|
+
chordDuration = br2[1];
|
1279
1260
|
break;
|
1280
1261
|
case '1':
|
1281
1262
|
case '2':
|
@@ -1290,7 +1271,7 @@ window.ABCJS.parse.Parse = function() {
|
|
1290
1271
|
var fraction = tokenizer.getFraction(line, i);
|
1291
1272
|
chordDuration = fraction.value;
|
1292
1273
|
i = fraction.index;
|
1293
|
-
if (line.charAt(i) === '-' || line.charAt(i) === ')')
|
1274
|
+
if (line.charAt(i) === '-' || line.charAt(i) === ')' || line.charAt(i) === ' ' || line.charAt(i) === '<' || line.charAt(i) === '>')
|
1294
1275
|
i--; // Subtracting one because one is automatically added below
|
1295
1276
|
else
|
1296
1277
|
postChordDone = true;
|
@@ -1309,16 +1290,13 @@ window.ABCJS.parse.Parse = function() {
|
|
1309
1290
|
if (el.pitches !== undefined) {
|
1310
1291
|
if (chordDuration !== null) {
|
1311
1292
|
el.duration = el.duration * chordDuration;
|
1312
|
-
// window.ABCJS.parse.each(el.pitches, function(p) {
|
1313
|
-
// p.duration = p.duration * chordDuration;
|
1314
|
-
// });
|
1315
1293
|
}
|
1316
1294
|
if (multilineVars.barNumOnNextNote) {
|
1317
1295
|
el.barNumber = multilineVars.barNumOnNextNote;
|
1318
1296
|
multilineVars.barNumOnNextNote = null;
|
1319
1297
|
}
|
1320
1298
|
multilineVars.addFormattingOptions(el, tune.formatting, 'note');
|
1321
|
-
tune.appendElement('note', startOfLine+
|
1299
|
+
tune.appendElement('note', startOfLine+chordStartChar, startOfLine+i, el);
|
1322
1300
|
multilineVars.measureNotEmpty = true;
|
1323
1301
|
el = {};
|
1324
1302
|
}
|
@@ -1348,7 +1326,6 @@ window.ABCJS.parse.Parse = function() {
|
|
1348
1326
|
if (core.endSlur !== undefined) el.endSlur = core.endSlur;
|
1349
1327
|
if (core.endTie !== undefined) el.rest.endTie = core.endTie;
|
1350
1328
|
if (core.startSlur !== undefined) el.startSlur = core.startSlur;
|
1351
|
-
//if (el.startSlur !== undefined) el.startSlur = el.startSlur;
|
1352
1329
|
if (core.startTie !== undefined) el.rest.startTie = core.startTie;
|
1353
1330
|
if (el.startTie !== undefined) el.rest.startTie = el.startTie;
|
1354
1331
|
}
|
@@ -1400,7 +1377,6 @@ window.ABCJS.parse.Parse = function() {
|
|
1400
1377
|
if (i === startI) { // don't know what this is, so ignore it.
|
1401
1378
|
if (line.charAt(i) !== ' ' && line.charAt(i) !== '`')
|
1402
1379
|
warn("Unknown character ignored", line, i);
|
1403
|
-
// warn("Unknown character ignored (" + line.charCodeAt(i) + ")", line, i);
|
1404
1380
|
i++;
|
1405
1381
|
}
|
1406
1382
|
}
|
@@ -34,10 +34,7 @@ window.ABCJS.parse.parseDirective = {};
|
|
34
34
|
multilineVars.vocalfont = { face: "\"Times New Roman\"", size: 13, weight: "bold", style: "normal", decoration: "none" };
|
35
35
|
multilineVars.wordsfont = { face: "\"Times New Roman\"", size: 16, weight: "normal", style: "normal", decoration: "none" };
|
36
36
|
|
37
|
-
<<<<<<< HEAD
|
38
37
|
// These fonts are global for the entire tune.
|
39
|
-
=======
|
40
|
-
>>>>>>> origin/master
|
41
38
|
tune.formatting.composerfont = { face: "\"Times New Roman\"", size: 14, weight: "normal", style: "italic", decoration: "none" };
|
42
39
|
tune.formatting.subtitlefont = { face: "\"Times New Roman\"", size: 16, weight: "normal", style: "normal", decoration: "none" };
|
43
40
|
tune.formatting.tempofont = { face: "\"Times New Roman\"", size: 15, weight: "bold", style: "normal", decoration: "none" };
|
@@ -45,7 +42,6 @@ window.ABCJS.parse.parseDirective = {};
|
|
45
42
|
tune.formatting.footerfont = { face: "\"Times New Roman\"", size: 12, weight: "normal", style: "normal", decoration: "none" };
|
46
43
|
tune.formatting.headerfont = { face: "\"Times New Roman\"", size: 12, weight: "normal", style: "normal", decoration: "none" };
|
47
44
|
tune.formatting.voicefont = { face: "\"Times New Roman\"", size: 13, weight: "bold", style: "normal", decoration: "none" };
|
48
|
-
<<<<<<< HEAD
|
49
45
|
|
50
46
|
// these are the default fonts for these element types. In the printer, these fonts might change as the tune progresses.
|
51
47
|
tune.formatting.annotationfont = multilineVars.annotationfont;
|
@@ -58,8 +54,6 @@ window.ABCJS.parse.parseDirective = {};
|
|
58
54
|
tune.formatting.textfont = multilineVars.textfont;
|
59
55
|
tune.formatting.vocalfont = multilineVars.vocalfont;
|
60
56
|
tune.formatting.wordsfont = multilineVars.wordsfont;
|
61
|
-
=======
|
62
|
-
>>>>>>> origin/master
|
63
57
|
}
|
64
58
|
|
65
59
|
var fontTypeCanHaveBox = { gchordfont: true, measurefont: true, partsfont: true };
|
@@ -283,13 +277,8 @@ window.ABCJS.parse.parseDirective = {};
|
|
283
277
|
if (!currentSetting) {
|
284
278
|
warn("Must specify the size of the font since there is no default value.", str, position);
|
285
279
|
size = 12;
|
286
|
-
<<<<<<< HEAD
|
287
280
|
} else
|
288
281
|
size = currentSetting.size;
|
289
|
-
=======
|
290
|
-
}
|
291
|
-
size = currentSetting.size;
|
292
|
-
>>>>>>> origin/master
|
293
282
|
} else
|
294
283
|
size = parseFloat(size);
|
295
284
|
|
@@ -320,6 +309,8 @@ window.ABCJS.parse.parseDirective = {};
|
|
320
309
|
if (tokens.length === 0)
|
321
310
|
return "Directive \"" + cmd + "\" requires a font as a parameter.";
|
322
311
|
multilineVars[cmd] = getFontParameter(tokens, multilineVars[cmd], str, 0, cmd);
|
312
|
+
if (multilineVars.is_in_header) // If the font appears in the header, then it becomes the default font.
|
313
|
+
tune.formatting[cmd] = multilineVars[cmd];
|
323
314
|
return null;
|
324
315
|
};
|
325
316
|
var getGlobalFont = function(cmd, tokens, str) {
|
@@ -372,7 +363,6 @@ window.ABCJS.parse.parseDirective = {};
|
|
372
363
|
if (str !== null) return str;
|
373
364
|
multilineVars[key] = (multilineVars[key] === 1);
|
374
365
|
return null;
|
375
|
-
<<<<<<< HEAD
|
376
366
|
};
|
377
367
|
|
378
368
|
var addMultilineVarOneParamChoice = function(key, cmd, tokens, choices) {
|
@@ -388,8 +378,6 @@ window.ABCJS.parse.parseDirective = {};
|
|
388
378
|
return "Directive \"" + cmd + "\" requires one of [ " + choices.join(", ") + " ] as a parameter.";
|
389
379
|
multilineVars[key] = choice;
|
390
380
|
return null;
|
391
|
-
=======
|
392
|
-
>>>>>>> origin/master
|
393
381
|
};
|
394
382
|
|
395
383
|
window.ABCJS.parse.parseDirective.parseFontChangeLine = function(textstr) {
|
@@ -455,10 +443,6 @@ window.ABCJS.parse.parseDirective = {};
|
|
455
443
|
// straightflags: { type: "boolean", optional: true },
|
456
444
|
// stretchstaff: { type: "boolean", optional: true },
|
457
445
|
// titleformat: { type: "string", optional: true },
|
458
|
-
<<<<<<< HEAD
|
459
|
-
=======
|
460
|
-
// vocalabove: { type: "boolean", optional: true },
|
461
|
-
>>>>>>> origin/master
|
462
446
|
case "bagpipes":tune.formatting.bagpipes = true;break;
|
463
447
|
case "landscape":multilineVars.landscape = true;break;
|
464
448
|
case "papersize":multilineVars.papersize = restOfString;break;
|
@@ -105,6 +105,15 @@ ABCJS.write.AbsoluteElement.prototype.addRight = function (right) {
|
|
105
105
|
this.addChild(right);
|
106
106
|
};
|
107
107
|
|
108
|
+
ABCJS.write.AbsoluteElement.prototype.addCentered = function (elem) {
|
109
|
+
var half = elem.w/2;
|
110
|
+
if (-half<this.extraw) this.extraw = -half;
|
111
|
+
this.extra[this.extra.length] = elem;
|
112
|
+
if (elem.dx+half>this.w) this.w = elem.dx+half;
|
113
|
+
this.right[this.right.length] = elem;
|
114
|
+
this.addChild(elem);
|
115
|
+
};
|
116
|
+
|
108
117
|
ABCJS.write.AbsoluteElement.prototype.setLimit = function(member, child) {
|
109
118
|
if (!child[member]) return;
|
110
119
|
if (!this.specialY[member])
|
@@ -150,29 +159,22 @@ ABCJS.write.AbsoluteElement.prototype.pushBottom = function (bottom) {
|
|
150
159
|
}
|
151
160
|
};
|
152
161
|
|
153
|
-
<<<<<<< HEAD
|
154
162
|
ABCJS.write.AbsoluteElement.prototype.setX = function (x) {
|
155
163
|
this.x = x;
|
156
164
|
for (var i=0; i<this.children.length; i++)
|
157
165
|
this.children[i].setX(x);
|
158
166
|
};
|
159
167
|
|
160
|
-
=======
|
161
|
-
>>>>>>> origin/master
|
162
168
|
ABCJS.write.AbsoluteElement.prototype.draw = function (renderer, bartop) {
|
163
169
|
this.elemset = renderer.paper.set();
|
164
170
|
if (this.invisible) return;
|
165
171
|
renderer.beginGroup();
|
166
172
|
for (var i=0; i<this.children.length; i++) {
|
167
|
-
<<<<<<< HEAD
|
168
173
|
if (ABCJS.write.debugPlacement) {
|
169
174
|
if (this.children[i].klass === 'ornament')
|
170
175
|
renderer.printShadedBox(this.x, renderer.calcY(this.children[i].top), this.w, renderer.calcY(this.children[i].bottom)-renderer.calcY(this.children[i].top), "rgba(0,0,200,0.3)");
|
171
176
|
}
|
172
177
|
this.elemset.push(this.children[i].draw(renderer,bartop));
|
173
|
-
=======
|
174
|
-
this.elemset.push(this.children[i].draw(renderer,this.x, bartop));
|
175
|
-
>>>>>>> origin/master
|
176
178
|
}
|
177
179
|
this.elemset.push(renderer.endGroup(this.type));
|
178
180
|
if (this.klass)
|
@@ -180,7 +182,6 @@ ABCJS.write.AbsoluteElement.prototype.draw = function (renderer, bartop) {
|
|
180
182
|
var color = ABCJS.write.debugPlacement ? "rgba(0,0,0,0.3)" : "rgba(0,0,0,0)"; // Create transparent box that encompasses the element, and not so transparent to debug it.
|
181
183
|
var target = renderer.printShadedBox(this.x, renderer.calcY(this.top), this.w, renderer.calcY(this.bottom)-renderer.calcY(this.top), color);
|
182
184
|
var self = this;
|
183
|
-
<<<<<<< HEAD
|
184
185
|
var controller = renderer.controller;
|
185
186
|
// this.elemset.mouseup(function () {
|
186
187
|
target.mouseup(function () {
|
@@ -189,14 +190,6 @@ ABCJS.write.AbsoluteElement.prototype.draw = function (renderer, bartop) {
|
|
189
190
|
this.abcelem.abselem = this;
|
190
191
|
|
191
192
|
var spacing = ABCJS.write.spacing.STEP;
|
192
|
-
=======
|
193
|
-
this.elemset.mouseup(function () {
|
194
|
-
renderer.notifySelect(self);
|
195
|
-
});
|
196
|
-
this.abcelem.abselem = this;
|
197
|
-
|
198
|
-
var spacing = ABCJS.write.spacing.STEP*renderer.scale;
|
199
|
-
>>>>>>> origin/master
|
200
193
|
|
201
194
|
var start = function () {
|
202
195
|
// storing original relative coordinates
|
@@ -210,7 +203,6 @@ ABCJS.write.AbsoluteElement.prototype.draw = function (renderer, bartop) {
|
|
210
203
|
this.translate(0,this.dy);
|
211
204
|
},
|
212
205
|
up = function () {
|
213
|
-
<<<<<<< HEAD
|
214
206
|
if (self.abcelem.pitches) {
|
215
207
|
var delta = -Math.round(this.dy / spacing);
|
216
208
|
self.abcelem.pitches[0].pitch += delta;
|
@@ -219,14 +211,6 @@ ABCJS.write.AbsoluteElement.prototype.draw = function (renderer, bartop) {
|
|
219
211
|
}
|
220
212
|
};
|
221
213
|
if (this.abcelem.el_type==="note" && controller.editable)
|
222
|
-
=======
|
223
|
-
var delta = -Math.round(this.dy/spacing);
|
224
|
-
self.abcelem.pitches[0].pitch += delta;
|
225
|
-
self.abcelem.pitches[0].verticalPos += delta;
|
226
|
-
renderer.notifyChange();
|
227
|
-
};
|
228
|
-
if (this.abcelem.el_type==="note" && renderer.editable)
|
229
|
-
>>>>>>> origin/master
|
230
214
|
this.elemset.drag(move, start, up);
|
231
215
|
};
|
232
216
|
|