Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / melody-engraver.cc
blob3dc1d28448cbabed072b048e76473bcd116a8ff3
1 /*
2 melody-engraver.cc -- implement Melody_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
10 #include "engraver.hh"
12 #include "item.hh"
13 #include "melody-spanner.hh"
14 #include "pointer-group-interface.hh"
16 class Melody_engraver : public Engraver
18 Grob *melody_item_;
19 Grob *stem_;
20 protected:
22 DECLARE_ACKNOWLEDGER (stem);
23 DECLARE_ACKNOWLEDGER (slur);
24 TRANSLATOR_DECLARATIONS (Melody_engraver);
25 void stop_translation_timestep ();
26 void process_music ();
30 Melody_engraver::Melody_engraver ()
32 stem_ = 0;
33 melody_item_ = 0;
36 void
37 Melody_engraver::process_music ()
39 if (scm_is_string (get_property ("whichBar")))
40 melody_item_ = 0;
43 void
44 Melody_engraver::stop_translation_timestep ()
46 if (stem_
47 && !is_direction (stem_->get_property_data ("neutral-direction")))
49 extract_grob_set (stem_, "rests", rests);
50 if (rests.size ())
51 melody_item_ = 0;
52 else
54 if (!melody_item_)
55 melody_item_ = make_item ("MelodyItem", stem_->self_scm ());
57 Melody_spanner::add_stem (melody_item_, stem_);
60 stem_ = 0;
64 void
65 Melody_engraver::acknowledge_slur (Grob_info /* info */)
67 melody_item_ = 0;
71 void
72 Melody_engraver::acknowledge_stem (Grob_info info)
74 stem_ = info.grob ();
79 #include "translator.icc"
81 ADD_ACKNOWLEDGER (Melody_engraver, stem);
82 ADD_ACKNOWLEDGER (Melody_engraver, slur);
84 ADD_TRANSLATOR (Melody_engraver,
85 /* doc */
86 "Create information for context dependent typesetting"
87 " decisions.",
89 /* create */
90 "MelodyItem ",
92 /* read */
93 "",
95 /* write */