]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tie-engraver.cc
release commit
[lilypond.git] / lily / tie-engraver.cc
index 7806f311f7df25beb3b2719ab538862c04742c1c..f44e8b3b0d80a03d55bd7e37fbd29792c921e6db 100644 (file)
@@ -17,6 +17,7 @@
 #include "grob-pitch-tuple.hh"
 #include "warn.hh"
 #include "note-head.hh"
+#include "staff-symbol-referencer.hh"
 
 /**
    Manufacture ties.  Acknowledge noteheads, and put them into a
@@ -49,6 +50,7 @@ class Tie_engraver : public Engraver
   
 protected:
   virtual void stop_translation_timestep ();
+  virtual void start_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music*);
   virtual void process_acknowledged_grobs ();
@@ -75,15 +77,6 @@ Tie_engraver::try_music (Music *mus)
       event_ = mus;
     }
   
-  if (event_)
-    {
-      SCM m = get_property ("automaticMelismata");
-      bool am = gh_boolean_p (m) &&gh_scm2bool (m);
-      if (am)
-       {
-  daddy_trans_->set_property ("tieMelismaBusy", m ? SCM_BOOL_T : SCM_BOOL_F);
-       }
-    }
   return true;
 }
 
@@ -97,9 +90,15 @@ Tie_engraver::acknowledge_grob (Grob_info i)
       for  (int i = heads_to_tie_.size (); i--;)
        {
          Grob *th =  heads_to_tie_[i];
-         int staff_pos = gh_scm2int (h->get_grob_property ("staff-position"));
-         int left_staff_pos = gh_scm2int (th->get_grob_property ("staff-position"));
-         if (staff_pos == left_staff_pos)
+         Music * right_mus = unsmob_music (h->get_grob_property ("cause"));
+         Music * left_mus = unsmob_music (th->get_grob_property ("cause"));
+
+         /*
+           maybe should check positions too.
+          */
+         if (right_mus && left_mus
+             && gh_equal_p (right_mus->get_mus_property ("pitch"),
+                            left_mus->get_mus_property ("pitch")))
            {
              Grob * p = new Spanner (get_property ("Tie"));
              Tie::set_interface (p); // cannot remove yet!
@@ -128,6 +127,14 @@ Tie_engraver::process_acknowledged_grobs ()
     }
 }
 
+void
+Tie_engraver::start_translation_timestep ()
+{
+  if (to_boolean (get_property ("automaticMelismata")))
+      daddy_trans_->set_property ("tieMelismaBusy",
+                                 gh_bool2scm (heads_to_tie_.size ()));
+      
+}
 
 void
 Tie_engraver::stop_translation_timestep ()