Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / text-engraver.cc
blobf27a74bf84fa50bf79c6f41ed73459a37697aa39
1 /*
2 text-engraver.cc -- implement Text_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "directional-element-interface.hh"
10 #include "engraver.hh"
11 #include "rhythmic-head.hh"
12 #include "side-position-interface.hh"
13 #include "stem.hh"
14 #include "stream-event.hh"
15 #include "text-interface.hh"
16 #include "item.hh"
18 #include "translator.icc"
20 /**
21 typeset directions that are plain text.
23 class Text_engraver : public Engraver
25 vector<Stream_event *> evs_;
26 vector<Grob*> texts_;
27 public:
28 TRANSLATOR_DECLARATIONS (Text_engraver);
29 protected:
30 void stop_translation_timestep ();
31 void process_acknowledged ();
33 DECLARE_TRANSLATOR_LISTENER (text_script);
36 IMPLEMENT_TRANSLATOR_LISTENER (Text_engraver, text_script);
37 void
38 Text_engraver::listen_text_script (Stream_event *ev)
40 evs_.push_back (ev);
43 void
44 Text_engraver::process_acknowledged ()
46 if (texts_.size ())
47 return;
48 for (vsize i = 0; i < evs_.size (); i++)
50 Stream_event *r = evs_[i];
52 // URG: Text vs TextScript
53 Item *text = make_item ("TextScript", r->self_scm ());
55 int priority = robust_scm2int (text->get_property ("script-priority"),
56 200);
58 /* see script-engraver.cc */
59 priority += i;
61 text->set_property ("script-priority", scm_from_int (priority));
63 Direction dir = to_dir (r->get_property ("direction"));
64 if (dir)
65 set_grob_direction (text, dir);
67 SCM mark = r->get_property ("text");
69 text->set_property ("text", mark);
70 texts_.push_back (text);
74 void
75 Text_engraver::stop_translation_timestep ()
77 texts_.clear ();
78 evs_.clear ();
81 Text_engraver::Text_engraver ()
85 ADD_TRANSLATOR (Text_engraver,
86 /* doc */
87 "Create text scripts.",
89 /* create */
90 "TextScript ",
92 /* read */
93 "",
95 /* write */