Merge branch 'fret-diagram-details'
[lilypond/csorensen.git] / lily / semi-tie.cc
blob4f3c6b39d81c9bd38af5c5c71a93e10a955d4472
1 /*
2 semi-tie.cc -- implement Semi_tie
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 */
10 #include "semi-tie-column.hh"
11 #include "semi-tie.hh"
12 #include "directional-element-interface.hh"
13 #include "grob.hh"
14 #include "tie.hh"
15 #include "warn.hh"
16 #include "staff-symbol-referencer.hh"
18 ADD_INTERFACE (Semi_tie,
19 "A tie which is only on one side connected to a note head.",
21 /* properties */
22 "control-points "
23 "direction "
24 "details "
25 "head-direction "
26 "note-head "
27 "thickness "
30 MAKE_SCHEME_CALLBACK (Semi_tie, calc_control_points, 1)
31 SCM
32 Semi_tie::calc_control_points (SCM smob)
34 Grob *me = unsmob_grob (smob);
35 (void) me->get_property ("direction");
37 if (Semi_tie_column::has_interface (me->get_parent (Y_AXIS)))
39 me->get_parent (Y_AXIS)->get_property ("positioning-done");
41 else
43 programming_error ("lv tie without Semi_tie_column. Killing lv tie.");
44 me->suicide ();
47 return me->get_property_data ("control-points");
50 int
51 Semi_tie::get_position (Grob *me)
53 Grob *h = unsmob_grob (me->get_object ("note-head"));
54 return (int) rint (Staff_symbol_referencer::get_position (h));
57 bool
58 Semi_tie::less (Grob *const &s1,
59 Grob *const &s2)
61 return get_position (s1) < get_position (s2);