]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/semi-tie-column.cc
Run `make grand-replace'.
[lilypond.git] / lily / semi-tie-column.cc
index 055b377c72107416ea3f7080a8e47232164a62fa..6fe180a8ea1f1295701f20dc1f52c377c8aaf3a1 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 2005--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
 */
 
 #include "staff-symbol-referencer.hh"
 #include "item.hh"
 #include "tie-formatting-problem.hh"
-#include "tie-configuration.hh"
 #include "tie-column-format.hh"
 
 
-ADD_INTERFACE(Semi_tie_column,
-             "semi-tie-column-interface",
-             "The interface for a column of l.v. ties.",
+ADD_INTERFACE (Semi_tie_column,
+             "The interface for a column of l.v. (laissez vibrer) ties.",
 
              /* properties */
              "positioning-done "
@@ -36,12 +34,14 @@ ADD_INTERFACE(Semi_tie_column,
 /*
   Cut & paste from tie-column.cc
  */   
-MAKE_SCHEME_CALLBACK(Semi_tie_column, calc_positioning_done, 1);
+MAKE_SCHEME_CALLBACK (Semi_tie_column, calc_positioning_done, 1);
 SCM
 Semi_tie_column::calc_positioning_done (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  
+
+  me->set_property ("positioning-done", SCM_BOOL_T);
+    
   extract_grob_set (me, "ties", lv_ro_ties);
   vector<Grob*> lv_ties (lv_ro_ties);
 
@@ -57,15 +57,38 @@ Semi_tie_column::calc_positioning_done (SCM smob)
   SCM manual_configs = me->get_property ("tie-configuration");
   problem.set_manual_tie_configuration (manual_configs);
 
-  Ties_configuration base = problem.generate_optimal_chord_configuration ();
-  for (vsize i = 0; i < lv_ties.size(); i++)
+  Ties_configuration base = problem.generate_optimal_configuration ();
+  for (vsize i = 0; i < lv_ties.size (); i++)
     {
-      Tie::set_control_points (lv_ties[i], problem.common_x_refpoint (), base[i],
-                              problem.details_);
+      SCM cp = Tie::get_control_points (lv_ties[i], problem.common_x_refpoint (), base[i],
+                                       problem.details_);
+
+      lv_ties[i]->set_property ("control-points", cp);
       set_grob_direction (lv_ties[i], base[i].dir_);
-    }
 
+      problem.set_debug_scoring (base);
+    }
+  
   return SCM_BOOL_T;
 }
   
+MAKE_SCHEME_CALLBACK (Semi_tie_column, calc_head_direction, 1);
+SCM
+Semi_tie_column::calc_head_direction (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
 
+  extract_grob_set (me, "ties", ties);
+  Direction d = LEFT;
+  for (vsize i = 0; i < ties.size (); i++)
+    {
+      Direction this_d = to_dir (ties[i]->get_property ("head-direction"));
+      if (i > 0 && d != this_d)
+       {
+         programming_error ("all semi-ties in a semi-tie-column should have the same head-direction");
+         return scm_from_int (d);
+       }
+      d = this_d;
+    }
+  return scm_from_int (d);
+}