]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tuplet-iterator.cc
Run grand replace for 2015.
[lilypond.git] / lily / tuplet-iterator.cc
index 5f3548e4905975f41392f5b5d40ca3a98dce631b..80a75a9beb7ad2d8c64f14c66d12158b7e3e0089 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1998--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>,
+  Copyright (C) 1998--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>,
                  Erik Sandberg <mandolaerik@gmail.com>
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -68,7 +68,7 @@ Tuplet_iterator::create_event (Direction d)
 
   Music *mus = get_music ();
 
-  Music *ev = unsmob_music (ev_scm);
+  Music *ev = Music::unsmob (ev_scm);
   ev->set_spot (*mus->origin ());
   if (d == START)
     {
@@ -104,11 +104,13 @@ Tuplet_iterator::process (Moment m)
       && m.main_part_ == next_split_mom_)
     {
       descend_to_bottom_context ();
-      if (tuplet_handler_.get_outlet ())
-        create_event (STOP)->send_to_context (tuplet_handler_.get_outlet ());
+      if (tuplet_handler_.get_context ())
+        create_event (STOP)->send_to_context (tuplet_handler_.get_context ());
 
       if (m.main_part_ < music_get_length ().main_part_)
         {
+          spanner_duration_ =
+            min (music_get_length () - next_split_mom_, spanner_duration_);
           tuplet_handler_.set_context (get_outlet ());
           report_event (create_event (START));
 
@@ -126,12 +128,13 @@ Tuplet_iterator::process (Moment m)
 void
 Tuplet_iterator::construct_children ()
 {
-  spanner_duration_ = music_get_length ();
-
-  Moment *mp
-    = unsmob_moment (get_outlet ()->get_property ("tupletSpannerDuration"));
-  if (mp)
-    spanner_duration_ = min (mp->main_part_, spanner_duration_);
+  if (Duration *d = Duration::unsmob (get_music ()->get_property ("duration")))
+    spanner_duration_ = d->get_length ();
+  else if (Moment *mp
+           = Moment::unsmob (get_outlet ()->get_property ("tupletSpannerDuration")))
+    spanner_duration_ = mp->main_part_;
+  else
+    spanner_duration_.set_infinite (1);
 
   Music_wrapper_iterator::construct_children ();