]> git.donarmstrong.com Git - lilypond.git/blob - lily/forbid-break-engraver.cc
* lily/text-item.cc (interpret_string): new file, select font with
[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 void
16 Forbid_line_break_engraver::start_translation_timestep ()
17 {
18   /*
19     Check for running note heads. This should probably be done elsewhere.
20    */
21   SCM busy = get_property ("busyGrobs");
22
23   Moment now = now_mom ();
24   while (is_pair (busy) && unsmob_moment (ly_caar (busy))->main_part_ == now.main_part_)
25     busy = ly_cdr (busy);
26
27   
28   while (is_pair (busy))
29     {
30       Grob *g = unsmob_grob (ly_cdar (busy));
31       if (Rhythmic_head::has_interface (g))
32         {
33           get_score_engraver ()->forbid_breaks ();
34         }
35       busy = ly_cdr (busy);
36     }
37 }
38
39
40 ENTER_DESCRIPTION (Forbid_line_break_engraver,
41 /* descr */       "Forbid line breaks when note heads are still playing at some point.",
42 /* creats*/       "",
43 /* accepts */     "",
44 /* acks  */      "",
45 /* reads */       "busyGrobs",
46 /* write */       "");