Fix substitution error in shape noteheads
[lilypond/mpolesky.git] / lily / tab-harmonic-engraver.cc
bloba6e226dd3e2d9779fb6a3797d9913f960058ec08
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2005--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 LilyPond is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 LilyPond is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
21 #include "engraver.hh"
23 #include "item.hh"
24 #include "pointer-group-interface.hh"
25 #include "simple-closure.hh"
26 #include "stream-event.hh"
27 #include "warn.hh"
29 #include "translator.icc"
31 class Tab_harmonic_engraver : public Engraver
33 TRANSLATOR_DECLARATIONS (Tab_harmonic_engraver);
35 protected:
36 DECLARE_ACKNOWLEDGER (note_head);
39 Tab_harmonic_engraver::Tab_harmonic_engraver ()
43 void
44 Tab_harmonic_engraver::acknowledge_note_head (Grob_info info)
46 if (Stream_event *note = info.event_cause ())
48 for (SCM s = note->get_property ("articulations");
49 scm_is_pair (s); s = scm_cdr (s))
51 Stream_event *ev = unsmob_stream_event (scm_car (s));
53 if (!ev)
54 continue;
57 if (ev->in_event_class ("harmonic-event"))
59 if (Item *victim = info.item ())
61 Engraver *eng = dynamic_cast<Engraver*> (info.origin_translator ());
62 Item *paren = eng->make_item ("HarmonicParenthesesItem", victim->self_scm ());
63 Pointer_group_interface::add_grob (paren, ly_symbol2scm ("elements"), victim);
65 paren->set_parent (victim, Y_AXIS);
67 Real size = robust_scm2double (paren->get_property ("font-size"), 0.0)
68 + robust_scm2double (victim->get_property ("font-size"), 0.0);
69 paren->set_property ("font-size", scm_from_double (size));
76 ADD_ACKNOWLEDGER (Tab_harmonic_engraver, note_head);
77 ADD_TRANSLATOR (Tab_harmonic_engraver,
78 /* doc */
79 "In a tablature, parenthesize objects whose music cause has"
80 " the @code{parenthesize} property.",
82 /* create */
83 "HarmonicParenthesesItem ",
85 /* read */
86 "",
88 /* write */