]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-lib.scm
Bugifix: rename to separation-group-spanner-interface.
[lilypond.git] / scm / output-lib.scm
index c67c89df90e2d7309a7baa6885b1cc17a9de8244..88904384cda91c194bd235967ff3c7b963326b31 100644 (file)
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; note heads
 
-(define-public (note-head::calc-duration-log grob)
+
+(define-public (stem::calc-duration-log grob)
   (ly:duration-log
    (ly:event-property (event-cause grob) 'duration)))
 
+(define-public (note-head::calc-duration-log grob)
+  (min 2 
+       (ly:duration-log
+       (ly:event-property (event-cause grob) 'duration))))
+
 (define-public (dots::calc-dot-count grob)
   (ly:duration-dot-count
    (ly:event-property (event-cause grob) 'duration)))
@@ -410,7 +416,7 @@ centered, X==1 is at the right, X == -1 is at the left."
     
     (if (> digit 5)
        (ly:input-message (ly:event-property event 'origin)
-                         "Music for the martians"))
+                         "Warning: Fingering notation for finger number ~a" digit))
 
     (number->string digit 10)
   ))
@@ -422,12 +428,15 @@ centered, X==1 is at the right, X == -1 is at the left."
     (number->string digit 10)
   ))
 
-(define-public (string-finger::calc-text grob)
+
+(define-public (stroke-finger::calc-text grob)
   (let*
-      ((digit (ly:event-property (event-cause  grob) 'digit))
-       (texts (ly:grob-property grob 'digit-names)))
-    (vector-ref texts  (1- (max (min 5 digit) 1)))
-    ))
+      ((digit (ly:event-property (event-cause grob) 'digit))
+       (text (ly:event-property (event-cause grob) 'text)))
+
+    (if (string? text)
+       text
+       (vector-ref (ly:grob-property grob 'digit-names)  (1- (max (min 5 digit) 1))))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; dynamics
@@ -455,5 +464,45 @@ centered, X==1 is at the right, X == -1 is at the left."
                                             (make-tied-lyric-markup text)
                                             text))))
 
-(define-public (lyric-text::calc-text grob)
-   (ly:event-property (event-cause grob) 'text))
+(define-public ((grob::calc-property-by-copy prop) grob)
+  (ly:event-property (event-cause grob) prop))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; fret boards
+
+(define (string-frets->description string-frets string-count)
+  (let*
+      ((desc (list->vector
+             (map (lambda (x) (list 'mute  (1+ x)))
+                  (iota string-count)))))
+       
+       (for-each (lambda (sf)
+                  (let*
+                      ((string (car sf))
+                       (fret (cadr sf))
+                       (finger (caddr sf)))
+
+                    
+                    (vector-set! desc (1- string)
+                                 (if (= 0 fret)
+                                     (list 'open string)
+                                     (if finger
+                                         (list 'place-fret string fret finger) 
+                                         (list 'place-fret string fret))
+                                         
+
+                                     ))
+                    ))
+                string-frets)
+
+       (vector->list desc)))
+
+(define-public (fret-board::calc-stencil grob)
+  (let* ((string-frets (ly:grob-property grob 'string-fret-finger-combinations))
+        (string-count (ly:grob-property grob 'string-count))
+        (layout (ly:grob-layout grob))
+        (defs (ly:output-def-lookup layout 'text-font-defaults))
+        (props (ly:grob-alist-chain grob defs)))
+
+    (make-fret-diagram layout props
+                      (string-frets->description string-frets 6))))