lilypond-user
[Top][All Lists]
Advanced

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

Re: Objects as links


From: Thomas Morley
Subject: Re: Objects as links
Date: Sat, 29 Dec 2012 20:39:25 +0100

2012/12/29 Noeck <address@hidden>:
> Hi,
>
> is there a way to make objects behave like links? I want an object (like
> a clef or a beam) to be a link to a website. From the point-and-click
> functionality it seems to be doable, but I only found the solution for
> markup (\with-url).
>
> If there is a user function or if someone knows how point-and-click
> works internally, I would be thankful for any help.
>
> Cheers,
> Joram
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user

Hi,

you could use this markup-command \with-url to add sth to the grob-stencil.

It's a hack, but all I can think of.

\version "2.17.9"

#(ly:set-option 'debug-skylines #t)

#(define (add-link strg)
  (lambda (grob)
    (let* ((stil (ly:grob-property grob 'stencil))
           (x-ext (ly:stencil-extent stil X))
           (y-ext (ly:stencil-extent stil Y))
           (link-stil (grob-interpret-markup
                         grob
                         (markup
                           #:with-url strg
                           #:with-dimensions x-ext y-ext
                           #:null)))
           (new-stil (ly:stencil-add
                        stil
                        link-stil)))
    (ly:grob-set-property! grob 'stencil new-stil))))


\relative c' {
  \override Staff.Clef.after-line-breaking =
    #(add-link
      "http://lilypond.org/doc/v2.17/Documentation/notation/writing-pitches";)
  \override Staff.TimeSignature.after-line-breaking =
    #(add-link
       "http://lilypond.org/doc/v2.17/Documentation/notation/rhythms";)
  \override NoteHead.after-line-breaking =
    #(add-link
       "http://lilypond.org/doc/v2.17/Documentation/notation/note-heads";)
  c''
}

HTH,
  Harm



reply via email to

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