2 extender-engraver.cc -- implement Extender_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2003 Glen Prideaux <glenprideaux@iname.com>,
7 Han-Wen Nienhuys <hanwen@cs.uu.nl>,
8 Jan Nieuwenhuizen <janneke@gnu.org>
11 #include "flower-proto.hh"
13 #include "lyric-extender.hh"
14 #include "paper-column.hh"
16 #include "engraver.hh"
17 #include "drul-array.hh"
18 #include "lyric-extender.hh"
23 Generate an centred extender. Should make a Extender_spanner that
24 typesets a nice centred extender of varying length depending on the
25 gap between syllables.
27 We remember the last Item that come across. When we get a
28 event, we create the spanner, and attach the left point to the
29 last lyrics, and the right point to any lyrics we receive by
31 class Extender_engraver : public Engraver
38 TRANSLATOR_DECLARATIONS(Extender_engraver);
41 virtual void acknowledge_grob (Grob_info);
42 virtual void finalize ();
43 virtual bool try_music (Music*);
44 virtual void stop_translation_timestep ();
45 virtual void start_translation_timestep ();
46 virtual void process_music ();
54 Extender_engraver::Extender_engraver ()
63 Extender_engraver::acknowledge_grob (Grob_info i)
66 if (i.grob_->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")))
68 current_lyric_ = i.grob_;
70 && !extender_->get_bound (RIGHT)
73 Lyric_extender::set_textitem (extender_, RIGHT, dynamic_cast<Item*> (i.grob_));
80 Extender_engraver::try_music (Music* r)
90 Extender_engraver::finalize ()
94 req_->origin ()->warning (_ ("unterminated extender"));
95 extender_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
100 Extender_engraver::process_music ()
102 if (req_ && ! extender_)
106 req_->origin ()->warning (_ ("Nothing to connect extender to on the left. Ignoring extender event."));
110 extender_ = new Spanner (get_property ("LyricExtender"));
113 Lyric_extender::set_textitem (extender_, LEFT, last_lyric_);
114 announce_grob(extender_, req_->self_scm());
120 Extender_engraver::stop_translation_timestep ()
124 typeset_grob (extender_);
130 last_lyric_ = current_lyric_;
136 Extender_engraver::start_translation_timestep ()
142 ENTER_DESCRIPTION(Extender_engraver,
143 /* descr */ "Create lyric extenders",
144 /* creats*/ "LyricExtender",
145 /* accepts */ "extender-event",
146 /* acks */ "lyric-syllable-interface",