2 voice-devnull-engraver.cc -- implement Voice_devnull_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2002 Jan Nieuwenhuizen <janneke@gnu.org>
11 #include "musical-request.hh"
12 #include "translator-group.hh"
14 class Voice_devnull_engraver : public Engraver
17 TRANSLATOR_DECLARATIONS(Voice_devnull_engraver);
20 virtual bool try_music (Music *m);
21 virtual void acknowledge_grob (Grob_info);
26 static char const *eat_spanners[] = {
36 Voice_devnull_engraver::try_music (Music *m)
38 SCM s = get_property ("devNullVoice");
41 if (gh_equal_p (s, ly_symbol2scm ("never")))
45 if (gh_equal_p (s, ly_symbol2scm ("allways"))
47 && daddy_trans_l_->id_str_.left_str (3) == "two"
48 && (to_boolean (get_property ("unison"))
49 || to_boolean (get_property ("unisilence")))))
51 if (Span_req *s = dynamic_cast <Span_req *> (m))
53 SCM t = s->get_mus_property ("span-type");
55 for (char const **p = eat_spanners; *p; p++)
57 if (t == ly_str02scm (*p))
61 /* Ugh. Should eat other requests, script etc. too. */
62 else if (dynamic_cast<Tie_req*> (m))
68 static char const *junk_interfaces[] = {
72 "multi-measure-rest-interface",
76 "text-item-interface",
77 "text-script-interface",
78 "text-spanner-interface",
84 Voice_devnull_engraver::acknowledge_grob (Grob_info i)
86 SCM s = get_property ("devNullVoice");
88 /* No need, next if will never be true */
89 if (s == ly_symbol2scm ("never"))
93 if (s == ly_symbol2scm ("allways")
95 && daddy_trans_l_->id_str_.left_str (3) == "two"
96 && (to_boolean (get_property ("unison"))
97 || to_boolean (get_property ("unisilence")))))
98 for (char const **p = junk_interfaces; *p; p++)
99 if (i.grob_l_->internal_has_interface (ly_symbol2scm (*p)))
101 /* Ugh, we can suicide them, but they remain living */
102 i.grob_l_->suicide ();
107 Voice_devnull_engraver::Voice_devnull_engraver(){}
109 ENTER_DESCRIPTION(Voice_devnull_engraver,
110 /* descr */ "Kill off certain items and spanners if we're Voice `two' and unison or unisilence is set.",
112 /* acks */ "grob-interface",