App-Music-ChordPro

 view release on metacpan or  search on metacpan

lib/ChordPro/res/abc/abc2svg/clip-1.js  view on Meta::CPAN

				p_voice.sym = s2
			}
			s2 = this.get_tsfirst()
			if (s != s2) {
				if (s2.type == C.STAVES) {
					s2.ts_next = s
					s.ts_prev = s2
					s2.next = s2.p_v.sym
					s2.p_v.sym = s2
					s2.next.prev = s2
				} else {
					this.set_tsfirst(s)
					delete s.ts_prev
				}
			}
		}

		/* remove the end of the tune */
		s = go_global_time(s, cfmt.clip[1])
		if (!s)
			return

		/* keep the current sequence */
		do {
			s = s.ts_next
			if (!s)
				return
		} while (!s.seqst)

		/* cut the voices */
		for (v = 0; v < voice_tb.length; v++) {
			p_voice = voice_tb[v]
			for (s2 = s.ts_prev; s2; s2 = s2.ts_prev) {
				if (s2.v == v) {
					delete s2.next
					break
				}
			}
			if (!s2)
				p_voice.sym = null
		}
		delete s.ts_prev.ts_next

		chkptr(s.ts_prev)	// check the pointers (ties and slurs)
	}, // do_clip()

    do_pscom: function (of, text) {
	if (text.slice(0, 5) == "clip ")
		abc2svg.clip.get_clip.call(this, text)
	else
		of(text)
    },

    set_bar_num: function(of) {
	of()
	if (this.cfmt().clip)
		abc2svg.clip.do_clip.call(this)
    },

    set_hooks: function(abc) {
	abc.do_pscom = abc2svg.clip.do_pscom.bind(abc, abc.do_pscom);
	abc.set_bar_num = abc2svg.clip.set_bar_num.bind(abc, abc.set_bar_num)
    }
} // clip

if (!abc2svg.mhooks)
	abc2svg.mhooks = {}
abc2svg.mhooks.clip = abc2svg.clip.set_hooks



( run in 0.841 second using v1.01-cache-2.11-cpan-2398b32b56e )