2 ambitus.cc -- implement Ambitus
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--2004 Juergen Reuter <reuter@ipd.uka.de>
9 #include "staff-symbol-referencer.hh"
13 #include "note-head.hh"
15 #include "font-interface.hh"
16 #include "output-def.hh"
18 #include "group-interface.hh"
20 MAKE_SCHEME_CALLBACK (Ambitus,print,1);
22 Ambitus::print (SCM smob)
24 Item *me = (Item*) unsmob_grob (smob);
28 Link_array<Grob> heads (Pointer_group_interface__extract_grobs (me, (Grob*)0, "note-heads"));
29 if (to_boolean (me->get_property ("join-heads"))
33 = common_refpoint_of_array (heads.slice (0,2), me, Y_AXIS);
35 Grob *minh = heads[0];
36 Grob *maxh = heads[1];
38 if (minh->relative_coordinate (common, Y_AXIS) >
39 maxh->relative_coordinate (common, Y_AXIS))
46 Real pmax = maxh->relative_coordinate (common, Y_AXIS) - pad;
47 Real pmin = minh->relative_coordinate (common, Y_AXIS) + pad;
51 Real linethickness = me->get_paper ()->get_dimension (ly_symbol2scm ("linethickness"));
52 Real blotdiameter = me->get_paper ()->get_dimension (ly_symbol2scm ("blotdiameter"));
53 Interval x_extent = 0.5 * Interval (-linethickness, +linethickness);
54 Interval y_extent = 0.5 * Interval (pmin, pmax);
55 Box line_box (x_extent, y_extent);
57 Stencil line = Lookup::round_filled_box (line_box, blotdiameter);
58 line.translate_axis (- me-> relative_coordinate (common, Y_AXIS),
60 return line.smobbed_copy ();
67 ADD_INTERFACE (Ambitus, "ambitus-interface",
68 "The line between note heads for a pitch range.",
69 "note-heads join-heads");