void
check_meshing_chords (Grob *me,
- Drul_array<std::vector<Real> > *offsets,
- Drul_array<std::vector<Slice> > const &extents,
- Drul_array<Link_array<Grob> > const &clash_groups)
+ Drul_array<vector<Real> > *offsets,
+ Drul_array<vector<Slice> > const &extents,
+ Drul_array<vector<Grob*> > const &clash_groups)
{
if (!extents[UP].size () || ! extents[DOWN].size ())
Grob *nu = Note_column::first_head (cu);
Grob *nd = Note_column::first_head (cd);
- std::vector<int> ups = Stem::note_head_positions (Note_column::get_stem (cu));
- std::vector<int> dps = Stem::note_head_positions (Note_column::get_stem (cd));
+ vector<int> ups = Stem::note_head_positions (Note_column::get_stem (cu));
+ vector<int> dps = Stem::note_head_positions (Note_column::get_stem (cd));
/* Too far apart to collide. */
if (ups[0] > dps.back () + 1)
return;
- // FIXME: what's this?
+ /* Merge heads if the notes lie the same line, or if the "stem-up-note" is
+ above the "stem-down-note". */
bool merge_possible = (ups[0] >= dps[0]) && (ups.back () >= dps.back ());
/* Do not merge notes typeset in different style. */
Note_collision_interface::calc_positioning_done (SCM smob)
{
Grob *me = unsmob_grob (smob);
- Drul_array<Link_array<Grob> > cg = get_clash_groups (me);
+ Drul_array<vector<Grob*> > cg = get_clash_groups (me);
Direction d = UP;
do
}
while (flip (&d) != UP);
- Link_array<Grob> done;
+ vector<Grob*> done;
Real left_most = 1e6;
- std::vector<Real> amounts;
+ vector<Real> amounts;
for (; scm_is_pair (hand); hand = scm_cdr (hand))
{
Grob *s = unsmob_grob (scm_caar (hand));
Grob *s = unsmob_grob (scm_caar (autos));
Real amount = scm_to_double (scm_cdar (autos)) * wid;
- if (!done.find (s))
+ vsize x = find (done, s) - done.begin ();
+ if (x == VPOS || x >= done.size ())
{
done.push_back (s);
amounts.push_back (amount);
return SCM_BOOL_T;
}
-Drul_array < Link_array<Grob> >
+Drul_array < vector<Grob*> >
Note_collision_interface::get_clash_groups (Grob *me)
{
- Drul_array<Link_array<Grob> > clash_groups;
+ Drul_array<vector<Grob*> > clash_groups;
extract_grob_set (me, "elements", elements);
for (vsize i = 0; i < elements.size (); i++)
{
Grob *se = elements[i];
if (Note_column::has_interface (se))
- clash_groups[Note_column::dir (se)].push_back (se);
+ {
+ if (!Note_column::dir (se))
+ {
+ se->programming_error ("note-column has no direction");
+ }
+ else
+ clash_groups[Note_column::dir (se)].push_back (se);
+ }
}
Direction d = UP;
do
{
- Link_array<Grob> &clashes (clash_groups[d]);
- clashes.sort (Note_column::shift_compare);
+ vector<Grob*> &clashes (clash_groups[d]);
+ vector_sort (clashes, Note_column::shift_compare);
}
while ((flip (&d)) != UP);
*/
SCM
Note_collision_interface::automatic_shift (Grob *me,
- Drul_array < Link_array<Grob>
+ Drul_array < vector<Grob*>
> clash_groups)
{
- Drul_array < std::vector<int> > shifts;
+ Drul_array < vector<int> > shifts;
SCM tups = SCM_EOL;
Direction d = UP;
do
{
- std::vector<int> &shift (shifts[d]);
- Link_array<Grob> &clashes (clash_groups[d]);
+ vector<int> &shift (shifts[d]);
+ vector<Grob*> &clashes (clash_groups[d]);
for (vsize i = 0; i < clashes.size (); i++)
{
}
while ((flip (&d)) != UP);
- Drul_array<std::vector<Slice> > extents;
- Drul_array<std::vector<Real> > offsets;
+ Drul_array<vector<Slice> > extents;
+ Drul_array<vector<Real> > offsets;
d = UP;
do
{