2 stanza-number-align-engraver.cc -- implement Stanza_number_align_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2004--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "engraver.hh"
11 #include "note-head.hh"
12 #include "lyric-extender.hh"
13 #include "pointer-group-interface.hh"
14 #include "side-position-interface.hh"
16 #include "translator.icc"
18 class Stanza_number_align_engraver
: public Engraver
21 TRANSLATOR_DECLARATIONS (Stanza_number_align_engraver
);
24 vector
<Grob
*> lyrics_
;
25 vector
<Grob
*> stanza_numbers_
;
27 DECLARE_ACKNOWLEDGER (lyric_syllable
);
28 DECLARE_ACKNOWLEDGER (stanza_number
);
29 void stop_translation_timestep ();
32 Stanza_number_align_engraver::Stanza_number_align_engraver ()
37 Stanza_number_align_engraver::acknowledge_lyric_syllable (Grob_info gi
)
40 lyrics_
.push_back (h
);
44 Stanza_number_align_engraver::acknowledge_stanza_number (Grob_info gi
)
47 stanza_numbers_
.push_back (h
);
51 Stanza_number_align_engraver::stop_translation_timestep ()
53 for (vsize i
= lyrics_
.size (); i
--;)
54 for (vsize j
= stanza_numbers_
.size (); j
--;)
55 Side_position_interface::add_support (stanza_numbers_
[j
], lyrics_
[i
]);
57 stanza_numbers_
.clear ();
61 ADD_ACKNOWLEDGER (Stanza_number_align_engraver
, lyric_syllable
);
62 ADD_ACKNOWLEDGER (Stanza_number_align_engraver
, stanza_number
);
63 ADD_TRANSLATOR (Stanza_number_align_engraver
,
64 "This engraver ensures that stanza numbers are neatly aligned. ",