* lily/include/lily-guile.hh: many new ly_ functions. Thanks to
[lilypond.git] / lily / forbid-break-engraver.cc
blob492a35e4f79f560a2c4abaed2583ebd9a6fed405
1 #include "rhythmic-head.hh"
2 #include "engraver.hh"
3 #include "grob.hh"
4 #include "score-engraver.hh"
6 class Forbid_line_break_engraver : public Engraver
8 public:
9 TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver);
10 virtual void start_translation_timestep ();
13 Forbid_line_break_engraver::Forbid_line_break_engraver (){}
15 void
16 Forbid_line_break_engraver::start_translation_timestep ()
19 Check for running note heads. This should probably be done elsewhere.
21 SCM busy = get_property ("busyGrobs");
23 Moment now = now_mom ();
24 while (ly_pair_p (busy) && unsmob_moment (ly_caar (busy))->main_part_ == now.main_part_)
25 busy = ly_cdr (busy);
28 while (ly_pair_p (busy))
30 Grob *g = unsmob_grob (ly_cdar (busy));
31 if (Rhythmic_head::has_interface (g))
33 get_score_engraver ()->forbid_breaks ();
35 busy = ly_cdr (busy);
40 ENTER_DESCRIPTION (Forbid_line_break_engraver,
41 /* descr */ "Forbid line breaks when note heads are still playing at some point.",
42 /* creats*/ "",
43 /* accepts */ "",
44 /* acks */ "",
45 /* reads */ "busyGrobs",
46 /* write */ "");