lilypond-1.3.129
[lilypond.git] / lily / voice-devnull-engraver.cc
blobb3414f531d2475bbd6494aa2b20f625d49305ef0
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 "tie",
30 "dynamic-interface",
31 "crescendo-interface",
35 bool
36 Voice_devnull_engraver::try_music (Music *m)
38 SCM s = get_property ("devNullVoice");
39 #if 0
40 /* No need */
41 if (gh_equal_p (s, ly_symbol2scm ("never")))
42 return;
43 #endif
45 if (gh_equal_p (s, ly_symbol2scm ("allways"))
46 || (s == SCM_EOL
47 && daddy_trans_l_->id_str_.left_str (3) == "two"
48 && (to_boolean (get_property ("unison"))
49 || to_boolean (get_property ("unisilence")))))
51 for (char const **p = eat_spanners; *p; p++)
53 if (Span_req *s = dynamic_cast <Span_req *> (m))
55 if (scm_equal_p (s->get_mus_property ("span-type"),
56 ly_str02scm ( *p)) == SCM_BOOL_T)
58 return true;
63 return false;
66 static char const *junk_interfaces[] = {
67 #if 0
68 "beam-interface",
69 #endif
70 "slur-interface",
71 "tie-interface",
72 "text-item-interface",
73 "text-script-interface",
74 "dynamic-interface",
75 "crescendo-interface",
79 void
80 Voice_devnull_engraver::acknowledge_grob (Grob_info i)
82 SCM s = get_property ("devNullVoice");
83 #if 0
84 /* No need */
85 if (gh_equal_p (s, ly_symbol2scm ("never")))
86 return;
87 #endif
89 if (gh_equal_p (s, ly_symbol2scm ("allways"))
90 || (gh_equal_p (s, ly_symbol2scm ("unisolo"))
91 && daddy_trans_l_->id_str_.left_str (3) == "two"
92 && (to_boolean (get_property ("unison"))
93 || to_boolean (get_property ("unisilence")))))
94 for (char const **p = junk_interfaces; *p; p++)
95 if (i.elem_l_->has_interface (ly_symbol2scm (*p)))
97 i.elem_l_->suicide ();
98 return;