- Offset o;
- if (Spanner *mother = dynamic_cast<Spanner*> (me->original_l_))
- {
- for (int i = dir == LEFT ? 0 : mother->broken_into_l_arr_.size () - 1;
- dir == LEFT ? i < mother->broken_into_l_arr_.size () : i > 0;
- dir == LEFT ? i++ : i--)
- {
- if (mother->broken_into_l_arr_[i - dir] == me)
- {
- Grob *neighbour = mother->broken_into_l_arr_[i];
- if (dir == RIGHT)
- neighbour->set_grob_property ("direction",
- me->get_grob_property ("direction"));
- Real neighbour_y = get_first_notecolumn_y (neighbour, dir);
- Real y = get_first_notecolumn_y (me, -dir);
- int neighbour_cols = scm_ilength (neighbour->get_grob_property ("note-columns"));
- int cols = scm_ilength (me->get_grob_property ("note-columns"));
- o = Offset (0, (y*neighbour_cols + neighbour_y*cols) /
- (cols + neighbour_cols));
- break;
- }
- }
- }
- return o;
-}
-
-Offset
-Slur::get_attachment (Grob *me, Direction dir,
- Grob **common)
-{
- SCM s = me->get_grob_property ("attachment");
- if (!gh_symbol_p (index_cell (s, dir)))
- {
- set_extremities (me);
- s = me->get_grob_property ("attachment");
- }
- SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s);
- Spanner*sp = dynamic_cast<Spanner*> (me);
- String str = ly_symbol2string (a);
- Real staff_space = Staff_symbol_referencer::staff_space ((Grob*)me);
- Real hs = staff_space / 2.0;
- Offset o;
-
- Grob *stem = 0;
- if (Note_column::has_interface (sp->get_bound (dir)))
- {
- Grob * n =sp->get_bound (dir);
- if ((stem = Note_column::stem_l (n)))
- {
-
- if (str == "head")
- {
- o = Offset (0, Stem::head_positions (stem)
- [Directional_element_interface::get (me)] * hs);
- /*
- Default position is centered in X, on outer side of head Y
- */
- o += Offset (0.5 * n->extent (n,X_AXIS).length (),
- 0.5 * staff_space
- * Directional_element_interface::get (me));
- }
- else if (str == "alongside-stem")
- {
- o = Offset (0, Stem::chord_start_f (stem));
- /*
- Default position is on stem X, on outer side of head Y
- */
- o += Offset (n->extent (n,X_AXIS).length ()
- * (1 + Stem::get_direction (stem)),
- 0.5 * staff_space
- * Directional_element_interface::get (me));
- }
- else if (str == "stem")
- {
- o = Offset (0, Stem::stem_end_position (stem) * hs);
- /*
- Default position is on stem X, at stem end Y
- */
- o += Offset (0.5 *
- (n->extent (n,X_AXIS).length ()
- - stem->extent (stem,X_AXIS).length ())
- * (1 + Stem::get_direction (stem)),
- 0);
- }
- }
- }
- else if (str == "loose-end")
- {
- SCM other_a = dir == LEFT ? gh_cdr (s) : gh_car (s);
- if (ly_symbol2string (other_a) != "loose-end")
- {
-#if 0
- /*
- The braindead way: horizontal
- */
- o = Offset (0, get_attachment (me, -dir, common)[Y_AXIS]);
-#else
- o = broken_trend_offset (me, dir);
-#endif
-
-
- }
-
- }