]> git.donarmstrong.com Git - lilypond.git/blob - lily/voice-devnull-engraver.cc
patch::: 1.3.121.jcn2
[lilypond.git] / lily / voice-devnull-engraver.cc
1 /*
2   voice-devnull-engraver.cc -- implement Voice_devnull_engraver
3
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "engraver.hh"
10 #include "item.hh"
11 #include "musical-request.hh"
12 #include "translator-group.hh"
13
14 class Voice_devnull_engraver : public Engraver
15 {
16 public:
17   VIRTUAL_COPY_CONS (Translator);
18   
19 protected:
20   virtual bool try_music (Music *m);
21   virtual void acknowledge_grob (Grob_info);
22 };
23
24 ADD_THIS_TRANSLATOR (Voice_devnull_engraver);
25
26 static char const *eat_spanners[] = {
27   "beam-interface",
28   "slur",
29   "dynamic-interface",
30   "crescendo-interface",
31   0
32 };
33
34 bool
35 Voice_devnull_engraver::try_music (Music *m)
36 {
37   if (daddy_trans_l_->id_str_ == "two"
38       && (to_boolean (get_property ("unison"))
39           || to_boolean (get_property ("unisilence"))))
40     {
41       for (char const **p = eat_spanners; *p; p++)
42         {
43           if (Span_req *s = dynamic_cast <Span_req *> (m))
44             {
45               if (scm_equal_p (s->get_mus_property ("span-type"),
46                                ly_str02scm ( *p)) == SCM_BOOL_T)
47                 {
48                   return true;
49                 }
50             }
51         }
52     }
53   return false;
54 }
55   
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",
66   0
67 };
68
69 void
70 Voice_devnull_engraver::acknowledge_grob (Grob_info i)
71 {
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)))
77         {
78           i.elem_l_->suicide ();
79           return;
80         }
81 }