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>
8 #include "rhythmic-head.hh"
10 #include "score-engraver.hh"
12 class Forbid_line_break_engraver : public Engraver
15 TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver);
16 virtual void start_translation_timestep ();
19 Forbid_line_break_engraver::Forbid_line_break_engraver (){}
22 Forbid_line_break_engraver::start_translation_timestep ()
25 Check for running note heads. This should probably be done elsewhere.
27 SCM busy = get_property ("busyGrobs");
29 Moment now = now_mom ();
30 while (scm_is_pair (busy) && unsmob_moment (scm_caar (busy))->main_part_ == now.main_part_)
31 busy = scm_cdr (busy);
33 while (scm_is_pair (busy))
35 Grob *g = unsmob_grob (scm_cdar (busy));
36 if (Rhythmic_head::has_interface (g))
38 get_score_engraver ()->forbid_breaks ();
40 busy = scm_cdr (busy);
44 ADD_TRANSLATOR (Forbid_line_break_engraver,
45 /* descr */ "Forbid line breaks when note heads are still playing at some point.",
49 /* reads */ "busyGrobs",