\version "2.17.3" % ulLibrary/curvesToolbox/debugCurves.ily #(define (make-cross-stencil coords) (ly:stencil-add (make-line-stencil 0.1 (- (car coords) 0.2) (- (cdr coords) 0.2) (+ (car coords) 0.2) (+ (cdr coords) 0.2)) (make-line-stencil 0.1 (- (car coords) 0.2) (+ (cdr coords) 0.2) (+ (car coords) 0.2) (- (cdr coords) 0.2)))) #(define (display-control-points) (lambda (grob) (let* ((grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name))) (name (grob-name grob)) (stil (cond ((or (eq? name 'Slur)(eq? name 'PhrasingSlur))(ly:slur::print grob)) ((eq? name 'Tie)(ly:tie::print grob)))) (cps (ly:grob-property grob 'control-points))) (ly:stencil-add stil (ly:stencil-in-color (ly:stencil-add (make-cross-stencil (second cps)) (make-cross-stencil (third cps)) ) 1 0 0) ; color is hard-coded here (R G B). ; modify to change the color of the crosses (ly:stencil-in-color (ly:stencil-add (make-line-stencil 0.05 (car (first cps)) (cdr (first cps)) (car (second cps)) (cdr (second cps))) ;(make-line-stencil 0.05 (car (second cps)) (cdr (second cps)) (car (third cps)) (cdr (third cps))) (make-line-stencil 0.05 (car (third cps)) (cdr (third cps)) (car (fourth cps)) (cdr (fourth cps))) ) 1 0 0) ; color is hard-coded here (R G B). ; modify to change the color of the lines empty-stencil) ) )) % The following functions work in the current context % So you can place it in the music input and modify the % following music. % Switch on the display of control-points for the current Voice displayControlPoints = { \override Slur #'stencil = #(display-control-points) \override PhrasingSlur #'stencil = #(display-control-points) \override Tie #'stencil = #(display-control-points) } %FIXME: This doesn't seem to work % How can I set it back to normal behaviour? % % Switch the display of control-points off again hideControlPoints = { \revert Slur #'stencil \revert PhrasingSlur #'stencil } % display the control-points of the following curve % (Slur, PhrasingSlur or Tie). % This is probably the most common function, % place immediately before the start of the curve displayControlPointsOnce = { \once \override Slur #'stencil = #(display-control-points) \once \override PhrasingSlur #'stencil = #(display-control-points) \once \override Tie #'stencil = #(display-control-points) % commenting this out gives an error } % Switch on the display of the control-points globally % Place in a \layout block debugCurvesOn = \layout { \context { \Score \override Slur #'stencil = #(display-control-points) \override PhrasingSlur #'stencil = #(display-control-points) \override Tie #'stencil = #(display-control-points) } } testDebugCurves = { \override Slur #'stencil = #(display-control-points) \override PhrasingSlur #'stencil = #(display-control-points) \override Tie #'stencil = #(display-control-points) }