From fa4a19819030d7ebe7223fbd863ada11a3477c21 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 1 Feb 2004 12:44:56 +0000 Subject: [PATCH] * input/regression/collision-dots-move.ly: New test. * lily/note-collision.cc (check_meshing_chords): Move dots on left hand side note head of non-merged collision to the right. --- ChangeLog | 5 +++++ input/regression/collision-dots-move.ly | 16 ++++++++++++++ lily/note-collision.cc | 29 ++++++++++++++++++------- 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 input/regression/collision-dots-move.ly diff --git a/ChangeLog b/ChangeLog index 89ddc56e6d..878911fda7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2004-02-01 Jan Nieuwenhuizen + * input/regression/collision-dots-move.ly: New test. + + * lily/note-collision.cc (check_meshing_chords): Move dots on left + hand side note head of non-merged collision to the right. + * lily/new-lyric-combine-music-iterator.cc (start_new_syllable): Construct children before accessing property from emtpy lyrics_context_. diff --git a/input/regression/collision-dots-move.ly b/input/regression/collision-dots-move.ly new file mode 100644 index 0000000000..31ca437497 --- /dev/null +++ b/input/regression/collision-dots-move.ly @@ -0,0 +1,16 @@ +\header { + + texidoc = "If collision resolution finds dotted note head must + remain on left hand side, move dots to the right." + +} + +\paper { raggedright = ##t } + +\score { + \notes \relative c { + \key d \minor + \clef bass + << 4 \\ { g'8. bes16} >> + } +} diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 01364cb838..a53eae524f 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -15,6 +15,8 @@ #include "axis-group-interface.hh" #include "item.hh" #include "stem.hh" +#include "side-position-interface.hh" +#include "dot-column.hh" MAKE_SCHEME_CALLBACK (Note_collision_interface,force_shift_callback,2); @@ -168,12 +170,10 @@ check_meshing_chords (Grob *me, if (touch) shift_amount *= -1; - /* - for full collisions, the right hand head may obscure dots, so - make sure the dotted heads go to the right. - */ - if ((Rhythmic_head::dot_count (nu) > Rhythmic_head::dot_count (nd) - && full_collide)) + /* For full collisions, the right hand head may obscure dots, so + make sure the dotted heads go to the right. */ + if (Rhythmic_head::dot_count (nu) > Rhythmic_head::dot_count (nd) + && full_collide) shift_amount = 1; if (merge_possible) @@ -218,6 +218,18 @@ check_meshing_chords (Grob *me, else shift_amount *= 0.25; + /* For full or close half collisions, the right hand head may + obscure dots. Move dots to the right. */ + if (abs (shift_amount) > 1e-6 + && Rhythmic_head::dot_count (nd) > Rhythmic_head::dot_count (nu) + && (full_collide || close_half_collide)) + { + Grob *d = unsmob_grob (nd->get_grob_property ("dot")); + Grob *parent = d->get_parent (X_AXIS); + if (Dot_column::has_interface (parent)) + Side_position_interface::add_support (parent, nu); + } + Direction d = UP; do { @@ -387,8 +399,9 @@ Note_collision_interface::automatic_shift (Grob *me, do { for (int i=0; i < clash_groups[d].size (); i++) - tups = gh_cons (gh_cons (clash_groups[d][i]->self_scm (), gh_double2scm (offsets[d][i])), - tups); + tups = gh_cons (gh_cons (clash_groups[d][i]->self_scm (), + gh_double2scm (offsets[d][i])), + tups); } while (flip (&d) != UP); return tups; -- 2.39.5