]> git.donarmstrong.com Git - lilypond.git/blob - scm/slur.scm
patch::: 1.3.64.jcn2
[lilypond.git] / scm / slur.scm
1
2 ;;;  als aan echte stok
3 ;;;      if ((note_column_drul[d] == get_bound (d))
4 ;;;       && note_column_drul[d]->first_head ()
5 ;;;       && (note_column_drul[d]->stem_l ()))
6 ;;;
7 ;;;  *Need: Score_elment::pointer_alist_
8 ;;;         Score_elment::property_alist_
9 ;;;         Spanner::Drul_array<Item*> spanned_drul_;
10 ;;;         spanner:: (cons get_bound (LEFT) get_bound (RIGHT))
11
12 (define (attached-to-stem slur dir)
13   (let* ((note-columns (get-pointer slur 'note-columns))
14          (col (if (= dir 1) (car note-columns) (car (reverse note-columns))))
15          (stem (get-pointer col 'stem)))
16     (and
17      (eq? col (get-bound slur dir))
18      stem
19      (get-pointer stem 'heads))))
20
21 (define slur-extremity-rules
22   '(
23     ((lambda (slur dir)
24        ;; urg, code dup
25        (let* ((note-columns (get-pointer slur 'note-columns))
26          (col (if (= dir 1) (car note-columns) (car (reverse note-columns))))
27          (stem (get-pointer col 'stem)))
28          (and stem
29               (not (= (get-property slur 'direction) 
30                       (get-property stem 'direction)))))) . head)
31
32     ((lambda (slur dir)
33        ;; if attached-to-stem
34        (and (attached-to-stem slur dir)
35             ;; and got beam
36             ;; urg, code dup
37             (let* ((note-columns (get-pointer slur 'note-columns))
38                    (col (if (= dir 1) (car note-columns) (car (reverse note-columns))))
39                    (stem (get-pointer col 'stem)))
40             (and stem
41                  (get-pointer stem 'beam)
42                  ;; and beam on same side as slur
43                  (let ((beaming (get-property stem 'beaming)))
44                    (if (pair? beaming)
45                        (>= 1
46                            (if (= dir -1) (car beaming) (cdr beaming)))
47                        #f)))))) . stem)
48
49     ((lambda (slur dir) (not (attached-to-stem slur dir))) . loose-end)
50
51     ;; default case, attach to head
52     ((lambda (x y) #t) . head)
53     
54     ;; silly rule, just to check
55     ((lambda (slur dir)
56        (and (attached-to-stem slur dir) 
57             (= (get-property slur 'direction) dir))) . stem)
58     ))
59
60
61 (define slur-extremity-offset-alist
62   '(
63     ((head 1 1) . (-0.25 . 0.2))
64     ((head 1 -1) . (-0.25 . -0.25))
65     ((head -1 1) . (-0.25 . 0.25))
66     ((head -1 -1) . (-0.85 . -0.2))
67
68     ((stem 1 1) . (0 . 0.5))
69     ((stem -1 -1) . (0 . -0.5))
70     ))