]> git.donarmstrong.com Git - lilypond.git/blob - lily/tweak-engraver.cc
Merge branch 'lilypond/translation' of ssh://git.sv.gnu.org/srv/git/lilypond into...
[lilypond.git] / lily / tweak-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2005--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6
7   LilyPond is free software: you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   LilyPond is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "engraver.hh"
22
23 #include "grob.hh"
24 #include "stream-event.hh"
25 #include "translator.icc"
26
27 class Tweak_engraver : public Engraver
28 {
29   TRANSLATOR_DECLARATIONS (Tweak_engraver);
30
31 protected:
32   DECLARE_ACKNOWLEDGER (grob);
33 };
34
35 Tweak_engraver::Tweak_engraver ()
36 {
37 }
38
39 void
40 Tweak_engraver::acknowledge_grob (Grob_info info)
41 {
42   if (Stream_event *ev = info.event_cause ())
43     {
44       for (SCM s = ev->get_property ("tweaks");
45            scm_is_pair (s); s = scm_cdr (s))
46         {
47           info.grob ()->set_property (scm_caar (s), scm_cdar (s));
48         }
49     }
50 }
51
52 ADD_ACKNOWLEDGER (Tweak_engraver, grob);
53 ADD_TRANSLATOR (Tweak_engraver,
54                 /* doc */
55                 "Read the @code{tweaks} property from the originating event,"
56                 " and set properties.",
57
58                 /* create */
59                 "",
60
61                 /* read */
62                 "",
63
64                 /* write */
65                 ""
66                );