LSR: Update.
[lilypond/mpolesky.git] / lily / hara-kiri-engraver.cc
blobd35dbbf8291de975abade4b3c095d81c08a37a5a
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2005--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
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.
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.
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/>.
20 #include "axis-group-engraver.hh"
21 #include "hara-kiri-group-spanner.hh"
22 #include "rhythmic-head.hh"
23 #include "spanner.hh"
25 #include "translator.icc"
28 TODO: fold together with axis_group_engraver?
31 class Hara_kiri_engraver : public Axis_group_engraver
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);
45 Hara_kiri_engraver::Hara_kiri_engraver ()
47 interesting_ = SCM_EOL;
50 void
51 Hara_kiri_engraver::derived_mark () const
53 scm_gc_mark (interesting_);
56 void
57 Hara_kiri_engraver::process_music ()
59 Axis_group_engraver::process_music ();
60 interesting_ = get_property ("keepAliveInterfaces");
63 void
64 Hara_kiri_engraver::add_element (Grob *e)
66 Axis_group_engraver::add_element (e);
69 Spanner *
70 Hara_kiri_engraver::get_spanner ()
72 Spanner *sp = make_spanner ("VerticalAxisGroup", SCM_EOL);
73 return sp;
76 void
77 Hara_kiri_engraver::acknowledge_grob (Grob_info i)
79 Axis_group_engraver::acknowledge_grob (i);
80 if (staffline_)
82 for (SCM s = interesting_; scm_is_pair (s); s = scm_cdr (s))
84 if (i.grob ()->internal_has_interface (scm_car (s)))
85 Hara_kiri_group_spanner::add_interesting_item (staffline_, i.grob ());
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).",
98 /* create */
99 "VerticalAxisGroup ",
101 /* read */
102 "keepAliveInterfaces ",
104 /* write */