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"
14 #include "rhythmic-head.hh"
16 #include "translator.icc"
18 class Forbid_line_break_engraver : public Engraver
21 TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver);
22 void start_translation_timestep ();
25 Forbid_line_break_engraver::Forbid_line_break_engraver ()
30 Forbid_line_break_engraver::start_translation_timestep ()
33 Check for running note heads. This should probably be done elsewhere.
35 SCM busy = get_property ("busyGrobs");
37 Moment now = now_mom ();
38 while (scm_is_pair (busy) && unsmob_moment (scm_caar (busy))->main_part_ == now.main_part_)
39 busy = scm_cdr (busy);
41 while (scm_is_pair (busy))
43 Grob *g = unsmob_grob (scm_cdar (busy));
44 if (g->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface")))
45 context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
46 busy = scm_cdr (busy);
50 ADD_TRANSLATOR (Forbid_line_break_engraver,
51 /* doc */ "Forbid line breaks when note heads "
52 "are still playing at some point.",
54 /* read */ "busyGrobs",
55 /* write */ "forbidBreak");