/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 1997--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
annoying layer between (rest)collision & (note-head + stem)
*/
-Interval
-Note_column::accidental_width (Grob *me)
-{
- extract_grob_set (me, "note-heads", nhs);
- vector<Grob *> accs;
- for (vsize i = 0; i < nhs.size (); i++)
- if (Grob *acc = unsmob_grob (nhs[i]->get_object ("accidental-grob")))
- accs.push_back (acc);
-
- Grob *common = common_refpoint_of_array (accs, me, X_AXIS);
- common = common_refpoint_of_array (nhs, common, X_AXIS);
-
- Interval nhs_ex = Axis_group_interface::relative_group_extent (nhs, common, X_AXIS);
- Interval accs_ex = Axis_group_interface::relative_group_extent (accs, common, X_AXIS);
-
- if (nhs_ex.is_empty ())
- return accs_ex;
-
- // want an empty interval here
- if (accs_ex.is_empty ())
- return Interval ();
-
- return Interval (accs_ex[LEFT], nhs_ex[LEFT]);
-}
-
bool
Note_column::has_rests (Grob *me)
{
- return unsmob_grob (me->get_object ("rest"));
+ return Grob::unsmob (me->get_object ("rest"));
}
bool
Note_column::get_stem (Grob *me)
{
SCM s = me->get_object ("stem");
- return unsmob_item (s);
+ return Item::unsmob (s);
}
Item *
if (stem)
{
SCM s = stem->get_object ("flag");
- return unsmob_item (s);
+ return Item::unsmob (s);
}
return 0;
}
Direction
Note_column::dir (Grob *me)
{
- Grob *stem = unsmob_grob (me->get_object ("stem"));
+ Grob *stem = Grob::unsmob (me->get_object ("stem"));
if (stem && Stem::has_interface (stem))
return get_grob_direction (stem);
else
Grob *
Note_column::get_rest (Grob *me)
{
- return unsmob_grob (me->get_object ("rest"));
+ return Grob::unsmob (me->get_object ("rest"));
}
void
}
else if (Note_head::has_interface (h))
{
- if (unsmob_grob (me->get_object ("rest")))
+ if (Grob::unsmob (me->get_object ("rest")))
both = true;
Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-heads"), h);
}
return st ? Stem::first_head (st) : 0;
}
+/*
+ Return extent of the noteheads in the "main column",
+ i.e. excluding any suspended noteheads.
+*/
+Interval
+Note_column::calc_main_heads_extent (Grob *me)
+{
+ if (get_stem (me))
+ return first_head (me)->extent (me, X_AXIS);
+ else
+ {
+ // no stems => no suspended noteheads.
+ extract_grob_set (me, "note-heads", heads);
+ if (heads.size())
+ return heads[0]->extent (me, X_AXIS);
+ else
+ return Interval (0, 0);
+ }
+}
+
/*
Return the first AccidentalPlacement grob that we find in a note-head.
*/
for (vsize i = 0; i < heads.size (); i++)
{
Grob *h = heads[i];
- acc = h ? unsmob_grob (h->get_object ("accidental-grob")) : 0;
+ acc = h ? Grob::unsmob (h->get_object ("accidental-grob")) : 0;
if (acc)
break;
}
extract_grob_set (me, "note-heads", heads);
for (vsize i = 0; i < heads.size (); i++)
{
- Grob *dots = unsmob_grob (heads[i]->get_object ("dot"));
+ Grob *dots = Grob::unsmob (heads[i]->get_object ("dot"));
if (dots)
return dots->get_parent (X_AXIS);
}
return 0;
}
-Grob *
-Note_column::arpeggio (Grob *me)
-{
- return unsmob_grob (me->get_object ("arpeggio"));
-}
-
/* If a note-column contains a cross-staff stem then
nc->extent (Y_AXIS, refp) will not consider the extent of the stem.
If you want the extent of the stem to be included (and you are safe
"Stem and noteheads combined.",
/* properties */
- "arpeggio "
"force-hshift "
"horizontal-shift "
"ignore-collision "