/*
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
#include "staff-symbol-referencer.hh"
#include "stem.hh"
#include "grob.hh"
+#include "unpure-pure-container.hh"
#include "warn.hh"
MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, 1, "");
if (rest)
{
chain_offset_callback (rest,
- Rest_collision::force_shift_callback_rest_proc, Y_AXIS);
+ ly_make_unpure_pure_container
+ (Rest_collision::force_shift_callback_rest_proc,
+ ly_lily_module_constant ("pure-chain-offset-callback")),
+ Y_AXIS);
}
}
for (LEFT_and_RIGHT (d))
vector_sort (ordered_rests[d], rest_shift_less);
-
for (LEFT_and_RIGHT (d))
{
if (ordered_rests[d].size () < 1)
Real y = dir * max (0.0,
-dir * restdim[-dir] + dir * notedim[dir] + minimum_dist);
- int stafflines = Staff_symbol_referencer::line_count (me);
- if (!stafflines)
- {
- programming_error ("no staff line count");
- stafflines = 5;
- }
-
// move discretely by half spaces.
int discrete_y = dir * int (ceil (y / (0.5 * dir * staff_space)));
+ Interval staff_span = Staff_symbol_referencer::staff_span (rest);
+ staff_span.widen (1);
// move by whole spaces inside the staff.
- if (fabs (Staff_symbol_referencer::get_position (rest)
- + discrete_y) < stafflines + 1)
+ if (staff_span.contains
+ (Staff_symbol_referencer::get_position (rest) + discrete_y))
{
discrete_y = dir * int (ceil (dir * discrete_y / 2.0) * 2.0);
}