]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tuplet-engraver.cc
* input/regression/{many}.ly: refresh, trying to guess how
[lilypond.git] / lily / tuplet-engraver.cc
index 68313e84922799f4d387cff66c31b83c1a730b47..0db8d88ef25af4fff6f1c2e1269e2a84bf193cea 100644 (file)
@@ -3,12 +3,12 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1998--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
 
-#include "command-request.hh"
+
 #include "tuplet-bracket.hh"
 #include "note-column.hh"
 #include "time-scaled-music.hh"
@@ -23,7 +23,7 @@ public:
   TRANSLATOR_DECLARATIONS(Tuplet_engraver);
 
 protected:
-  Link_array<Time_scaled_music> time_scaled_musics_;
+  Link_array<Music> time_scaled_musics_;
   /// when does the scaled music stop? Array order is synced with time_scaled_musics_
   Array<Rational> stop_moments_;
   /// when does the current spanner stop? Array order is synced with time_scaled_musics_
@@ -40,21 +40,15 @@ protected:
 };
 
 bool
-Tuplet_engraver::try_music (Music *r)
+Tuplet_engraver::try_music (Music *c)
 {
-#if 1
-  if (Time_scaled_music * c = dynamic_cast<Time_scaled_music *> (r))
-    {
-      Music *el = c->element ();
-#else    
-  if (r->is_mus_type ("time-scaled-music"))
+  if (c->is_mus_type ("time-scaled-music"))
     {
       Music *el = unsmob_music (c->get_mus_property ("element"));
-#endif
-      if (!dynamic_cast<Request_chord*> (el))
+      if (el && !el->is_mus_type ("event-chord"))
        {
          time_scaled_musics_.push (c);
-         Rational m = now_mom ().main_part_ + c->length_mom ().main_part_;
+         Rational m = now_mom ().main_part_ + c->get_length ().main_part_;
          stop_moments_.push (m);
 
          SCM s = get_property ("tupletSpannerDuration");
@@ -71,16 +65,12 @@ Tuplet_engraver::try_music (Music *r)
 void
 Tuplet_engraver::process_acknowledged_grobs ()
 {
-  SCM v = get_property ("tupletInvisible");
-  if (to_boolean (v))
-    return;
-
   for (int i= 0; i < time_scaled_musics_.size (); i++)
     {
       if (i < started_spanners_.size () && started_spanners_[i])
        continue;
 
-      Spanner* glep = new Spanner (get_property ("TupletBracket"));
+      Spanner* glep = make_spanner ("TupletBracket");
 
       if (i >= started_spanners_.size ())
        started_spanners_.push (glep);
@@ -124,9 +114,13 @@ Tuplet_engraver::start_translation_timestep ()
     {
       if (now.main_part_ >= span_stop_moments_[i])
        {
-         if (started_spanners_[i])
+         if (Spanner *sp = started_spanners_[i])
            {
-             typeset_grob (started_spanners_[i]);
+             if (!sp->get_bound (RIGHT))
+               sp->set_bound (RIGHT, sp->get_bound (LEFT));
+             
+             typeset_grob (sp);
+
              started_spanners_[i] =0;
            }
          
@@ -163,5 +157,5 @@ ENTER_DESCRIPTION(Tuplet_engraver,
 /* creats*/       "TupletBracket",
 /* accepts */     "time-scaled-music",
 /* acks  */      "note-column-interface",
-/* reads */       "tupletNumberFormatFunction tupletSpannerDuration tupletInvisible",
+/* reads */       "tupletNumberFormatFunction tupletSpannerDuration",
 /* write */       "");