]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tie-engraver.cc
Nitpick run.
[lilypond.git] / lily / tie-engraver.cc
index cf5364015cb9daadad230e4086fd462d29683db0..33608058a6160403780f101f976e2aab31f33429 100644 (file)
@@ -53,12 +53,12 @@ class Tie_engraver : public Engraver
   Spanner *tie_column_;
 
 protected:
-  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  void stop_translation_timestep ();
   virtual void derived_mark () const;
-  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
-  virtual void acknowledge_grob (Grob_info);
+  void start_translation_timestep ();
+  DECLARE_ACKNOWLEDGER (note_head);
   virtual bool try_music (Music *);
-  PRECOMPUTED_VIRTUAL void process_music ();
+  void process_music ();
   void typeset_tie (Grob *);
 public:
   TRANSLATOR_DECLARATIONS (Tie_engraver);
@@ -82,9 +82,7 @@ bool
 Tie_engraver::try_music (Music *mus)
 {
   if (mus->is_mus_type ("tie-event"))
-    {
-      event_ = mus;
-    }
+    event_ = mus;
 
   return true;
 }
@@ -93,53 +91,46 @@ void
 Tie_engraver::process_music ()
 {
   if (event_)
-    {
-      context ()->set_property ("tieMelismaBusy", SCM_BOOL_T);
-    }
+    context ()->set_property ("tieMelismaBusy", SCM_BOOL_T);
 }
 
 void
-Tie_engraver::acknowledge_grob (Grob_info i)
+Tie_engraver::acknowledge_note_head (Grob_info i)
 {
-  if (Note_head::has_interface (i.grob ()))
+  Grob *h = i.grob ();
+  now_heads_.push (h);
+  for (int i = heads_to_tie_.size (); i--;)
     {
-      Grob *h = i.grob ();
-      now_heads_.push (h);
-      for (int i = heads_to_tie_.size (); i--;)
+      Grob *th = heads_to_tie_[i].head_;
+      Music *right_mus = unsmob_music (h->get_property ("cause"));
+      Music *left_mus = unsmob_music (th->get_property ("cause"));
+
+      /*
+       maybe should check positions too.
+      */
+      if (right_mus && left_mus
+         && ly_is_equal (right_mus->get_property ("pitch"),
+                         left_mus->get_property ("pitch")))
        {
-         Grob *th = heads_to_tie_[i].head_;
-         Music *right_mus = unsmob_music (h->get_property ("cause"));
-         Music *left_mus = unsmob_music (th->get_property ("cause"));
-
-         /*
-           maybe should check positions too.
-         */
-         if (right_mus && left_mus
-             && ly_is_equal (right_mus->get_property ("pitch"),
-                              left_mus->get_property ("pitch")))
-           {
-             Grob *p = new Spanner (heads_to_tie_[i].tie_definition_,
-                                    context ()->get_grob_key ("Tie"));
-             announce_grob (p, heads_to_tie_[i].event_->self_scm ());
-             Tie::set_interface (p); // cannot remove yet!
-
-             Tie::set_head (p, LEFT, th);
-             Tie::set_head (p, RIGHT, h);
-
-             ties_.push (p);
-             heads_to_tie_.del (i);
-           }
-       }
+         Grob *p = new Spanner (heads_to_tie_[i].tie_definition_,
+                                context ()->get_grob_key ("Tie"));
+         announce_grob (p, heads_to_tie_[i].event_->self_scm ());
+         Tie::set_interface (p); // cannot remove yet!
 
-      if (ties_.size () && ! tie_column_)
-       {
-         tie_column_ = make_spanner ("TieColumn", ties_[0]->self_scm ());
-       }
+         Tie::set_head (p, LEFT, th);
+         Tie::set_head (p, RIGHT, h);
 
-      if (tie_column_)
-       for (int i = ties_.size (); i--;)
-         Tie_column::add_tie (tie_column_, ties_[i]);
+         ties_.push (p);
+         heads_to_tie_.del (i);
+       }
     }
+
+  if (ties_.size () && ! tie_column_)
+    tie_column_ = make_spanner ("TieColumn", ties_[0]->self_scm ());
+
+  if (tie_column_)
+    for (int i = ties_.size (); i--;)
+      Tie_column::add_tie (tie_column_, ties_[i]);
 }
 
 void
@@ -155,14 +146,10 @@ Tie_engraver::stop_translation_timestep ()
   if (ties_.size ())
     {
       if (!to_boolean (get_property ("tieWaitForNote")))
-       {
-         heads_to_tie_.clear ();
-       }
+       heads_to_tie_.clear ();
 
       for (int i = 0; i < ties_.size (); i++)
-       {
-         typeset_tie (ties_[i]);
-       }
+       typeset_tie (ties_[i]);
 
       ties_.clear ();
       tie_column_ = 0;
@@ -209,11 +196,10 @@ Tie_engraver::typeset_tie (Grob *her)
 }
 
 #include "translator.icc"
-
+ADD_ACKNOWLEDGER (Tie_engraver, note_head);
 ADD_TRANSLATOR (Tie_engraver,
-               /* descr */ "Generate ties between noteheads of equal pitch.",
-               /* creats*/ "Tie TieColumn",
-               /* accepts */ "tie-event",
-               /* acks  */ "rhythmic-head-interface",
-               /* reads */ "tieMelismaBusy",
-               /* write */ "");
+               /* doc */ "Generate ties between noteheads of equal pitch.",
+               /* create */ "Tie TieColumn",
+               /* accept */ "tie-event",
+               /* read */ "tieWaitForNote",
+               /* write */ "tieMelismaBusy");