lilypond-1.3.121
[lilypond.git] / lily / voice-devnull-engraver.cc
blob6b5e540363a3f1f2980d652e33ede8544024aaf2
1 /*
2 voice-devnull-engraver.cc -- implement Voice_devnull_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
9 #include "engraver.hh"
10 #include "item.hh"
11 #include "musical-request.hh"
12 #include "translator-group.hh"
14 class Voice_devnull_engraver : public Engraver
16 public:
17 VIRTUAL_COPY_CONS (Translator);
19 protected:
20 virtual bool try_music (Music *m);
21 virtual void acknowledge_grob (Grob_info);
24 ADD_THIS_TRANSLATOR (Voice_devnull_engraver);
26 static char const *eat_spanners[] = {
27 "beam-interface",
28 "slur",
29 "dynamic-interface",
30 "crescendo-interface",
34 bool
35 Voice_devnull_engraver::try_music (Music *m)
37 if (daddy_trans_l_->id_str_ == "two"
38 && (to_boolean (get_property ("unison"))
39 || to_boolean (get_property ("unisilence"))))
41 for (char const **p = eat_spanners; *p; p++)
43 if (Span_req *s = dynamic_cast <Span_req *> (m))
45 if (scm_equal_p (s->get_mus_property ("span-type"),
46 ly_str02scm ( *p)) == SCM_BOOL_T)
48 return true;
53 return false;
56 static char const *junk_interfaces[] = {
57 #if 0
58 "beam-interface",
59 #endif
60 "slur-interface",
61 "tie-interface",
62 "text-item-interface",
63 "text-script-interface",
64 "dynamic-interface",
65 "crescendo-interface",
69 void
70 Voice_devnull_engraver::acknowledge_grob (Grob_info i)
72 if (daddy_trans_l_->id_str_ == "two"
73 && (to_boolean (get_property ("unison"))
74 || to_boolean (get_property ("unisilence"))))
75 for (char const **p = junk_interfaces; *p; p++)
76 if (i.elem_l_->has_interface (ly_symbol2scm (*p)))
78 i.elem_l_->suicide ();
79 return;