]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/hyphen-engraver.cc
Run `make grand-replace'.
[lilypond.git] / lily / hyphen-engraver.cc
index 27572d852fc5fb0ec82899d2519579bb1b2196e4..b4dbcefc8cdcbd557b3994438bd729cd1f0919d3 100644 (file)
@@ -3,22 +3,25 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1999--2006 Glen Prideaux <glenprideaux@iname.com>,
+  (c) 1999--2008 Glen Prideaux <glenprideaux@iname.com>,
   Han-Wen Nienhuys <hanwen@xs4all.nl>,
   Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "engraver.hh"
-
-#include "warn.hh"
+#include "international.hh"
 #include "item.hh"
-#include "spanner.hh"
 #include "pointer-group-interface.hh"
+#include "spanner.hh"
+#include "stream-event.hh"
+#include "warn.hh"
+
+#include "translator.icc"
 
 class Hyphen_engraver : public Engraver
 {
-  Music *ev_;
-  Music *finished_ev_;
+  Stream_event *ev_;
+  Stream_event *finished_ev_;
 
   Spanner *hyphen_;
   Spanner *finished_hyphen_;
@@ -29,9 +32,9 @@ public:
 protected:
 
   DECLARE_ACKNOWLEDGER (lyric_syllable);
+  DECLARE_TRANSLATOR_LISTENER (hyphen);
 
   virtual void finalize ();
-  virtual bool try_music (Music *);
 
   void stop_translation_timestep ();
   void process_music ();
@@ -60,14 +63,11 @@ Hyphen_engraver::acknowledge_lyric_syllable (Grob_info i)
     finished_hyphen_->set_bound (RIGHT, item);
 }
 
-bool
-Hyphen_engraver::try_music (Music *r)
+IMPLEMENT_TRANSLATOR_LISTENER (Hyphen_engraver, hyphen);
+void
+Hyphen_engraver::listen_hyphen (Stream_event *ev)
 {
-  if (ev_)
-    return false;
-
-  ev_ = r;
-  return true;
+  ASSIGN_EVENT_ONCE (ev_, ev);
 }
 
 void
@@ -77,7 +77,7 @@ completize_hyphen (Spanner *sp)
     {
       extract_item_set (sp, "heads", heads);
       if (heads.size ())
-       sp->set_bound (RIGHT, heads.top ());
+       sp->set_bound (RIGHT, heads.back ());
     }
 }
 
@@ -144,14 +144,19 @@ Hyphen_engraver::stop_translation_timestep ()
   ev_ = 0;
 }
 
-#include "translator.icc"
-
 ADD_ACKNOWLEDGER (Hyphen_engraver, lyric_syllable);
 
 ADD_TRANSLATOR (Hyphen_engraver,
-               /* doc */ "Create lyric hyphens and "
-               "distance constraints between words.",
-               /* create */ "LyricHyphen LyricSpace",
-               /* accept */ "hyphen-event",
-               /* read */ "",
-               /* write */ "");
+               /* doc */
+               "Create lyric hyphens and distance constraints between words.",
+
+               /* create */
+               "LyricHyphen "
+               "LyricSpace ",
+
+               /* read */
+               "",
+
+               /* write */
+               ""
+               );