Real by = 0.0;
if (Spanner *mother = dynamic_cast<Spanner *> (state.slur_->original ()))
{
- vsize k = broken_spanner_index (state.slur_);
- int j = int (k) + hdir;
- if (j < 0 || vsize (j) >= mother->broken_intos_.size ())
+ Grob *neighbor = mother->broken_neighbor (hdir);
+ if (!neighbor)
return by;
- Grob *neighbor = mother->broken_intos_[j];
+
Spanner *common_mother
= dynamic_cast<Spanner *> (state.common_[Y_AXIS]->original ());
int common_k
if (extremes_[RIGHT].note_column_)
return;
- if (Spanner *mother = dynamic_cast<Spanner *> (slur_->original ()))
+ if (Grob *neighbor = slur_->broken_neighbor (RIGHT))
{
- vsize j = 1 + broken_spanner_index (slur_);
- if (j >= mother->broken_intos_.size ())
- return;
-
- Grob *neighbor = mother->broken_intos_[j];
set_grob_direction (neighbor, dir_);
}
}
slur_ = dynamic_cast<Spanner *> (me);
columns_
= internal_extract_grob_array (me, ly_symbol2scm ("note-columns"));
-
+
if (columns_.empty ())
{
me->suicide ();
return;
}
+ 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;
bool debug_slurs = to_boolean (slur_->layout ()
->lookup_variable (ly_symbol2scm ("debug-slur-scoring")));
SCM inspect_quants = slur_->get_property ("inspect-quants");
+ SCM inspect_index = slur_->get_property ("inspect-index");
if (debug_slurs
- && scm_is_pair (inspect_quants))
+ && scm_is_integer (inspect_index))
+ {
+ opt_idx = scm_to_int (inspect_index);
+ configurations_[opt_idx]->calculate_score (*this);
+ opt = configurations_[opt_idx]->score ();
+ }
+ else if (debug_slurs
+ && scm_is_pair (inspect_quants))
{
opt_idx = get_closest_index (inspect_quants);
configurations_[opt_idx]->calculate_score (*this);
}
else
{
- programming_error ("No optimal slur found. Guessing 0.");
total = "no sol?";
}
}
#endif
+ if (opt_idx < 0)
+ {
+ opt_idx = 0;
+ programming_error ("No optimal slur found. Guessing 0.");
+ }
+
return configurations_[opt_idx]->curve_;
}
+Grob *
+Slur_score_state::breakable_bound_item (Direction d) const
+{
+ Grob *col = slur_->get_bound (d)->get_column ();
+
+ extract_grob_set (slur_, "encompass-objects", extra_encompasses);
+
+ for (vsize i = 0; i < extra_encompasses.size (); i++)
+ {
+ Item *item = dynamic_cast<Item*> (extra_encompasses[i]);
+ if (item && col == item->get_column ())
+ return item;
+ }
+
+ return 0;
+}
+
int
Slur_score_state::get_closest_index (SCM inspect_quants) const
{
}
}
if (mindist > 1e5)
- programming_error ("can't not find quant");
+ programming_error ("cannot find quant");
return opt_idx;
}
{
end_ys[d] = dir_
* max (max (dir_ * (base_attachments_[d][Y_AXIS]
- + parameters_.region_size_ * dir_),
+ + parameters_.region_size_ * dir_),
dir_ * (dir_ + extremes_[d].note_column_->extent (common_[Y_AXIS], Y_AXIS)[dir_])),
dir_ * base_attachments_[-d][Y_AXIS]);
}
{
if (!extremes_[d].note_column_)
{
- Real x, y;
- if (d == RIGHT)
+ Real x = 0;
+ Real y = 0;
+
+ if (Grob *g = breakable_bound_item (d))
+ {
+ x = robust_relative_extent (g, common_[X_AXIS], X_AXIS)[RIGHT];
+ }
+ else if (d == RIGHT)
x = robust_relative_extent (extremes_[d].bound_, common_[X_AXIS], X_AXIS)[d];
else
x = slur_->get_broken_left_end_align ();
+
Grob *col = (d == LEFT) ? columns_[0] : columns_.back ();
if (extremes_[-d].bound_ != col)