2 forbid-break-engraver.cc -- implement Forbid_line_break_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--_2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #include "rhythmic-head.hh"
11 #include "score-engraver.hh"
13 class Forbid_line_break_engraver : public Engraver
16 TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver);
17 virtual void start_translation_timestep ();
20 Forbid_line_break_engraver::Forbid_line_break_engraver (){}
23 Forbid_line_break_engraver::start_translation_timestep ()
26 Check for running note heads. This should probably be done elsewhere.
28 SCM busy = get_property ("busyGrobs");
30 Moment now = now_mom ();
31 while (scm_is_pair (busy) && unsmob_moment (scm_caar (busy))->main_part_ == now.main_part_)
32 busy = scm_cdr (busy);
35 while (scm_is_pair (busy))
37 Grob *g = unsmob_grob (scm_cdar (busy));
38 if (Rhythmic_head::has_interface (g))
40 get_score_engraver ()->forbid_breaks ();
42 busy = scm_cdr (busy);
47 ADD_TRANSLATOR (Forbid_line_break_engraver,
48 /* descr */ "Forbid line breaks when note heads are still playing at some point.",
52 /* reads */ "busyGrobs",