2 lyric-number-engraver.cc -- implement Stanza_number_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>, Glen Prideaux <glenprideaux@iname.com>
10 #include "engraver.hh"
12 #include "side-position-interface.hh"
14 class Stanza_number_engraver : public Engraver
19 This is naughty, since last_stanza_ may be GCd from under us. But
20 since we don't look at the contents, we are/should be (knock on
25 TRANSLATOR_DECLARATIONS(Stanza_number_engraver);
26 virtual void process_music ();
27 virtual void stop_translation_timestep ();
28 virtual void acknowledge_grob (Grob_info);
33 TODO: should make engraver that collects all the stanzas on a higher
34 level, and then groups them to the side. Stanza numbers should be
38 Stanza_number_engraver::Stanza_number_engraver ()
44 Stanza_number_engraver::process_music ()
46 SCM stanza = get_property ("stanza");
48 if (gh_string_p (stanza) && stanza != last_stanza_)
50 last_stanza_ = stanza;
52 text_ = new Item (get_property ("StanzaNumber"));
53 text_->set_grob_property ("text", stanza);
54 announce_grob (text_, SCM_EOL);
60 Stanza_number_engraver::acknowledge_grob (Grob_info inf)
63 && inf.grob_->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")))
65 Side_position_interface::add_support (text_, inf.grob_);
70 Stanza_number_engraver::stop_translation_timestep ()
80 ENTER_DESCRIPTION(Stanza_number_engraver,
82 /* creats*/ "StanzaNumber",
84 /* acks */ "lyric-syllable-interface",