]> git.donarmstrong.com Git - lilypond.git/commitdiff
''
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 1 Apr 2002 19:19:27 +0000 (19:19 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 1 Apr 2002 19:19:27 +0000 (19:19 +0000)
ChangeLog
Documentation/regression-test.tely
lily/rhythmic-column-engraver.cc
lily/spacing-engraver.cc
lily/spacing-spanner.cc

index 4b0b8713c102e036509ab21efc54c87958f2ecf1..7f1be4e3c28e97a2004b36b50dc1980775fda3a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-04-01  Han-Wen  <hanwen@cs.uu.nl>
+
+       * lily/rhythmic-column-engraver.cc (acknowledge_grob): don't make
+       note column for notes/stems/dots that already have parents. Fixes
+       nested grace contexts.
+
 2002-04-01  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * input/mozart-hrn-3.ly: Tweak Slur.beautiful, so that we don't
 
 2002-04-01  Han-Wen  <hanwen@cs.uu.nl>
 
+       * input/regression/spacing-grace-duration.ly: new file
+
+       * lily/spacing-engraver.cc (acknowledge_grob): ignore grace notes
+       for shortest durations.
+
        * lily/multi-measure-rest.cc (set_spacing_rods): tune rods to the
        extent of the mm rest. 
 
index 5ff30ffc4355e0573ed2f87652c3293e411c3c2e..fb74d544cd7f4df50ccf882d9fab572320f18a2d 100644 (file)
@@ -262,6 +262,8 @@ Grace note do weird things with timing. Fragile.
 
 @lilypondfile[printfilename]{spacing-short-notes.ly}
 
+@lilypondfile[printfilename]{spacing-grace-duration.ly}
+
 @lilypondfile[printfilename]{lyrics-bar.ly}
 
 @lilypondfile[printfilename]{spacing-knee.ly}
index 89ed54beb1cb03ec839f375c5459934c6ffc6839..80e483dfc620d43b19c3091189661d463ae8a843 100644 (file)
@@ -132,15 +132,17 @@ void
 Rhythmic_column_engraver::acknowledge_grob (Grob_info i)
 {
   Item * item =  dynamic_cast <Item *> (i.grob_l_);
-  if (item && Stem::has_interface (item))
+  if (!item || item->get_parent (X_AXIS))
+    return ; 
+  if (Stem::has_interface (item))
     {
       stem_l_ = item;
     }
-  else if (item && Rhythmic_head::has_interface (item))
+  else if (Rhythmic_head::has_interface (item))
     {
       rhead_l_arr_.push (item);
     }
-  else if (item && Dot_column::has_interface (item))
+  else if (Dot_column::has_interface (item))
     {
       dotcol_l_ = item;
     }
index 00fce0be69a42347482de4f408809c74dbca2efa..1da3613a1f206c74d48bde28874c5658d01faa17 100644 (file)
@@ -43,7 +43,7 @@ class Spacing_engraver : public Engraver
   PQueue<Rhythmic_tuple> playing_durations_;
   Array<Rhythmic_tuple> now_durations_;
   Array<Rhythmic_tuple> stopped_durations_;
-
+  Moment now_;
   Spanner * spacing_p_;
   
   TRANSLATOR_DECLARATIONS(Spacing_engraver);
@@ -100,11 +100,18 @@ Spacing_engraver::acknowledge_grob (Grob_info i)
   
   if (to_boolean (i.grob_l_->get_grob_property ("non-rhythmic")))
     return;
-  
-  if (Rhythmic_req * r = dynamic_cast<Rhythmic_req*> (i.music_cause ()))
+
+  /*
+    only pay attention to durations that are not grace notes. 
+   */
+  if (!now_.grace_part_)
     {
-      Rhythmic_tuple t (i, now_mom () + r->length_mom ());
-      now_durations_.push (t);
+      if (Rhythmic_req * r = dynamic_cast<Rhythmic_req*> (i.music_cause ()))
+       {
+         Moment len = r->length_mom ();
+         Rhythmic_tuple t (i, now_mom () + len);
+         now_durations_.push (t);
+       }
     }
 }
 
@@ -116,10 +123,7 @@ Spacing_engraver::stop_translation_timestep ()
   for (int i=0; i < playing_durations_.size (); i++)
     {
       Moment m = (playing_durations_[i].info_.music_cause ())->length_mom ();
-      if (m.to_bool ())
-       {
-         shortest_playing = shortest_playing <? m;
-       }
+      shortest_playing = shortest_playing <? m;
     }
   
   Moment starter;
@@ -152,11 +156,11 @@ Spacing_engraver::stop_translation_timestep ()
 void
 Spacing_engraver::start_translation_timestep ()
 {
-  Moment now = now_mom ();
+  now_ = now_mom ();
   stopped_durations_.clear ();
-  while (playing_durations_.size () && playing_durations_.front ().end_ < now)
+  while (playing_durations_.size () && playing_durations_.front ().end_ < now_)
     playing_durations_.delmin ();
-  while (playing_durations_.size () && playing_durations_.front ().end_ == now)
+  while (playing_durations_.size () && playing_durations_.front ().end_ == now_)
     stopped_durations_.push (playing_durations_.get ());
 }
 
index b087ffde981c597e6adb7ca6f7d4e0fb4bdb4b6c..68fe674790a84836cf9e4d629832f97e7b433415 100644 (file)
@@ -441,7 +441,7 @@ Spacing_spanner::find_shortest (Link_array<Grob> const &cols)
          max_count = counts[i];
        }
 
-      printf ("duration %d/%d, count %d\n", durations[i].num (), durations[i].den (), counts[i]);
+      //      printf ("duration %d/%d, count %d\n", durations[i].num (), durations[i].den (), counts[i]);
     }
 
   /*