]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lyric-extender.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / lyric-extender.cc
index 53090bcafb53d0554d5a078afef83bcc176570a9..281296c506157dc570f3cb93d95fc5d9cb649f2a 100644 (file)
@@ -2,20 +2,19 @@
   lyric-extender.cc -- implement Lyric_extender
   source file of the GNU LilyPond music typesetter
 
-  (c) 1998--2005 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
   Han-Wen Nienhuys
 */
 
 #include "lyric-extender.hh"
 
-#include <math.h>
 
 #include "warn.hh"
 #include "lookup.hh"
 #include "paper-column.hh"
 #include "output-def.hh"
 #include "note-head.hh"
-#include "group-interface.hh"
+#include "pointer-group-interface.hh"
 
 MAKE_SCHEME_CALLBACK (Lyric_extender, print, 1)
   SCM
@@ -23,7 +22,7 @@ Lyric_extender::print (SCM smob)
 {
   Spanner *me = unsmob_spanner (smob);
   Item *left_edge = me->get_bound (LEFT);
-  Item *right_text = unsmob_item (me->get_property ("next"));
+  Item *right_text = unsmob_item (me->get_object ("next"));
 
   Grob *common = left_edge;
 
@@ -31,8 +30,9 @@ Lyric_extender::print (SCM smob)
     common = common->common_refpoint (right_text, X_AXIS);
 
   common = common->common_refpoint (me->get_bound (RIGHT), X_AXIS);
-  Real sl = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
-  Link_array<Grob> heads (extract_grob_array (me, ly_symbol2scm ("heads")));
+  Real sl = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
+
+  extract_grob_set (me, "heads", heads);
 
   if (!heads.size ())
     return SCM_EOL;
@@ -57,17 +57,17 @@ Lyric_extender::print (SCM smob)
     = left_point + (robust_scm2double (minlen, 0));
 
   if (heads.size ())
-    right_point = right_point >? heads.top ()->extent (common, X_AXIS)[RIGHT];
+    right_point = max (right_point, heads.back ()->extent (common, X_AXIS)[RIGHT]);
 
   Real h = sl * robust_scm2double (me->get_property ("thickness"), 0);
   Real pad = 2* h;
 
   if (right_text)
-    right_point = right_point <? (robust_relative_extent (right_text, common, X_AXIS)[LEFT] - pad);
+    right_point = min (right_point, (robust_relative_extent (right_text, common, X_AXIS)[LEFT] - pad));
 
   /* run to end of line. */
   if (me->get_bound (RIGHT)->break_status_dir ())
-    right_point = right_point >? (robust_relative_extent (me->get_bound (RIGHT), common, X_AXIS)[LEFT] - pad);
+    right_point = max (right_point, (robust_relative_extent (me->get_bound (RIGHT), common, X_AXIS)[LEFT] - pad));
 
   left_point += pad;
   Real w = right_point - left_point;