2 figured-bass-continuation.cc -- implement Figured_bass_continuation
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "line-interface.hh"
12 #include "output-def.hh"
15 #include "pointer-group-interface.hh"
16 #include "axis-group-interface.hh"
19 #include "horizontal-bracket.hh"
21 struct Figured_bass_continuation
23 DECLARE_GROB_INTERFACE ();
26 DECLARE_SCHEME_CALLBACK (print
, (SCM
));
27 DECLARE_SCHEME_CALLBACK (center_on_figures
, (SCM
));
30 MAKE_SCHEME_CALLBACK (Figured_bass_continuation
, center_on_figures
, 1);
32 Figured_bass_continuation::center_on_figures (SCM grob
)
34 Spanner
*me
= dynamic_cast<Spanner
*> (unsmob_grob (grob
));
35 extract_grob_set (me
, "figures", figures
);
37 return scm_from_double (0.0);
38 Grob
*common
= common_refpoint_of_array (figures
, me
, Y_AXIS
);
40 Interval ext
= Axis_group_interface::relative_group_extent (figures
, common
, Y_AXIS
);
42 return scm_from_double (0.0);
43 return scm_from_double (ext
.center () - me
->relative_coordinate (common
, Y_AXIS
));
46 MAKE_SCHEME_CALLBACK (Figured_bass_continuation
, print
, 1);
48 Figured_bass_continuation::print (SCM grob
)
50 Spanner
*me
= dynamic_cast<Spanner
*> (unsmob_grob (grob
));
53 me
->layout ()->get_dimension (ly_symbol2scm ("line-thickness"))
54 * robust_scm2double (me
->get_property ("thickness"), 1);
58 Grob
*common
= me
->get_bound (LEFT
)->common_refpoint (me
->get_bound (RIGHT
),
62 Item
*bound
= me
->get_bound (d
);
64 (d
== LEFT
&& to_boolean (bound
->get_property ("implicit")))
68 = robust_relative_extent (bound
, common
, X_AXIS
)[extdir
]
69 - me
->relative_coordinate (common
, X_AXIS
);
71 while (flip (&d
) != LEFT
);
72 spanned
.widen (- robust_scm2double (me
->get_property ("padding"), 0.2));
75 if (!spanned
.is_empty ())
76 extender
= Line_interface::make_line (thick
,
77 Offset (spanned
[LEFT
], 0),
78 Offset (spanned
[RIGHT
], 0));
80 return extender
.smobbed_copy ();
83 ADD_INTERFACE (Figured_bass_continuation
,
84 "Simple extender line between bounds.",