]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-symbol-referencer.cc
2003 -> 2004
[lilypond.git] / lily / staff-symbol-referencer.cc
index e16a7ead078bbb206372b398784356b470ee5490..cfb871d575cb4b8071da5d31f36214643312d5d1 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
  */
 
 #include <math.h>
@@ -51,6 +51,16 @@ Staff_symbol_referencer::staff_space (Grob*me)
   return 1.0;
 }
 
+Real
+Staff_symbol_referencer::line_thickness (Grob*me) 
+{
+  Grob * st = get_staff_symbol (me);
+  if (st)
+    return Staff_symbol::get_line_thickness (st);
+
+  return me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
+}
+
 Real
 Staff_symbol_referencer::get_position (Grob*me) 
 {
@@ -63,15 +73,10 @@ Staff_symbol_referencer::get_position (Grob*me)
        - st->relative_coordinate (c, Y_AXIS);
 
       p += 2.0 * y / Staff_symbol::staff_space (st);
+      return p;
     }
-  else
-    {
-      SCM pos = me->get_grob_property ("staff-position");
-      if (gh_number_p (pos))
-       return gh_scm2double (pos);
-    }
-  
-  return  p;
+
+  return robust_scm2double ( me->get_grob_property ("staff-position"), p);
 }
 
 
@@ -86,10 +91,7 @@ LY_DEFINE(ly_grob_staff_position,
   Real pos = Staff_symbol_referencer::get_position (g);
 
   if (fabs (rint (pos) -pos) < 1e-6) // ugh.
-    /*
-      lrint has issues with various glibcs. 
-     */
-    return gh_int2scm ((int) round (pos));
+    return gh_int2scm ((int) my_round (pos));
   else
     return gh_double2scm (pos);
 }
@@ -104,7 +106,6 @@ Staff_symbol_referencer::callback (SCM element_smob, SCM)
 {
   Grob *me = unsmob_grob (element_smob);
 
-  
   SCM pos = me->get_grob_property ("staff-position");
   Real off =0.0;
   if (gh_number_p (pos))