]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/timing-engraver.cc
''
[lilypond.git] / lily / timing-engraver.cc
index fb021095830bcb4f58a7005fa4bfdc8014dec803..9a381cede41a4ba24e50fd4183b3d144179ef014 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 #include "translator-group.hh"
 #include "command-request.hh"
@@ -11,6 +11,7 @@
 #include "multi-measure-rest.hh"
 #include "timing-translator.hh"
 #include "engraver.hh"
+#include "grob.hh"
 
 /**
   Do time bookkeeping
@@ -25,11 +26,9 @@ protected:
   
   virtual void start_translation_timestep ();
   virtual void stop_translation_timestep ();
-  virtual void process_music ();
 
 public:
-  Timing_engraver ();
-  VIRTUAL_COPY_CONS (Translator);
+  TRANSLATOR_DECLARATIONS(Timing_engraver);
 };
 
 
@@ -38,7 +37,7 @@ Timing_engraver::Timing_engraver ()
   last_moment_.main_part_ = Rational (-1);
 }
 
-ADD_THIS_TRANSLATOR (Timing_engraver);
+
 
 void
 Timing_engraver::start_translation_timestep ()
@@ -56,14 +55,21 @@ Timing_engraver::start_translation_timestep ()
     which
       = (now.main_part_ || now.main_part_ == last_moment_.main_part_)
       ? SCM_EOL : ly_str02scm ("|");
+
+  Moment mp = measure_position ();
+  bool start_of_measure = (last_moment_.main_part_ != now.main_part_&& !mp.main_part_  );
+
+  if (start_of_measure)
+    {
+      Moment mlen = Moment(measure_length ());
+      unsmob_grob (get_property ("currentCommandColumn"))->set_grob_property ("measure-length", mlen.smobbed_copy()); 
+    }
   
   if (!gh_string_p (which) && !to_boolean (nonauto))
     {
       SCM always = get_property ("barAlways");
-      Moment mp = measure_position ();
-      if ( (last_moment_.main_part_ != now.main_part_
-           && !mp.main_part_)
-          || (to_boolean (always)))
+
+      if ( start_of_measure || (to_boolean (always)))
        {
          /* should this work, or be junked?  See input/bugs/no-bars.ly */
          which = get_property ("defaultBarType");
@@ -79,14 +85,16 @@ Timing_engraver::stop_translation_timestep ()
   Timing_translator::stop_translation_timestep ();
   daddy_trans_l_->set_property ("whichBar", SCM_EOL);
   last_moment_ = now_mom ();
+      
 }
 
 
-/*
-  ugh. Translator doesn't do process_music ().
- */
-void
-Timing_engraver::process_music ()
-{
-  Timing_translator::process_music ();
-}
+ENTER_DESCRIPTION(Timing_engraver,
+/* descr */       " Responsible for synchronizing timing information from staves. 
+Normally in @code{Score}.  In order to create polyrhythmic music,
+this engraver should be removed from @code{Score} and placed in
+@code{Staff}.",
+/* creats*/       "",
+/* acks  */       "",
+/* reads */       "timeSignatureFraction barCheckNoSynchronize barNonAuto whichBar barAlways defaultBarType skipBars timing oneBeat measureLength measurePosition currentBarNumber",
+/* write */       "");