2 semi-tie-column.cc -- implement Semi_tie_column
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "semi-tie-column.hh"
11 #include "semi-tie.hh"
13 #include "tie-column.hh"
15 #include "directional-element-interface.hh"
16 #include "pointer-group-interface.hh"
17 #include "staff-symbol-referencer.hh"
19 #include "tie-formatting-problem.hh"
20 #include "tie-column-format.hh"
23 ADD_INTERFACE (Semi_tie_column
,
24 "The interface for a column of l.v. (laissez vibrer) ties.",
35 Cut & paste from tie-column.cc
37 MAKE_SCHEME_CALLBACK (Semi_tie_column
, calc_positioning_done
, 1);
39 Semi_tie_column::calc_positioning_done (SCM smob
)
41 Grob
*me
= unsmob_grob (smob
);
43 me
->set_property ("positioning-done", SCM_BOOL_T
);
45 extract_grob_set (me
, "ties", lv_ro_ties
);
46 vector
<Grob
*> lv_ties (lv_ro_ties
);
48 vector_sort (lv_ties
, Semi_tie::less
);
50 Ties_configuration ties_config
;
53 Tie_formatting_problem problem
;
55 problem
.from_semi_ties (lv_ties
, to_dir (me
->get_property ("head-direction")));
57 SCM manual_configs
= me
->get_property ("tie-configuration");
58 problem
.set_manual_tie_configuration (manual_configs
);
60 Ties_configuration base
= problem
.generate_optimal_configuration ();
61 for (vsize i
= 0; i
< lv_ties
.size (); i
++)
63 SCM cp
= Tie::get_control_points (lv_ties
[i
], problem
.common_x_refpoint (), base
[i
],
66 lv_ties
[i
]->set_property ("control-points", cp
);
67 set_grob_direction (lv_ties
[i
], base
[i
].dir_
);
69 problem
.set_debug_scoring (base
);
75 MAKE_SCHEME_CALLBACK (Semi_tie_column
, calc_head_direction
, 1);
77 Semi_tie_column::calc_head_direction (SCM smob
)
79 Grob
*me
= unsmob_grob (smob
);
81 extract_grob_set (me
, "ties", ties
);
83 for (vsize i
= 0; i
< ties
.size (); i
++)
85 Direction this_d
= to_dir (ties
[i
]->get_property ("head-direction"));
86 if (i
> 0 && d
!= this_d
)
88 programming_error ("all semi-ties in a semi-tie-column should have the same head-direction");
89 return scm_from_int (d
);
93 return scm_from_int (d
);