]> git.donarmstrong.com Git - lilypond.git/blob - lily/thread-devnull-engraver.cc
* lily/multi-measure-rest-engraver.cc (process_music): extra check
[lilypond.git] / lily / thread-devnull-engraver.cc
1 /*
2   thread-devnull-engraver.cc -- implement Thread_devnull_engraver
3
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2000--2003 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "engraver.hh"
10 #include "item.hh"
11 #include "event.hh"
12 #include "translator-group.hh"
13
14 class Thread_devnull_engraver : public Engraver
15 {
16 public:
17   TRANSLATOR_DECLARATIONS(Thread_devnull_engraver);
18   
19 protected:
20   virtual void acknowledge_grob (Grob_info);
21 };
22
23
24
25 void
26 Thread_devnull_engraver::acknowledge_grob (Grob_info i)
27 {
28   SCM s = get_property ("devNullThread");
29
30   if (s == ly_symbol2scm ("always")
31       || (s == SCM_EOL
32           && to_boolean (get_property ("soloADue"))
33           && ((daddy_trans_->id_string_.left_string (3) == "two"
34                && (to_boolean (get_property ("unison"))
35                    || to_boolean (get_property ("unisilence"))))
36
37               /* Maybe this should be optional? */
38               || to_boolean (get_property ("othersolo")))))
39     {
40       i.grob_->suicide ();
41     }
42 }
43 Thread_devnull_engraver::Thread_devnull_engraver(){}
44
45 ENTER_DESCRIPTION(Thread_devnull_engraver,
46 /* descr */       "Kill elements whenever we are Voice called `two' and either "
47 "unison, unisilence or soloADue is set.@footnote{On unix systems, the "
48 "file @file{/dev/null} is special device: anything written to it is "
49 "discarded.}. This engraver works closely together with the part "
50 "combiner.  When the part combiner notices that two threads are "
51 "identical, it tells the @code{Thread_devnull_engraver} to discard " 
52 "everything in the second thread. "
53 ,
54 /* creats*/       "",
55 /* accepts */     "",
56 /* acks  */      "grob-interface",
57 /* reads */       "",
58 /* write */       "");