]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/timing-engraver.cc
* po/nl.po: Update.
[lilypond.git] / lily / timing-engraver.cc
index be0fa1aef6cf0815e2a7ac7640a57f1bed9ff089..78b56d44a927c5486dd328352fa8c35ef3fd04ec 100644 (file)
@@ -3,10 +3,9 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-#include "translator-group.hh"
-
+#include "context.hh"
 #include "grob-info.hh"
 #include "multi-measure-rest.hh"
 #include "timing-translator.hh"
@@ -23,6 +22,7 @@ protected:
   Moment last_moment_;
   
   virtual void start_translation_timestep ();
+  virtual void initialize ();
   virtual void stop_translation_timestep ();
 
 public:
@@ -36,6 +36,22 @@ Timing_engraver::Timing_engraver ()
 }
 
 
+void
+Timing_engraver::initialize ()
+{
+  Timing_translator::initialize ();
+  
+  SCM which = get_property ("whichBar");
+  Moment now = now_mom ();
+  
+  /* Set the first bar of the score? */
+  if (!gh_string_p (which))
+    which = (now.main_part_ || now.main_part_ == last_moment_.main_part_)
+      ? SCM_EOL : scm_makfrom0str ("|");
+
+  daddy_context_->set_property ("whichBar", which);
+}
+
 
 void
 Timing_engraver::start_translation_timestep ()
@@ -48,9 +64,7 @@ Timing_engraver::start_translation_timestep ()
 
   /* Set the first bar of the score? */
   if (!gh_string_p (which))
-    which
-      = (now.main_part_ || now.main_part_ == last_moment_.main_part_)
-      ? SCM_EOL : scm_makfrom0str ("|");
+    which = SCM_EOL;
 
   Moment mp = measure_position ();
   bool start_of_measure = (last_moment_.main_part_ != now.main_part_
@@ -60,7 +74,7 @@ Timing_engraver::start_translation_timestep ()
     {
       Moment mlen = Moment (measure_length ());
       unsmob_grob (get_property ("currentCommandColumn"))
-       ->set_grob_property ("measure-length", mlen.smobbed_copy ()); 
+       ->set_property ("measure-length", mlen.smobbed_copy ()); 
     }
   
   if (!gh_string_p (which) && to_boolean (automatic_bars))
@@ -74,16 +88,15 @@ Timing_engraver::start_translation_timestep ()
        }
     }
 
-  daddy_trans_->set_property ("whichBar", which);
+  daddy_context_->set_property ("whichBar", which);
 }
 
 void
 Timing_engraver::stop_translation_timestep ()
 {
   Timing_translator::stop_translation_timestep ();
-  daddy_trans_->set_property ("whichBar", SCM_EOL);
+  daddy_context_->set_property ("whichBar", SCM_EOL);
   last_moment_ = now_mom ();
-      
 }
 
 
@@ -91,7 +104,10 @@ 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}.",
+"@code{Staff}. "
+"\n\nThis engraver adds the alias @code{Timing} to its containing context."
+
+                  ,
 /* creats*/       "",
 /* accepts */     "",
 /* acks  */      "",