source file of the GNU LilyPond music typesetter
- (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
struct Tuplet_number
{
- DECLARE_SCHEME_CALLBACK(print, (SCM));
- static bool has_interface (Grob *);
+ DECLARE_SCHEME_CALLBACK (print, (SCM));
+ DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
+ DECLARE_GROB_INTERFACE ();
};
-MAKE_SCHEME_CALLBACK(Tuplet_number, print, 1);
+MAKE_SCHEME_CALLBACK (Tuplet_number, print, 1);
SCM
Tuplet_number::print (SCM smob)
{
me->suicide ();
return SCM_EOL;
}
-
- Stencil *stc = unsmob_stencil (Text_interface::print (smob));
+
+ SCM stc_scm = Text_interface::print (smob);
+ Stencil *stc = unsmob_stencil (stc_scm);
stc->align_to (X_AXIS, CENTER);
stc->align_to (Y_AXIS, CENTER);
SCM cpoints = tuplet->get_property ("control-points");
Drul_array<Offset> points;
- points[LEFT] = ly_scm2offset (scm_car (cpoints));
- points[RIGHT] = ly_scm2offset (scm_cadr (cpoints));
-
+ if (scm_is_pair (cpoints))
+ {
+ points[LEFT] = ly_scm2offset (scm_car (cpoints));
+ points[RIGHT] = ly_scm2offset (scm_cadr (cpoints));
+ }
+ else
+ {
+ programming_error ("wrong type for control-points");
+ }
stc->translate ((points[RIGHT] + points[LEFT]) / 2);
- return stc->smobbed_copy ();
+ return stc_scm;
}
+MAKE_SCHEME_CALLBACK (Tuplet_number, calc_cross_staff, 1)
+SCM
+Tuplet_number::calc_cross_staff (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ return unsmob_grob (me->get_object ("bracket"))->get_property ("cross-staff");
+}
ADD_INTERFACE (Tuplet_number,
- "tuplet-number-interface",
"The number for a bracket. "
,