#include "staff-symbol-referencer.hh"
#include "staff-symbol.hh"
-#include "paper-def.hh"
+#include "output-def.hh"
#include "libc-extension.hh"
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);
}
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 (is_number (pos))
+ if (ly_c_number_p (pos))
{
Real space = Staff_symbol_referencer::staff_space (me);
off = ly_scm2double (pos) * space / 2.0;
/* This sets the position relative to the center of the staff symbol.
-The function is hairy, because it can be callled in two situations:
+The function is hairy, because it can be called in two situations:
1. There is no staff yet; we must set staff-position
else
me->set_property ("staff-position", scm_make_real (p));
- if (!me->has_offset_callback (Staff_symbol_referencer::callback_proc,
- Y_AXIS))
- me->add_offset_callback (Staff_symbol_referencer::callback_proc, Y_AXIS);
+ me->add_offset_callback (Staff_symbol_referencer::callback_proc, Y_AXIS);
}
/* Half of the height, in staff space, i.e. 2.0 for a normal staff. */