Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / lily / hara-kiri-engraver.cc
blob9724d105fbfd1c84c68bb83744d9b20b9653289d
1 /*
2 hara-kiri-engraver.cc -- implement Hara_kiri_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "axis-group-engraver.hh"
10 #include "hara-kiri-group-spanner.hh"
11 #include "rhythmic-head.hh"
12 #include "spanner.hh"
14 #include "translator.icc"
17 TODO: fold together with axis_group_engraver?
20 class Hara_kiri_engraver : public Axis_group_engraver
22 protected:
23 virtual Spanner *get_spanner ();
24 DECLARE_ACKNOWLEDGER (grob);
25 virtual void add_element (Grob *e);
26 void process_music ();
27 virtual void derived_mark () const;
28 SCM interesting_;
29 public:
30 TRANSLATOR_DECLARATIONS (Hara_kiri_engraver);
34 Hara_kiri_engraver::Hara_kiri_engraver ()
36 interesting_ = SCM_EOL;
39 void
40 Hara_kiri_engraver::derived_mark () const
42 scm_gc_mark (interesting_);
45 void
46 Hara_kiri_engraver::process_music ()
48 Axis_group_engraver::process_music ();
49 interesting_ = get_property ("keepAliveInterfaces");
52 void
53 Hara_kiri_engraver::add_element (Grob *e)
55 Axis_group_engraver::add_element (e);
58 Spanner *
59 Hara_kiri_engraver::get_spanner ()
61 Spanner *sp = make_spanner ("VerticalAxisGroup", SCM_EOL);
62 return sp;
65 void
66 Hara_kiri_engraver::acknowledge_grob (Grob_info i)
68 Axis_group_engraver::acknowledge_grob (i);
69 if (staffline_)
71 for (SCM s = interesting_; scm_is_pair (s); s = scm_cdr (s))
73 if (i.grob ()->internal_has_interface (scm_car (s)))
74 Hara_kiri_group_spanner::add_interesting_item (staffline_, i.grob ());
80 ADD_ACKNOWLEDGER (Hara_kiri_engraver, grob);
81 ADD_TRANSLATOR (Hara_kiri_engraver,
82 /* doc */
83 "Like @code{Axis_group_engraver}, but make a hara-kiri"
84 " spanner, and add interesting items (i.e., note heads, lyric"
85 " syllables, and normal rests).",
87 /* create */
88 "VerticalAxisGroup ",
90 /* read */
91 "keepAliveInterfaces ",
93 /* write */