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"
13 #include "duration.hh"
16 class Forbid_line_break_engraver : public Engraver
19 TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver);
20 virtual void start_translation_timestep ();
23 Forbid_line_break_engraver::Forbid_line_break_engraver (){}
26 Forbid_line_break_engraver::start_translation_timestep ()
29 Check for running note heads. This should probably be done elsewhere.
31 SCM busy = get_property ("busyGrobs");
33 Moment now = now_mom ();
34 while (scm_is_pair (busy) && unsmob_moment (scm_caar (busy))->main_part_ == now.main_part_)
35 busy = scm_cdr (busy);
37 while (scm_is_pair (busy))
39 Grob *g = unsmob_grob (scm_cdar (busy));
40 if (Rhythmic_head::has_interface (g))
42 get_score_engraver ()->forbid_breaks ();
44 busy = scm_cdr (busy);
48 ADD_TRANSLATOR (Forbid_line_break_engraver,
49 /* descr */ "Forbid line breaks when note heads are still playing at some point.",
53 /* reads */ "busyGrobs",