]> git.donarmstrong.com Git - lilypond.git/blob - lily/pitch-squash-engraver.cc
* lily/include/translator.icc: new file.
[lilypond.git] / lily / pitch-squash-engraver.cc
1 /*
2   pitch-squash-engraver.cc -- implement Pitch_squash_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8 #include "staff-symbol-referencer.hh"
9 #include "note-head.hh"
10 #include "rhythmic-head.hh"
11 #include "engraver.hh"
12
13 class Pitch_squash_engraver : public Engraver
14 {
15 public:
16   TRANSLATOR_DECLARATIONS (Pitch_squash_engraver);
17   virtual void acknowledge_grob (Grob_info);
18 };
19
20 void
21 Pitch_squash_engraver::acknowledge_grob (Grob_info i)
22 {
23   SCM newpos = get_property ("squashedPosition");
24   if (scm_is_number (newpos)
25       && Note_head::has_interface (i.grob ()))
26     {
27       i.grob ()->set_property ("staff-position", newpos);
28     }
29 }
30
31 Pitch_squash_engraver::Pitch_squash_engraver ()
32 {
33 }
34
35 #include "translator.icc"
36
37 ADD_TRANSLATOR (Pitch_squash_engraver,
38                 /* descr */
39                 "Set the vertical position of noteheads to "
40                 "@code{squashedPosition}, if that "
41                 "property is set. "
42                 "This can be used to make  a single line staff "
43                 "demonstrating the rhythm of a melody.",
44
45                 /* creats*/ "",
46                 /* accepts */ "",
47                 /* acks  */ "note-head-interface",
48                 /* reads */ "squashedPosition",
49                 /* write */ "");