X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fambitus.cc;h=e123538dfa2df315e52cfc59b309bcf439489b6c;hb=5b4b0d6e9a197e8f9eb085b7c2ad78b8be3e5cfc;hp=bfcc7fd5c6a0f9dddfb73f631084804adbe09a6a;hpb=3c9561d788078f7ee4a6e1d973cf549d8f258935;p=lilypond.git diff --git a/lily/ambitus.cc b/lily/ambitus.cc index bfcc7fd5c6..e123538dfa 100644 --- a/lily/ambitus.cc +++ b/lily/ambitus.cc @@ -3,40 +3,42 @@ source file of the GNU LilyPond music typesetter - (c) 2002--2004 Juergen Reuter + (c) 2002--2008 Juergen Reuter */ +#include "ambitus.hh" + #include "staff-symbol-referencer.hh" #include "pitch.hh" -#include "ambitus.hh" -#include "stencil.hh" #include "note-head.hh" #include "item.hh" #include "font-interface.hh" #include "output-def.hh" #include "lookup.hh" -#include "group-interface.hh" +#include "pointer-group-interface.hh" -MAKE_SCHEME_CALLBACK (Ambitus,print,1); +MAKE_SCHEME_CALLBACK (Ambitus, print, 1); SCM Ambitus::print (SCM smob) { - Item *me = (Item*) unsmob_grob (smob); + Item *me = (Item *) unsmob_grob (smob); Stencil stencil; - // join heads - Link_array heads (Pointer_group_interface__extract_grobs (me, (Grob*)0, "note-heads")); + // FIXME : should be Ambitus_line join heads + extract_grob_set (me, "note-heads", heads); if (to_boolean (me->get_property ("join-heads")) - && heads.size() > 1) + && heads.size () > 1) { Grob *common - = common_refpoint_of_array (heads.slice (0,2), me, Y_AXIS); + = common_refpoint_of_array (vector (heads.begin (), + heads.begin () + 2), + me, Y_AXIS); Grob *minh = heads[0]; Grob *maxh = heads[1]; - - if (minh->relative_coordinate (common, Y_AXIS) > - maxh->relative_coordinate (common, Y_AXIS)) + + if (minh->relative_coordinate (common, Y_AXIS) + > maxh->relative_coordinate (common, Y_AXIS)) { Grob *t = maxh; maxh = minh; @@ -44,20 +46,21 @@ Ambitus::print (SCM smob) } Real pad = 0.35; - Real pmax = maxh->relative_coordinate (common, Y_AXIS) - pad; - Real pmin = minh->relative_coordinate (common, Y_AXIS) + pad; - + Real pmax = maxh->extent (common, Y_AXIS)[DOWN] - pad; + Real pmin = minh->extent (common, Y_AXIS)[UP] + pad; + if (pmin < pmax) { - Real linethickness = me->get_paper ()->get_dimension (ly_symbol2scm ("linethickness")); - Real blotdiameter = me->get_paper ()->get_dimension (ly_symbol2scm ("blotdiameter")); - Interval x_extent = 0.5 * Interval (-linethickness, +linethickness); - Interval y_extent = 0.5 * Interval (pmin, pmax); + Real linethickness = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")) + * robust_scm2double (me->get_property ("thickness"), 1.0); + Real blotdiameter = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter")); + Interval x_extent = 0.5 * linethickness * Interval (-1, 1); + Interval y_extent = Interval (pmin, pmax); Box line_box (x_extent, y_extent); Stencil line = Lookup::round_filled_box (line_box, blotdiameter); - line.translate_axis (- me-> relative_coordinate (common, Y_AXIS), - Y_AXIS); + line.translate_axis (- me->relative_coordinate (common, Y_AXIS), + Y_AXIS); return line.smobbed_copy (); } } @@ -65,6 +68,11 @@ Ambitus::print (SCM smob) return SCM_EOL; } -ADD_INTERFACE (Ambitus, "ambitus-interface", - "The line between note heads for a pitch range.", - "note-heads join-heads"); +ADD_INTERFACE (Ambitus, + "The line between note heads for a pitch range.", + + /* properties */ + "join-heads " + "note-heads " + "thickness " + );