Bump version.
[lilypond.git] / lily / tab-harmonic-engraver.cc
blob8c493048bc3c7d009f42fca25dd070d8faa34205
1 /*
2 tab-harmonic-engraver.cc -- implement Tab_harmonic_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 */
10 #include "engraver.hh"
12 #include "item.hh"
13 #include "pointer-group-interface.hh"
14 #include "simple-closure.hh"
15 #include "stream-event.hh"
16 #include "warn.hh"
18 #include "translator.icc"
20 class Tab_harmonic_engraver : public Engraver
22 TRANSLATOR_DECLARATIONS (Tab_harmonic_engraver);
24 protected:
25 DECLARE_ACKNOWLEDGER (note_head);
28 Tab_harmonic_engraver::Tab_harmonic_engraver ()
32 void
33 Tab_harmonic_engraver::acknowledge_note_head (Grob_info info)
35 if (Stream_event *note = info.event_cause ())
37 for (SCM s = note->get_property ("articulations");
38 scm_is_pair (s); s = scm_cdr (s))
40 Stream_event *ev = unsmob_stream_event (scm_car (s));
42 if (!ev)
43 continue;
46 if (ev->in_event_class ("harmonic-event"))
48 if (Item *victim = info.item ())
50 Engraver *eng = dynamic_cast<Engraver*> (info.origin_translator ());
51 Item *paren = eng->make_item ("HarmonicParenthesesItem", victim->self_scm ());
52 Pointer_group_interface::add_grob (paren, ly_symbol2scm ("elements"), victim);
54 paren->set_parent (victim, Y_AXIS);
56 Real size = robust_scm2double (paren->get_property ("font-size"), 0.0)
57 + robust_scm2double (victim->get_property ("font-size"), 0.0);
58 paren->set_property ("font-size", scm_from_double (size));
65 ADD_ACKNOWLEDGER (Tab_harmonic_engraver, note_head);
66 ADD_TRANSLATOR (Tab_harmonic_engraver,
67 /* doc */
68 "In a tablature, parenthesize objects whose music cause has"
69 " the @code{parenthesize} property.",
71 /* create */
72 "HarmonicParenthesesItem ",
74 /* read */
75 "",
77 /* write */