]> git.donarmstrong.com Git - lilypond.git/blob - lily/hara-kiri-engraver.cc
Doc-es: update Unfretted.
[lilypond.git] / lily / hara-kiri-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2005--2009 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 "axis-group-engraver.hh"
21 #include "hara-kiri-group-spanner.hh"
22 #include "rhythmic-head.hh"
23 #include "spanner.hh"
24
25 #include "translator.icc"
26
27 /*
28   TODO: fold together with axis_group_engraver? 
29  */
30
31 class Hara_kiri_engraver : public Axis_group_engraver
32 {
33 protected:
34   virtual Spanner *get_spanner ();
35   DECLARE_ACKNOWLEDGER (grob);
36   virtual void add_element (Grob *e);
37   void process_music ();
38   virtual void derived_mark () const;
39   SCM interesting_;
40 public:
41   TRANSLATOR_DECLARATIONS (Hara_kiri_engraver);
42 };
43
44
45 Hara_kiri_engraver::Hara_kiri_engraver ()
46 {
47   interesting_ = SCM_EOL;
48 }
49
50 void
51 Hara_kiri_engraver::derived_mark () const
52 {
53   scm_gc_mark (interesting_);
54 }
55
56 void
57 Hara_kiri_engraver::process_music ()
58 {
59   Axis_group_engraver::process_music ();
60   interesting_ = get_property ("keepAliveInterfaces");
61 }
62
63 void
64 Hara_kiri_engraver::add_element (Grob *e)
65 {
66   Axis_group_engraver::add_element (e);
67 }
68
69 Spanner *
70 Hara_kiri_engraver::get_spanner ()
71 {
72   Spanner *sp = make_spanner ("VerticalAxisGroup", SCM_EOL);
73   return sp;
74 }
75
76 void
77 Hara_kiri_engraver::acknowledge_grob (Grob_info i)
78 {
79   Axis_group_engraver::acknowledge_grob (i);
80   if (staffline_)
81     {
82       for (SCM s = interesting_; scm_is_pair (s); s = scm_cdr (s))
83         {
84           if (i.grob ()->internal_has_interface (scm_car (s)))
85             Hara_kiri_group_spanner::add_interesting_item (staffline_, i.grob ());
86         }
87     }
88 }
89
90
91 ADD_ACKNOWLEDGER (Hara_kiri_engraver, grob);
92 ADD_TRANSLATOR (Hara_kiri_engraver,
93                 /* doc */
94                 "Like @code{Axis_group_engraver}, but make a hara-kiri"
95                 " spanner, and add interesting items (i.e., note heads, lyric"
96                 " syllables, and normal rests).",
97
98                 /* create */
99                 "VerticalAxisGroup ",
100
101                 /* read */
102                 "keepAliveInterfaces ",
103
104                 /* write */
105                 ""
106                 );
107