]> git.donarmstrong.com Git - lilypond.git/blob - lily/instrument-switch-engraver.cc
Remove commented out code
[lilypond.git] / lily / instrument-switch-engraver.cc
1 /*
2   instrument-switch-engraver.cc -- implement
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2006--2009 Han-Wen Nienhuys <hanwen@lilypond.org>
7
8 */
9
10 #include "engraver.hh"
11 #include "item.hh"
12 #include "text-interface.hh"
13 #include "translator.icc"
14
15
16 class Instrument_switch_engraver : public Engraver
17 {
18
19   TRANSLATOR_DECLARATIONS (Instrument_switch_engraver);
20 protected:
21   Grob *text_;
22   SCM cue_name_;
23
24   void stop_translation_time_step ();
25   void process_music ();
26 };
27
28
29 Instrument_switch_engraver::Instrument_switch_engraver ()
30 {
31   cue_name_ = SCM_EOL;
32   text_ = 0;
33 }
34
35 /*
36   TODO: should use an event.
37  */
38 void
39 Instrument_switch_engraver::process_music ()
40 {
41   SCM cue_text = get_property ("instrumentCueName");
42   
43   if (!scm_is_eq (cue_name_, cue_text))
44     {
45       if (Text_interface::is_markup (cue_text))
46         {
47           text_ = make_item ("InstrumentSwitch", SCM_EOL);
48           text_->set_property ("text", cue_text);
49         }
50       cue_name_ = cue_text;
51     }
52 }
53
54 void
55 Instrument_switch_engraver::stop_translation_time_step ()
56 {
57   text_ = 0;
58 }
59
60 ADD_TRANSLATOR (Instrument_switch_engraver,
61                 /* doc */
62                 "Create a cue text for taking instrument.",
63                         
64                 /* create */
65                 "InstrumentSwitch ",
66
67                 /* read */
68                 "instrumentCueName ",
69                         
70                 /* write */
71                 ""
72                 );