[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix #943. (issue956051)
From: |
pnorcks |
Subject: |
Re: Fix #943. (issue956051) |
Date: |
Fri, 30 Apr 2010 03:22:27 +0000 |
Reviewers: Neil Puttock,
http://codereview.appspot.com/956051/diff/1/3
File lily/slur-scoring.cc (right):
http://codereview.appspot.com/956051/diff/1/3#newcode86
lily/slur-scoring.cc:86: Slur_score_state::slur_direction (Grob *me)
const
On 2010/04/29 22:40:10, Neil Puttock wrote:
Do you need to pass `me' here? Isn't it the same as slur_?
Oh yes, thanks for the catch. I'll amend that and push.
Description:
Fix #943.
See: http://code.google.com/p/lilypond/issues/detail?id=943
- 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.
Please review this at http://codereview.appspot.com/956051/show
Affected files:
M lily/include/slur-scoring.hh
M lily/slur-scoring.cc
Index: lily/include/slur-scoring.hh
diff --git a/lily/include/slur-scoring.hh b/lily/include/slur-scoring.hh
index
aeaac19c84a2e7aaddcee76b7317946e0f4cc91f..f4dc5cdbe91b5359f99c9b11d0add37d43f6439b
100644
--- a/lily/include/slur-scoring.hh
+++ b/lily/include/slur-scoring.hh
@@ -107,7 +107,7 @@ struct Slur_score_state
Bezier get_best_curve ();
void fill (Grob *);
- void set_next_direction ();
+ Direction slur_direction (Grob *) const;
vector<Offset> generate_avoid_offsets () const;
Drul_array<Bound_info> get_bound_info () const;
Index: lily/slur-scoring.cc
diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc
index
5182072a03f9a321413bddb8b632f324c0ed38fb..b7e183718cf9aac4ef0058f5b1e74efc75920d5e
100644
--- a/lily/slur-scoring.cc
+++ b/lily/slur-scoring.cc
@@ -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 (Grob *me) 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 (me);
+
+ 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 (me);
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;
}