lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixes problems with glissando line breaking code pointed out by Han-Wen.


From: mtsolo
Subject: Fixes problems with glissando line breaking code pointed out by Han-Wen. (issue4634119)
Date: Fri, 01 Jul 2011 15:23:28 +0000

Reviewers: ,

Message:
Cheers,
MS

Description:
Fixes problems with glissando line breaking code pointed out by Han-Wen.

Please review this at http://codereview.appspot.com/4634119/

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 69cbc69ce0544400a34b99ee748d634dc0933253..c2a7f020890565fdfb675aafaad58dc09fb0f0ad 100644
--- a/lily/line-spanner.cc
+++ b/lily/line-spanner.cc
@@ -224,6 +224,9 @@ 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"));

@@ -269,7 +272,6 @@ Line_spanner::print (SCM smob)
   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)
     {
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index d2162ce58724d7eed32258b0eed2c63afbddcd0c..9a8d14a1c31a434b0c02a72e194433ee818d1ed7 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -927,7 +927,6 @@
     (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)
                                      ))
@@ -939,7 +938,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)
+       (simple-Y . ,glissando::make-simple-y)
        (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 a9581e5e8e0b47129cd94ecdb5cfaf019b6dc225..57ed7419d49aea64c69a5adfe968c3170a323d78 100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -795,17 +795,23 @@ between the two text elements."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; glissando

-(define-public (glissando::before-line-breaking grob)
+(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 ((bound-details (ly:grob-property grob 'bound-details))
-        (extra-dy (ly:grob-property grob 'extra-dy 0.0)))
-
+  (let* ((orig (ly:grob-original grob))
+         (siblings (if (ly:grob? orig)
+                       (ly:spanner-broken-into orig)
+                       (list 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))
+                       (good-grob (if (eq? dir-sym 'left)
+                                      (car siblings)
+                                      (car (reverse 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))))
@@ -814,7 +820,8 @@ positions of its left and right bounds."
(acons 'Y y details))))))
               '(left right))

-    (set! (ly:grob-property grob 'bound-details) bound-details)))
+    (set! (ly:grob-property grob 'bound-details) bound-details)
+    #t))


 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]