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");
42 if (gh_equal_p (s, ly_symbol2scm ("never")))
46 if (gh_equal_p (s, ly_symbol2scm ("always"))
48 && daddy_trans_l_->id_str_.left_str (3) == "two"
49 && (to_boolean (get_property ("unison"))
50 || to_boolean (get_property ("unisilence")))))
52 if (Span_req *s = dynamic_cast <Span_req *> (m))
54 SCM t = s->get_mus_property ("span-type");
56 for (char const **p = eat_spanners; *p; p++)
58 if (t == ly_str02scm (*p))
62 /* Ugh. Should eat other requests, script etc. too. */
63 else if (dynamic_cast<Tie_req*> (m))
69 static char const *junk_interfaces[] = {
73 "multi-measure-rest-interface",
77 "text-item-interface",
78 "text-script-interface",
79 "text-spanner-interface",
85 Voice_devnull_engraver::acknowledge_grob (Grob_info i)
87 SCM s = get_property ("devNullVoice");
89 /* No need, next if will never be true */
90 if (s == ly_symbol2scm ("never"))
94 if (s == ly_symbol2scm ("allways")
96 && daddy_trans_l_->id_str_.left_str (3) == "two"
97 && (to_boolean (get_property ("unison"))
98 || to_boolean (get_property ("unisilence")))))
99 for (char const **p = junk_interfaces; *p; p++)
100 if (i.grob_l_->internal_has_interface (ly_symbol2scm (*p)))
102 /* Ugh, we can suicide them, but they remain living */
103 i.grob_l_->suicide ();
108 Voice_devnull_engraver::Voice_devnull_engraver(){}
110 ENTER_DESCRIPTION(Voice_devnull_engraver,
111 /* descr */ "Kill off certain items and spanners if we're Voice `two' and unison or unisilence is set.",
113 /* acks */ "grob-interface",