]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-symbol-referencer.cc
* mf/feta-bolletjes.mf (overdone_heads): cleanup triangle
[lilypond.git] / lily / staff-symbol-referencer.cc
index e3070ff53d7373373b5505d095e4afef2b27e6e7..b02e7620f460d91293b1f3e4611be3fcf240eb3c 100644 (file)
@@ -6,14 +6,14 @@
   (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include <math.h>
-
 #include "staff-symbol-referencer.hh"
+
+#include <cmath>
+
 #include "staff-symbol.hh"
 #include "output-def.hh"
 #include "libc-extension.hh"
 
-
 int
 Staff_symbol_referencer::line_count (Grob *me)
 {
@@ -27,6 +27,10 @@ Staff_symbol_referencer::on_staffline (Grob *me)
   return on_staffline (me, (int) rint (get_position (me)));
 }
 
+/*
+  This does not take size into account.
+  maybe rename: on_virtual_staffline, on_staff_or_ledger_line?
+ */
 bool
 Staff_symbol_referencer::on_staffline (Grob *me, int pos)
 {
@@ -59,7 +63,7 @@ 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_dimension (ly_symbol2scm ("linethickness"));
+  return me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
 }
 
 Real
@@ -76,7 +80,10 @@ Staff_symbol_referencer::get_position (Grob *me)
       p += 2.0 * y / Staff_symbol::staff_space (st);
       return p;
     }
-
+  else if (!st)
+    {
+      return me->relative_coordinate (me->get_parent (Y_AXIS), Y_AXIS) * 2;
+    }
   return robust_scm2double (me->get_property ("staff-position"), p);
 }
 
@@ -111,10 +118,10 @@ Staff_symbol_referencer::callback (SCM element_smob, SCM)
 
   SCM pos = me->get_property ("staff-position");
   Real off = 0.0;
-  if (ly_c_number_p (pos))
+  if (scm_is_number (pos))
     {
       Real space = Staff_symbol_referencer::staff_space (me);
-      off = ly_scm2double (pos) * space / 2.0;
+      off = scm_to_double (pos) * space / 2.0;
       me->set_property ("staff-position", scm_int2num (0));
     }