]> git.donarmstrong.com Git - lilypond.git/blob - lily/pitch-squash-engraver.cc
e8f3b5335d335b53350aa1af9473195618eb1db6
[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--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "engraver.hh"
10
11 #include "staff-symbol-referencer.hh"
12 #include "note-head.hh"
13 #include "rhythmic-head.hh"
14 #include "grob.hh"
15
16 class Pitch_squash_engraver : public Engraver
17 {
18 public:
19   TRANSLATOR_DECLARATIONS (Pitch_squash_engraver);
20   DECLARE_ACKNOWLEDGER (note_head);
21 };
22
23 void
24 Pitch_squash_engraver::acknowledge_note_head (Grob_info i)
25 {
26   SCM newpos = get_property ("squashedPosition");
27   if (scm_is_number (newpos))
28     i.grob ()->set_property ("staff-position", newpos);
29 }
30
31 Pitch_squash_engraver::Pitch_squash_engraver ()
32 {
33 }
34
35 #include "translator.icc"
36 ADD_ACKNOWLEDGER (Pitch_squash_engraver, note_head);
37 ADD_TRANSLATOR (Pitch_squash_engraver,
38                 /* doc */
39                 "Set the vertical position of note heads to"
40                 " @code{squashedPosition}, if that property is set.  This can"
41                 " be used to make a single-line staff demonstrating the"
42                 " rhythm of a melody.",
43
44                 /* create */
45                 "",
46
47                 /* read */
48                 "squashedPosition ",
49
50                 /* write */
51                 ""
52                 );