diff options
author | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2007-09-12 01:08:58 +0200 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2007-09-12 01:08:58 +0200 |
commit | e0a7f6822a00738f61043050ba9eb9e089bba982 (patch) | |
tree | 8be4b32bbc830a555515e16fa7994f24c1e57982 | |
parent | 1049e628978abb11b0b8c2a912313de541d42c90 (diff) |
Fix #459.
Add end-on-note detail property to line spanner. Use this to make a
trill spanner start on the note iso. paper column on the left broken
edge.
-rw-r--r-- | input/regression/trill-spanner-broken.ly | 15 | ||||
-rw-r--r-- | lily/line-spanner.cc | 38 | ||||
-rw-r--r-- | lily/trill-spanner-engraver.cc | 17 | ||||
-rw-r--r-- | scm/define-grobs.scm | 1 |
4 files changed, 58 insertions, 13 deletions
diff --git a/input/regression/trill-spanner-broken.ly b/input/regression/trill-spanner-broken.ly new file mode 100644 index 0000000000..6d4d0fb7b3 --- /dev/null +++ b/input/regression/trill-spanner-broken.ly @@ -0,0 +1,15 @@ +\version "2.11.32" + +\header { + texidoc = " +A TrillSpanner crossing a line break should restart exactly above +the first note on the new line. " +} + +{ c'1\startTrillSpan \break + c' c'\stopTrillSpan +} + +\paper { + ragged-right = ##t +} diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index 08dfbe7001..7d8cea10d6 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -6,21 +6,21 @@ (c) 2000--2007 Jan Nieuwenhuizen <janneke@gnu.org> */ +#include "align-interface.hh" #include "axis-group-interface.hh" -#include "spanner.hh" -#include "output-def.hh" -#include "item.hh" -#include "staff-symbol-referencer.hh" #include "font-interface.hh" -#include "warn.hh" -#include "align-interface.hh" +#include "grob-interface.hh" +#include "item.hh" +#include "lily-proto.hh" #include "line-interface.hh" #include "moment.hh" +#include "output-def.hh" +#include "pointer-group-interface.hh" +#include "spanner.hh" +#include "staff-symbol-referencer.hh" #include "system.hh" - -#include "lily-proto.hh" -#include "grob-interface.hh" #include "text-interface.hh" +#include "warn.hh" class Line_spanner { @@ -88,8 +88,19 @@ Line_spanner::calc_bound_info (SCM smob, Direction dir) details, SCM_BOOL_F), CENTER); + Item *bound_item = me->get_bound (dir); + Grob *bound_grob = bound_item; + if (to_boolean (ly_assoc_get (ly_symbol2scm ("end-on-note"), details, SCM_BOOL_F)) + && bound_item->break_status_dir ()) + { + extract_grob_set (me, "note-columns", columns); + if (columns.size ()) + bound_grob = (dir == LEFT) + ? columns[0] : columns.back(); + } + details = scm_acons (ly_symbol2scm ("X"), - scm_from_double (me->get_bound (dir)->extent (commonx, X_AXIS) + scm_from_double (bound_grob->extent (commonx, X_AXIS) .linear_combination (attach)), details); } @@ -336,11 +347,12 @@ ADD_INTERFACE (Line_spanner, "@code{dotted-line} or @code{zigzag}.\n" "\n", + "bound-details " "extra-dy " "gap " - "thickness " - "bound-details " - "left-bound-info " + "left-bound-info " + "note-columns " "right-bound-info " + "thickness " ); diff --git a/lily/trill-spanner-engraver.cc b/lily/trill-spanner-engraver.cc index d2ef7e1eb8..857c03051d 100644 --- a/lily/trill-spanner-engraver.cc +++ b/lily/trill-spanner-engraver.cc @@ -17,6 +17,7 @@ #include "international.hh" #include "note-column.hh" +#include "pointer-group-interface.hh" #include "side-position-interface.hh" #include "stream-event.hh" #include "spanner.hh" @@ -30,6 +31,8 @@ public: protected: virtual void finalize (); DECLARE_TRANSLATOR_LISTENER (trill_span); + DECLARE_ACKNOWLEDGER (note_column); + void stop_translation_timestep (); void process_music (); @@ -59,6 +62,20 @@ Trill_spanner_engraver::listen_trill_span (Stream_event *ev) } void +Trill_spanner_engraver::acknowledge_note_column (Grob_info info) +{ + if (!span_) + return; + + Pointer_group_interface::add_grob (span_, + ly_symbol2scm ("note-columns"), + info.grob()); +} + +ADD_ACKNOWLEDGER (Trill_spanner_engraver, note_column); + + +void Trill_spanner_engraver::process_music () { if (event_drul_[STOP]) diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index ba60047963..cd2c337b88 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1936,6 +1936,7 @@ (padding . 1.5) (attach-dir . ,LEFT) )) + (left-broken . ((end-on-note . #t))) (right . ((Y . 0))) )) |