2 trill-spanner-engraver.cc -- implement Trill_spanner_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
10 C&P from text-spanner.cc
12 - todo: ending should be detected automatically? a new note
13 automatically is the end of the trill?
17 #include "note-column.hh"
18 #include "side-position-interface.hh"
19 #include "engraver.hh"
21 class Trill_spanner_engraver : public Engraver
24 TRANSLATOR_DECLARATIONS (Trill_spanner_engraver);
26 virtual void finalize ();
27 virtual void acknowledge_grob (Grob_info);
28 virtual bool try_music (Music *);
29 virtual void stop_translation_timestep ();
30 virtual void process_music ();
36 Drul_array<Music*> req_drul_;
41 Trill_spanner_engraver::Trill_spanner_engraver ()
51 Trill_spanner_engraver::try_music (Music *m)
53 if (m->is_mus_type ("trill-span-event"))
55 Direction d = to_dir (m->get_property ("span-direction"));
64 Trill_spanner_engraver::process_music ()
70 req_drul_[STOP]->origin ()->warning (_ ("can't find start of trill spanner"));
84 req_drul_[START]->origin ()->warning (_ ("already have a trill spanner"));
88 current_req_ = req_drul_[START];
89 span_ = make_spanner ("TrillSpanner", req_drul_[START]->self_scm ());
90 Side_position_interface::set_axis (span_, Y_AXIS);
97 Trill_spanner_engraver::acknowledge_grob (Grob_info info)
99 Spanner * spans[2] ={span_, finished_};
100 for (int i = 0; i < 2 ; i++)
102 if (spans[i] && Note_column::has_interface (info.grob_))
104 Side_position_interface::add_support (spans[i], info.grob_);
105 add_bound_item (spans[i], dynamic_cast<Item*> (info.grob_));
111 Trill_spanner_engraver::typeset_all ()
115 if (!finished_->get_bound (RIGHT))
117 Grob* e = unsmob_grob (get_property ("currentMusicalColumn"));
118 finished_->set_bound (RIGHT, e);
125 Trill_spanner_engraver::stop_translation_timestep ()
127 if (span_ && !span_->get_bound (LEFT))
129 Grob* e = unsmob_grob (get_property ("currentMusicalColumn"));
130 span_->set_bound (LEFT, e);
134 req_drul_[START] = 0;
139 Trill_spanner_engraver::finalize ()
144 current_req_->origin ()->warning (_ ("unterminated trill spanner"));
150 ADD_TRANSLATOR (Trill_spanner_engraver,
151 /* descr */ "Create trill spanner from a Music.",
152 /* creats*/ "TrillSpanner",
153 /* accepts */ "trill-span-event",
154 /* acks */ "note-column-interface",