]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tuplet-bracket.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / tuplet-bracket.cc
index 37099683bf859b33cf91cbcf5fea282f60c74087..f4b4456812d0c45130a446d894cba119be12903f 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2012 Jan Nieuwenhuizen <janneke@gnu.org>
+  Copyright (C) 1997--2014 Jan Nieuwenhuizen <janneke@gnu.org>
   Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -92,8 +92,10 @@ Tuplet_bracket::parallel_beam (Grob *me_grob, vector<Grob *> const &cols,
 {
   Spanner *me = dynamic_cast<Spanner *> (me_grob);
 
-  if (me->get_bound (LEFT)->break_status_dir ()
-      || me->get_bound (RIGHT)->break_status_dir ())
+  Item *left = me->get_bound (LEFT);
+  Item *right = me->get_bound (RIGHT);
+  if (!left || left->break_status_dir ()
+      || !right || right->break_status_dir ())
     return 0;
 
   Drul_array<Grob *> stems (Note_column::get_stem (cols[0]),
@@ -199,9 +201,8 @@ Tuplet_bracket::calc_x_positions (SCM smob)
   Interval x_span;
   for (LEFT_and_RIGHT (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];
+      x_span[d] = Axis_group_interface::generic_bound_extent (bounds[d], commonx, X_AXIS)[d];
+
       if (connect_to_other[d])
         {
           Interval overshoot (robust_scm2drul (me->get_property ("break-overshoot"),
@@ -651,10 +652,7 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy)
 
           // assume that if a script is avoiding slurs, it should not get placed
           // under a tuplet bracket
-          SCM avoid = scripts[i]->get_property ("avoid-slur");
-          if (unsmob_grob (scripts[i]->get_object ("slur"))
-              && (avoid == ly_symbol2scm ("outside")
-                  || avoid == ly_symbol2scm ("around")))
+          if (unsmob_grob (scripts[i]->get_object ("slur")))
             continue;
 
           Interval script_x (scripts[i]->extent (commonx, X_AXIS));
@@ -681,21 +679,20 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy)
   /*
     horizontal brackets should not collide with staff lines.
 
-    Kind of pointless since we put them outside the staff anyway, but
-    let's leave code for the future when possibly allow them to move
-    into the staff once again.
-
     This doesn't seem to support cross-staff tuplets atm.
   */
-  if (*dy == 0
-      && fabs (*offset) < ss * Staff_symbol_referencer::staff_radius (me))
+  if (*dy == 0)
     {
       // quantize, then do collision check.
-      *offset *= 2 / ss;
+      *offset /= 0.5 * ss;
 
-      *offset = rint (*offset);
-      if (Staff_symbol_referencer::on_line (me, (int) rint (*offset)))
-        *offset += dir;
+      Interval staff_span = Staff_symbol_referencer::staff_span (me);
+      if (staff_span.contains (*offset))
+        {
+          *offset = rint (*offset);
+          if (Staff_symbol_referencer::on_line (me, int (*offset)))
+            *offset += dir;
+        }
 
       *offset *= 0.5 * ss;
     }