Consider accidentals in optical spacing correction.
[lilypond.git] / lily / instrument-switch-engraver.cc
bloba2830554ede8a30e50acfc5c8191815288d7e984
1 /*
2 instrument-switch-engraver.cc -- implement
4 source file of the GNU LilyPond music typesetter
6 (c) 2006--2009 Han-Wen Nienhuys <hanwen@lilypond.org>
8 */
10 #include "engraver.hh"
11 #include "item.hh"
12 #include "translator.icc"
15 class Instrument_switch_engraver : public Engraver
18 TRANSLATOR_DECLARATIONS (Instrument_switch_engraver);
19 protected:
20 Grob *text_;
21 SCM cue_name_;
23 void stop_translation_time_step ();
24 void process_music ();
28 Instrument_switch_engraver::Instrument_switch_engraver ()
30 cue_name_ = SCM_EOL;
31 text_ = 0;
35 TODO: should use an event.
37 void
38 Instrument_switch_engraver::process_music ()
40 SCM cue_text = get_property ("instrumentCueName");
42 if (!scm_is_eq (cue_name_, cue_text))
44 text_ = make_item ("InstrumentSwitch", SCM_EOL);
45 text_->set_property ("text", cue_text);
46 cue_name_ = cue_text;
50 void
51 Instrument_switch_engraver::stop_translation_time_step ()
53 text_ = 0;
56 ADD_TRANSLATOR (Instrument_switch_engraver,
57 /* doc */
58 "Create a cue text for taking instrument.",
60 /* create */
61 "InstrumentSwitch ",
63 /* read */
64 "instrumentCueName ",
66 /* write */