2 tab-harmonic-engraver.cc -- implement Tab_harmonic_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "engraver.hh"
13 #include "pointer-group-interface.hh"
14 #include "simple-closure.hh"
15 #include "stream-event.hh"
18 #include "translator.icc"
20 class Tab_harmonic_engraver
: public Engraver
22 TRANSLATOR_DECLARATIONS (Tab_harmonic_engraver
);
25 DECLARE_ACKNOWLEDGER (note_head
);
28 Tab_harmonic_engraver::Tab_harmonic_engraver ()
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
));
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 */ "Parenthesize objects whose music cause has the @code{parenthesize} "
71 "HarmonicParenthesesItem ",