lilypond-devel
[Top][All Lists]
Advanced

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

Re: Overhauls broken bound coordinate checking (issue 5602054)


From: mtsolo
Subject: Re: Overhauls broken bound coordinate checking (issue 5602054)
Date: Wed, 01 Feb 2012 15:14:47 +0000

Reviewers: Neil Puttock,


http://codereview.appspot.com/5602054/diff/2001/input/regression/metronome-mark-broken-bound.ly
File input/regression/metronome-mark-broken-bound.ly (right):

http://codereview.appspot.com/5602054/diff/2001/input/regression/metronome-mark-broken-bound.ly#newcode1
input/regression/metronome-mark-broken-bound.ly:1: \version "2.15.27"
On 2012/02/01 15:04:47, Neil Puttock wrote:
2.15.28

Fixed.

http://codereview.appspot.com/5602054/diff/2001/input/regression/metronome-mark-broken-bound.ly#newcode4
input/regression/metronome-mark-broken-bound.ly:4: texidoc = "A broken
spanner must not interfere with @code{\\tempo}
On 2012/02/01 15:04:47, Neil Puttock wrote:
Surely you mean break-alignable grobs shouldn't interfere with broken
spanners?
You have this back-to-front.

I may or may not have copied and pasted this text with out reading it.

http://codereview.appspot.com/5602054/diff/2001/input/regression/metronome-mark-broken-bound.ly#newcode12
input/regression/metronome-mark-broken-bound.ly:12: \tempo \markup {
"fooooo" } 4 = 90
On 2012/02/01 15:04:47, Neil Puttock wrote:
You might add

\override Score.MetronomeMark #'break-visibility = #all-visible

otherwise you're only checking the left-broken spanners.

Done.

