(c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "staff-symbol-referencer.hh"
+
#include <math.h>
-#include "staff-symbol-referencer.hh"
#include "staff-symbol.hh"
#include "output-def.hh"
#include "libc-extension.hh"
-
int
Staff_symbol_referencer::line_count (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)
{
Grob*
Staff_symbol_referencer::get_staff_symbol (Grob *me)
{
+ if (Staff_symbol::has_interface (me))
+ return me;
+
SCM st = me->get_property ("staff-symbol");
return unsmob_grob (st);
}
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
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);
}
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));
}