Ensure scripts inside chords obey manual directions.
[lilypond/mpolesky.git] / lily / forbid-break-engraver.cc
blob81c03e15bef45389532dd6621e97289aa1bee5bf
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2002--_2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
19 #include "context.hh"
20 #include "duration.hh"
21 #include "engraver.hh"
22 #include "grob.hh"
23 #include "input.hh"
24 #include "pitch.hh"
25 #include "rhythmic-head.hh"
27 #include "translator.icc"
29 class Forbid_line_break_engraver : public Engraver
31 public:
32 TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver);
33 void start_translation_timestep ();
36 Forbid_line_break_engraver::Forbid_line_break_engraver ()
40 void
41 Forbid_line_break_engraver::start_translation_timestep ()
44 Check for running note heads. This should probably be done elsewhere.
46 SCM busy = get_property ("busyGrobs");
48 Moment now = now_mom ();
49 while (scm_is_pair (busy) && unsmob_moment (scm_caar (busy))->main_part_ == now.main_part_)
50 busy = scm_cdr (busy);
52 while (scm_is_pair (busy))
54 Grob *g = unsmob_grob (scm_cdar (busy));
55 if (g->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface")))
56 context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
57 busy = scm_cdr (busy);
61 ADD_TRANSLATOR (Forbid_line_break_engraver,
62 /* doc */
63 "Forbid line breaks when note heads are still playing at some"
64 " point.",
66 /* create */
67 "",
69 /* read */
70 "busyGrobs ",
72 /* write */
73 "forbidBreak "