2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2005--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
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.
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.
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/>.
21 #include "tuplet-bracket.hh"
23 #include "paper-column.hh"
24 #include "text-interface.hh"
30 DECLARE_SCHEME_CALLBACK (print
, (SCM
));
31 DECLARE_SCHEME_CALLBACK (calc_cross_staff
, (SCM
));
32 DECLARE_GROB_INTERFACE ();
36 MAKE_SCHEME_CALLBACK (Tuplet_number
, print
, 1);
38 Tuplet_number::print (SCM smob
)
40 Spanner
*me
= unsmob_spanner (smob
);
41 Spanner
*tuplet
= unsmob_spanner (me
->get_object ("bracket"));
43 if (!tuplet
|| !tuplet
->is_live ())
49 SCM stc_scm
= Text_interface::print (smob
);
50 Stencil
*stc
= unsmob_stencil (stc_scm
);
52 stc
->align_to (X_AXIS
, CENTER
);
53 stc
->align_to (Y_AXIS
, CENTER
);
55 SCM cpoints
= tuplet
->get_property ("control-points");
56 Drul_array
<Offset
> points
;
57 if (scm_is_pair (cpoints
))
59 points
[LEFT
] = ly_scm2offset (scm_car (cpoints
));
60 points
[RIGHT
] = ly_scm2offset (scm_cadr (cpoints
));
64 programming_error ("wrong type for control-points");
66 stc
->translate ((points
[RIGHT
] + points
[LEFT
]) / 2);
71 MAKE_SCHEME_CALLBACK (Tuplet_number
, calc_cross_staff
, 1)
73 Tuplet_number::calc_cross_staff (SCM smob
)
75 Grob
*me
= unsmob_grob (smob
);
76 return unsmob_grob (me
->get_object ("bracket"))->get_property ("cross-staff");
79 ADD_INTERFACE (Tuplet_number
,
80 "The number for a bracket.",