#include "directional-element-interface.hh"
#include "item.hh"
#include "libc-extension.hh"
+#include "misc.hh"
#include "note-head.hh"
#include "rhythmic-head.hh"
#include "spanner.hh"
#include "tie.hh"
#include "warn.hh"
-/*
- 0 at threshold, 1 at 0, with 1/x falloff.
- */
-Real peak_around (Real epsilon, Real threshold, Real x)
-{
- if (x < 0)
- return 1.0;
- return max (- epsilon * (x - threshold) / ((x + epsilon) * threshold), 0.0);
-}
void
Tie_formatting_problem::print_ties_configuration (Ties_configuration const *ties)
Real x = robust_relative_extent (bounds[0], x_refpoint_, X_AXIS)[-dir];
chord_outlines_[dir].at (0).height_ = x;
}
-
+ else
+ {
+ Interval x;
+ for (vsize i = 0; i < head_boxes.size (); i++)
+ {
+ x.unite (head_boxes[i][X_AXIS]);
+ }
+
+ chord_outlines_[dir].at (0).height_ = x[dir];
+ }
+
for (vsize i = 0; i < boxes.size (); i++)
insert_extent_into_skyline (&chord_outlines_[dir] ,
boxes[i], Y_AXIS, -dir);
}
spec.position_ = Tie::get_position (ties[i]);
-
+ if (scm_is_number (ties[i]->get_property ("staff-position")))
+ {
+ spec.manual_position_ = scm_to_double (ties[i]->get_property ("staff-position"));
+ spec.has_manual_position_ = true;
+ spec.position_ = int (my_round (spec.manual_position_));
+ }
+
do
{
spec.note_head_drul_[d] = Tie::head (ties[i], d);
}
void
-Tie_formatting_problem::from_lv_ties (vector<Grob*> const &lv_ties)
+Tie_formatting_problem::from_semi_ties (vector<Grob*> const &lv_ties, Direction head_dir)
{
if (lv_ties.empty ())
return;
spec.position_ = int (Staff_symbol_referencer::get_position (head));
}
- spec.note_head_drul_[LEFT] = head;
+ spec.note_head_drul_[head_dir] = head;
heads.push_back (head);
specifications_.push_back (spec);
}
for (vsize i = 0; i < heads.size (); i++)
x_refpoint_ = heads[i]->common_refpoint (x_refpoint_, X_AXIS);
- set_chord_outline (heads, LEFT);
+ set_chord_outline (heads, head_dir);
- Real right_most = - infinity_f;
+ Real extremal = head_dir * infinity_f;
- for (vsize i = 0; i < chord_outlines_[LEFT].size (); i++)
+ for (vsize i = 0; i < chord_outlines_[head_dir].size (); i++)
{
- right_most = max (right_most, chord_outlines_[LEFT][i].height_);
+ extremal = head_dir * min (head_dir * extremal,
+ head_dir * chord_outlines_[head_dir][i].height_);
}
Skyline_entry right_entry;
right_entry.width_.set_full ();
- right_entry.height_ = right_most + 1.5;
+ right_entry.height_ = extremal - head_dir * 1.5;
- chord_outlines_[RIGHT].push_back (right_entry);
+ chord_outlines_[-head_dir].push_back (right_entry);
}
bool y_tune = true;
if (dot_positions_.find (pos) != dot_positions_.end ())
{
- conf->delta_y_ += 0.25 * details_.staff_space_;
+ conf->delta_y_ += dir * 0.25 * details_.staff_space_;
y_tune = false;
}
for (int i = 0; i < details_.single_tie_region_size_; i ++)
{
confs.push_back (generate_configuration (pos + i * dir, dir));
+
+ if (spec.has_manual_position_)
+ {
+ confs.back ()->delta_y_
+ = (spec.manual_position_ - spec.position_)
+ * 0.5 * details_.staff_space_;
+
+ break;
+ }
}
vector<Real> scores;