{
Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
+ // Triggers simple-Y calculations
+ bool simple_y = to_boolean (me->get_property ("simple-Y")) && !to_boolean (me->get_property ("cross-staff"));
+
Drul_array<SCM> bounds (me->get_property ("left-bound-info"),
me->get_property ("right-bound-info"));
while (flip (&d) != LEFT);
Grob *my_common_y = common_y[LEFT]->common_refpoint (common_y[RIGHT], Y_AXIS);
- bool simple_y = to_boolean (me->get_property ("simple-Y")) && !to_boolean (me->get_property ("cross-staff"));
if (!simple_y)
{
(Glissando
. (
(after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
- (before-line-breaking . ,glissando::before-line-breaking)
(bound-details . ((right . ((attach-dir . ,CENTER)
(padding . 1.5)
))
(left-bound-info . ,ly:line-spanner::calc-left-bound-info)
(normalized-endpoints . ,ly:spanner::calc-normalized-endpoints)
(right-bound-info . ,ly:line-spanner::calc-right-bound-info)
- (simple-Y . #t)
+ (simple-Y . ,glissando::make-simple-y)
(stencil . ,ly:line-spanner::print)
(style . line)
(X-extent . #f)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; glissando
-(define-public (glissando::before-line-breaking grob)
- "Establishes the Y terminus points of the glissando based on the pre-broken
-positions of its left and right bounds."
- (let ((bound-details (ly:grob-property grob 'bound-details))
+(define-public (glissando::make-simple-y grob)
+ "Establishes the Y terminus points of the glissando based on the
+pre-broken positions of its left and right bounds."
+ (let* ((siblings (ly:spanner-broken-into (ly:grob-original grob)))
+ (bound-details (ly:grob-property grob 'bound-details))
(extra-dy (ly:grob-property grob 'extra-dy 0.0)))
- (for-each (lambda (dir-sym)
- (let* ((details (assoc-get dir-sym bound-details))
- (dir (if (eq? dir-sym 'left) LEFT RIGHT))
- (bound (ly:spanner-bound grob dir))
- (common-y (ly:grob-common-refpoint grob bound Y))
- (y (+ (interval-center (ly:grob-extent bound common-y Y))
- (/ (* dir extra-dy)
- 2))))
- (if (not (assoc-get 'Y details))
- (set! bound-details (assoc-set! bound-details dir-sym
- (acons 'Y y details))))))
- '(left right))
-
- (set! (ly:grob-property grob 'bound-details) bound-details)))
+ (and (pair? siblings)
+ (for-each (lambda (dir-sym)
+ (let* ((details (assoc-get dir-sym bound-details))
+ (dir (if (eq? dir-sym 'left) LEFT RIGHT))
+ (good-grob (if (eq? dir-sym 'left)
+ (first siblings)
+ (last siblings)))
+ (bound (ly:spanner-bound good-grob dir))
+ (common-y (ly:grob-common-refpoint good-grob
+ bound
+ Y))
+ (y (+ (interval-center (ly:grob-extent bound
+ common-y
+ Y))
+ (/ (* dir extra-dy)
+ 2))))
+ (if (not (assoc-get 'Y details))
+ (set! bound-details (assoc-set! bound-details dir-sym
+ (acons 'Y y details))))))
+ '(left right))
+
+ (set! (ly:grob-property grob 'bound-details) bound-details))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;