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>
11 #include "musical-request.hh"
12 #include "translator-group.hh"
14 class Voice_devnull_engraver
: public Engraver
17 VIRTUAL_COPY_CONS (Translator
);
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
[] = {
31 "crescendo-interface",
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 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
)
66 static char const *junk_interfaces
[] = {
72 "text-item-interface",
73 "text-script-interface",
75 "crescendo-interface",
80 Voice_devnull_engraver::acknowledge_grob (Grob_info i
)
82 SCM s
= get_property ("devNullVoice");
85 if (gh_equal_p (s
, ly_symbol2scm ("never")))
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 ();