2 tie-column.cc -- implement Tie_column
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "tie-column.hh"
11 #include "group-interface.hh"
13 #include "directional-element-interface.hh"
14 #include "rhythmic-head.hh"
16 Tie_column::Tie_column (SCM s
)
22 Tie_column::set_interface (Score_element
*me
)
24 me
-> set_elt_property ("ties", SCM_EOL
);
25 me
->set_extent_callback (0, X_AXIS
);
26 me
->set_extent_callback (0, Y_AXIS
);
30 Tie_column::add_tie (Score_element
*me
,Tie
*s
)
32 Pointer_group_interface
g (me
, "ties");
35 dynamic_cast<Spanner
*> (me
)->set_bound (LEFT
, Tie::head (s
,LEFT
));
36 dynamic_cast<Spanner
*> (me
)->set_bound (RIGHT
, Tie::head (s
,RIGHT
));
39 Pointer_group_interface (me
, "ties").add_element (s
);
40 s
->add_dependency (me
);
45 tie_compare (Tie
* const & s1
,
48 return sign (Tie::position_f (s1
) - Tie::position_f(s2
));
55 In normal chord cases, the outer ties point outwards, and the
56 direction of the rest is determined by their staff position.
58 Ross forgets about the tie that is *on* the middle staff line. We
59 assume it goes UP. (TODO: make me settable) */
61 Tie_column::set_directions (Score_element
*me
)
63 Link_array
<Tie
> ties
=
64 Pointer_group_interface__extract_elements (me
, (Tie
*)0, "ties");
67 Direction d
= Directional_element_interface (me
).get ();
71 for (int i
= ties
.size (); i
--;)
74 Directional_element_interface (t
).set (d
);
79 if (ties
.size () == 1)
82 Directional_element_interface (t
).set (Tie::get_default_dir (t
));
86 ties
.sort (tie_compare
);
87 Directional_element_interface
tie0(ties
[0]);
91 Directional_element_interface
tietop(ties
.pop ());
94 for (int i
=ties
.size(); i
--; )
97 Real p
= Tie::position_f (t
);
98 Direction d
= (Direction
) sign (p
);
101 Directional_element_interface (t
).set (d
);
106 MAKE_SCHEME_CALLBACK(Tie_column
,after_line_breaking
);
108 Tie_column::after_line_breaking (SCM smob
)
110 set_directions (unsmob_element (smob
));
111 return SCM_UNDEFINED
;