2 tuplet-number.cc -- implement Tuplet_number
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2006 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 static bool has_interface (Grob *);
24 MAKE_SCHEME_CALLBACK(Tuplet_number, print, 1);
26 Tuplet_number::print (SCM smob)
28 Spanner *me = unsmob_spanner (smob);
29 Spanner *tuplet = unsmob_spanner (me->get_object ("bracket"));
31 if (!tuplet || !tuplet->is_live ())
38 Don't print if it doesn't span time.
40 if (robust_scm2moment (tuplet->get_bound (LEFT)->get_column ()->get_property ("when"), Moment (0))
41 == robust_scm2moment (tuplet->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0)))
47 SCM stc_scm = Text_interface::print (smob);
48 Stencil *stc = unsmob_stencil (stc_scm);
50 stc->align_to (X_AXIS, CENTER);
51 stc->align_to (Y_AXIS, CENTER);
53 SCM cpoints = tuplet->get_property ("control-points");
54 Drul_array<Offset> points;
55 points[LEFT] = ly_scm2offset (scm_car (cpoints));
56 points[RIGHT] = ly_scm2offset (scm_cadr (cpoints));
58 stc->translate ((points[RIGHT] + points[LEFT]) / 2);
64 ADD_INTERFACE (Tuplet_number,
65 "tuplet-number-interface",
66 "The number for a bracket. "