3 stanza-number-align-engraver.cc -- implement
5 source file of the GNU LilyPond music typesetter
7 (c) 2004--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "engraver.hh"
12 #include "note-head.hh"
13 #include "lyric-extender.hh"
14 #include "group-interface.hh"
15 #include "side-position-interface.hh"
17 class Stanza_number_align_engraver : public Engraver
20 TRANSLATOR_DECLARATIONS (Stanza_number_align_engraver);
23 Link_array<Grob> lyrics_;
24 Link_array<Grob> stanza_numbers_;
25 virtual void acknowledge_grob (Grob_info);
26 virtual void stop_translation_timestep ();
29 Stanza_number_align_engraver::Stanza_number_align_engraver ()
34 Stanza_number_align_engraver::acknowledge_grob (Grob_info gi)
38 if (h->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")))
40 else if (h->internal_has_interface (ly_symbol2scm ("stanza-number-interface")))
41 stanza_numbers_.push (h);
45 Stanza_number_align_engraver::stop_translation_timestep ()
47 for (int i = lyrics_.size (); i--;)
48 for (int j = stanza_numbers_.size (); j--;)
49 Side_position_interface::add_support (stanza_numbers_[j], lyrics_[i]);
51 stanza_numbers_.clear ();
55 ADD_TRANSLATOR (Stanza_number_align_engraver,
56 "This engraver ensures that stanza numbers are neatly aligned. ",
59 "stanza-number-interface lyric-syllable-interface ",