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>
13 #include "engraver.hh"
14 #include "note-head.hh"
15 #include "lyric-extender.hh"
17 #include "group-interface.hh"
18 #include "side-position-interface.hh"
21 class Stanza_number_align_engraver
: public Engraver
24 TRANSLATOR_DECLARATIONS (Stanza_number_align_engraver
);
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 ()
39 Stanza_number_align_engraver::acknowledge_grob (Grob_info gi
)
43 if (h
->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")))
45 else if (h
->internal_has_interface (ly_symbol2scm ("stanza-number-interface")))
46 stanza_numbers_
.push (h
);
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 ();
61 ENTER_DESCRIPTION (Stanza_number_align_engraver
,
62 "This engraver ensures that stanza numbers are neatly aligned. ",
65 "stanza-number-interface lyric-syllable-interface ",