]> git.donarmstrong.com Git - lilypond.git/blob - scm/slur.scm
patch::: 1.3.64.jcn1
[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     ;;if (stem_l->beam_l () && (stem_l->beam_count (-d) >= 1))
24     ((lambda (slur dir)
25        ;; urg, code dup
26        ;; if attached-to-stem
27        (let* ((note-columns (get-pointer slur 'note-columns))
28          (col (if (= dir 1) (car note-columns) (car (reverse note-columns))))
29          (stem (get-pointer col 'stem)))
30          (and
31           (and
32            (eq? col (get-bound slur dir))
33            stem
34            (get-pointer stem 'heads))
35           ;; and got beam
36           (and (get-pointer stem 'beam)
37                ;; and beam on same side as slur
38                (let ((beaming (get-property stem 'beaming)))
39                  (if (pair? beaming)
40                      (>= 1
41                          (if (= dir -1) (car beaming) (cdr beaming)))
42                      #f)))))) . stem)
43     ((lambda (slur dir) (not (attached-to-stem slur dir))) . loose-end)
44     ;; default case, attach to head
45     ((lambda (x y) #t) . head)
46     
47   ;; silly rule, just to check
48   ((lambda (slur dir)
49        (and (attached-to-stem slur dir) 
50             (= (get-property slur 'direction) dir))) . stem)
51   ))
52
53
54 (define slur-extremity-offset-alist
55   '(
56     ((head 1 1) . (-0.25 . 0.2))
57     ((head 1 -1) . (-0.25 . -0.75))
58     ((head -1 1) . (-0.25 . 0.75))
59     ((head -1 -1) . (-0.75 . 1.2))
60     ((stem 1 1) . (0 . 0.2))
61     ((stem -1 -1) . (0 . 0.2))
62     ))