X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fspacing-engraver.cc;h=109a3063212d1ea991e436a507507a6d01b0bc5d;hb=f085824b2182c1f0fa2c5118884770ac7ff775c7;hp=24e8ab969ae3f718707ad7a6abfe8c96785909f5;hpb=487ee28c2a58e7bd5cb9e85c7676057c0b32f385;p=lilypond.git diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index 24e8ab969a..109a306321 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1999--2002 Han-Wen Nienhuys + (c) 1999--2004 Han-Wen Nienhuys */ @@ -51,7 +51,7 @@ protected: virtual void acknowledge_grob (Grob_info); virtual void start_translation_timestep (); virtual void stop_translation_timestep (); - virtual void initialize (); + virtual void process_music (); virtual void finalize (); }; @@ -74,20 +74,27 @@ Spacing_engraver::Spacing_engraver () } void -Spacing_engraver::initialize () +Spacing_engraver::process_music () { - spacing_ =new Spanner (get_property ("SpacingSpanner")); - spacing_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn"))); - announce_grob(spacing_, SCM_EOL); + if (!spacing_) + { + spacing_ = make_spanner ("SpacingSpanner"); + 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); + typeset_grob (spacing_); + spacing_ =0; + } } void @@ -123,10 +130,13 @@ Spacing_engraver::stop_translation_timestep () shortest_playing.set_infinite (1); for (int i=0; i < playing_durations_.size (); i++) { - Moment m = (playing_durations_[i].info_.music_cause ())->get_length (); - shortest_playing = shortest_playing get_length (); + shortest_playing = shortest_playing