]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fixes Issue 40.
authorMike Solomon <mike@apollinemike.com>
Mon, 22 Aug 2011 06:36:46 +0000 (08:36 +0200)
committerMike Solomon <mike@apollinemike.com>
Mon, 22 Aug 2011 06:36:46 +0000 (08:36 +0200)
Adds an end-on-accidental bool in the details property of glissandi
that is used in line spanner bound calculations.

input/regression/glissando-accidental.ly [new file with mode: 0644]
lily/line-spanner.cc
scm/define-grobs.scm

diff --git a/input/regression/glissando-accidental.ly b/input/regression/glissando-accidental.ly
new file mode 100644 (file)
index 0000000..1e15196
--- /dev/null
@@ -0,0 +1,9 @@
+\header {
+  texidoc = "Glissandi stop before hitting accidentals."
+
+}
+\version "2.15.9"
+
+\relative c'' {
+  a1\glissando cis
+}
index 962f772a50275393430416fd26a8797ac488cfc7..8cdc16b94ffcf75aab36686c86bf203e4e242b61 100644 (file)
@@ -24,6 +24,7 @@
 #include "item.hh"
 #include "lily-proto.hh"
 #include "line-interface.hh"
+#include "note-column.hh"
 #include "output-def.hh"
 #include "paper-column.hh"
 #include "pointer-group-interface.hh"
@@ -109,12 +110,16 @@ Line_spanner::calc_bound_info (SCM smob, Direction dir)
                          ? columns[0] : columns.back ();
         }
 
-      Interval extent = (Paper_column::has_interface (bound_grob)
-                         ? Axis_group_interface::generic_bound_extent (bound_grob, commonx, X_AXIS)
-                         : robust_relative_extent (bound_grob, commonx, X_AXIS));
+      Real x_coord = (Paper_column::has_interface (bound_grob)
+                      ? Axis_group_interface::generic_bound_extent (bound_grob, commonx, X_AXIS)
+                      : robust_relative_extent (bound_grob, commonx, X_AXIS)).linear_combination (attach);
+
+      Grob *acc = Note_column::accidentals (bound_grob->get_parent (X_AXIS));
+      if (acc && to_boolean (ly_assoc_get (ly_symbol2scm ("end-on-accidental"), details, SCM_BOOL_F)))
+        x_coord = robust_relative_extent (acc, commonx, X_AXIS).linear_combination (attach);
 
       details = scm_acons (ly_symbol2scm ("X"),
-                           scm_from_double (extent.linear_combination (attach)),
+                           scm_from_double (x_coord),
                            details);
     }
 
index 2dbaa4c2e7709e7c9dd4afd78d15ebd4ab2fb32e..e1d076c29684d7c71b4a79a281cdd946e0fad86a 100644 (file)
     (Glissando
      . (
        (after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
-       (bound-details . ((right . ((attach-dir .  ,CENTER)
-                                   (padding . 1.5)
+       (bound-details . ((right . ((attach-dir .  ,LEFT)
+                                   (end-on-accidental . #t)
+                                   (padding . 0.5)
                                      ))
-                         (left . ((attach-dir .  ,CENTER)
-                                  (padding . 1.5)
+                         (left . ((attach-dir .  ,RIGHT)
+                                  (padding . 0.5)
                                      ))
                          ))
        (gap . 0.5)