]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tuplet-bracket.cc
Merge branch 'lilypond/translation' into staging
[lilypond.git] / lily / tuplet-bracket.cc
index b2c67cbb18d27d5df1b1288f90ced5c86621f057..40e0c728c5ef2c353de391bd5da025386bce7007 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2011 Jan Nieuwenhuizen <janneke@gnu.org>
+  Copyright (C) 1997--2012 Jan Nieuwenhuizen <janneke@gnu.org>
   Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -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];
         }
 
@@ -652,7 +655,26 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy)
       Grob *number = unsmob_grob (tuplets[i]->get_object ("tuplet-number"));
       if (number)
         points.push_back (Offset (number->extent (commonx, X_AXIS).center () - x0,
-                                                  number->extent (commony, Y_AXIS)[dir]));
+                                  number->extent (commony, Y_AXIS)[dir]));
+    }
+
+  if (to_boolean (me->get_property ("avoid-scripts"))
+      && !scm_is_number (me->get_property ("outside-staff-priority")))
+    {
+      extract_grob_set (me, "scripts", scripts);
+      for (vsize i = 0; i < scripts.size (); i++)
+        {
+          if (!scripts[i]->is_live ())
+            continue;
+          if (scm_is_number (scripts[i]->get_property ("outside-staff-priority")))
+            continue;
+
+          Interval script_x (scripts[i]->extent (commonx, X_AXIS));
+          Interval script_y (scripts[i]->extent (commony, Y_AXIS));
+
+          points.push_back (Offset (script_x.center () - x0,
+                                    script_y[dir]));
+        }
     }
 
   *offset = -dir * infinity_f;
@@ -767,6 +789,12 @@ Tuplet_bracket::add_column (Grob *me, Item *n)
   add_bound_item (dynamic_cast<Spanner *> (me), n);
 }
 
+void
+Tuplet_bracket::add_script (Grob *me, Item *s)
+{
+  Pointer_group_interface::add_grob (me, ly_symbol2scm ("scripts"), s);
+}
+
 void
 Tuplet_bracket::add_tuplet_bracket (Grob *me, Grob *bracket)
 {
@@ -812,6 +840,7 @@ ADD_INTERFACE (Tuplet_bracket,
                " @code{edge-text} are printed at the edges.",
 
                /* properties */
+               "avoid-scripts "
                "bracket-flare "
                "bracket-visibility "
                "break-overshoot "