]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #943.
authorPatrick McCarty <pnorcks@gmail.com>
Thu, 29 Apr 2010 02:25:56 +0000 (19:25 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Fri, 30 Apr 2010 03:24:00 +0000 (20:24 -0700)
- Currently, slur direction is calculated once and possibly modified
  later.  Combine these routines into a single function.

- Check for a post-line-break slur first; in this case, the direction
  should come from the pre-line-break slur.

- Check for a pre-line-break slur next; if found, forward its direction
  to the corresponding post-line-break slur.

- If these conditions do not hold, we have an unbroken slur, so simply
  calculate its direction.

lily/include/slur-scoring.hh
lily/slur-scoring.cc

index aeaac19c84a2e7aaddcee76b7317946e0f4cc91f..6348125cc994fc80ee59d2c2c4ae2b0ba06fd3c9 100644 (file)
@@ -107,7 +107,7 @@ struct Slur_score_state
 
   Bezier get_best_curve ();
   void fill (Grob *);
-  void set_next_direction ();
+  Direction slur_direction () const;
   
   vector<Offset> generate_avoid_offsets () const;
   Drul_array<Bound_info> get_bound_info () const;
index 5182072a03f9a321413bddb8b632f324c0ed38fb..a43daa3ed430ebd0996f74cd42d220d3cf07ae81 100644 (file)
@@ -78,18 +78,22 @@ Slur_score_state::~Slur_score_state ()
 }
 
 /*
-  copy slur dir forwards across line break.
+  If a slur is broken across a line break, the direction
+  of the post-break slur must be the same as the pre-break
+  slur.
 */
-void
-Slur_score_state::set_next_direction ()
+Direction
+Slur_score_state::slur_direction () const
 {
-  if (extremes_[RIGHT].note_column_)
-    return;
+  if (Grob *left_neighbor = slur_->broken_neighbor (LEFT))
+    return get_grob_direction (left_neighbor);
 
-  if (Grob *neighbor = slur_->broken_neighbor (RIGHT))
-    {
-      set_grob_direction (neighbor, dir_);
-    }
+  Direction dir = get_grob_direction (slur_);
+
+  if (Grob *right_neighbor = slur_->broken_neighbor (RIGHT))
+    set_grob_direction (right_neighbor, dir);
+
+  return dir;
 }
 
 Encompass_info
@@ -215,7 +219,7 @@ Slur_score_state::fill (Grob *me)
   Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
   thickness_ = robust_scm2double (me->get_property ("thickness"), 1.0) * lt;
 
-  dir_ = get_grob_direction (me);
+  dir_ = slur_direction ();
   parameters_.fill (me);
 
   extract_grob_set (me, "note-columns", columns);
@@ -277,8 +281,6 @@ Slur_score_state::fill (Grob *me)
     = (extremes_[LEFT].stem_ && Stem::get_beam (extremes_[LEFT].stem_))
     || (extremes_[RIGHT].stem_ && Stem::get_beam (extremes_[RIGHT].stem_));
 
-  set_next_direction ();
-
   if (is_broken_)
     musical_dy_ = 0.0;
 }