Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / lily / text-engraver.cc
blob270855febde233ecc7d34f52f5b592d0430bc7f1
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1998--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "directional-element-interface.hh"
21 #include "engraver.hh"
22 #include "item.hh"
23 #include "side-position-interface.hh"
24 #include "stream-event.hh"
25 #include "text-interface.hh"
27 #include "translator.icc"
29 /**
30 typeset directions that are plain text.
32 class Text_engraver : public Engraver
34 vector<Stream_event *> evs_;
35 public:
36 TRANSLATOR_DECLARATIONS (Text_engraver);
37 protected:
38 void stop_translation_timestep ();
39 void process_music ();
41 DECLARE_TRANSLATOR_LISTENER (text_script);
44 IMPLEMENT_TRANSLATOR_LISTENER (Text_engraver, text_script);
45 void
46 Text_engraver::listen_text_script (Stream_event *ev)
48 evs_.push_back (ev);
51 void
52 Text_engraver::process_music ()
54 for (vsize i = 0; i < evs_.size (); i++)
56 Stream_event *r = evs_[i];
58 // URG: Text vs TextScript
59 Item *text = make_item ("TextScript", r->self_scm ());
61 int priority = robust_scm2int (text->get_property ("script-priority"),
62 200);
64 /* see script-engraver.cc */
65 priority += i;
67 text->set_property ("script-priority", scm_from_int (priority));
69 Direction dir = to_dir (r->get_property ("direction"));
70 if (dir)
71 set_grob_direction (text, dir);
73 SCM mark = r->get_property ("text");
75 text->set_property ("text", mark);
79 void
80 Text_engraver::stop_translation_timestep ()
82 evs_.clear ();
85 Text_engraver::Text_engraver ()
89 ADD_TRANSLATOR (Text_engraver,
90 /* doc */
91 "Create text scripts.",
93 /* create */
94 "TextScript ",
96 /* read */
97 "",
99 /* write */