]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/spacing-engraver.cc
* lily/modified-font-metric.cc (text_dimension): try
[lilypond.git] / lily / spacing-engraver.cc
index ae331b60d6299caefd7ee9360dbfebd18b8f1b11..697820f72de51f6ef99985d923b43b5d1f677d44 100644 (file)
@@ -3,11 +3,10 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
-#include "event.hh"
 #include "paper-column.hh"
 #include "engraver.hh"
 #include "pqueue.hh"
@@ -46,7 +45,7 @@ class Spacing_engraver : public Engraver
   Moment now_;
   Spanner * spacing_;
   
-  TRANSLATOR_DECLARATIONS(Spacing_engraver);
+  TRANSLATOR_DECLARATIONS (Spacing_engraver);
 protected:
   virtual void acknowledge_grob (Grob_info);
   virtual void start_translation_timestep ();
@@ -78,18 +77,22 @@ Spacing_engraver::process_music ()
 {
   if (!spacing_)
     {
-      spacing_  =new Spanner (get_property ("SpacingSpanner"));
+      spacing_ = make_spanner ("SpacingSpanner", SCM_EOL);
       spacing_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));  
-      announce_grob(spacing_, SCM_EOL);
+      
     }
 }
+
 void
 Spacing_engraver::finalize ()
 {
-  Grob * p = unsmob_grob (get_property ("currentCommandColumn"));
-  spacing_->set_bound (RIGHT, p);
-  typeset_grob (spacing_);
-  spacing_ =0;
+  if (spacing_)
+    {
+      Grob * p = unsmob_grob (get_property ("currentCommandColumn"));
+  
+      spacing_->set_bound (RIGHT, p);
+      spacing_ = 0;
+    }
 }
 
 void
@@ -100,7 +103,8 @@ Spacing_engraver::acknowledge_grob (Grob_info i)
       Pointer_group_interface::add_grob (spacing_, ly_symbol2scm  ("wishes"), i.grob_);
     }
   
-  if (i.grob_->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")))
+  if (i.grob_->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface"))
+      || i.grob_->internal_has_interface (ly_symbol2scm ("multi-measure-event")))
     return;
 
   /*
@@ -123,16 +127,19 @@ Spacing_engraver::stop_translation_timestep ()
 {
   Moment shortest_playing;
   shortest_playing.set_infinite (1);
-  for (int i=0; i < playing_durations_.size (); i++)
+  for (int i = 0; i < playing_durations_.size (); i++)
     {
-      Moment m = (playing_durations_[i].info_.music_cause ())->get_length ();
-      shortest_playing = shortest_playing <? m;
+      Music * mus = playing_durations_[i].info_.music_cause ();
+      if (mus)
+       {
+         Moment m = mus->get_length ();
+         shortest_playing = shortest_playing <? m;
+       }
     }
-  
   Moment starter;
   starter.set_infinite (1);
 
-  for (int i=0; i < now_durations_.size (); i++)
+  for (int i = 0; i < now_durations_.size (); i++)
     {
       Moment m = now_durations_[i].info_.music_cause ()->get_length ();
       if (m.to_bool ())
@@ -153,8 +160,8 @@ Spacing_engraver::stop_translation_timestep ()
   SCM sh = shortest_playing.smobbed_copy ();
   SCM st = starter.smobbed_copy ();
 
-  sc->set_grob_property ("shortest-playing-duration", sh);  
-  sc->set_grob_property ("shortest-starter-duration", st);
+  sc->set_property ("shortest-playing-duration", sh);  
+  sc->set_property ("shortest-starter-duration", st);
 }
 
 void
@@ -171,7 +178,7 @@ Spacing_engraver::start_translation_timestep ()
 
 
 
-ENTER_DESCRIPTION(Spacing_engraver,
+ADD_TRANSLATOR (Spacing_engraver,
 /* descr */       "make a SpacingSpanner and do bookkeeping of shortest starting and playing notes  ",
 /* creats*/       "SpacingSpanner",
 /* accepts */     "",