X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lily%2Fspacing-engraver.cc;h=6985a7903a266bd024255ca9da6f077ae20356da;hb=874fecc2e70c51d2ad34f1677496292a5c56e63d;hp=0e4a4fe71749df3a51e486a167fcf68874c728c9;hpb=051d7e7cbdbbe5f5337ab2b477b0bd1e72eedd04;p=lilypond.git diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index 0e4a4fe717..6985a7903a 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -3,11 +3,11 @@ source file of the GNU LilyPond music typesetter - (c) 1999--2002 Han-Wen Nienhuys + (c) 1999--2004 Han-Wen Nienhuys */ -#include "request.hh" +#include "event.hh" #include "paper-column.hh" #include "engraver.hh" #include "pqueue.hh" @@ -46,12 +46,12 @@ 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 (); 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 @@ -98,7 +105,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,10 +131,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 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 @@ -169,7 +180,7 @@ Spacing_engraver::start_translation_timestep () -ENTER_DESCRIPTION(Spacing_engraver, +ENTER_DESCRIPTION (Spacing_engraver, /* descr */ "make a SpacingSpanner and do bookkeeping of shortest starting and playing notes ", /* creats*/ "SpacingSpanner", /* accepts */ "",