/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 1996--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
LilyPond is free software: you can redistribute it and/or modify
#include "staff-symbol-referencer.hh"
#include "staff-symbol.hh"
#include "stem.hh"
-#include "time-signature.hh"
#include "warn.hh"
/*
{
musical_dy_ = 0.0;
valid_ = false;
- stub_ = false;
edge_has_beams_ = false;
has_same_beam_ = false;
is_broken_ = false;
Encompass_info
Slur_score_state::get_encompass_info (Grob *col) const
{
- Grob *stem = unsmob_grob (col->get_object ("stem"));
+ Grob *stem = Grob::unsmob (col->get_object ("stem"));
Encompass_info ei;
if (!stem)
{
programming_error ("no stem for note column");
ei.x_ = col->relative_coordinate (common_[X_AXIS], X_AXIS);
- ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS],
- Y_AXIS, stub_, 0, INT_MAX)[dir_];
+ ei.head_ = ei.stem_ = col->extent (common_[Y_AXIS],
+ Y_AXIS)[dir_];
return ei;
}
Direction stem_dir = get_grob_direction (stem);
Grob *h = Stem::extremal_heads (stem)[Direction (dir_)];
if (!h)
{
- ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+ ei.head_ = ei.stem_ = col->extent (common_[Y_AXIS], Y_AXIS)[dir_];
return ei;
}
- ei.head_ = h->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+ ei.head_ = h->extent (common_[Y_AXIS], Y_AXIS)[dir_];
if ((stem_dir == dir_)
- && !stem->maybe_pure_extent (stem, Y_AXIS, stub_, 0, INT_MAX).is_empty ())
+ && !stem->extent (stem, Y_AXIS).is_empty ())
{
- ei.stem_ = stem->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+ ei.stem_ = stem->extent (common_[Y_AXIS], Y_AXIS)[dir_];
if (Grob *b = Stem::get_beam (stem))
ei.stem_ += stem_dir * 0.5 * Beam::get_beam_thickness (b);
for (int a = X_AXIS; a < NO_AXES; a++)
{
Axis ax = Axis (a);
- Interval s = ax == Y_AXIS
- ? extremes[d].stem_->maybe_pure_extent (common_[ax], ax, stub_, 0, INT_MAX)
- : extremes[d].stem_->extent (common_[ax], ax);
+ Interval s = extremes[d].stem_->extent (common_[ax], ax);
if (extremes[d].flag_)
- s.unite (ax == Y_AXIS
- ? extremes[d].flag_->maybe_pure_extent (common_[ax], ax, stub_, 0, INT_MAX)
- : extremes[d].flag_->extent (common_[ax], ax));
+ s.unite (extremes[d].flag_->extent (common_[ax], ax));
if (s.is_empty ())
{
/*
whole notes.
*/
s = Interval (0, 0)
- + (ax == Y_AXIS
- ? extremes[d].stem_->maybe_pure_coordinate (common_[ax], ax, stub_, 0, INT_MAX)
- : extremes[d].stem_->relative_coordinate (common_[ax], ax));
+ + extremes[d].stem_->relative_coordinate (common_[ax], ax);
}
extremes[d].stem_extent_[ax] = s;
}
Slur_score_state::fill (Grob *me)
{
slur_ = dynamic_cast<Spanner *> (me);
- stub_ = slur_->internal_has_interface (ly_symbol2scm ("cross-staff-stub-interface"));
-
columns_
= internal_extract_grob_array (me, ly_symbol2scm ("note-columns"));
Slur::replace_breakable_encompass_objects (me);
staff_space_ = Staff_symbol_referencer::staff_space (me);
- Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
- thickness_ = robust_scm2double (me->get_property ("thickness"), 1.0) * lt;
+ line_thickness_ = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
+ thickness_ = robust_scm2double (me->get_property ("thickness"), 1.0) * line_thickness_;
dir_ = slur_direction ();
parameters_.fill (me);
&& minmax (dir_, encompass_place, y_place) == encompass_place
&& (!extra_encompass_infos_[i].grob_->internal_has_interface (ly_symbol2scm ("key-signature-interface"))
&& !Clef::has_interface (extra_encompass_infos_[i].grob_)
- && !Time_signature::has_interface (extra_encompass_infos_[i].grob_)))
+ && !extra_encompass_infos_[i].grob_->internal_has_interface (ly_symbol2scm ("time-signature-interface"))))
{
for (LEFT_and_RIGHT (d))
additional_ys[d] = minmax (dir_,
if (!is_broken_
&& extremes_[d].slur_head_)
musical_dy_ += d
- * extremes_[d].slur_head_->maybe_pure_coordinate (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX);
+ * extremes_[d].slur_head_->relative_coordinate (common_[Y_AXIS], Y_AXIS);
}
edge_has_beams_
SCM
Slur::calc_control_points (SCM smob)
{
- Spanner *me = unsmob_spanner (smob);
-
- if (!to_boolean (me->get_property ("cross-staff"))
- && me->internal_has_interface (ly_symbol2scm ("cross-staff-stub-interface")))
- {
- me->suicide ();
- return SCM_EOL;
- }
+ Spanner *me = Spanner::unsmob (smob);
Slur_score_state state;
state.fill (me);
{
Offset o = best->curve_.control_[i]
- Offset (me->relative_coordinate (state.common_[X_AXIS], X_AXIS),
- me->maybe_pure_coordinate (state.common_[Y_AXIS], Y_AXIS,
- state.stub_, 0, INT_MAX));
-
+ me->relative_coordinate (state.common_[Y_AXIS], Y_AXIS));
controls = scm_cons (ly_offset2scm (o), controls);
}
{
if (extremes_[d].note_column_)
{
- end_ys[d] = dir_
- * max (max (dir_ * (base_attachments_[d][Y_AXIS]
- + parameters_.region_size_ * dir_),
- dir_ * (dir_ + extremes_[d].note_column_->maybe_pure_extent
- (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_])),
- dir_ * base_attachments_[-d][Y_AXIS]);
+ Interval nc_extent = extremes_[d].note_column_
+ ->extent (common_[Y_AXIS], Y_AXIS);
+ if (nc_extent.is_empty ())
+ slur_->warning ("slur trying to encompass an empty note column.");
+ else
+ end_ys[d] = dir_
+ * max (max (dir_ * (base_attachments_[d][Y_AXIS]
+ + parameters_.region_size_ * dir_),
+ dir_ * (dir_ + nc_extent[dir_])),
+ dir_ * base_attachments_[-d][Y_AXIS]);
}
else
end_ys[d] = base_attachments_[d][Y_AXIS] + parameters_.region_size_ * dir_;
|| has_same_beam_))
y = extremes_[d].stem_extent_[Y_AXIS][dir_];
else if (head)
- y = head->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+ y = head->extent (common_[Y_AXIS], Y_AXIS)[dir_];
y += dir_ * 0.5 * staff_space_;
y = move_away_from_staffline (y, head);
if (extremes_[-d].bound_ != col)
{
- y = maybe_pure_robust_relative_extent (col, common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+ y = robust_relative_extent (col, common_[Y_AXIS], Y_AXIS)[dir_];
y += dir_ * 0.5 * staff_space_;
if (get_grob_direction (col) == dir_
return y;
Real pos
- = (y - staff_symbol->maybe_pure_coordinate (common_[Y_AXIS],
- Y_AXIS, stub_, 0, INT_MAX))
+ = (y - staff_symbol->relative_coordinate (common_[Y_AXIS],
+ Y_AXIS))
* 2.0 / staff_space_;
if (fabs (pos - my_round (pos)) < 0.2
Offset z = b.curve_point (0.5);
z += Offset (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS),
- small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX));
+ small_slur->relative_coordinate (common_[Y_AXIS], Y_AXIS));
z[Y_AXIS] += dir_ * parameters_.free_slur_distance_;
avoid.push_back (z);
{
Grob *g = extra_encompasses [i];
Interval xe = g->extent (common_[X_AXIS], X_AXIS);
- Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX);
+ Interval ye = g->extent (common_[Y_AXIS], Y_AXIS);
if (!xe.is_empty ()
&& !ye.is_empty ())
Bezier b = Slur::get_curve (small_slur);
Offset relative (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS),
- small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX));
+ small_slur->relative_coordinate (common_[Y_AXIS], Y_AXIS));
for (int k = 0; k < 3; k++)
{
{
Grob *g = encompasses [i];
Interval xe = g->extent (common_[X_AXIS], X_AXIS);
- Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX);
+ Interval ye = g->extent (common_[Y_AXIS], Y_AXIS);
if (Dots::has_interface (g))
ye.widen (0.2);