X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fhorizontal-bracket.cc;h=b453985b091b6ef31c7ff16f3b6f5110597d6232;hb=93480498d7f4fec2e33ac6ff2685153014922a9e;hp=d1259113222f3991059b728c0f4400f2ae35fb3d;hpb=e8936ee66fdd3e7ebe30556590e8dc913908a533;p=lilypond.git diff --git a/lily/horizontal-bracket.cc b/lily/horizontal-bracket.cc index d125911322..b453985b09 100644 --- a/lily/horizontal-bracket.cc +++ b/lily/horizontal-bracket.cc @@ -1,70 +1,66 @@ -/* - horizontal-bracket.cc -- implement Horizontal_bracket - - source file of the GNU LilyPond music typesetter - -(c) 2002--2003 Han-Wen Nienhuys - - */ - -#include "side-position-interface.hh" -#include "lookup.hh" -#include "group-interface.hh" -#include "directional-element-interface.hh" -#include "paper-def.hh" - -struct Horizontal_bracket -{ - DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); - static bool has_interface (Grob*); -}; - - /* - TODO: + This file is part of LilyPond, the GNU music typesetter. + + Copyright (C) 2002--2015 Han-Wen Nienhuys - This doesn't look very elegant: should support winged edges. + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - Support texts on the brackets? + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ -MAKE_SCHEME_CALLBACK(Horizontal_bracket, brew_molecule, 1); +#include "horizontal-bracket.hh" + +#include "bracket.hh" +#include "stencil.hh" +#include "pointer-group-interface.hh" +#include "directional-element-interface.hh" +#include "spanner.hh" +#include "item.hh" +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"); + Spanner *me = unsmob (smob); + extract_grob_set (me, "columns", gs); - if (!gs.size()) + vector enclosed = gs; + 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); - ext.unite (gs[0]->extent (cx, X_AXIS)); - - Direction d = Directional_element_interface::get (me); - Real t = me->get_paper()->get_realvar (ly_symbol2scm ("linethickness")); - - SCM lthick = me->get_grob_property ("thickness"); - if (gh_number_p (lthick)) - t *= gh_scm2double (lthick); - - Molecule b = Lookup::bracket (X_AXIS, ext, t, - d* 1.0); - - b.translate_axis ( - sp->get_bound (LEFT)->relative_coordinate (cx, X_AXIS), X_AXIS); + for (LEFT_and_RIGHT (d)) + { + Item *b = me->get_bound (d); + if (b->break_status_dir ()) + enclosed.push_back (b); + } - return b.smobbed_copy(); + Stencil b = Bracket::make_enclosing_bracket (me, me, enclosed, X_AXIS, + get_grob_direction (me)); + return b.smobbed_copy (); } -ADD_INTERFACE (Horizontal_bracket,"horizontal-bracket-interface", - "A horizontal bracket encompassing notes.", - "thickness columns direction"); +ADD_INTERFACE (Horizontal_bracket, + "A horizontal bracket encompassing notes.", + + /* properties */ + "bracket-flare " + "bracket-text " + "columns " + "edge-height " + "shorten-pair " + "connect-to-neighbor " + );