2 tie-column.cc -- implement Tie_column
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #include "tie-column.hh"
15 #include "paper-column.hh"
17 #include "pointer-group-interface.hh"
19 #include "directional-element-interface.hh"
20 #include "tie-column-format.hh"
21 #include "tie-formatting-problem.hh"
22 #include "tie-configuration.hh"
27 Tie_column::add_tie (Grob *me, Grob *tie)
29 if (tie->get_parent (Y_AXIS)
30 && Tie_column::has_interface (tie->get_parent (Y_AXIS)))
33 if (!Pointer_group_interface::count (me, ly_symbol2scm ("ties")))
35 dynamic_cast<Spanner *> (me)->set_bound (LEFT, Tie::head (tie, LEFT));
36 dynamic_cast<Spanner *> (me)->set_bound (RIGHT, Tie::head (tie, RIGHT));
39 tie->set_parent (me, Y_AXIS);
40 Pointer_group_interface::add_grob (me, ly_symbol2scm ("ties"), tie);
44 Extend the spanner over its Tie constituents.
46 MAKE_SCHEME_CALLBACK (Tie_column, before_line_breaking, 1);
48 Tie_column::before_line_breaking (SCM smob)
50 Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
51 for (SCM s = me->get_property ("ties"); scm_is_pair (s); s = scm_cdr (s))
53 Spanner *tie = dynamic_cast<Spanner *> (unsmob_grob (scm_car (s)));
57 if (dir * tie->get_bound (dir)->get_column ()->get_rank ()
58 > dir * me->get_bound (dir)->get_column ()->get_rank ())
59 me->set_bound (dir, Tie::head (tie, dir));
61 while (flip (&dir) != LEFT);
64 return SCM_UNSPECIFIED;
67 MAKE_SCHEME_CALLBACK(Tie_column, calc_positioning_done, 1)
69 Tie_column::calc_positioning_done (SCM smob)
71 Grob *me = unsmob_grob (smob);
72 extract_grob_set (me, "ties", ro_ties);
73 vector<Grob*> ties (ro_ties);
80 Already handled by standard mechanisms.
85 vector_sort (ties, &Tie::compare);
87 Tie_formatting_problem problem;
88 problem.from_ties (ties);
90 SCM manual_configs = me->get_property ("tie-configuration");
91 problem.set_manual_tie_configuration (manual_configs);
94 Ties_configuration base = problem.generate_optimal_chord_configuration ();
96 for (vsize i = 0; i < base.size(); i++)
98 Tie::set_control_points (ties[i], problem.common_x_refpoint (),
101 set_grob_direction (ties[i],
109 ADD_INTERFACE (Tie_column, "tie-column-interface",
110 "Object that sets directions of multiple ties in a tied chord",