]> git.donarmstrong.com Git - lilypond.git/blob - lily/forbid-break-engraver.cc
*** empty log message ***
[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
17 at some point.",
18 /* creats*/       "",
19 /* accepts */     "",
20 /* acks  */      "",
21 /* reads */       "busyGrobs",
22 /* write */       "");
23
24 void
25 Forbid_line_break_engraver::start_translation_timestep()
26 {
27   /*
28     Check for running note heads. This should probably be done elsewhere.
29    */
30   SCM busy = get_property ("busyGrobs");
31
32   Moment now = now_mom();
33   while (gh_pair_p (busy) && unsmob_moment (gh_caar (busy))->main_part_ == now.main_part_)
34     busy = gh_cdr (busy);
35
36   
37   while (gh_pair_p (busy))
38     {
39       Grob *g = unsmob_grob (gh_cdar (busy));
40       if (Rhythmic_head::has_interface (g))
41         {
42           top_engraver()->forbid_breaks();
43         }
44       busy = gh_cdr(busy);
45     }
46 }