X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fnote-collision.cc;h=aad09a95a99ee64069f3fdca24441b06b096d709;hb=61275ff8fa4fa01422b4dd6dfc0f6372c7d9cd5e;hp=b6185e4458deced9394837376ee02d515cfbea57;hpb=30339cb3706f6399c84607426988b25f79b4998c;p=lilypond.git diff --git a/lily/note-collision.cc b/lily/note-collision.cc index b6185e4458..aad09a95a9 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -178,7 +178,7 @@ check_meshing_chords (Grob *me, full_collide = full_collide || (close_half_collide && distant_half_collide) || ( distant_half_collide // like full_ for wholes and longer - && (up_ball_type <= 0 || down_ball_type <= 0)); + && (up_ball_type <= 0 || down_ball_type <= 0)); /* Determine which chord goes on the left, and which goes right. Up-stem usually goes on the right, but if chords just 'touch' we can put @@ -231,7 +231,8 @@ check_meshing_chords (Grob *me, /* If possible, don't wipe any heads. Else, wipe shortest head, or head with smallest amount of dots. Note: when merging - different heads, dots on the smaller one disappear. */ + different heads, dots on the smaller one disappear; and when + merging identical heads, dots on the down-stem head disappear */ Grob *wipe_ball = 0; Grob *dot_wipe_head = head_up; @@ -248,7 +249,7 @@ check_meshing_chords (Grob *me, wipe_ball = head_up; } else - dot_wipe_head = head_up; + dot_wipe_head = head_down; } else if (down_ball_type > up_ball_type) { @@ -353,8 +354,8 @@ check_meshing_chords (Grob *me, Grob *stem = unsmob_grob (head_down->get_object ("stem")); extract_grob_set (stem, "note-heads", heads); for (vsize i = 0; i < heads.size (); i++) - unsmob_grob (heads[i]->get_object ("dot")) - ->set_property ("direction", scm_from_int (dir)); + if (Grob *dot = unsmob_grob (heads[i]->get_object ("dot"))) + dot->set_property ("direction", scm_from_int (dir)); } } @@ -593,6 +594,22 @@ Note_collision_interface::add_column (Grob *me, Grob *ncol) Axis_group_interface::add_element (me, ncol); } +vector +Note_collision_interface::note_head_positions (Grob *me) +{ + vector out; + extract_grob_set (me, "elements", elts); + for (vsize i = 0; i < elts.size (); i++) + if (Grob *stem = unsmob_grob (elts[i]->get_object ("stem"))) + { + vector nhp = Stem::note_head_positions (stem); + out.insert (out.end (), nhp.begin (), nhp.end ()); + } + + vector_sort (out, less ()); + return out; +} + ADD_INTERFACE (Note_collision_interface, "An object that handles collisions between notes with" " different stem directions and horizontal shifts. Most of"