2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2000--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>, Glen Prideaux <glenprideaux@iname.com>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "engraver.hh"
21 #include "side-position-interface.hh"
22 #include "text-interface.hh"
25 class Stanza_number_engraver : public Engraver
31 TRANSLATOR_DECLARATIONS (Stanza_number_engraver);
32 void process_music ();
33 virtual void derived_mark () const;
34 void stop_translation_timestep ();
35 DECLARE_ACKNOWLEDGER (lyric_syllable);
39 Stanza_number_engraver::derived_mark () const
41 scm_gc_mark (last_stanza_);
45 TODO: should make engraver that collects all the stanzas on a higher
46 level, and then groups them to the side. Stanza numbers should be
50 Stanza_number_engraver::Stanza_number_engraver ()
53 last_stanza_ = SCM_EOL;
57 Stanza_number_engraver::process_music ()
59 SCM stanza = get_property ("stanza");
61 if (Text_interface::is_markup (stanza)
62 && stanza != last_stanza_)
64 last_stanza_ = stanza;
66 text_ = make_item ("StanzaNumber", SCM_EOL);
67 text_->set_property ("text", stanza);
72 Stanza_number_engraver::acknowledge_lyric_syllable (Grob_info inf)
75 Side_position_interface::add_support (text_, inf.grob ());
79 Stanza_number_engraver::stop_translation_timestep ()
84 #include "translator.icc"
86 ADD_ACKNOWLEDGER (Stanza_number_engraver, lyric_syllable);
87 ADD_TRANSLATOR (Stanza_number_engraver,
89 "Engrave stanza numbers.",