]> git.donarmstrong.com Git - lilypond.git/blob - lily/forbid-break-engraver.cc
(Composite_music): new transpose syntax,
[lilypond.git] / lily / forbid-break-engraver.cc
1 #include "rhythmic-head.hh"
2 #include "engraver.hh"
3 #include "grob.hh"
4 #include "score-engraver.hh"
5
6 class Forbid_line_break_engraver : public Engraver
7 {
8 public:
9   TRANSLATOR_DECLARATIONS(Forbid_line_break_engraver);
10   virtual void start_translation_timestep ();
11 };
12
13 Forbid_line_break_engraver::Forbid_line_break_engraver(){}
14
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 */       "");
22
23 void
24 Forbid_line_break_engraver::start_translation_timestep()
25 {
26   /*
27     Check for running note heads. This should probably be done elsewhere.
28    */
29   SCM busy = get_property ("busyGrobs");
30
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);
34
35   
36   while (gh_pair_p (busy))
37     {
38       Grob *g = unsmob_grob (gh_cdar (busy));
39       if (Rhythmic_head::has_interface (g))
40         {
41           top_engraver()->forbid_breaks();
42         }
43       busy = gh_cdr(busy);
44     }
45 }