App-Music-ChordPro
view release on metacpan or search on metacpan
lib/ChordPro/res/abc/abc2svg/clair-1.js view on Meta::CPAN
set_fmt: function(of, cmd, param) {
if (cmd == "clairnote") {
if (!this.get_bool(param))
return
this.set_v_param("clair", true);
this.set_v_param("stafflines", "|-|---|-|")
this.set_v_param("staffscale", .8)
return
}
of(cmd, param)
},
// set the pitches according to the clefs
set_pitch: function(of, last_s) {
if (last_s) {
of(last_s)
return // not the 1st time
}
var p_v, s, v,
voice_tb = this.get_voice_tb(),
staff_tb = this.get_staff_tb()
for (v = 0; v < voice_tb.length; v++) {
p_v = voice_tb[v]
if (!p_v.clair)
continue
abc2svg.clair.new_clef(staff_tb[p_v.st].clef)
for (s = p_v.sym; s; s = s.next) {
if (s.clef_type)
abc2svg.clair.new_clef(s)
}
}
of(last_s)
},
// set the clairnote flag in the current voice
set_vp: function(of, a) {
var i,
curvoice = this.get_curvoice()
for (i = 0; i < a.length; i++) {
if (a[i] == "clair=") {
curvoice.clair = a[i + 1]
break
}
}
of(a)
},
// set the width of the clairnote key signatures
set_width: function(of, s) {
if (s.k_sf && s.p_v && s.p_v.clair) {
s.wl = 8;
s.wr = 10
} else {
of(s)
}
},
set_hooks: function(abc) {
abc.draw_hl = abc2svg.clair.draw_hl.bind(abc, abc.draw_hl);
abc.draw_keysig = abc2svg.clair.draw_keysig.bind(abc, abc.draw_keysig);
abc.output_music = abc2svg.clair.output_music.bind(abc, abc.output_music);
abc.set_format = abc2svg.clair.set_fmt.bind(abc, abc.set_format);
abc.set_pitch = abc2svg.clair.set_pitch.bind(abc, abc.set_pitch);
abc.set_vp = abc2svg.clair.set_vp.bind(abc, abc.set_vp);
abc.set_width = abc2svg.clair.set_width.bind(abc, abc.set_width)
}
} // clair
if (!abc2svg.mhooks)
abc2svg.mhooks = {}
abc2svg.mhooks.clair = abc2svg.clair.set_hooks
( run in 0.813 second using v1.01-cache-2.11-cpan-2398b32b56e )