]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/percent-repeat-engraver.cc
* lily/tuplet-bracket.cc (calc_positions): multiply with
[lilypond.git] / lily / percent-repeat-engraver.cc
index 924098c4af1c29a0216f3a6615ebddb4f5c67e22..112d1668fbb5dc7a505fe88dc61cc4671b0302be 100644 (file)
@@ -3,21 +3,22 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2000--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 
 #include "score-engraver.hh"
 
-#include "repeated-music.hh"
+#include "bar-line.hh"
 #include "global-context.hh"
-#include "warn.hh"
-#include "misc.hh"
-#include "spanner.hh"
+#include "international.hh"
 #include "item.hh"
+#include "misc.hh"
 #include "percent-repeat-iterator.hh"
-#include "bar-line.hh"
+#include "repeated-music.hh"
 #include "side-position-interface.hh"
+#include "spanner.hh"
+#include "warn.hh"
 
 #include "translator.icc"
 
@@ -107,11 +108,8 @@ Percent_repeat_engraver::try_music (Music *m)
       else if (Moment (2) * meas_len == body_length_)
        repeat_sign_type_ = DOUBLE_MEASURE;
       else
-       {
-         warning (_f ("can't handle a percent repeat of length: %s",
-                      body_length_.to_string ()));
-         return false;
-       }
+       return false;
+    
 
       repeat_ = m;
 
@@ -139,7 +137,7 @@ Percent_repeat_engraver::try_music (Music *m)
 void
 Percent_repeat_engraver::process_music ()
 {
-  if (repeat_ && now_mom () == next_moment_)
+  if (repeat_ && now_mom ().main_part_ == next_moment_.main_part_)
     {
       count_ ++; 
       if (repeat_sign_type_ == MEASURE)
@@ -153,12 +151,12 @@ Percent_repeat_engraver::process_music ()
          Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
          percent_->set_bound (LEFT, col);
 
-         if (total_count_ > 2)
+         if (total_count_ > 2
+             && to_boolean (get_property ("countPercentRepeats")))
            {
              percent_counter_
                = make_spanner ("PercentRepeatCounter", repeat_->self_scm ());
 
-
              SCM text = scm_number_to_string (scm_from_int (count_),
                                               scm_from_int (10));
              percent_counter_->set_property ("text", text);
@@ -172,7 +170,8 @@ Percent_repeat_engraver::process_music ()
        {
          double_percent_ = make_item ("DoublePercentRepeat", repeat_->self_scm ());
 
-         if (total_count_ > 2)
+         if (total_count_ > 2
+             && to_boolean (get_property ("countPercentRepeats")))
            {
              double_percent_counter_
                = make_item ("DoublePercentRepeatCounter",
@@ -197,6 +196,7 @@ Percent_repeat_engraver::process_music ()
          get_score_engraver ()->forbid_breaks ();
        }
       next_moment_ = next_moment_ + body_length_;
+      next_moment_.grace_part_ = Rational (0);
     }
 }
 
@@ -235,7 +235,7 @@ Percent_repeat_engraver::typeset_perc ()
 void
 Percent_repeat_engraver::start_translation_timestep ()
 {
-  if (stop_mom_ == now_mom ())
+  if (stop_mom_.main_part_ == now_mom ().main_part_)
     {
       if (percent_)
        {
@@ -259,10 +259,21 @@ Percent_repeat_engraver::stop_translation_timestep ()
 }
 
 ADD_TRANSLATOR (Percent_repeat_engraver,
-               /* doc */ "Make whole bar and double bar repeats.",
+               /* doc */
+               "Make whole bar and double bar repeats.",
+               
                /* create */
-               "PercentRepeat DoublePercentRepeat "
-               "PercentRepeatCounter DoublePercentRepeatCounter",
-               /* accept */ "repeated-music",
-               /* read */ "measureLength currentCommandColumn",
+               "PercentRepeat "
+               "DoublePercentRepeat "
+               "PercentRepeatCounter "
+               "DoublePercentRepeatCounter",
+               
+               /* accept */
+               "repeated-music",
+
+               /* read */
+               "measureLength "
+               "currentCommandColumn "
+               "countPercentRepeats",
+
                /* write */ "");