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>
10 #include "engraver.hh"
15 #include "rhythmic-head.hh"
17 #include "translator.icc"
19 class Forbid_line_break_engraver : public Engraver
22 TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver);
23 void start_translation_timestep ();
26 Forbid_line_break_engraver::Forbid_line_break_engraver ()
31 Forbid_line_break_engraver::start_translation_timestep ()
34 Check for running note heads. This should probably be done elsewhere.
36 SCM busy = get_property ("busyGrobs");
38 Moment now = now_mom ();
39 while (scm_is_pair (busy) && unsmob_moment (scm_caar (busy))->main_part_ == now.main_part_)
40 busy = scm_cdr (busy);
42 while (scm_is_pair (busy))
44 Grob *g = unsmob_grob (scm_cdar (busy));
45 if (g->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface")))
46 context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
47 busy = scm_cdr (busy);
51 ADD_TRANSLATOR (Forbid_line_break_engraver,
52 /* doc */ "Forbid line breaks when note heads "
53 "are still playing at some point.",
55 /* read */ "busyGrobs",
56 /* write */ "forbidBreak");