*** empty log message ***
[lilypond.git] / lily / stanza-number-engraver.cc
blobd9887cfefd2686f17a5bbbd4066f78bab9c0c513
1 /*
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>
8 Similar to (and derived from) Instrument_name_engraver.
9 */
11 #include "engraver.hh"
12 #include "item.hh"
13 #include "bar-line.hh"
15 class Stanza_number_engraver : public Engraver
17 Item *text_;
18 bool bar_b_;
20 void create_text (SCM s);
21 public:
22 TRANSLATOR_DECLARATIONS(Stanza_number_engraver);
24 virtual void process_music ();
25 virtual void stop_translation_timestep ();
30 Stanza_number_engraver::Stanza_number_engraver ()
32 text_ = 0;
33 bar_b_ = false;
36 void
37 Stanza_number_engraver::process_music ()
39 if (gh_string_p (get_property ("whichBar")))
41 SCM s = get_property ("stanza");
43 if (now_mom () > Moment (0))
44 s = get_property ("stz");
47 // TODO
48 if (gh_string_p (s) || gh_pair_p (s))
51 if (i.grob_->internal_has_interface (symbol ("lyric-syllable-interface")))
53 Tried catching lyric items to generate stanza numbers, but it
54 spoils lyric spacing.
56 Works, but requires bar_engraver in LyricsVoice context apart
57 from at beginning. Is there any score element we can catch
58 that will do the trick?
60 What happens if we try anything at all EXCEPT a lyric? Is
61 there anything else? Not sure what it's catching, but it
62 still mucks up lyrics.
66 create_text (s);
70 void
71 Stanza_number_engraver::stop_translation_timestep ()
73 if (text_)
75 typeset_grob (text_);
76 text_ = 0;
80 void
81 Stanza_number_engraver::create_text (SCM txt)
83 if (!text_)
85 text_ = new Item (get_property ("StanzaNumber"));
86 text_->set_grob_property ("text", txt);
87 announce_grob (text_, SCM_EOL);
94 ENTER_DESCRIPTION(Stanza_number_engraver,
95 /* descr */ "",
96 /* creats*/ "StanzaNumber",
97 /* accepts */ "",
98 /* acks */ "",
99 /* reads */ "stz stanza",
100 /* write */ "");