X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fhorizontal-bracket.cc;h=de9ccb32514f3a1fb1b844af1a4efb756b45ca48;hb=3c9561d788078f7ee4a6e1d973cf549d8f258935;hp=ef0cc486936ef7ecec62cbf908fd84e6ad425d9d;hpb=2bd7ba5d76b5439325ec1175921945894944429a;p=lilypond.git diff --git a/lily/horizontal-bracket.cc b/lily/horizontal-bracket.cc index ef0cc48693..de9ccb3251 100644 --- a/lily/horizontal-bracket.cc +++ b/lily/horizontal-bracket.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter -(c) 2002 Han-Wen Nienhuys +(c) 2002--2004 Han-Wen Nienhuys */ @@ -11,11 +11,12 @@ #include "lookup.hh" #include "group-interface.hh" #include "directional-element-interface.hh" -#include "paper-def.hh" +#include "output-def.hh" +#include "staff-symbol-referencer.hh" struct Horizontal_bracket { - DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); + DECLARE_SCHEME_CALLBACK (print, (SCM)); static bool has_interface (Grob*); }; @@ -26,42 +27,38 @@ struct Horizontal_bracket This doesn't look very elegant: should support winged edges. Support texts on the brackets? - */ - -MAKE_SCHEME_CALLBACK(Horizontal_bracket, brew_molecule, 1); +MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1); SCM -Horizontal_bracket::brew_molecule (SCM smob) +Horizontal_bracket::print (SCM smob) { Grob * me = unsmob_grob (smob); Spanner *sp = dynamic_cast (me); Link_array gs = Pointer_group_interface__extract_grobs (me,(Grob*)0, "columns"); - if (!gs.size()) + if (!gs.size ()) { - me->suicide(); + me->suicide (); return SCM_EOL; } Grob * cx = common_refpoint_of_array (gs, me, X_AXIS); cx = cx->common_refpoint (sp->get_bound (LEFT), X_AXIS); cx = cx->common_refpoint (sp->get_bound (RIGHT),X_AXIS); - Interval ext = gs.top()->extent (cx, X_AXIS); + Interval ext = gs.top ()->extent (cx, X_AXIS); ext.unite (gs[0]->extent (cx, X_AXIS)); - Direction d = Directional_element_interface::get (me); - Real t = me->get_paper()->get_var ("linethickness"); + Direction d = get_grob_direction (me); - SCM lthick = me->get_grob_property ("thickness"); - if (gh_number_p (lthick)) - t *= gh_scm2double (lthick); + Real thickness = Staff_symbol_referencer::line_thickness (me); + thickness *= robust_scm2double (me->get_property ("thickness"), 1.0); - Molecule b = Lookup::bracket (X_AXIS, ext, t, - d* 1.0); + Stencil b = Lookup::bracket (X_AXIS, ext, thickness, - d* 1.0, thickness/2); b.translate_axis ( - sp->get_bound (LEFT)->relative_coordinate (cx, X_AXIS), X_AXIS); - return b.smobbed_copy(); + return b.smobbed_copy (); } ADD_INTERFACE (Horizontal_bracket,"horizontal-bracket-interface",