]> git.donarmstrong.com Git - lilypond.git/blob - lily/pitch-squash-engraver.cc
Web-ja: update introduction
[lilypond.git] / lily / pitch-squash-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
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.
10
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.
15
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/>.
18 */
19
20 #include "engraver.hh"
21
22 #include "staff-symbol-referencer.hh"
23 #include "note-head.hh"
24 #include "rhythmic-head.hh"
25 #include "grob.hh"
26
27 class Pitch_squash_engraver : public Engraver
28 {
29 public:
30   TRANSLATOR_DECLARATIONS (Pitch_squash_engraver);
31   void acknowledge_note_head (Grob_info);
32 };
33
34 void
35 Pitch_squash_engraver::acknowledge_note_head (Grob_info i)
36 {
37   SCM newpos = get_property ("squashedPosition");
38   if (scm_is_number (newpos))
39     i.grob ()->set_property ("staff-position", newpos);
40 }
41
42 Pitch_squash_engraver::Pitch_squash_engraver (Context *c)
43   : Engraver (c)
44 {
45 }
46
47 #include "translator.icc"
48 void
49 Pitch_squash_engraver::boot ()
50 {
51   ADD_ACKNOWLEDGER (Pitch_squash_engraver, note_head);
52 }
53
54 ADD_TRANSLATOR (Pitch_squash_engraver,
55                 /* doc */
56                 "Set the vertical position of note heads to"
57                 " @code{squashedPosition}, if that property is set.  This can"
58                 " be used to make a single-line staff demonstrating the"
59                 " rhythm of a melody.",
60
61                 /* create */
62                 "",
63
64                 /* read */
65                 "squashedPosition ",
66
67                 /* write */
68                 ""
69                );