+ (fold moment-min #f (map get-difference
+ (iota (1- (ly:grob-array-length cols)))))))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; fingering
+
+(define-public (fingering::calc-text grob)
+ (let*
+ ((event (event-cause grob))
+ (digit (ly:event-property event 'digit)))
+
+ (if (> digit 5)
+ (ly:input-message (ly:event-property event 'origin)
+ "Music for the martians"))
+
+ (number->string digit 10)
+ ))
+
+(define-public (string-number::calc-text grob)
+ (let*
+ ((digit (ly:event-property (event-cause grob) 'string-number)))
+
+ (number->string digit 10)
+ ))
+
+
+(define-public (stroke-finger::calc-text grob)
+ (let*
+ ((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
+(define-public (hairpin::calc-grow-direction grob)
+ (if (eq? (ly:event-property (event-cause grob) 'class) 'decrescendo-event)
+ START
+ STOP
+ ))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; lyrics
+
+(define-public (lyric-text::print grob)
+ "Allow interpretation of tildes as lyric tieing marks."
+
+ (let*
+ ((text (ly:grob-property grob 'text))
+ (layout (ly:grob-layout grob))
+ (defs (ly:output-def-lookup layout 'text-font-defaults))
+ (props (ly:grob-alist-chain grob defs)))
+
+ (ly:text-interface::interpret-markup layout
+ props
+ (if (string? text)
+ (make-tied-lyric-markup text)
+ 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)))