3 lyric-number-engraver.cc -- implement Stanza_number_engraver
5 source file of the GNU LilyPond music typesetter
7 (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>, Glen Prideaux <glenprideaux@iname.com>
9 Similar to (and derived from) Instrument_name_engraver.
12 #include "engraver.hh"
14 //#include "system-start-delimiter.hh"
15 //#include "side-position-interface.hh"
16 //#include "staff-symbol-referencer.hh"
19 class Stanza_number_engraver : public Engraver
24 void create_text (SCM s);
26 VIRTUAL_COPY_CONS(Translator);
27 Stanza_number_engraver ();
29 virtual void acknowledge_grob (Grob_info);
30 virtual void stop_translation_timestep ();
33 ADD_THIS_TRANSLATOR(Stanza_number_engraver);
35 Stanza_number_engraver::Stanza_number_engraver ()
42 Stanza_number_engraver::acknowledge_grob(Grob_info i)
44 SCM s = get_property ("stanza");
46 if (now_mom () > Moment (0))
47 s = get_property ("stz");
51 // if (i.elem_l_->has_interface (symbol ("lyric-syllable-interface")))
52 // Tried catching lyric items to generate stanza numbers, but it spoils lyric spacing.
53 if (Bar::has_interface (i.elem_l_) || now_mom() == Moment(0))
54 // Works, but requires bar_engraver in LyricVoice context apart from at beginning.
55 // Is there any score element we can catch that will do the trick?
56 // if (! i.elem_l_->has_interface (symbol ("lyric-syllable-interface")) ||
57 // now_mom() == Moment(0))
58 // What happens if we try anything at all EXCEPT a lyric? Is there anything else?
59 // Not sure what it's catching, but it still mucks up lyrics.
66 Stanza_number_engraver::stop_translation_timestep ()
76 Stanza_number_engraver::create_text (SCM txt)
80 text_ = new Item (get_property ("StanzaNumber"));
81 text_->set_grob_property ("text", txt);
82 announce_grob (text_,0);