*** empty log message ***
[lilypond.git] / lily / stanza-number-align-engraver.cc
blob194064f8fd7379c64d8bf8d6d133681f2b47c6b6
2 /*
3 stanza-number-align-engraver.cc -- implement
5 source file of the GNU LilyPond music typesetter
7 (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 */
12 #include "context.hh"
13 #include "engraver.hh"
14 #include "note-head.hh"
15 #include "lyric-extender.hh"
16 #include "item.hh"
17 #include "group-interface.hh"
18 #include "side-position-interface.hh"
21 class Stanza_number_align_engraver : public Engraver
23 public:
24 TRANSLATOR_DECLARATIONS (Stanza_number_align_engraver);
26 protected:
27 Link_array<Grob> lyrics_;
28 Link_array<Grob> stanza_numbers_;
29 virtual void acknowledge_grob (Grob_info);
30 virtual void stop_translation_timestep ();
33 Stanza_number_align_engraver::Stanza_number_align_engraver ()
38 void
39 Stanza_number_align_engraver::acknowledge_grob (Grob_info gi)
41 Grob *h = gi.grob_;
43 if (h->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")))
44 lyrics_.push (h);
45 else if (h->internal_has_interface (ly_symbol2scm ("stanza-number-interface")))
46 stanza_numbers_.push (h);
49 void
50 Stanza_number_align_engraver::stop_translation_timestep ()
52 for (int i= lyrics_.size (); i--;)
53 for (int j = stanza_numbers_.size (); j--;)
54 Side_position_interface::add_support (stanza_numbers_[j], lyrics_[i]);
56 stanza_numbers_.clear ();
57 lyrics_.clear ();
61 ENTER_DESCRIPTION (Stanza_number_align_engraver,
62 "This engraver ensures that stanza numbers are neatly aligned. ",
63 "",
64 "",
65 "stanza-number-interface lyric-syllable-interface ",
66 "",
67 "");