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 0 /* We used to have have this until 1.5.68. Not sure about
95 soloADue requirement */
96 if (s == ly_symbol2scm ("always")
98 && daddy_trans_l_->id_str_.left_str (3) == "two"
99 && (to_boolean (get_property ("unison"))
100 || to_boolean (get_property ("unisilence")))))
102 if (s == ly_symbol2scm ("always")
104 && to_boolean (get_property ("soloADue"))
105 && ((daddy_trans_l_->id_str_.left_str (3) == "two"
106 && (to_boolean (get_property ("unison"))
107 || to_boolean (get_property ("unisilence"))))
109 /* Maybe this should be optional? */
110 || to_boolean (get_property ("othersolo")))))
113 for (char const **p = junk_interfaces; *p; p++)
114 if (i.grob_l_->internal_has_interface (ly_symbol2scm (*p)))
116 i.grob_l_->suicide ();
121 Voice_devnull_engraver::Voice_devnull_engraver(){}
123 ENTER_DESCRIPTION(Voice_devnull_engraver,
124 /* descr */ "Kill off certain items and spanners if we're Voice `two' and unison or unisilence is set.",
126 /* acks */ "grob-interface",