diff options
author | Neil Puttock <n.puttock@gmail.com> | 2009-04-11 13:15:08 +0100 |
---|---|---|
committer | Neil Puttock <n.puttock@gmail.com> | 2009-04-11 13:15:08 +0100 |
commit | 2970ffbf1e41774474b2113c09a8ec1766e2224e (patch) | |
tree | 4093b50cc03d4efad2ca9866b371aeb847d629f2 | |
parent | 84e2e1980002388ad4adc102bbd86b11ffb77c6e (diff) |
Fix #670: Chained trills
- if trill spanner isn't stopped using \stopTrillSpan, make next
start-span right bound.
- for trill spans on last note of final system, don't end on final
musical column, since it will extend beyond the last breakable column.
-rw-r--r-- | input/regression/trill-spanner-auto-stop.ly | 15 | ||||
-rw-r--r-- | input/regression/trill-spanner-chained.ly | 20 | ||||
-rw-r--r-- | lily/trill-spanner-engraver.cc | 69 |
3 files changed, 68 insertions, 36 deletions
diff --git a/input/regression/trill-spanner-auto-stop.ly b/input/regression/trill-spanner-auto-stop.ly new file mode 100644 index 0000000000..cda0cc23a2 --- /dev/null +++ b/input/regression/trill-spanner-auto-stop.ly @@ -0,0 +1,15 @@ +\version "2.13.1" +\header { + texidoc = "Consecutive trill spans work without explicit +@code{\\stopTrillSpan} commands, since successive trill spanners +will automatically become the right bound of the previous trill. +" +} + +\paper { ragged-right = ##f } + +\relative c'' { + c1\startTrillSpan + c1\startTrillSpan + c2\stopTrillSpan r +} diff --git a/input/regression/trill-spanner-chained.ly b/input/regression/trill-spanner-chained.ly new file mode 100644 index 0000000000..3e756ce38d --- /dev/null +++ b/input/regression/trill-spanner-chained.ly @@ -0,0 +1,20 @@ +\version "2.13.1" +\header { + texidoc = "Chained trills end at the next trill or barline. +Collisions can be prevented by overriding @code{bound-details}. +" +} + +\paper { ragged-right = ##f } + +\relative c'' { + g8 f\startTrillSpan ~ + f8 g\stopTrillSpan \startTrillSpan ~ + g8 r\stopTrillSpan r4 + \once \override TrillSpanner #'to-barline = ##t + c1\startTrillSpan ~ + c1 + \once \override TrillSpanner #'(bound-details right padding) = #1.2 + c1\stopTrillSpan \startTrillSpan + c1\stopTrillSpan\startTrillSpan +} diff --git a/lily/trill-spanner-engraver.cc b/lily/trill-spanner-engraver.cc index 513a2ae605..94554b790b 100644 --- a/lily/trill-spanner-engraver.cc +++ b/lily/trill-spanner-engraver.cc @@ -49,8 +49,7 @@ Trill_spanner_engraver::Trill_spanner_engraver () finished_ = 0; current_event_ = 0; span_ = 0; - event_drul_[START] = 0; - event_drul_[STOP] = 0; + event_drul_.set (0, 0); } IMPLEMENT_TRANSLATOR_LISTENER (Trill_spanner_engraver, trill_span); @@ -64,45 +63,43 @@ Trill_spanner_engraver::listen_trill_span (Stream_event *ev) void Trill_spanner_engraver::acknowledge_note_column (Grob_info info) { - if (span_) { - Pointer_group_interface::add_grob (span_, - ly_symbol2scm ("note-columns"), - info.grob()); - add_bound_item (span_, info.grob ()); - } else if (finished_) { - Pointer_group_interface::add_grob (finished_, ly_symbol2scm ("note-columns"), - info.grob()); - add_bound_item (finished_, info.grob ()); - } + if (span_) + { + Pointer_group_interface::add_grob (span_, + ly_symbol2scm ("note-columns"), + info.grob()); + if (!span_->get_bound (LEFT)) + add_bound_item (span_, info.grob ()); + } + else if (finished_) + { + Pointer_group_interface::add_grob (finished_, ly_symbol2scm ("note-columns"), + info.grob()); + if (!finished_->get_bound (RIGHT)) + add_bound_item (finished_, info.grob ()); + } } void Trill_spanner_engraver::process_music () { - if (event_drul_[STOP]) + if (span_ + && (event_drul_[STOP] || event_drul_[START])) { - if (!span_) - event_drul_[STOP]->origin ()->warning (_ ("cannot find start of trill spanner")); - else - { - finished_ = span_; - announce_end_grob (finished_, SCM_EOL); - span_ = 0; - current_event_ = 0; - } + Stream_event *ender = event_drul_[STOP]; + if (!ender) + ender = event_drul_[START]; + finished_ = span_; + announce_end_grob (finished_, ender->self_scm ()); + span_ = 0; + current_event_ = 0; } if (event_drul_[START]) { - if (current_event_) - event_drul_[START]->origin ()->warning (_ ("already have a trill spanner")); - else - { - current_event_ = event_drul_[START]; - span_ = make_spanner ("TrillSpanner", event_drul_[START]->self_scm ()); - Side_position_interface::set_axis (span_, Y_AXIS); - event_drul_[START] = 0; - } + current_event_ = event_drul_[START]; + span_ = make_spanner ("TrillSpanner", event_drul_[START]->self_scm ()); + Side_position_interface::set_axis (span_, Y_AXIS); } } @@ -130,8 +127,7 @@ Trill_spanner_engraver::stop_translation_timestep () } typeset_all (); - event_drul_[START] = 0; - event_drul_[STOP] = 0; + event_drul_.set (0, 0); } void @@ -140,8 +136,8 @@ Trill_spanner_engraver::finalize () typeset_all (); if (span_) { - finished_ = span_; - typeset_all (); + Grob *e = unsmob_grob (get_property ("currentCommandColumn")); + span_->set_bound (RIGHT, e); } } @@ -155,7 +151,8 @@ ADD_TRANSLATOR (Trill_spanner_engraver, "TrillSpanner ", /* read */ - "", + "currentCommandColumn " + "currentMusicalColumn ", /* write */ "" |