]> git.donarmstrong.com Git - lilypond.git/blob - lily/semi-tie.cc
unsmob_pitch -> Pitch::unsmob and related
[lilypond.git] / lily / semi-tie.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2005--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6
7   LilyPond is free software: you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   LilyPond is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "semi-tie-column.hh"
22 #include "semi-tie.hh"
23 #include "directional-element-interface.hh"
24 #include "grob.hh"
25 #include "tie.hh"
26 #include "warn.hh"
27 #include "staff-symbol-referencer.hh"
28
29 ADD_INTERFACE (Semi_tie,
30                "A tie which is only connected to a note head on one side."
31                "\n"
32                "The following properties may be set in the @code{details}"
33                " list:\n"
34                "\n"
35                "@table @code\n"
36                "@item height-limit\n"
37                "Maximum tie height: The longer the tie, the closer it is"
38                " to this height.\n"
39                "@item ratio\n"
40                "Parameter for tie shape.  The higher this number, the"
41                " quicker the tie attains its @code{height-limit}.\n"
42                "@end table\n",
43
44                /* properties */
45                "control-points "
46                "direction "
47                "details "
48                "head-direction "
49                "note-head "
50                "thickness "
51               );
52
53 MAKE_SCHEME_CALLBACK (Semi_tie, calc_control_points, 1)
54 SCM
55 Semi_tie::calc_control_points (SCM smob)
56 {
57   Grob *me = Grob::unsmob (smob);
58   (void) me->get_property ("direction");
59
60   if (Semi_tie_column::has_interface (me->get_parent (Y_AXIS)))
61     {
62       me->get_parent (Y_AXIS)->get_property ("positioning-done");
63     }
64   else
65     {
66       programming_error ("lv tie without Semi_tie_column.  Killing lv tie.");
67       me->suicide ();
68     }
69
70   return me->get_property_data ("control-points");
71 }
72
73 int
74 Semi_tie::get_position (Grob *me)
75 {
76   Grob *h = Grob::unsmob (me->get_object ("note-head"));
77   return (int) rint (Staff_symbol_referencer::get_position (h));
78 }
79
80 bool
81 Semi_tie::less (Grob *const &s1,
82                 Grob *const &s2)
83 {
84   return get_position (s1) < get_position (s2);
85 }
86