]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/timing-translator.cc
release: 1.1.43
[lilypond.git] / lily / timing-translator.cc
index 856525785b8b65cbc8dd8331ee864462dc6f0895..800fab932bc1fd355a6c22345f9e7b631edf3a7f 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "timing-translator.hh"
@@ -18,7 +18,7 @@ Timing_translator::Timing_translator ()
 }
 
 bool
-Timing_translator::do_try_request(Request*r)
+Timing_translator::do_try_music (Music*r)
 {
   if (Timing_req *t =  dynamic_cast <Timing_req *> (r))
     {
@@ -26,7 +26,7 @@ Timing_translator::do_try_request(Request*r)
        {
          if (timing_req_l_arr_[i]->equal_b(t))
            return true;
-         if (timing_req_l_arr_[i]->name() == r->name())
+         if (String (classname (timing_req_l_arr_[i])) == classname (r))
            {
              r->warning (_ ("conflicting timing request"));
              return false;
@@ -68,13 +68,15 @@ Timing_translator::do_process_requests()
          else
            {
              time_.set_time_signature (b_i, o_i);
+
              default_grouping_ =
-               Rhythmic_grouping (MInterval (0,Moment (b_i, o_i)), b_i);
+               Rhythmic_grouping (MInterval (0,Moment (b_i, o_i)),
+                                  b_i == 1 ? 2 : b_i);
            }
        }
       else if (Partial_measure_req *pm = dynamic_cast <Partial_measure_req *> (tr_l))
        {
-         Moment m = pm->duration_;
+         Moment m = pm->length_mom_;
          String error = time_.try_set_partial_str (m);
          if (error.length_i ())
            {
@@ -93,7 +95,6 @@ Timing_translator::do_process_requests()
              time_.whole_in_measure_ = 0; // resync
              time_.error_b_ = true;
            }
-
        }
       else if (Cadenza_req *cr = dynamic_cast <Cadenza_req *> (tr_l))
        {
@@ -107,6 +108,17 @@ Timing_translator::do_process_requests()
 
        }
     }
+
+  Translator_group * tr=0;
+
+  Scalar barn = get_property ("currentBarNumber", &tr);
+  if (!barn.empty_b () && barn.isnum_b ())
+    {
+      time_.bars_i_ = int(barn);
+      tr->set_property ("currentBarNumber", "");
+    }
+  
+
 }
 
 
@@ -119,26 +131,28 @@ Timing_translator::do_pre_move_processing()
 
 
   /* allbars == ! skipbars */
-  bool allbars = ! get_property ("SkipBars").to_bool ();
-
+  bool allbars = ! get_property ("skipBars", 0).to_bool ();
 
+  // urg: multi bar rests: should always must process whole of first bar?
   if (!time_.cadenza_b_ && allbars)
     global_l->add_moment_to_process (time_.next_bar_moment ());
 }
 
-IMPLEMENT_IS_TYPE_B1(Timing_translator, Translator);
+
 ADD_THIS_TRANSLATOR(Timing_translator);
 
 void
 Timing_translator::do_creation_processing()
 {
-  time_.when_ = now_moment ();
+  time_.when_ = now_mom ();
 }
 
 void
 Timing_translator::do_post_move_processing()
 {
-  time_.add (now_moment ()  - time_.when_);
+  time_.add (now_mom ()  - time_.when_);
+
+
 }
 
 void