http://codereview.appspot.com/5602054/diff/2001/input/regression/metronome-mark-broken-bound.ly#newcode22
input/regression/metronome-mark-broken-bound.ly:22: \ottava #1 \times
1/1 { e'8\<\startTextSpan\startTrillSpan\glissando\episemInitium
On 2012/02/01 15:04:47, Neil Puttock wrote:
If you want to test episema, you need to add the engraver (it's not
worth it imo
since you wouldn't use it outside a VaticanaVoice and it would never
be broken).

The code's a bit messy here

Fair nuf - removed.

http://codereview.appspot.com/5602054/diff/2001/input/regression/metronome-mark-broken-bound.ly#newcode22
input/regression/metronome-mark-broken-bound.ly:22: \ottava #1 \times
1/1 { e'8\<\startTextSpan\startTrillSpan\glissando\episemInitium
On 2012/02/01 15:04:47, Neil Puttock wrote:
If you want to test episema, you need to add the engraver (it's not
worth it imo
since you wouldn't use it outside a VaticanaVoice and it would never
be broken).

The code's a bit messy here

Fair nuf - omitted.  What'd be the proper formatting here?

http://codereview.appspot.com/5602054/diff/2001/scm/define-grobs.scm
File scm/define-grobs.scm (right):

http://codereview.appspot.com/5602054/diff/2001/scm/define-grobs.scm#newcode1420
scm/define-grobs.scm:1420: (bound-alignment-forbidden-interfaces .
(metronome-mark-interface))
On 2012/02/01 15:04:47, Neil Puttock wrote:
I question whether you need this property.  Would be better just to
exclude
break-alignable-interface in axis-group-interface.cc (so it includes
RehearsalMark and BarNumber - note that these will also interfere with
bounds if
you leave them out here)

If one could never conceive of a case where a bound would need to
include these things, then I could hard code it, but I tend to favor
using properties in case there is a scenario I can't imagine where a
person would want these to be included in NonMusicalPaperColumn bounds.

Description:
Overhauls broken bound coordinate checking

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

Affected files:
  A input/regression/metronome-mark-broken-bound.ly
  M lily/axis-group-interface.cc
  M lily/beam.cc
  M lily/lyric-hyphen.cc
  M lily/ottava-bracket.cc
  M lily/tuplet-bracket.cc
  M scm/define-grob-properties.scm
  M scm/define-grobs.scm


Index: input/regression/metronome-mark-broken-bound.ly
diff --git a/input/regression/metronome-mark-broken-bound.ly b/input/regression/metronome-mark-broken-bound.ly
new file mode 100644
index 0000000000000000000000000000000000000000..5ba5064065ab8e3340aca7861f55881ac2fdbb3e
--- /dev/null
+++ b/input/regression/metronome-mark-broken-bound.ly
@@ -0,0 +1,36 @@
+\version "2.15.28"
+
+\header {
+texidoc = "A @code{MetronomeMark}, @code{RehearsalMark} and @code{BarNumber}
+should not effect the starting point of spanners.
+"
+}
+
+<<
+ \new Staff {
+   e'1 \time 4/4 \break |
+   \tempo \markup { "fooooo" } 4 = 90
+   e'1 |
+   e'1 |
+ }
+
+ \new Staff {
+   \override Score.MetronomeMark #'break-visibility = #all-visible
+   \override TupletBracket #'breakable = ##t
+   \override Beam #'breakable = ##t
+   \override Glissando #'breakable = ##t
+
+   \ottava #1 \times 1/1 { e'8\<\startTextSpan\startTrillSpan\glissando
+     [ \override NoteColumn #'glissando-skip = ##t\repeat unfold 22 e'8
+ \revert NoteColumn #'glissando-skip e'8\!\stopTextSpan\stopTrillSpan ] } |
+ }
+ \addlyrics { ah __ \repeat unfold 21 { \skip 4 } _ rrgh }
+ \addlyrics { ah --  \repeat unfold 21 { \skip 4 } _ rrgh }
+>>
+
+\layout {
+ \context {
+   \Voice
+   \remove "Forbid_line_break_engraver"
+ }
+}
Index: lily/axis-group-interface.cc
diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc
index 8857de109d6b3cb6ec438fae3578fe22386e2da0..ab7845f66e7fba6c4aba84cc353b7288460d225b 100644
--- a/lily/axis-group-interface.cc
+++ b/lily/axis-group-interface.cc
@@ -111,6 +111,7 @@ Axis_group_interface::generic_bound_extent (Grob *me, Grob *common, Axis a)
   vector<Grob *> new_elts;

   SCM interfaces = me->get_property ("bound-alignment-interfaces");
+ SCM forbidden_interfaces = me->get_property ("bound-alignment-forbidden-interfaces");

   for (vsize i = 0; i < elts.size (); i++)
     for (SCM l = interfaces; scm_is_pair (l); l = scm_cdr (l))
@@ -118,7 +119,12 @@ Axis_group_interface::generic_bound_extent (Grob *me, Grob *common, Axis a)
         new_elts.push_back (elts[i]);

   if (!new_elts.size ())
-    return robust_relative_extent (me, common, a);
+    new_elts.insert (new_elts.end (), elts.begin (), elts.end());
+
+  for (vsize i = new_elts.size (); i--;)
+    for (SCM l = forbidden_interfaces; scm_is_pair (l); l = scm_cdr (l))
+      if (new_elts[i]->internal_has_interface (scm_car (l))) {
+        new_elts.erase (new_elts.begin () + i); }

   if (!common)
     common = common_refpoint_of_array (new_elts, me, a);
@@ -852,6 +858,7 @@ ADD_INTERFACE (Axis_group_interface,
                "adjacent-pure-heights "
                "axes "
                "bound-alignment-interfaces "
+               "bound-alignment-forbidden-interfaces "
                "default-staff-staff-spacing "
                "elements "
                "max-stretch "
Index: lily/beam.cc
diff --git a/lily/beam.cc b/lily/beam.cc
index d0b975ec04c10f74d7afe6c58f6798b5f49b334d..4a27d648e1a0790f5321b12bc1a42bf518bf03be 100644
--- a/lily/beam.cc
+++ b/lily/beam.cc
@@ -37,6 +37,7 @@

 #include "beam.hh"

+#include "axis-group-interface.hh"
 #include "align-interface.hh"
 #include "beam-scoring-problem.hh"
 #include "beaming-pattern.hh"
@@ -483,8 +484,8 @@ Beam::calc_beam_segments (SCM smob)
                       && me->get_bound (event_dir)->break_status_dir ())
                     {
                       current.horizontal_[event_dir]
- = (robust_relative_extent (me->get_bound (event_dir),
-                                                   commonx, X_AXIS)[RIGHT]
+ = (Axis_group_interface::generic_bound_extent (me->get_bound (event_dir), + commonx, X_AXIS)[RIGHT]
                            + event_dir * break_overshoot[event_dir]);
                     }
                   else
Index: lily/lyric-hyphen.cc
diff --git a/lily/lyric-hyphen.cc b/lily/lyric-hyphen.cc
index 86ae8cdc659a85345f436740d057a1d9ef86c1e8..65ba72651ecad950581a1f1e3e5ff5db4dc67ac3 100644
--- a/lily/lyric-hyphen.cc
+++ b/lily/lyric-hyphen.cc
@@ -19,6 +19,7 @@

 #include "lyric-hyphen.hh"

+#include "axis-group-interface.hh"
 #include "lookup.hh"
 #include "output-def.hh"
 #include "paper-column.hh"
@@ -50,7 +51,7 @@ Lyric_hyphen::print (SCM smob)
   Drul_array<bool> broken;
   do
     {
-      Interval iv = bounds[d]->extent (common, X_AXIS);
+ Interval iv = Axis_group_interface::generic_bound_extent (bounds[d], common, X_AXIS);

       span_points[d] = iv.is_empty ()
                        ? bounds[d]->relative_coordinate (common, X_AXIS)
Index: lily/ottava-bracket.cc
diff --git a/lily/ottava-bracket.cc b/lily/ottava-bracket.cc
index 38040342ca645c9ac75501ed3ab9774c31be282b..cbe9928b6e977b12b31d4e31aa913c9e2c667232 100644
--- a/lily/ottava-bracket.cc
+++ b/lily/ottava-bracket.cc
@@ -17,6 +17,7 @@
   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */

+#include "axis-group-interface.hh"
 #include "text-interface.hh"
 #include "spanner.hh"
 #include "font-interface.hh"
@@ -114,7 +115,7 @@ Ottava_bracket::print (SCM smob)

       if (broken[d])
         {
-          span_points[d] = b->extent (common, X_AXIS)[RIGHT];
+ span_points[d] = Axis_group_interface::generic_bound_extent (b, common, X_AXIS)[RIGHT];
           shorten[d] = 0.;
         }

Index: lily/tuplet-bracket.cc
diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc
index dbbd782cfbe7a219a09d7ec6d41a14330ace36b0..40e0c728c5ef2c353de391bd5da025386bce7007 100644
--- a/lily/tuplet-bracket.cc
+++ b/lily/tuplet-bracket.cc
@@ -41,6 +41,7 @@
 */

 #include "tuplet-bracket.hh"
+#include "axis-group-interface.hh"
 #include "line-interface.hh"
 #include "beam.hh"
 #include "warn.hh"
@@ -203,8 +204,9 @@ Tuplet_bracket::calc_x_positions (SCM smob)
   Direction d = LEFT;
   do
     {
-      x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS)[d];
-
+      x_span[d] = bounds[d]->break_status_dir ()
+ ? Axis_group_interface::generic_bound_extent (bounds[d], commonx, X_AXIS)[d]
+                  : robust_relative_extent (bounds[d], commonx, X_AXIS)[d];
       if (connect_to_other[d])
         {
Interval overshoot (robust_scm2drul (me->get_property ("break-overshoot"),
@@ -213,8 +215,9 @@ Tuplet_bracket::calc_x_positions (SCM smob)
           if (d == RIGHT)
             x_span[d] += d * overshoot[d];
           else
-            x_span[d] = robust_relative_extent (bounds[d],
-                                                commonx, X_AXIS)[RIGHT]
+            x_span[d] = (bounds[d]->break_status_dir ()
+ ? Axis_group_interface::generic_bound_extent (bounds[d], commonx, X_AXIS)[-d] + : robust_relative_extent (bounds[d], commonx, X_AXIS)[-d])
                         - overshoot[LEFT];
         }

Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index 28443694a686e457542c77af7d9f9db74acf46d7..1633ff8615a7e6ec439e9897fcd3a05fa12a3cdc 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -1022,6 +1022,8 @@ function is to protect objects from being garbage collected.")
      (beam-segments ,list? "Internal representation of beam segments.")
      (bound-alignment-interfaces ,list "Interfaces to be used
 for positioning elements that align with a column.")
+     (bound-alignment-forbidden-interfaces ,list "Interfaces that may not
+be used for positioning elements that align with a column.")
      (bounded-by-me ,ly:grob-array? "An array of spanners that have this
 column as start/@/begin point.  Only columns that have grobs or act as
 bounds are spaced.")
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 97645233c63a9057a319541fb4413b020ca9d002..311a33d14a2119fbe5e5cf38763ce2fa071c9497 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1417,6 +1417,7 @@
        (allow-loose-spacing . #t)
        (axes . (,X))
        (before-line-breaking . ,ly:paper-column::before-line-breaking)
+       (bound-alignment-forbidden-interfaces . (break-alignable-interface))
        (full-measure-extra-space . 1.0)
        (horizontal-skylines . ,ly:separation-item::calc-skylines)
        ;;                    (stencil . ,ly:paper-column::print)





reply via email to

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