(parse_symbol_list): Bugfix.
[lilypond/patrick.git] / lily / stanza-number-engraver.cc
blob34586f5e556592cdb85d84d3ff948988e0d4af70
1 /*
2 lyric-number-engraver.cc -- implement Stanza_number_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>, Glen Prideaux <glenprideaux@iname.com>
7 */
9 #include "engraver.hh"
10 #include "side-position-interface.hh"
12 class Stanza_number_engraver : public Engraver
14 Item *text_;
16 SCM last_stanza_;
17 public:
18 TRANSLATOR_DECLARATIONS (Stanza_number_engraver);
19 void process_music ();
20 virtual void derived_mark () const;
21 void stop_translation_timestep ();
22 DECLARE_ACKNOWLEDGER (lyric_syllable);
25 void
26 Stanza_number_engraver::derived_mark () const
28 scm_gc_mark (last_stanza_);
32 TODO: should make engraver that collects all the stanzas on a higher
33 level, and then groups them to the side. Stanza numbers should be
34 all aligned.
37 Stanza_number_engraver::Stanza_number_engraver ()
39 text_ = 0;
40 last_stanza_ = SCM_EOL;
43 void
44 Stanza_number_engraver::process_music ()
46 SCM stanza = get_property ("stanza");
48 if (scm_is_string (stanza) && stanza != last_stanza_)
50 last_stanza_ = stanza;
52 text_ = make_item ("StanzaNumber", SCM_EOL);
53 text_->set_property ("text", stanza);
57 void
58 Stanza_number_engraver::acknowledge_lyric_syllable (Grob_info inf)
60 if (text_)
62 Side_position_interface::add_support (text_, inf.grob ());
66 void
67 Stanza_number_engraver::stop_translation_timestep ()
69 text_ = 0;
72 #include "translator.icc"
74 ADD_ACKNOWLEDGER (Stanza_number_engraver, lyric_syllable);
75 ADD_TRANSLATOR (Stanza_number_engraver,
76 /* doc */ "",
77 /* create */ "StanzaNumber",
78 /* accept */ "",
79 /* read */ "stanza",
80 /* write */ "");