]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/hyphen-engraver.cc
Clarifies that multi-measure rests can be used for a single bar.
[lilypond.git] / lily / hyphen-engraver.cc
index 2f314f00062b7eef4c0babaee031346903c37765..4a8109a4af9e677ece896fefac735431ed0f0fc5 100644 (file)
@@ -8,10 +8,12 @@
   Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
+#include "engraver.hh"
+
 #include "warn.hh"
 #include "item.hh"
-#include "engraver.hh"
 #include "spanner.hh"
+#include "pointer-group-interface.hh"
 
 class Hyphen_engraver : public Engraver
 {
@@ -22,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:
 };
 
@@ -38,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
@@ -67,12 +65,10 @@ completize_hyphen (Spanner *sp)
 {
   if (!sp->get_bound (RIGHT))
     {
-      SCM heads = sp->get_property ("heads");
-      if (scm_is_pair (heads))
+      extract_item_set (sp, "heads", heads);
+      if (heads.size ())
        {
-         Item *it = dynamic_cast<Item *> (unsmob_grob (scm_car (heads)));
-         if (it)
-           sp->set_bound (RIGHT, it);
+         sp->set_bound (RIGHT, heads.top ());
        }
     }
 }
@@ -136,10 +132,12 @@ 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 */ "",
                /* write */ "");