lilypond-common-includes/title_with_category_images.ly

68 lines
2.8 KiB
Plaintext

#(define-markup-command (bookTitleMarkupCustom layout props)()
(interpret-markup layout
(prepend-alist-chain 'defaultmarkup #{
\markup {
\override #'(baseline-skip . 3.5)
\center-column {
\override #`(font-name . ,songTitleFont) { \fontsize #6 \fromproperty #'header:title }
\large \bold \fromproperty #'header:subtitle
\smaller \bold \fromproperty #'header:subsubtitle
}
}
#}
(prepend-alist-chain 'songfilename (chain-assoc-get 'header:songfilename props "") props))
(make-column-markup
(list
(make-vspace-markup (chain-assoc-get 'header:titletopspace props 0))
(make-customEps-markup (chain-assoc-get 'header:titlesize props 3.5) "titel.eps")
))
))
#(define-markup-command (category-image layout props size category)(number? string?)
(interpret-markup layout props
(if noStandaloneOutput
(make-epsfileref-markup Y size
(category-image-path category))
(make-epsfile-markup Y size
(category-image-path category)))))
#(define showCategoryImages (if (defined? 'showCategoryImages) showCategoryImages #t))
#(define-markup-command (category-images layout props)()
(interpret-markup layout props
(if showCategoryImages
(make-line-markup (map (lambda (category) (make-category-image-markup 5 category))
(string-tokenize (chain-assoc-get 'header:categories props ""))))
(make-null-markup))))
#(define pdf-encode (@@ (lily framework-ps) pdf-encode))
% PDF tags
#(define-markup-command (title-to-pdf-toc layout props title) (string?)
(ly:make-stencil
(list 'embedded-ps
(ly:format
"[/Action /GoTo /View [/Fit] /Title (~a) /OUT pdfmark" (pdf-encode title)))
empty-interval empty-interval
;'(0 . 0) '(0 . 0)
))
#(define-markup-command (title-with-category-images layout props right)(boolean?)
(interpret-markup layout props
(let* ((title (chain-assoc-get 'header:title props #f))
(pdfbookmark (chain-assoc-get 'header:songfilename props title)))
(if title
;(if (chain-assoc-get 'header:categories props #f)
(if right
#{\markup { \title-to-pdf-toc #pdfbookmark \fill-line \general-align #Y #UP { \null \bookTitleMarkupCustom \category-images } } #}
#{\markup { \title-to-pdf-toc #pdfbookmark \fill-line \general-align #Y #UP { \category-images \bookTitleMarkupCustom \null } } #})
;#{\markup \fill-line \general-align #Y #UP { \null \bookTitleMarkupCustom \null } #})
;(make-null-markup))
#{ \markup { " " } #})
)))
\paper {
bookTitleMarkup = \markup \null
scoreTitleMarkup = \markup \null
oddHeaderMarkup = \markup { \if \on-first-page-of-part \title-with-category-images ##t }
evenHeaderMarkup = \markup { \if \on-first-page-of-part \title-with-category-images ##f }
}