[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Set up label in add-toc-item!
From: |
Robert Kubosz |
Subject: |
Set up label in add-toc-item! |
Date: |
Fri, 7 Feb 2020 12:18:59 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 |
Hello!
I have a question that bothers me. Can I put a label in a markup
function/add-toc-item! ? I'll explain:
I have scores, that obviously use a \header {} block. I use a custom
scoreTitleMarkup, that obviously manages each piece's title markup and
also calls add-toc-item! that puts an item in toc-items list. I want the
add-toc-item! to put the piece label also to the 'label-page-table, so
there would be no need for an extra toplevel "\label 'someSymbol" command.
Below is a snippet that compiles, but it clearly does not work as I want
it to do. I would be very grateful if somebody would help me with this
or give proper guidance where to find a solution.
\version "2.19.83"
#(let ((toc-item-list (list)))
(set! add-toc-item!
(lambda (label markup-symbol text . rest)
(set! toc-item-list
(cons (append! (list label markup-symbol text) rest)
toc-item-list))
(make-music 'EventChord
'page-marker #t
'page-label label
'elements (list (make-music 'LabelEvent
'page-label label)))))
(set! toc-items (lambda ()
(reverse toc-item-list))))
#(define-markup-command (mymarkupfunction layout props) ()
(let ((title (chain-assoc-get 'header:piece props))
;; (label (gensym "piece"))
(label 'piece1 ))
(display (toc-items))
(display "<-should be empty \n")
(add-toc-item! label 'tocPieceMarkup title "123") ;;"123" is a
piece number, take it here as placeholder
(display (toc-items))
(display "<-one toc item \n")
(let ((table (ly:output-def-lookup layout 'label-page-table)))
(display table)
(display "<-here should be at least one item, but isn't!\n"))
(interpret-markup layout props (markup title))))
\paper {
scoreTitleMarkup = \markup \mymarkupfunction
}
\score {
\header {
piece = "foo"
}
{c' c' c' c'}
}
\markup { There should be a working page reference \page-ref #'piece1
"0" "?" }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Set up label in add-toc-item!,
Robert Kubosz <=