From: Mike Solomon Date: Fri, 1 Jul 2011 09:36:41 +0000 (+0200) Subject: Implements multiple-line non-cross-staff glissandi. X-Git-Tag: release/2.15.4-1~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4e55f40a1bf65633fedc62d09d91d8e3c0247efe;p=lilypond.git Implements multiple-line non-cross-staff glissandi. Glissandi, not being placed outside the staff, are not bumped up or down depending on other outside staff grobs that may appear after a line break. Thus, all they need to know are the terminus positions on the Y axis in order to be typeset. This means that they can span multiple lines. --- diff --git a/input/regression/glissando-broken-multiple.ly b/input/regression/glissando-broken-multiple.ly new file mode 100644 index 0000000000..4ef945b427 --- /dev/null +++ b/input/regression/glissando-broken-multiple.ly @@ -0,0 +1,18 @@ +\header { + texidoc = "When broken, glissandi can span multiple lines." + +} +\version "2.15.0" +\paper { + ragged-right = ##t +} + +\relative c'' { + \override Glissando #'breakable = ##t + \override Glissando #'after-line-breaking = ##t + d1\glissando + \break s1 + \break s1 + \break s1 + c,1^\ff\trill +} diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index d7f4837a25..69cbc69ce0 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -269,9 +269,14 @@ Line_spanner::print (SCM smob) while (flip (&d) != LEFT); Grob *my_common_y = common_y[LEFT]->common_refpoint (common_y[RIGHT], Y_AXIS); - do - span_points[d][Y_AXIS] += common_y[d]->relative_coordinate (my_common_y, Y_AXIS); - while (flip (&d) != LEFT); + bool simple_y = to_boolean (me->get_property ("simple-Y")) && !to_boolean (me->get_property ("cross-staff")); + + if (!simple_y) + { + do + span_points[d][Y_AXIS] += common_y[d]->relative_coordinate (my_common_y, Y_AXIS); + while (flip (&d) != LEFT); + } Interval normalized_endpoints = robust_scm2interval (me->get_property ("normalized-endpoints"), Interval (0, 1)); Real y_length = span_points[RIGHT][Y_AXIS] - span_points[LEFT][Y_AXIS]; @@ -334,7 +339,7 @@ Line_spanner::print (SCM smob) } line.translate (Offset (-me->relative_coordinate (commonx, X_AXIS), - -me->relative_coordinate (my_common_y, Y_AXIS))); + simple_y ? 0.0 : -me->relative_coordinate (my_common_y, Y_AXIS))); return line.smobbed_copy (); @@ -351,6 +356,7 @@ ADD_INTERFACE (Line_spanner, "left-bound-info " "note-columns " "right-bound-info " + "simple-Y " "thickness " "to-barline " ); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 8f05a8b324..a10e62b965 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -735,6 +735,8 @@ placed vertically.") (side-relative-direction ,ly:dir? "Multiply direction of @code{direction-source} with this to get the direction of this object.") + (simple-Y ,boolean? "Should the Y placement of a spanner +disregard changes in system heights?") (size ,number? "Size of object, relative to standard size.") (skyline-horizontal-padding ,number? "For determining the vertical distance between two staves, it is possible to have a diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index ecfeee3d6b..d2162ce587 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -927,6 +927,7 @@ (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) )) @@ -938,6 +939,7 @@ (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) (stencil . ,ly:line-spanner::print) (style . line) (X-extent . #f) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 1081377907..a9581e5e8e 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -792,6 +792,31 @@ between the two text elements." (ly:grob-property grob 'dot-placement-list)))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; 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)) + (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))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; scripts