* lexer-gcc-3.1.sh: Remove.
[lilypond/patrick.git] / lily / stanza-number-align-engraver.cc
blobbf4da5f840acd726f132b06b73e7beb2bcd4e9aa
1 /*
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>
7 */
9 #include "context.hh"
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
20 public:
21 TRANSLATOR_DECLARATIONS (Stanza_number_align_engraver);
23 protected:
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 ()
36 void
37 Stanza_number_align_engraver::acknowledge_lyric_syllable (Grob_info gi)
39 Grob *h = gi.grob ();
40 lyrics_.push_back (h);
43 void
44 Stanza_number_align_engraver::acknowledge_stanza_number (Grob_info gi)
46 Grob *h = gi.grob ();
47 stanza_numbers_.push_back (h);
50 void
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 ();
58 lyrics_.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. ",
65 "",
66 "",
67 " ",
68 "");