Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / instrument-switch-engraver.cc
blobdc09e03d10d360404a71995df5a39ad5f4134f7f
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 "text-interface.hh"
13 #include "translator.icc"
16 class Instrument_switch_engraver : public Engraver
19 TRANSLATOR_DECLARATIONS (Instrument_switch_engraver);
20 protected:
21 Grob *text_;
22 SCM cue_name_;
24 void stop_translation_time_step ();
25 void process_music ();
29 Instrument_switch_engraver::Instrument_switch_engraver ()
31 cue_name_ = SCM_EOL;
32 text_ = 0;
36 TODO: should use an event.
38 void
39 Instrument_switch_engraver::process_music ()
41 SCM cue_text = get_property ("instrumentCueName");
43 if (!scm_is_eq (cue_name_, cue_text))
45 if (Text_interface::is_markup (cue_text))
47 text_ = make_item ("InstrumentSwitch", SCM_EOL);
48 text_->set_property ("text", cue_text);
50 cue_name_ = cue_text;
54 void
55 Instrument_switch_engraver::stop_translation_time_step ()
57 text_ = 0;
60 ADD_TRANSLATOR (Instrument_switch_engraver,
61 /* doc */
62 "Create a cue text for taking instrument.",
64 /* create */
65 "InstrumentSwitch ",
67 /* read */
68 "instrumentCueName ",
70 /* write */