SCM lst = index_get_cell (pair, d);
- int len = scm_ilength (lst);
+ int len = scm_ilength (lst); // -1 for dotted lists!
return max (len, 0);
}
// todo: margins
Direction d = get_grob_direction (me);
- Grob *beam = Grob::unsmob (me->get_object ("beam"));
+ Grob *beam = unsmob<Grob> (me->get_object ("beam"));
if (d && d * head_positions (me)[get_grob_direction (me)] >= se * d)
me->warning (_ ("weird stem size, check for narrow beams"));
{
n->set_object ("stem", me->self_scm ());
- if (Note_head::has_interface (n))
+ if (has_interface<Note_head> (n))
Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-heads"), n);
- else if (Rest::has_interface (n))
+ else if (has_interface<Rest> (n))
Pointer_group_interface::add_grob (me, ly_symbol2scm ("rests"), n);
}
SCM /* start */,
SCM /* end */)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
return ly_interval2scm (internal_pure_height (me, true));
}
if (!is_normal_stem (me))
return Interval (0.0, 0.0);
- Grob *beam = Grob::unsmob (me->get_object ("beam"));
+ Grob *beam = unsmob<Grob> (me->get_object ("beam"));
Interval iv = internal_height (me, false);
SCM
Stem::calc_stem_end_position (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
return scm_from_double (internal_calc_stem_end_position (me, true));
}
SCM, /* start */
SCM /* end */)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
return scm_from_double (internal_calc_stem_end_position (me, false));
}
length *= robust_scm2double (me->get_property ("length-fraction"), 1.0);
/* Tremolo stuff. */
- Grob *t_flag = Grob::unsmob (me->get_object ("tremolo-flag"));
- if (t_flag && (!Grob::is_smob (me->get_object ("beam")) || !calc_beam))
+ Grob *t_flag = unsmob<Grob> (me->get_object ("tremolo-flag"));
+ if (t_flag && (!unsmob<Grob> (me->get_object ("beam")) || !calc_beam))
{
/* Crude hack: add extra space if tremolo flag is there.
SCM
Stem::calc_positioning_done (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
if (!head_count (me))
return SCM_BOOL_T;
}
bool parity = true;
Real lastpos = Real (Staff_symbol_referencer::get_position (heads[0]));
+ int threshold = robust_scm2int (me->get_property ("note-collision-threshold"), 1);
for (vsize i = 1; i < heads.size (); i++)
{
Real p = Staff_symbol_referencer::get_position (heads[i]);
dy should always be 0.5, 0.0, 1.0, but provide safety margin
for rounding errors.
*/
- if (dy < 1.1)
+ if (dy < 0.1 + threshold)
{
if (parity)
{
SCM
Stem::calc_direction (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
Direction dir = CENTER;
- if (Grob *beam = Grob::unsmob (me->get_object ("beam")))
+ if (Grob *beam = unsmob<Grob> (me->get_object ("beam")))
{
SCM ignore_me = beam->get_property ("direction");
(void) ignore_me;
SCM
Stem::calc_default_direction (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
Direction dir = CENTER;
int staff_center = 0;
SCM
Stem::height (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
return ly_interval2scm (internal_height (me, true));
}
Real
Stem::beam_end_corrective (Grob *me)
{
- Grob *beam = Grob::unsmob (me->get_object ("beam"));
+ Grob *beam = unsmob<Grob> (me->get_object ("beam"));
Direction dir = get_grob_direction (me);
if (beam)
{
If there is a beam but no stem, slope calculations depend on this
routine to return where the stem end /would/ be.
*/
- if (calc_beam && !beam && !Stencil::is_smob (me->get_property ("stencil")))
+ if (calc_beam && !beam && !unsmob<Stencil> (me->get_property ("stencil")))
return Interval ();
Real y1 = robust_scm2double ((calc_beam
SCM
Stem::width (SCM e)
{
- Grob *me = Grob::unsmob (e);
+ Grob *me = unsmob<Grob> (e);
Interval r;
SCM
Stem::calc_stem_begin_position (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
return scm_from_double (internal_calc_stem_begin_position (me, true));
}
SCM, /* start */
SCM /* end */)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
return scm_from_double (internal_calc_stem_begin_position (me, false));
}
SCM
Stem::pure_calc_length (SCM smob, SCM /*start*/, SCM /*end*/)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
Real beg = robust_scm2double (me->get_pure_property ("stem-begin-position", 0, INT_MAX), 0.0);
Real res = fabs (internal_calc_stem_end_position (me, false) - beg);
return scm_from_double (res);
SCM
Stem::calc_length (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
- if (Grob::is_smob (me->get_object ("beam")))
+ Grob *me = unsmob<Grob> (smob);
+ if (unsmob<Grob> (me->get_object ("beam")))
{
me->programming_error ("ly:stem::calc-length called but will not be used for beamed stem.");
return scm_from_double (0.0);
if (!me)
return false;
Grob *lh = get_reference_head (me);
- Grob *beam = Grob::unsmob (me->get_object ("beam"));
+ Grob *beam = unsmob<Grob> (me->get_object ("beam"));
if (!lh && !beam)
return false;
SCM
Stem::print (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
if (!is_valid_stem (me))
return SCM_EOL;
SCM
Stem::offset_callback (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
extract_grob_set (me, "rests", rests);
if (rests.size ())
{
Grob *rest = rests.back ();
- Real r = rest->extent (rest, X_AXIS).center ();
+ Real r = robust_relative_extent (rest, rest, X_AXIS).center ();
return scm_from_double (r);
}
Stem::get_beam (Grob *me)
{
SCM b = me->get_object ("beam");
- return Spanner::unsmob (b);
+ return unsmob<Spanner> (b);
}
Stem_info
SCM
Stem::calc_stem_info (SCM smob)
{
- Grob *me = Grob::unsmob (smob);
+ Grob *me = unsmob<Grob> (smob);
Direction my_dir = get_grob_direction (me);
if (!my_dir)
: 0.0);
Real height_of_my_trem = 0.0;
- Grob *trem = Grob::unsmob (me->get_object ("tremolo-flag"));
+ Grob *trem = unsmob<Grob> (me->get_object ("tremolo-flag"));
if (trem)
{
height_of_my_trem
bool
Stem::is_cross_staff (Grob *stem)
{
- Grob *beam = Grob::unsmob (stem->get_object ("beam"));
+ Grob *beam = unsmob<Grob> (stem->get_object ("beam"));
return beam && Beam::is_cross_staff (beam);
}
SCM
Stem::calc_cross_staff (SCM smob)
{
- return scm_from_bool (is_cross_staff (Grob::unsmob (smob)));
+ return scm_from_bool (is_cross_staff (unsmob<Grob> (smob)));
}
Grob *
Stem::flag (Grob *me)
{
- return Grob::unsmob (me->get_object ("flag"));
+ return unsmob<Grob> (me->get_object ("flag"));
}
/* FIXME: Too many properties */
"neutral-direction "
"no-stem-extend "
"note-heads "
+ "note-collision-threshold "
"positioning-done "
"rests "
"stem-begin-position "