2 parenthesis-engraver.cc -- implement Parenthesis_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "engraver.hh"
13 #include "simple-closure.hh"
17 #include "pointer-group-interface.hh"
19 #include "translator.icc"
21 class Parenthesis_engraver : public Engraver
23 TRANSLATOR_DECLARATIONS (Parenthesis_engraver);
26 DECLARE_ACKNOWLEDGER (grob);
29 Parenthesis_engraver::Parenthesis_engraver()
34 Parenthesis_engraver::acknowledge_grob (Grob_info info)
36 if (Music *music = info.music_cause ())
38 if (to_boolean (music->get_property ("parenthesize")))
40 if (Item *victim = dynamic_cast<Item*> (info.grob ()))
42 Engraver *eng = dynamic_cast<Engraver*> (info.origin_translator ());
43 Item *paren = make_item_from_properties (eng,
44 ly_symbol2scm ("ParenthesesItem"),
48 Pointer_group_interface::add_grob (paren, ly_symbol2scm ("elements"), victim);
50 Real size = robust_scm2double (paren->get_property ("font-size"), 0.0)
51 + robust_scm2double (victim->get_property ("font-size"), 0.0);
52 paren->set_property ("font-size", scm_from_double (size));
57 enlarge victim to allow for parentheses space?
62 programming_error ("Don't know how to parenthesize spanners.");
68 ADD_ACKNOWLEDGER (Parenthesis_engraver, grob);
69 ADD_TRANSLATOR (Parenthesis_engraver,
70 /* doc */ "Parenthesize objects whose music cause has the @code{parenthesize} "