Make whole notes in solfa style the same width as half notes
[lilypond/mpolesky.git] / lily / text-engraver.cc
blob39a732cc01fe4d6c2c17068a77dd67a07414ac8c
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1998--2010 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 "rhythmic-head.hh"
23 #include "side-position-interface.hh"
24 #include "stem.hh"
25 #include "stream-event.hh"
26 #include "text-interface.hh"
27 #include "item.hh"
29 #include "translator.icc"
31 /**
32 typeset directions that are plain text.
34 class Text_engraver : public Engraver
36 vector<Stream_event *> evs_;
37 vector<Grob*> texts_;
38 public:
39 TRANSLATOR_DECLARATIONS (Text_engraver);
40 protected:
41 void stop_translation_timestep ();
42 void process_acknowledged ();
44 DECLARE_TRANSLATOR_LISTENER (text_script);
47 IMPLEMENT_TRANSLATOR_LISTENER (Text_engraver, text_script);
48 void
49 Text_engraver::listen_text_script (Stream_event *ev)
51 evs_.push_back (ev);
54 void
55 Text_engraver::process_acknowledged ()
57 if (texts_.size ())
58 return;
59 for (vsize i = 0; i < evs_.size (); i++)
61 Stream_event *r = evs_[i];
63 // URG: Text vs TextScript
64 Item *text = make_item ("TextScript", r->self_scm ());
66 int priority = robust_scm2int (text->get_property ("script-priority"),
67 200);
69 /* see script-engraver.cc */
70 priority += i;
72 text->set_property ("script-priority", scm_from_int (priority));
74 Direction dir = to_dir (r->get_property ("direction"));
75 if (dir)
76 set_grob_direction (text, dir);
78 SCM mark = r->get_property ("text");
80 text->set_property ("text", mark);
81 texts_.push_back (text);
85 void
86 Text_engraver::stop_translation_timestep ()
88 texts_.clear ();
89 evs_.clear ();
92 Text_engraver::Text_engraver ()
96 ADD_TRANSLATOR (Text_engraver,
97 /* doc */
98 "Create text scripts.",
100 /* create */
101 "TextScript ",
103 /* read */
106 /* write */