- return SCM_UNSPECIFIED;
- }
- set_extremities (me);
- set_control_points (me);
- return SCM_UNSPECIFIED;
-}
-
-
-void
-Slur::check_slope (Score_element *me)
-{
- /*
- Avoid too steep slurs.
- */
- SCM s = me->get_elt_property ("slope-limit");
- if (gh_number_p (s))
- {
- Array<Offset> encompass = get_encompass_offset_arr (me);
- Drul_array<Offset> attachment;
- attachment[LEFT] = encompass[0];
- attachment[RIGHT] = encompass.top ();
-
- Real dx = attachment[RIGHT][X_AXIS] - attachment[LEFT][X_AXIS];
- Real dy = attachment[RIGHT][Y_AXIS] - attachment[LEFT][Y_AXIS];
- if (!dx)
- return;
-
- Real slope = slope = abs (dy / dx);
-
- Real limit = gh_scm2double (s);
-
- if (slope > limit)
- {
- Real staff_space = Staff_symbol_referencer::staff_space ((Score_element*)me);
- Direction dir = (Direction)gh_scm2int (me->get_elt_property ("direction"));
- Direction d = (Direction)(- dir * (sign (dy)));
- SCM a = me->get_elt_property ("attachment-offset");
- Drul_array<Offset> o;
- o[LEFT] = ly_scm2offset (index_cell (a, LEFT));
- o[RIGHT] = ly_scm2offset (index_cell (a, RIGHT));
- o[d][Y_AXIS] -= (limit - slope) * dx * dir / staff_space;
- //o[d][Y_AXIS] = attachment[-d][Y_AXIS] + (dx * limit * dir / staff_space);
- me->set_elt_property ("attachment-offset",
- gh_cons (ly_offset2scm (o[LEFT]),
- ly_offset2scm (o[RIGHT])));
- }
- }
-}
-
-void
-Slur::set_extremities (Score_element *me)
-{
- if (!Directional_element_interface::get (me))
- Directional_element_interface::set (me, get_default_dir (me));
-
- Direction dir = LEFT;
- do
- {
- if (!gh_symbol_p (index_cell (me->get_elt_property ("attachment"), dir)))
- {
- for (SCM s = me->get_elt_property ("extremity-rules");
- s != SCM_EOL; s = gh_cdr (s))
- {
- SCM r = gh_call2 (gh_caar (s), me->self_scm (),
- gh_int2scm ((int)dir));
- if (r != SCM_BOOL_F)
- {
- index_set_cell (me->get_elt_property ("attachment"), dir,
- gh_cdar (s));
- break;
- }
- }
- }