2 voice-devnull-engraver.cc -- implement Voice_devnull_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2001 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
[] = {
35 Voice_devnull_engraver::try_music (Music
*m
)
37 SCM s
= get_property ("devNullVoice");
40 if (gh_equal_p (s
, ly_symbol2scm ("never")))
44 if (gh_equal_p (s
, ly_symbol2scm ("allways"))
46 && daddy_trans_l_
->id_str_
.left_str (3) == "two"
47 && (to_boolean (get_property ("unison"))
48 || to_boolean (get_property ("unisilence")))))
50 if (Span_req
*s
= dynamic_cast <Span_req
*> (m
))
52 SCM t
= s
->get_mus_property ("span-type");
54 for (char const **p
= eat_spanners
; *p
; p
++)
56 if (t
== ly_str02scm (*p
))
60 /* Ugh. Should eat other requests, script etc. too. */
61 else if (Tie_req
*t
= dynamic_cast<Tie_req
*> (m
))
67 static char const *junk_interfaces
[] = {
71 "multi-measure-rest-interface",
75 "text-item-interface",
76 "text-script-interface",
77 "text-spanner-interface",
83 Voice_devnull_engraver::acknowledge_grob (Grob_info i
)
85 SCM s
= get_property ("devNullVoice");
87 /* No need, next if will never be true */
88 if (s
== ly_symbol2scm ("never"))
92 if (s
== ly_symbol2scm ("allways")
94 && daddy_trans_l_
->id_str_
.left_str (3) == "two"
95 && (to_boolean (get_property ("unison"))
96 || to_boolean (get_property ("unisilence")))))
97 for (char const **p
= junk_interfaces
; *p
; p
++)
98 if (i
.elem_l_
->has_interface (ly_symbol2scm (*p
)))
101 /* Ugh: virtual mmrest::suicide () ? */
102 if (i
.elem_l_
->has_interface (ly_symbol2scm ("multi-measure-rest-interface")))
103 i
.elem_l_
->set_grob_property ("skip-timestep", SCM_BOOL_T
);
107 /* Ugh, we can suicide them, but they remain living */
108 i
.elem_l_
->suicide ();