2 tuplet-number.cc -- implement Tuplet_number
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "tuplet-bracket.hh"
12 #include "paper-column.hh"
13 #include "text-interface.hh"
19 DECLARE_SCHEME_CALLBACK (print
, (SCM
));
20 DECLARE_SCHEME_CALLBACK (calc_cross_staff
, (SCM
));
21 DECLARE_GROB_INTERFACE ();
25 MAKE_SCHEME_CALLBACK (Tuplet_number
, print
, 1);
27 Tuplet_number::print (SCM smob
)
29 Spanner
*me
= unsmob_spanner (smob
);
30 Spanner
*tuplet
= unsmob_spanner (me
->get_object ("bracket"));
32 if (!tuplet
|| !tuplet
->is_live ())
38 SCM stc_scm
= Text_interface::print (smob
);
39 Stencil
*stc
= unsmob_stencil (stc_scm
);
41 stc
->align_to (X_AXIS
, CENTER
);
42 stc
->align_to (Y_AXIS
, CENTER
);
44 SCM cpoints
= tuplet
->get_property ("control-points");
45 Drul_array
<Offset
> points
;
46 if (scm_is_pair (cpoints
))
48 points
[LEFT
] = ly_scm2offset (scm_car (cpoints
));
49 points
[RIGHT
] = ly_scm2offset (scm_cadr (cpoints
));
53 programming_error ("wrong type for control-points");
55 stc
->translate ((points
[RIGHT
] + points
[LEFT
]) / 2);
60 MAKE_SCHEME_CALLBACK (Tuplet_number
, calc_cross_staff
, 1)
62 Tuplet_number::calc_cross_staff (SCM smob
)
64 Grob
*me
= unsmob_grob (smob
);
65 return unsmob_grob (me
->get_object ("bracket"))->get_property ("cross-staff");
68 ADD_INTERFACE (Tuplet_number
,
69 "The number for a bracket.",