]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/repeat-engraver.cc
release: 1.1.43
[lilypond.git] / lily / repeat-engraver.cc
index 06a033696c4b4d4574e66955aa6551b598a245e2..8de755f670dc8adc28e6f4c7e8160db8202c816f 100644 (file)
 #include "command-request.hh"
 #include "time-description.hh"
 #include "engraver-group.hh"
-#include "repeated-music.hh"
+#include "new-repeated-music.hh"
 #include "time-description.hh"
 #include "volta-spanner.hh"
 #include "note-column.hh"
 #include "paper-def.hh"
-
+#include "music-list.hh"
 
 ADD_THIS_TRANSLATOR (Repeat_engraver);
 
-Repeat_engraver::Repeat_engraver ()
-{
-}
-
 /*
-  urg. Way too complicated. needs redesign.
+  Urg. Hairy.  Needs redesign?
  */
 bool
 Repeat_engraver::do_try_music (Music* m)
 {
-  if (Repeated_music* r = dynamic_cast<Repeated_music *> (m))
+  if (New_repeated_music* r = dynamic_cast<New_repeated_music *> (m))
     {
-      r->unfold_b_ = get_property ("unfoldRepeats", 0).to_bool ();
-      if (r->unfold_b_)
-        return true;
-      Music_sequence* alt = r->alternative_p_;
-      Moment repeat_length_mom = r->repeat_p_->length_mom ();
+      Music_sequence* alt = r->alternatives_p_;
+      Moment repeat_length_mom = r->repeat_body_p_->length_mom ();
       Moment stop_mom = now_mom () + repeat_length_mom;
       Moment alt_mom = now_mom () + repeat_length_mom;
       if (repeat_length_mom)
        {
-         for (Cons<Music> *i (alt->music_p_list_p_->head_cons_p_); i && i->next_cons_p_; i = i->next_cons_p_)
-           {
-             stop_mom += i->car_p_->length_mom ();
-             if (dynamic_cast<Simultaneous_music *> (alt))
-               break;
-           }
+         stop_mom += r->alternatives_length_mom ();
          repeated_music_arr_.push (r);
          stop_mom_arr_.push (stop_mom);
        }
@@ -71,23 +58,23 @@ Repeat_engraver::do_try_music (Music* m)
       if (prop.length_i ())
        span_mom = prop.to_rat ();
 
-      int alt_i = r->repeats_i_ + 1 - cons_list_size_i (alt->music_p_list_p_->head_cons_p_ ) >? 1;
-      for (Cons<Music> *i = alt->music_p_list_p_->head_cons_p_; i ; i = i->next_cons_p_)
+      int alt_i = r->repeats_i_ + 1 - cons_list_size_i (alt->music_p_list_p_->head_ ) >? 1;
+      for (Cons<Music> *i = alt->music_p_list_p_->head_; i ; i = i->next_)
         {
-         alternative_music_arr_.push (i->car_p_);
+         alternative_music_arr_.push (i->car_);
          alternative_start_mom_arr_.push (alt_mom);
          if (span_mom)
            alternative_stop_mom_arr_.push (alt_mom + span_mom);
          else
-           alternative_stop_mom_arr_.push (alt_mom + i->car_p_->length_mom ());
+           alternative_stop_mom_arr_.push (alt_mom + i->car_->length_mom ());
          String str;
-         if ((alt_i != 1) && (alt_i != r->repeats_i_) && (i == alt->music_p_list_p_->head_cons_p_))
+         if ((alt_i != 1) && (alt_i != r->repeats_i_) && (i == alt->music_p_list_p_->head_))
            str = "1.-";
          str += to_str (alt_i) + ".";
          alt_i++;
          alternative_str_arr_.push (str);
          if (!dynamic_cast<Simultaneous_music *> (alt))
-           alt_mom += i->car_p_->length_mom ();
+           alt_mom += i->car_->length_mom ();
        }
       return true;
     }
@@ -187,9 +174,3 @@ Repeat_engraver::do_pre_move_processing ()
        }
     }
 }
-
-void 
-Repeat_engraver::do_post_move_processing ()
-{
-}
-