2 trill-spanner-engraver.cc -- implement Trill_spanner_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2005 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?
16 #include "note-column.hh"
17 #include "side-position-interface.hh"
18 #include "engraver.hh"
20 class Trill_spanner_engraver : public Engraver
23 TRANSLATOR_DECLARATIONS (Trill_spanner_engraver);
25 virtual void finalize ();
26 virtual void acknowledge_grob (Grob_info);
27 virtual bool try_music (Music *);
28 virtual void stop_translation_timestep ();
29 virtual void process_music ();
35 Drul_array<Music *> req_drul_;
39 Trill_spanner_engraver::Trill_spanner_engraver ()
49 Trill_spanner_engraver::try_music (Music *m)
51 if (m->is_mus_type ("trill-span-event"))
53 Direction d = to_dir (m->get_property ("span-direction"));
62 Trill_spanner_engraver::process_music ()
68 req_drul_[STOP]->origin ()->warning (_ ("can't find start of trill spanner"));
82 req_drul_[START]->origin ()->warning (_ ("already have a trill spanner"));
86 current_req_ = req_drul_[START];
87 span_ = make_spanner ("TrillSpanner", req_drul_[START]->self_scm ());
88 Side_position_interface::set_axis (span_, Y_AXIS);
95 Trill_spanner_engraver::acknowledge_grob (Grob_info info)
97 Spanner *spans[2] ={span_, finished_};
98 for (int i = 0; i < 2; i++)
100 if (spans[i] && Note_column::has_interface (info.grob_))
102 Side_position_interface::add_support (spans[i], info.grob_);
103 add_bound_item (spans[i], dynamic_cast<Item *> (info.grob_));
109 Trill_spanner_engraver::typeset_all ()
113 if (!finished_->get_bound (RIGHT))
115 Grob *e = unsmob_grob (get_property ("currentMusicalColumn"));
116 finished_->set_bound (RIGHT, e);
123 Trill_spanner_engraver::stop_translation_timestep ()
125 if (span_ && !span_->get_bound (LEFT))
127 Grob *e = unsmob_grob (get_property ("currentMusicalColumn"));
128 span_->set_bound (LEFT, e);
132 req_drul_[START] = 0;
137 Trill_spanner_engraver::finalize ()
142 current_req_->origin ()->warning (_ ("unterminated trill spanner"));
148 ADD_TRANSLATOR (Trill_spanner_engraver,
149 /* descr */ "Create trill spanner from a Music.",
150 /* creats*/ "TrillSpanner",
151 /* accepts */ "trill-span-event",
152 /* acks */ "note-column-interface",