]> git.donarmstrong.com Git - lilypond.git/blob - lily/semi-tie-column.cc
Merge with master
[lilypond.git] / lily / semi-tie-column.cc
1 /*
2   semi-tie-column.cc -- implement Semi_tie_column
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 */
9
10 #include "semi-tie-column.hh"
11 #include "semi-tie.hh"
12 #include "grob.hh"
13 #include "tie-column.hh"
14 #include "tie.hh"
15 #include "directional-element-interface.hh"
16 #include "pointer-group-interface.hh"
17 #include "staff-symbol-referencer.hh"
18 #include "item.hh"
19 #include "tie-formatting-problem.hh"
20 #include "tie-column-format.hh"
21
22
23 ADD_INTERFACE(Semi_tie_column,
24               "The interface for a column of l.v. ties.",
25
26               /* properties */
27               "positioning-done "
28               "head-direction "
29               "tie-configuration "
30               );
31                            
32
33
34 /*
35   Cut & paste from tie-column.cc
36  */   
37 MAKE_SCHEME_CALLBACK(Semi_tie_column, calc_positioning_done, 1);
38 SCM
39 Semi_tie_column::calc_positioning_done (SCM smob)
40 {
41   Grob *me = unsmob_grob (smob);
42   
43   extract_grob_set (me, "ties", lv_ro_ties);
44   vector<Grob*> lv_ties (lv_ro_ties);
45
46   vector_sort (lv_ties, Semi_tie::less);
47
48   Ties_configuration ties_config;
49   
50
51   Tie_formatting_problem problem;
52   
53   problem.from_semi_ties (lv_ties, to_dir (me->get_property ("head-direction")));
54
55   SCM manual_configs = me->get_property ("tie-configuration");
56   problem.set_manual_tie_configuration (manual_configs);
57
58   Ties_configuration base = problem.generate_optimal_configuration ();
59   for (vsize i = 0; i < lv_ties.size(); i++)
60     {
61       SCM cp = Tie::get_control_points (lv_ties[i], problem.common_x_refpoint (), base[i],
62                                         problem.details_);
63
64       lv_ties[i]->set_property ("control-points", cp);
65       set_grob_direction (lv_ties[i], base[i].dir_);
66
67       problem.set_debug_scoring (base);
68     }
69   
70   return SCM_BOOL_T;
71 }
72   
73