On Saturday 30 May 2009 07:41:51 pm Kieren MacMillan wrote: > The saga continues... =) > > I've hacked the Tie callback to try to adjust the Accidental > property. Coloring the Accidental works fine: > > %%%%%%%%%%%%% > \version "2.12.2" > > #(define (tie-callback tiegrob) > (let* ( > ; have we been split? > (orig (ly:grob-original tiegrob)) > > ; if yes, get the split pieces (our siblings) > (siblings (if (ly:grob? orig) > (ly:spanner-broken-into orig) '() ))) > > (if (and (>= (length siblings) 2) > (eq? (car (last-pair siblings)) tiegrob)) > (ly:grob-set-property! (ly:grob-object (ly:spanner-bound > tiegrob RIGHT) 'accidental-grob) 'color red)))) > > testMusic = \relative > { > \override Tie #'after-line-breaking = #tie-callback > cis'2 cis! ~ \break > cis > } > > \score { \testMusic } > %%%%%%%%%%%%% > > But when I try > > (ly:grob-set-property! (ly:grob-object (ly:spanner-bound tiegrob > RIGHT) 'accidental-grob) 'break-visibility #(#f #f #f)) > > nothing happens. Am I even close to on the right track?
Not really, although your approach should work in most cases. For Accidentals, though, the code that places a tied accidental after a line break isn't accessible from scheme (it lives in lily/accidental.cc, in the print function). Anyway, here's a patch (to be applied with "git am") that implements a new property, 'hide-tied-accidental-after-break, in the Accidental grob. I'll apply it soonish unless there are complaints. Cheers, Joe
From 057d39e33c669dacc98833bbc766d8ca693f084a Mon Sep 17 00:00:00 2001 From: Joe Neeman <joenee...@gmail.com> Date: Sat, 30 May 2009 19:14:42 -0700 Subject: [PATCH] Make tied accidentals after line breaks configurable. --- input/regression/accidental-tie-overridden.ly | 23 +++++++++++++++++++++++ lily/accidental.cc | 11 +++++++---- scm/define-grob-properties.scm | 2 ++ 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 input/regression/accidental-tie-overridden.ly diff --git a/input/regression/accidental-tie-overridden.ly b/input/regression/accidental-tie-overridden.ly new file mode 100644 index 0000000..3d21a79 --- /dev/null +++ b/input/regression/accidental-tie-overridden.ly @@ -0,0 +1,23 @@ +\version "2.12.0" + +\header { + texidoc = "The presence of an accidental after a broken tie can be +overridden." +} +\layout { + ragged-right = ##t +} + +mus = \relative c' { + \override Accidental #'hide-tied-accidental-after-break = ##t + f1~ + f2~f4 % ~ f8 + fis8 gis8 ~ + \break + gis1 +} + +<< + \new NoteNames \mus + \new Voice { \key g \major \mus } +>> diff --git a/lily/accidental.cc b/lily/accidental.cc index 0e81a6b..a017cf8 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -67,7 +67,8 @@ Accidental_interface::pure_height (SCM smob, SCM start_scm, SCM) if (to_boolean (me->get_property ("forced")) || !unsmob_grob (me->get_object ("tie")) - || rank == start + 1) /* we are at the start of a line */ + || (rank == start + 1 && /* we are at the start of a line */ + !to_boolean (me->get_property ("hide-tied-accidental-after-break")))) { Stencil *s = unsmob_stencil (get_stencil (me)); if (s) @@ -163,8 +164,9 @@ Accidental_interface::print (SCM smob) Grob *me = unsmob_grob (smob); Grob *tie = unsmob_grob (me->get_object ("tie")); - if (tie && !tie->original () - && !to_boolean (me->get_property ("forced"))) + if (tie && + (to_boolean (me->get_property ("hide-tied-accidental-after-break")) + || (!tie->original () && !to_boolean (me->get_property ("forced"))))) { me->suicide (); return SCM_EOL; @@ -218,8 +220,9 @@ ADD_INTERFACE (Accidental_interface, "alteration " "avoid-slur " "forced " + "glyph-name-alist " + "hide-tied-accidental-after-break " "parenthesized " "restore-first " - "glyph-name-alist " "tie " ); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index f3a2b6a..bbd6ae3 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -667,6 +667,8 @@ space for the shortest duration. This is expressed in shortest note playing here.") (shortest-starter-duration ,ly:moment? "The duration of the shortest note that starts here.") + (hide-tied-accidental-after-break ,boolean? "If set, an accidental +that appears on a tied note after a line break will not be displayed") (side-axis ,number? "If the value is @code{#X} (or equivalen...@tie{}@code{0}), the object is placed horizontally next to the other object. If the value is @code{#Y} o...@tie{}@code{1}, it is -- 1.6.0.4
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel