]> git.donarmstrong.com Git - lilypond.git/blob - scm/new-markup.scm
78cbb7779a8f4744455b31ad02eaab106e50e8b8
[lilypond.git] / scm / new-markup.scm
1
2
3
4 (define-public (simple-markup grob props . rest)
5   (Text_item::text_to_molecule grob props (car rest))
6   )
7
8 (define-public (line-markup grob props . rest)
9   (stack-molecules
10    X 1 1.0 
11    (map (lambda (x) (interpret_markup grob props x)) (car rest)))
12   )
13
14 (define (combine-molecule-list lst)
15   (if (null? (cdr lst)) (car lst)
16       (ly:add-molecule (car lst) (combine-molecule-list (cdr lst)))
17       ))
18
19 (define-public (combine-markup grob props . rest)
20    (combine-molecule-list (map (lambda (x) (interpret_markup grob props x)) (car rest))))
21
22 (define-public (bold-markup grob props . rest)
23    (interpret_markup grob (cons '((font-series .  bold)) props) (car rest))
24   )
25
26 (define-public (column-markup grob props . rest)
27   (stack-molecules
28    Y -1 0.0 
29    (map (lambda (x) (interpret_markup grob props x)) (car rest)))
30   )
31
32 ;; todo. Use macro?  
33 (map
34  (lambda (x)
35
36    (set-object-property!
37     (eval (string->symbol (string-append (symbol->string x) "-markup")) (current-module))
38     'markup-function? #t))
39
40  '(simple column bold combine line )
41  )
42
43 (define-public (brew-new-markup-molecule grob)
44   (interpret_markup grob
45                     (Font_interface::get_property_alist_chain grob)
46                     (ly:get-grob-property grob 'text)
47                     )
48   )
49
50 (define (interpret_markup  grob props markup)
51   (let*
52       (
53        (func (car markup))
54        (args (cdr markup))
55        )
56     
57     (apply func (cons grob (cons props args)) )
58     ))
59
60 (define (new-markup? x)
61         (markup-function? (car x))
62 )
63
64 (define (markup-function? x)
65         (object-property 'markup-function? x))