Reviewers: ,
Message:
Hah, it also works fine if you use left/right-bound-info (as I
originally suggested. ;)
Cheers,
Neil
Hey Neil,
I tried to implement your suggestion via the logic in this patch, but it
doesn't seem to work (it gets the same result as the current master).
Any pointers?
Description:
First stab at using the left and right bound detail callbacks.
Please review this at http://codereview.appspot.com/4654085/
Affected files:
M lily/line-spanner.cc
M scm/define-grobs.scm
M scm/output-lib.scm
Index: lily/line-spanner.cc
diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc
index
d50b94834a57c7fd3b6a83291d51acb7a0a23673..d00238e8d7be4114ba1eabcd4c2ed00a1a8de5b7
100644
--- a/lily/line-spanner.cc
+++ b/lily/line-spanner.cc
@@ -224,9 +224,6 @@ Line_spanner::print (SCM smob)
{
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"));
@@ -273,6 +270,8 @@ Line_spanner::print (SCM smob)
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)
{
do
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index
9a8d14a1c31a434b0c02a72e194433ee818d1ed7..393dd048b462fe0e0649ddbcb1669e2a19198f32
100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -935,10 +935,10 @@
))
))
(gap . 0.5)
- (left-bound-info . ,ly:line-spanner::calc-left-bound-info)
+ (left-bound-info . ,glissando::calc-left-bound-info)
(normalized-endpoints . ,ly:spanner::calc-normalized-endpoints)
- (right-bound-info . ,ly:line-spanner::calc-right-bound-info)
- (simple-Y . ,glissando::make-simple-y)
+ (right-bound-info . ,glissando::calc-right-bound-info)
+ (simple-Y . #t)
(stencil . ,ly:line-spanner::print)
(style . line)
(X-extent . #f)
Index: scm/output-lib.scm
diff --git a/scm/output-lib.scm b/scm/output-lib.scm
index
01953a941215f60b06c9a30797c5d2c5e8d551f0..3adb1d0a5a0b40f1c2cec71ff6a0cf557877547d
100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -795,36 +795,47 @@ between the two text elements."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; glissando
-(define-public (glissando::make-simple-y grob)
+(define (glissando::calc-bound-info grob dir-sym)
"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)))
-
+ (extra-dy (ly:grob-property grob 'extra-dy 0.0))
+ (bound-fn (if (eq? dir-sym 'left)
+ ly:line-spanner::calc-left-bound-info
+ ly:line-spanner::calc-right-bound-info)))
+
(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))))
-
+ (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)))))
+
+ (set! (ly:grob-property grob 'bound-details) bound-details))
+ (bound-fn grob)))
+
+(define-public (glissando::calc-left-bound-info grob)
+ "Establishes the left Y terminus points of the glissando based on
+the pre-broken positions of its left and right bounds."
+ (glissando::calc-bound-info grob 'left))
+
+(define-public (glissando::calc-right-bound-info grob)
+ "Establishes the left Y terminus points of the glissando based on
+the pre-broken positions of its left and right bounds."
+ (glissando::calc-bound-info grob 'right))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; scripts
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel