source file of the GNU LilyPond music typesetter
- (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
#include "note-collision.hh"
-#include <math.h>
#include "warn.hh"
#include "note-column.hh"
#include "dot-column.hh"
#include "pointer-group-interface.hh"
-MAKE_SCHEME_CALLBACK (Note_collision_interface, force_shift_callback, 2);
-SCM
-Note_collision_interface::force_shift_callback (SCM element_smob, SCM axis)
-{
- Grob *me = unsmob_grob (element_smob);
- Axis a = (Axis) scm_to_int (axis);
- assert (a == X_AXIS);
-
- me = me->get_parent (a);
-
- if (! to_boolean (me->get_property ("positioning-done")))
- {
- me->set_property ("positioning-done", SCM_BOOL_T);
- do_shifts (me);
- }
-
- return scm_make_real (0.0);
-}
void
check_meshing_chords (Grob *me,
/* Do not merge notes typeset in different style. */
if (!ly_is_equal (nu->get_property ("style"),
- nd->get_property ("style")))
+ nd->get_property ("style")))
merge_possible = false;
int upball_type = Note_head::get_balltype (nu);
&& !to_boolean (me->get_property ("merge-differently-headed")))
merge_possible = false;
+ merge_possible = merge_possible &&
+ !(nu->get_property ("style") == ly_symbol2scm ("fa")
+ && nd->get_property ("style") == ly_symbol2scm ("fa"));
+
+
/* Should never merge quarter and half notes, as this would make
them indistinguishable. */
if (merge_possible
wipe_ball = nu;
}
else
- {
- dot_wipe_head = nu;
- }
+ dot_wipe_head = nu;
}
else if (dnball_type > upball_type)
{
if (wipe_ball && wipe_ball->is_live ())
{
wipe_ball->set_property ("transparent", SCM_BOOL_T);
- wipe_ball->set_property ("stencil", SCM_EOL);
}
}
/* TODO: these numbers are magic; should devise a set of grob props
while ((flip (&d)) != UP);
}
-void
-Note_collision_interface::do_shifts (Grob *me)
+
+MAKE_SCHEME_CALLBACK(Note_collision_interface, calc_positioning_done, 1)
+SCM
+Note_collision_interface::calc_positioning_done (SCM smob)
{
+ Grob *me = unsmob_grob (smob);
Drul_array<Link_array<Grob> > cg = get_clash_groups (me);
+ Direction d = UP;
+ do
+ {
+ for (int i = cg[d].size(); i--; )
+ {
+ /*
+ Trigger positioning
+ */
+ cg[d][i]->extent (me, X_AXIS);
+ }
+ }
+ while (flip (&d) != UP);
+
SCM autos (automatic_shift (me, cg));
SCM hand (forced_shift (me));
- Direction d = UP;
Real wid = 0.0;
do
{
}
for (int i = 0; i < amounts.size (); i++)
- {
- done[i]->translate_axis (amounts[i] - left_most, X_AXIS);
- }
+ done[i]->translate_axis (amounts[i] - left_most, X_AXIS);
+
+ return SCM_BOOL_T;
}
Drul_array < Link_array<Grob> >
{
for (int i = 0; i < clash_groups[d].size (); i++)
tups = scm_cons (scm_cons (clash_groups[d][i]->self_scm (),
- scm_make_real (offsets[d][i])),
+ scm_from_double (offsets[d][i])),
tups);
}
while (flip (&d) != UP);
SCM tups = SCM_EOL;
extract_grob_set (me, "elements", elements);
- for (int i = 0; i < elements.size (); i++)
+ for (int i = 0; i < elements.size (); i++)
{
Grob *se = elements[i];
void
Note_collision_interface::add_column (Grob *me, Grob *ncol)
{
- ncol->add_offset_callback (Note_collision_interface::force_shift_callback_proc, X_AXIS);
+ ncol->set_property ("X-offset", Grob::x_parent_positioning_proc);
Axis_group_interface::add_element (me, ncol);
- me->add_dependency (ncol);
}
ADD_INTERFACE (Note_collision_interface, "note-collision-interface",
"are to be set in @ref{note-column-interface}: these are "
"@code{force-hshift} and @code{horizontal-shift}.",
- "merge-differently-dotted merge-differently-headed positioning-done");
+ /* properties */
+ "merge-differently-dotted "
+ "merge-differently-headed "
+ "positioning-done");