(staff_eligible): new function.
[lilypond.git] / lily / forbid-break-engraver.cc
blob461b55e9d8eecdb51520c363db2b9efeb03f2299
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 ENTER_DESCRIPTION(Forbid_line_break_engraver,
16 /* descr */ "Forbid line breaks when note heads are still playing at some point.",
17 /* creats*/ "",
18 /* accepts */ "",
19 /* acks */ "",
20 /* reads */ "busyGrobs",
21 /* write */ "");
23 void
24 Forbid_line_break_engraver::start_translation_timestep()
27 Check for running note heads. This should probably be done elsewhere.
29 SCM busy = get_property ("busyGrobs");
31 Moment now = now_mom();
32 while (gh_pair_p (busy) && unsmob_moment (gh_caar (busy))->main_part_ == now.main_part_)
33 busy = gh_cdr (busy);
36 while (gh_pair_p (busy))
38 Grob *g = unsmob_grob (gh_cdar (busy));
39 if (Rhythmic_head::has_interface (g))
41 top_engraver()->forbid_breaks();
43 busy = gh_cdr(busy);