]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/timing-engraver.cc
patch::: 1.3.58.jcn2
[lilypond.git] / lily / timing-engraver.cc
index dfe98a9d30204beb40fb7d730fae130f87815d7a..68c34aeff62d8ff416a98a32263da37e73c752e6 100644 (file)
@@ -3,21 +3,66 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
+
 #include "score-engraver.hh"
 #include "timing-engraver.hh"
 #include "command-request.hh"
 #include "score-element-info.hh"
 #include "multi-measure-rest.hh"
 
+ADD_THIS_TRANSLATOR(Timing_engraver);
 
 void
-Timing_engraver::fill_staff_info (Staff_info &inf)
+Timing_engraver::do_post_move_processing( )
 {
-  inf.time_C_ = &time_;
-  inf.rhythmic_C_ = &default_grouping_;
+  bar_req_l_ = 0;
+  Timing_translator::do_post_move_processing ();
+  
 }
 
-IMPLEMENT_IS_TYPE_B1(Timing_engraver, Timing_translator);
-ADD_THIS_TRANSLATOR(Timing_engraver);
+bool
+Timing_engraver::do_try_music (Music*m)
+{
+  if (Bar_req  * b= dynamic_cast <Bar_req *> (m))
+    {
+      if (bar_req_l_ && !bar_req_l_->equal_b (b)) // huh?
+       return false;
+      
+      bar_req_l_ = b;
+      return true;
+    }
+  
+  return Timing_translator::do_try_music (m);
+}
+
+/*
+  TODO make properties of this.
+ */
+String
+Timing_engraver::which_bar ()
+{
+  if (!bar_req_l_)
+    {
+      if (!now_mom ())
+       return "|";
+
+      SCM nonauto = get_property ("barNonAuto");
+      if (!to_boolean (nonauto))
+       {
+         SCM always = get_property ("barAlways");
+         if (!measure_position ()
+             || (to_boolean (always)))
+           {
+             SCM def=get_property ("defaultBarType" );
+             return (gh_string_p (def))? ly_scm2string (def) : "";
+           }
+       }
+      return "";
+    }
+  else
+    {
+      return bar_req_l_->type_str_;
+    }
+}