lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing grob properties?


From: Marc Hohl
Subject: Re: changing grob properties?
Date: Fri, 15 May 2009 20:50:51 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Neil Puttock schrieb:
2009/5/13 Marc Hohl <address@hidden>:

How can I achieve this?

Remember how you got the bounds of a glissando?

In the case of the broken tie, the right bound will be the notehead
you want to make transparent, so you can retrieve the TabNoteHead grob
using ly:spanner-bound.

Upto now, I have achieved to make tablature fret numbers invisible which are tied to another note. But I don't know how to add parentheses to the numbers that are tied but show up after a line break
(for example the first note in measure 5, see attachment).

I tried something like

(set! (ly:music-property note 'elements)
                (cons (make-music 'NoteEvent 'parenthesize #t)
                      (ly:music-property note 'elements)))

but I realized that a grob is not a music expression as the variable called 
"note" in the code fragment above.


Then I came up with the vague idea to combine the TabNoteHead-Stencil with the stencil for the parentheses, but this was beyond my knowledge, it didn't work.

Any hints are gladly appreciated!

Marc


Is this even the right way to solve this task?

It's certainly the most elegant method if you're making the notehead
transparent.

Regards,
Neil


\version "2.12.2"

#(define (tie::handle-tab-tie grob)
  (let* ((original (ly:grob-original grob))
         (tied-tabnotehead (ly:spanner-bound original RIGHT))
         (siblings (if (ly:grob? original)
                     (ly:spanner-broken-into original) '() )))

    (if (and (>= (length siblings) 2)
            (eq? (car (last-pair siblings)) grob))
       ;; tie is split
       ;; just a dummy function here, parentheses should be inserted
       (begin (ly:grob-set-property! tied-tabnotehead 'transparent #f)
              (newline)
              (display "Tie is split.")
              (newline))
       ;; tie is not split -> make fret number invisible
       (ly:grob-set-property! tied-tabnotehead 'transparent #t)
       );; end if
       ))

test = \relative c {
       f2 ~ f4 \parenthesize e
       g8 g ~ g g ~ g g~ g g ~
       g1
       c1 ~ \break c2 ~ c
       < c\3 e\2 g\1 >4 < c\3 e\2 g\1 > ~ < c\3 e\2 g\1 > < c\3 e\2 g\1 >
       \bar "|."
       }

\score {
   << \new Staff { \clef "G_8" \test }
      \new TabStaff { \clef "tab"
                      \override Tie  #'stencil = #tie::handle-tab-tie
                      \override Stem #'stencil = ##f
                      \override Beam #'stencil = ##f
                      \override Dots #'stencil = ##f
                      \test }
   >>
}

Attachment: tietest.pdf
Description: Adobe PDF document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]