]> git.donarmstrong.com Git - lilypond.git/commitdiff
''
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Jun 2002 22:43:05 +0000 (22:43 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Jun 2002 22:43:05 +0000 (22:43 +0000)
ChangeLog
lily/forbid-break-engraver.cc [new file with mode: 0644]
lily/grob-pq-engraver.cc
lily/note-heads-engraver.cc
ly/engraver-init.ly

index a993ab3754bdf4802c31b4caa8b92f122e8f38e6..c18eb112fa67adf8d84c9f48d2579c8444d592f5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2002-06-17  Han-Wen  <hanwen@cs.uu.nl>
 
+       * lily/forbid-break-engraver.cc (class
+       Forbid_line_break_engraver): new engraver: forbid linebreaks
+       during playing notes
+
        * lily/spacing-spanner.cc (loose_column): add another check: don't
        move around bar lines as loose columns.
 
diff --git a/lily/forbid-break-engraver.cc b/lily/forbid-break-engraver.cc
new file mode 100644 (file)
index 0000000..0ece130
--- /dev/null
@@ -0,0 +1,45 @@
+#include "rhythmic-head.hh"
+#include "engraver.hh"
+#include "grob.hh"
+#include "score-engraver.hh"
+
+class Forbid_line_break_engraver : public Engraver
+{
+public:
+  TRANSLATOR_DECLARATIONS(Forbid_line_break_engraver);
+  virtual void start_translation_timestep ();
+};
+
+Forbid_line_break_engraver::Forbid_line_break_engraver(){}
+
+ENTER_DESCRIPTION(Forbid_line_break_engraver,
+/* descr */       "Forbid line breaks when note heads are still playing
+at some point.",
+/* creats*/       "",
+/* acks  */       "",
+/* reads */       "busyGrobs",
+/* write */       "");
+
+void
+Forbid_line_break_engraver::start_translation_timestep()
+{
+  /*
+    Check for running note heads. This should probably be done elsewhere.
+   */
+  SCM busy = get_property ("busyGrobs");
+
+  Moment now = now_mom();
+  while (gh_pair_p (busy) && *unsmob_moment (gh_caar (busy)) == now)
+    busy = gh_cdr (busy);
+
+  
+  while (gh_pair_p (busy))
+    {
+      Grob *g = unsmob_grob (gh_cdar (busy));
+      if (Rhythmic_head::has_interface (g))
+       {
+         top_engraver()->forbid_breaks();
+       }
+      busy = gh_cdr(busy);
+    }
+}
index ff23b793e2cbf6757f36b9f04f3f5de581b729b0..b2540b8fa05bfda7d161594fbddb406839e1897c 100644 (file)
@@ -147,6 +147,7 @@ Grob_pq_engraver::start_translation_timestep ()
 
   if (start_busy != busy)
     daddy_trans_l_->set_property ("busyGrobs", busy);
+
 }
 
 
index c6ae621e9b4889ed8445c7d9c0b55564fc192762..7d48f15939122c483cd3d12b1fa1c50d34072b97 100644 (file)
@@ -12,7 +12,7 @@
 #include "dot-column.hh"
 #include "staff-symbol-referencer.hh"
 #include "item.hh"
-#include "score-engraver.hh"
+#include "engraver.hh"
 #include "warn.hh"
 
 /**
@@ -136,6 +136,8 @@ Note_heads_engraver::stop_translation_timestep ()
 void
 Note_heads_engraver::start_translation_timestep ()
 {
+
+
 }
 
 
index c06eaf848380c5fe3b1cdcfbb925b1eb6ea6987e..d5ab04dc50859a22c555cb72217ba981443832e5 100644 (file)
@@ -31,7 +31,7 @@ StaffContext=\translator {
        \consists "Piano_pedal_engraver"
        \consists "Instrument_name_engraver"
        \consists "Grob_pq_engraver"
-
+       \consists "Forbid_line_break_engraver"
        \consistsend "Axis_group_engraver"