]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/break-align-item.cc
release: 1.3.26
[lilypond.git] / lily / break-align-item.cc
index 7a5b9f9f0985d42b1d53094a1ac4f56ec3ada210..376a71dd25498005e01b69a1d8b8bd5af06759d8 100644 (file)
@@ -3,9 +3,11 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
+#include <math.h>
 
+#include "warn.hh"
 #include "dimension-cache.hh"
 #include "lily-guile.hh"
 #include "break-align-item.hh"
@@ -84,7 +86,7 @@ Break_align_item::do_pre_processing()
   symbol_list  = gh_cdr (scm_reverse (symbol_list));
   for (int i=0; i <elems.size()-1; i++)
     {
-      String sym_str = ly_scm2string (gh_car  (symbol_list));
+      String sym_str = ly_symbol2string (gh_car  (symbol_list));
       elems[i]->set_elt_property (sym_str,
                                  scm_cons (gh_double2scm (0),
                                            gh_double2scm (dists[i+1])));
@@ -95,10 +97,10 @@ Break_align_item::do_pre_processing()
 
   // urg
   SCM first_pair = elems[0]->get_elt_property ("minimum-space");
-  if (first_pair == SCM_UNDEFINED)
-    first_pair = gh_cons (gh_double2scm (0.0), gh_double2scm (0.0));
-  else
+  if (gh_pair_p (first_pair))
     first_pair = first_pair;
+  else
+    first_pair = gh_cons (gh_double2scm (0.0), gh_double2scm (0.0));
   
   scm_set_car_x (first_pair, gh_double2scm (-dists[0]));
   elems[0]->set_elt_property ("minimum-space", first_pair);
@@ -106,10 +108,20 @@ Break_align_item::do_pre_processing()
   Axis_align_item::do_pre_processing();
 
 
-  Real pre_space = elems[0]->extent (X_AXIS)[LEFT]
-    + elems[0]->relative_coordinate (column_l (), X_AXIS);
-  Real spring_len = elems.top ()->extent (X_AXIS)[RIGHT]
-    + elems.top ()->relative_coordinate (column_l (), X_AXIS);
+  Real pre_space = elems[0]->relative_coordinate (column_l (), X_AXIS);
+
+  Real xl = elems[0]->extent (X_AXIS)[LEFT];
+  if (!isinf (xl))
+    pre_space += xl;
+  else
+    programming_error ("Infinity reached. ");
+
+  Real xr = elems.top ()->extent (X_AXIS)[RIGHT];
+  Real spring_len = elems.top ()->relative_coordinate (column_l (), X_AXIS);
+  if (!isinf (xr))
+    spring_len += xr;
+  else
+    programming_error ("Infinity reached.");
   
   Real stretch_distance =0.;