summaryrefslogtreecommitdiff
path: root/lily/dynamic-align-engraver.cc
diff options
context:
space:
mode:
authorReinhold Kainhofer <reinhold@kainhofer.com>2011-07-22 16:35:41 +0200
committerReinhold Kainhofer <reinhold@kainhofer.com>2011-07-28 13:59:02 +0200
commitd959f8d548dc073c162c4599cfef2a596f9b66db (patch)
tree4d131d50b9d841e23442d018a1a7ad3f34b339f6 /lily/dynamic-align-engraver.cc
parentcf3642858a2340bb39ee56739f34c799946d4454 (diff)
Fix 1111: Break dynamic line spanner if different direction is explicitly given
Diffstat (limited to 'lily/dynamic-align-engraver.cc')
-rw-r--r--lily/dynamic-align-engraver.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/lily/dynamic-align-engraver.cc b/lily/dynamic-align-engraver.cc
index 591ffee733..766b63ed54 100644
--- a/lily/dynamic-align-engraver.cc
+++ b/lily/dynamic-align-engraver.cc
@@ -116,6 +116,23 @@ void
Dynamic_align_engraver::acknowledge_dynamic (Grob_info info)
{
Stream_event *cause = info.event_cause ();
+ // Check whether an existing line spanner has the same direction
+ if (line_ && cause)
+ {
+ Direction line_dir = get_grob_direction (line_);
+ Direction grob_dir = to_dir (cause->get_property ("direction"));
+
+ // If we have an explicit direction for the new dynamic grob
+ // that differs from the current line spanner, break the spanner
+ if (grob_dir && (line_dir != grob_dir))
+ {
+ if (!ended_line_)
+ ended_line_ = line_;
+ line_ = 0;
+ current_dynamic_spanner_ = 0;
+ }
+ }
+
create_line_spanner (cause);
if (Spanner::has_interface (info.grob ()))
{
@@ -131,9 +148,6 @@ Dynamic_align_engraver::acknowledge_dynamic (Grob_info info)
if (cause)
{
- // TODO: Compare the direction of the existing spanner with
- // the new one and if they differ, create a new line
- // spanner.
if (Direction d = to_dir (cause->get_property ("direction")))
set_grob_direction (line_, d);
}