Allow for nested properties in list form when using \override.
[lilypond.git] / lily / forbid-break-engraver.cc
blobf44d7bc27fca8656b43df95a881f0fe298a1cb90
1 /*
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>
7 */
8 #include "context.hh"
9 #include "duration.hh"
10 #include "engraver.hh"
11 #include "grob.hh"
12 #include "input.hh"
13 #include "pitch.hh"
14 #include "rhythmic-head.hh"
16 #include "translator.icc"
18 class Forbid_line_break_engraver : public Engraver
20 public:
21 TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver);
22 void start_translation_timestep ();
25 Forbid_line_break_engraver::Forbid_line_break_engraver ()
29 void
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 */
52 "Forbid line breaks when note heads are still playing at some"
53 " point.",
55 /* create */
56 "",
58 /* read */
59 "busyGrobs ",
61 /* write */
62 "forbidBreak "