2 figured-bass-continuation.cc -- implement Figured_bass_continuation
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "line-interface.hh"
11 #include "lily-guile.hh"
13 #include "output-def.hh"
16 #include "pointer-group-interface.hh"
17 #include "axis-group-interface.hh"
20 #include "horizontal-bracket.hh"
22 struct Figured_bass_continuation
24 static bool has_interface (Grob*);
27 DECLARE_SCHEME_CALLBACK(print, (SCM));
28 DECLARE_SCHEME_CALLBACK(center_on_figures, (SCM));
31 MAKE_SCHEME_CALLBACK (Figured_bass_continuation, center_on_figures, 1);
33 Figured_bass_continuation::center_on_figures (SCM grob)
35 Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (grob));
36 extract_grob_set (me, "figures", figures);
38 return scm_from_double (0.0);
39 Grob *common = common_refpoint_of_array (figures, me, Y_AXIS);
41 Interval ext = Axis_group_interface::relative_group_extent (figures, common, Y_AXIS);
43 return scm_from_double (0.0);
44 return scm_from_double (ext.center () - me->relative_coordinate (common, Y_AXIS));
47 MAKE_SCHEME_CALLBACK (Figured_bass_continuation, print, 1);
49 Figured_bass_continuation::print (SCM grob)
51 Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (grob));
54 me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"))
55 * robust_scm2double (me->get_property ("thickness"), 1);
59 Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT),
63 Item *bound = me->get_bound (d);
65 (d == LEFT && to_boolean (bound->get_property ("implicit")))
69 = robust_relative_extent (bound, common, X_AXIS)[extdir]
70 - me->relative_coordinate (common, X_AXIS);
72 while (flip (&d) != LEFT);
73 spanned.widen (- robust_scm2double (me->get_property ("padding"), 0.2));
76 if (!spanned.is_empty ())
77 extender = Line_interface::make_line (thick,
78 Offset (spanned[LEFT], 0),
79 Offset (spanned[RIGHT], 0));
81 return extender.smobbed_copy ();
84 ADD_INTERFACE(Figured_bass_continuation,
85 "figured-bass-continuation-interface",
86 "Simple extender line between bounds.",