]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/slur.scm
*** empty log message ***
[lilypond.git] / scm / slur.scm
index 0a7ea00cd34702af14aac8e3985c28bd44f797ff..73e087db0f3e8483bfa3e4b892fe5415aa0c4b1e 100644 (file)
@@ -7,13 +7,17 @@
 ;;;;
 
 (define (attached-to-stem slur dir)
-  (let* ((note-columns (ly:get-grob-property slur 'note-columns))
-        (col (if (= dir 1) (car note-columns) (car (last-pair note-columns))))
-        (stem (ly:get-grob-property col 'stem)))
+  (let* ((note-columns (ly:grob-property slur 'note-columns))
+        (col (if (= dir RIGHT)
+                 (car note-columns)
+                 (car (last-pair note-columns))))
+        (stem (ly:grob-property col 'stem)))
     (and
      (eq? col (ly:spanner-get-bound slur dir))
-     (ly:grob? stem)
-     (ly:get-grob-property stem 'heads))))
+     ;(ly:grob? stem)
+     ;(pair?  (ly:grob-property stem 'heads))
+
+     )))
 
 
 ;;
 ;;    'head 'along-side-stem 'stem 'loose-end
 ;;
 (define (calc-slur-extremity slur dir)
-  (let* ((note-columns (ly:get-grob-property slur 'note-columns))
-        (col (car (if (= dir 1) note-columns (reverse note-columns))))
-        (stem (ly:get-grob-property col 'stem)))
-
+  (let* ((note-columns (ly:grob-property slur 'note-columns))
+        (col (if (= dir 1)
+                 (car note-columns)
+                 (car (last-pair note-columns))))
+        (stem (ly:grob-property col 'stem))
+        (beaming (if (and (ly:grob? stem)
+                          (ly:grob? (ly:grob-property stem 'beam)))
+                     (ly:grob-property stem 'beaming)
+                     '(() . ())))
+        (one-side-beaming (if (= dir RIGHT)
+                              (car beaming)
+                              (cdr beaming)))
+                     
+        )
 
    (cond
     ((< (length note-columns) 1) 'head)
-    ((not (attached-to-stem slur dir)) 'loose-end)
+    ((not (attached-to-stem slur dir))
+
+     'loose-end)
     ((and stem
-         (not (equal? (ly:get-grob-property slur 'direction) 
-                      (ly:get-grob-property stem 'direction))))  'head)
-    ((and (attached-to-stem slur dir)
+         (not (equal? (ly:grob-property slur 'direction) 
+                      (ly:grob-property stem 'direction))))  'head)
+    ((and (memq (ly:spanner-get-bound slur dir)
+               (ly:grob-property slur 'note-columns))
          (ly:grob? stem)
-         (ly:grob? (ly:get-grob-property stem 'beam))
+
+         ;; slur would go under beam for 'head
+         (> (length one-side-beaming ) 0)
          ;; and beam on same side as slur
          (equal?
-          (ly:get-grob-property stem 'direction)
-          (ly:get-grob-property slur 'direction)))
+          (ly:grob-property stem 'direction)
+          (ly:grob-property slur 'direction))
+         )
      'stem)
-    ((not (attached-to-stem slur dir))  'loose-end)
-    (else 'head))
+    ((not (attached-to-stem slur dir))
+     'loose-end)
+    (else
+     'head))
    ))