Hello,

I've decided to dive into deep waters (the slur code) and try to fix
the popular "ugly slur" bugs, #379 and #427.

See the attached patch for the progress I've made.  Also attached is
an image of Mark Polesky's example from the bug tracker:

http://code.google.com/p/lilypond/issues/detail?id=379#c4

Note that I have not run the regression test suite, so I do not yet
know the impact this patch has overall.

Can anyone take a look at the patch and let me know if there are other
things I need to consider?  I'll also mark the bugs as "Started" so
that people know they are being worked on.


Thanks,
Patrick
>From 6b90a06e7c41998f3b5a9dcaffcb2665000ec4f2 Mon Sep 17 00:00:00 2001
From: Patrick McCarty <[email protected]>
Date: Thu, 13 Aug 2009 15:38:24 -0700
Subject: [PATCH] Attempt to fix #379 and #427

---
 lily/include/slur-scoring.hh   |    2 --
 lily/phrasing-slur-engraver.cc |   10 ++++++++++
 lily/slur-scoring.cc           |   25 ++-----------------------
 3 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/lily/include/slur-scoring.hh b/lily/include/slur-scoring.hh
index 6c4dd5d..b127ea3 100644
--- a/lily/include/slur-scoring.hh
+++ b/lily/include/slur-scoring.hh
@@ -108,8 +108,6 @@ struct Slur_score_state
   vector<Extra_collision_info> get_extra_encompass_infos () const;
   Real move_away_from_staffline (Real y, Grob *on_staff) const;
   int get_closest_index (SCM inspect_quants) const;
-
-  Grob *breakable_bound_item (Direction) const;  
 };
 
 void set_slur_control_points (Grob *me);
diff --git a/lily/phrasing-slur-engraver.cc b/lily/phrasing-slur-engraver.cc
index 4cd0c6e..7d7a485 100644
--- a/lily/phrasing-slur-engraver.cc
+++ b/lily/phrasing-slur-engraver.cc
@@ -171,6 +171,16 @@ Phrasing_slur_engraver::process_music ()
 void
 Phrasing_slur_engraver::stop_translation_timestep ()
 {
+  if (Grob *g = unsmob_grob (get_property ("currentCommandColumn")))
+    {
+      for (vsize i = 0; i < end_slurs_.size (); i++)
+       Slur::add_extra_encompass (end_slurs_[i], g);
+
+      if (!events_[START])
+       for (vsize i = 0; i < slurs_.size (); i++)
+         Slur::add_extra_encompass (slurs_[i], g);
+    }
+
   end_slurs_.clear ();
   events_[START] = events_[STOP] = 0;
 }
diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc
index bb2b1f3..ef16fc7 100644
--- a/lily/slur-scoring.cc
+++ b/lily/slur-scoring.cc
@@ -375,23 +375,6 @@ Slur_score_state::get_best_curve ()
   return configurations_[opt_idx]->curve_;
 }
 
-Grob *
-Slur_score_state::breakable_bound_item (Direction d) const
-{
-  Grob *col = slur_->get_bound (d)->get_column ();
-
-  extract_grob_set (slur_, "encompass-objects", extra_encompasses);
-
-  for (vsize i = 0; i < extra_encompasses.size (); i++)
-    {
-      Item *item = dynamic_cast<Item*> (extra_encompasses[i]);
-      if (item && col == item->get_column ())
-       return item;
-    }
-
-  return 0;
-}
-
 int
 Slur_score_state::get_closest_index (SCM inspect_quants) const
 {
@@ -507,12 +490,8 @@ Slur_score_state::get_base_attachments () const
          Real x = 0;
          Real y = 0;
 
-         if (Grob *g = breakable_bound_item (d))
-           {
-             x = robust_relative_extent (g, common_[X_AXIS], X_AXIS)[RIGHT];
-           }
-         else if (d == RIGHT)
-           x = robust_relative_extent (extremes_[d].bound_, common_[X_AXIS], 
X_AXIS)[d];
+         if (d == RIGHT)
+           x = robust_relative_extent (extremes_[d].bound_, common_[X_AXIS], 
X_AXIS)[LEFT];
          else
            x = slur_->get_broken_left_end_align ();
          
-- 
1.6.4

<<attachment: line-break-slurs.png>>

_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to