]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/hyphen-engraver.cc
* python/rational.py: PD rational number class.
[lilypond.git] / lily / hyphen-engraver.cc
index 29857100fa5d3e701a5f85123f5175bd3e8c6132..0f54038353711516dba07a74393f3aad481ef370 100644 (file)
@@ -4,7 +4,7 @@
   source file of the GNU LilyPond music typesetter
 
   (c) 1999--2005 Glen Prideaux <glenprideaux@iname.com>,
-  Han-Wen Nienhuys <hanwen@cs.uu.nl>,
+  Han-Wen Nienhuys <hanwen@xs4all.nl>,
   Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
@@ -24,11 +24,11 @@ public:
   TRANSLATOR_DECLARATIONS (Hyphen_engraver);
 
 protected:
-  virtual void acknowledge_grob (Grob_info);
+  DECLARE_ACKNOWLEDGER (lyric_syllable);
   virtual void finalize ();
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  void stop_translation_timestep ();
+  void process_music ();
 private:
 };
 
@@ -40,18 +40,14 @@ Hyphen_engraver::Hyphen_engraver ()
 }
 
 void
-Hyphen_engraver::acknowledge_grob (Grob_info i)
+Hyphen_engraver::acknowledge_lyric_syllable (Grob_info i)
 {
-  Item *item = dynamic_cast<Item *> (i.grob ());
-  // -> Text_item
-  if (item && item->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")))
-    {
-      if (hyphen_)
-       hyphen_->set_bound (LEFT, item);
+  Item *item = i.item ();
+  if (hyphen_)
+    hyphen_->set_bound (LEFT, item);
 
-      if (finished_hyphen_)
-       finished_hyphen_->set_bound (RIGHT, item);
-    }
+  if (finished_hyphen_)
+    finished_hyphen_->set_bound (RIGHT, item);
 }
 
 bool
@@ -71,9 +67,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.top ());
     }
 }
 
@@ -110,18 +104,14 @@ void
 Hyphen_engraver::process_music ()
 {
   if (ev_)
-    {
-      hyphen_ = make_spanner ("LyricHyphen", ev_->self_scm ());
-    }
+    hyphen_ = make_spanner ("LyricHyphen", ev_->self_scm ());
 }
 
 void
 Hyphen_engraver::stop_translation_timestep ()
 {
   if (finished_hyphen_ && finished_hyphen_->get_bound (RIGHT))
-    {
-      finished_hyphen_ = 0;
-    }
+    finished_hyphen_ = 0;
 
   if (finished_hyphen_ && hyphen_)
     {
@@ -136,10 +126,13 @@ Hyphen_engraver::stop_translation_timestep ()
   ev_ = 0;
 }
 
+#include "translator.icc"
+
+ADD_ACKNOWLEDGER (Hyphen_engraver, lyric_syllable);
+
 ADD_TRANSLATOR (Hyphen_engraver,
-               /* descr */ "Create lyric hyphens",
-               /* creats*/ "LyricHyphen",
-               /* accepts */ "hyphen-event",
-               /* acks  */ "lyric-syllable-interface",
-               /* reads */ "",
+               /* doc */ "Create lyric hyphens",
+               /* create */ "LyricHyphen",
+               /* accept */ "hyphen-event",
+               /* read */ "",
                /* write */ "");