*/
#include "tuplet-bracket.hh"
+#include "axis-group-interface.hh"
#include "line-interface.hh"
#include "beam.hh"
#include "warn.hh"
return 0;
Drul_array<Grob *> beams;
- Direction d = LEFT;
- do
+ for (LEFT_and_RIGHT (d))
beams[d] = stems[d] ? Stem::get_beam (stems[d]) : 0;
- while (flip (&d) != LEFT);
*equally_long = false;
if (! (beams[LEFT] && (beams[LEFT] == beams[RIGHT]) && !me->is_broken ()))
get_x_bound_item (me, RIGHT, dir));
Drul_array<bool> connect_to_other (false, false);
- Direction d = LEFT;
- do
+ for (LEFT_and_RIGHT (d))
{
Direction break_dir = bounds[d]->break_status_dir ();
Spanner *orig_spanner = dynamic_cast<Spanner *> (me->original ());
&& neighbor_idx < orig_spanner->broken_intos_.size ()
&& orig_spanner->broken_intos_[neighbor_idx]->is_live ());
}
- while (flip (&d) != LEFT);
if (connect_to_other[LEFT] || connect_to_other[RIGHT])
return scm_cons (scm_from_bool (connect_to_other[LEFT]),
Drul_array<bool> (false, false));
Interval x_span;
- Direction d = LEFT;
- do
+ for (LEFT_and_RIGHT (d))
{
- x_span[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])
{
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];
}
x_span[d] = coord - padding;
}
}
- while (flip (&d) != LEFT);
return ly_interval2scm (x_span - me->get_bound (LEFT)->relative_coordinate (commonx, X_AXIS));
}
Interval positions = robust_scm2interval (scm_positions, Interval (0.0, 0.0));
Drul_array<Offset> points;
- Direction d = LEFT;
- do
+ for (LEFT_and_RIGHT (d))
points[d] = Offset (x_span[d], positions[d]);
- while (flip (&d) != LEFT);
Output_def *pap = me->layout ();
= robust_scm2booldrul (me->get_property ("connect-to-neighbor"),
Drul_array<bool> (false, false));
- Direction d = LEFT;
- do
+ for (LEFT_and_RIGHT (d))
{
if (connect_to_other[d])
{
}
}
}
- while (flip (&d) != LEFT);
Stencil brack = make_bracket (me, Y_AXIS,
points[RIGHT] - points[LEFT],
Interval (-0.5, 0.5) * gap + 0.1,
flare, shorten);
- do
+ for (LEFT_and_RIGHT (d))
{
if (!edge_stencils[d].is_empty ())
brack.add_stencil (edge_stencils[d]);
}
- while (flip (&d) != LEFT);
mol.add_stencil (brack);
}
Drul_array<Offset> straight_corners = corners;
- Direction d = LEFT;
- do
+ for (LEFT_and_RIGHT (d))
straight_corners[d] += -d * shorten[d] / length * dz;
- while (flip (&d) != LEFT);
if (!gap.is_empty ())
{
- do
+ for (LEFT_and_RIGHT (d))
gap_corners[d] = (dz * 0.5) + gap[d] / length * dz;
- while (flip (&d) != LEFT);
}
Drul_array<Offset> flare_corners = straight_corners;
- do
+ for (LEFT_and_RIGHT (d))
{
flare_corners[d][bracket_axis] = straight_corners[d][bracket_axis];
flare_corners[d][protrusion_axis] += height[d];
straight_corners[d][bracket_axis] += -d * flare[d];
}
- while (flip (&d) != LEFT);
Stencil m;
- do
+ for (LEFT_and_RIGHT (d))
{
if (!gap.is_empty ())
m.add_stencil (Line_interface::line (me, straight_corners[d],
flare_corners[d]));
}
- while (flip (&d) != LEFT);
-
if (gap.is_empty ())
m.add_stencil (Line_interface::line (me, straight_corners[LEFT],
straight_corners[RIGHT]));
Note_column::get_stem (columns.back ()));
Interval poss;
- Direction side = LEFT;
- do
+ for (LEFT_and_RIGHT (side))
{
// Trigger setting of stem lengths if necessary.
if (Grob *beam = Stem::get_beam (stems[side]))
poss[side] = stems[side]->extent (stems[side], Y_AXIS)[get_grob_direction (stems[side])]
+ stems[side]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
}
- while (flip (&side) != LEFT);
*dy = poss[RIGHT] - poss[LEFT];
points.push_back (Offset (stems[LEFT]->relative_coordinate (commonx, X_AXIS) - x0, poss[LEFT]));
if (!tuplets[i]->is_live ())
continue;
- Direction d = LEFT;
Drul_array<Real> positions
= robust_scm2interval (tuplets[i]->get_property ("positions"),
Interval (0, 0));
Real other_dy = positions[RIGHT] - positions[LEFT];
- do
+ for (LEFT_and_RIGHT (d))
{
Real y
= tuplet_y.linear_combination (d * sign (other_dy));
points.push_back (Offset (tuplet_x[d] - x0, y));
}
- while (flip (&d) != LEFT);
+
// Check for number-on-bracket collisions
Grob *number = unsmob_grob (tuplets[i]->get_object ("tuplet-number"));
if (number)
number->extent (commony, Y_AXIS)[dir]));
}
- if (to_boolean (me->get_property ("avoid-scripts")))
+ 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;
+
+ // assume that if a script is avoiding slurs, it should not get placed
+ // under a tuplet bracket
+ if (unsmob_grob (scripts[i]->get_object ("slur")))
+ continue;
Interval script_x (scripts[i]->extent (commonx, X_AXIS));
Interval script_y (scripts[i]->extent (commony, Y_AXIS));
/*
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;
}
Direction d = Note_column::dir (columns[i]);
extremal_positions[d] = minmax (d, 1.0 * Note_column::head_positions_interval (columns[i])[d], extremal_positions[d]);
}
- Direction d = LEFT;
- do
+ for (LEFT_and_RIGHT (d))
extremal_positions[d] = -d * (staff_extent[d] - extremal_positions[d]);
- while (flip (&d) != LEFT);
return extremal_positions[UP] <= extremal_positions[DOWN] ? UP : DOWN;
}