~ubuntu-branches/ubuntu/precise/lilypond/precise

« back to all changes in this revision

Viewing changes to scm/titling.scm

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Bushnell, BSG
  • Date: 2006-12-19 10:18:12 UTC
  • mfrom: (3.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061219101812-7awtjkp0i393wxty
Tags: 2.8.7-3
scripts/midi2ly.py: When setting DATADIR, find Lilypond python files
in the @TOPLEVEL_VERSION@ directory, not 'current'.  Patch thanks to
Chris Lamb (chris@chris-lamb.co.uk).  (Closes: #400550)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;;;; titling.scm -- titling functions
 
2
;;;;
 
3
;;;;  source file of the GNU LilyPond music typesetter
 
4
;;;;
 
5
;;;; (c) 2004--2006 Jan Nieuwenhuizen <janneke@gnu.org>
 
6
;;;;          Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
7
 
 
8
(define-public (layout-extract-page-properties layout)
 
9
  (list (append `((line-width . ,(ly:paper-get-number
 
10
                                 layout 'line-width)))
 
11
                (ly:output-def-lookup layout 'text-font-defaults))))
 
12
 
 
13
;;;;;;;;;;;;;;;;;;
 
14
 
 
15
(define-public ((marked-up-headfoot what-odd what-even) layout scopes page-number last?)
 
16
 
 
17
  "Read variables WHAT-ODD, WHAT-EVEN from LAYOUT, and interpret them
 
18
as markup. The PROPS argument will include variables set in SCOPES and
 
19
page:last?, page:page-number-string and page:page-number
 
20
 
21
 
 
22
  (define (get sym)
 
23
    (ly:output-def-lookup layout sym))
 
24
 
 
25
  (define (interpret-in-page-env potential-markup)
 
26
    (if (markup? potential-markup)
 
27
        (let* ((alists (map ly:module->alist scopes))
 
28
               (prefixed-alists
 
29
                (map (lambda (alist)
 
30
                       (map (lambda (entry)
 
31
                              (cons
 
32
                               (string->symbol
 
33
                                (string-append
 
34
                                 "header:"
 
35
                                 (symbol->string (car entry))))
 
36
                               (cdr entry)))
 
37
                            alist))
 
38
                     alists))
 
39
               (pgnum-alist
 
40
                (list
 
41
                 (cons 'header:tagline
 
42
                       (ly:modules-lookup scopes 'tagline
 
43
                                          (ly:output-def-lookup layout 'tagline)))
 
44
                 (cons 'page:last? last?)
 
45
                 (cons 'page:page-number-string
 
46
                       (number->string page-number))
 
47
                 (cons 'page:page-number page-number)))
 
48
               (props (append
 
49
                       (list pgnum-alist)
 
50
                       prefixed-alists
 
51
                       (layout-extract-page-properties layout))))
 
52
          
 
53
          (interpret-markup layout props potential-markup))
 
54
 
 
55
        empty-stencil))
 
56
 
 
57
  (interpret-in-page-env
 
58
   (if (and (even? page-number)
 
59
            (markup? (get what-even)))
 
60
       (get what-even)
 
61
       (get what-odd))))
 
62
 
 
63
(define-public ((marked-up-title what) layout scopes)
 
64
  "Read variables WHAT from SCOPES, and interpret it as markup. The
 
65
PROPS argument will include variables set in SCOPES (prefixed with
 
66
`header:'
 
67
"
 
68
  
 
69
  (define (get sym)
 
70
    (let ((x (ly:modules-lookup scopes sym)))
 
71
      (if (markup? x) x #f)))
 
72
 
 
73
  (let* ((alists (map ly:module->alist scopes))
 
74
         (prefixed-alist
 
75
          (map (lambda (alist)
 
76
                 (map (lambda (entry)
 
77
                        (cons
 
78
                         (string->symbol
 
79
                          (string-append
 
80
                           "header:"
 
81
                           (symbol->string (car entry))))
 
82
                         (cdr entry)))
 
83
                      alist))
 
84
               alists))
 
85
         (props (append prefixed-alist
 
86
                        (layout-extract-page-properties layout)))
 
87
 
 
88
         (markup (ly:output-def-lookup layout what)))
 
89
 
 
90
    (if (markup? markup)
 
91
        (interpret-markup layout props markup)
 
92
        (ly:make-stencil '() '(1 . -1) '(1 . -1)))))