2 fall-engraver.cc -- implement Bend_after_engraver
4 (c) 2006 Han-Wen Nienhuys
13 #include "stream-event.hh"
15 #include "translator.icc"
17 class Bend_after_engraver : public Engraver
20 TRANSLATOR_DECLARATIONS (Bend_after_engraver);
21 DECLARE_ACKNOWLEDGER (note_head);
24 DECLARE_TRANSLATOR_LISTENER (bend_after);
25 void process_music ();
26 void stop_translation_timestep ();
27 void start_translation_timestep ();
32 Stream_event *fall_event_;
38 Bend_after_engraver::stop_fall ()
40 bool bar = scm_is_string (get_property ("whichBar"));
43 fall_->set_bound (RIGHT, unsmob_grob (bar
44 ? get_property ("currentCommandColumn")
45 : get_property ("currentMusicalColumn")));
52 Bend_after_engraver::stop_translation_timestep ()
54 if (fall_ && !fall_->get_bound (LEFT))
56 fall_->set_bound (LEFT, note_head_);
57 fall_->set_parent (note_head_, Y_AXIS);
62 Bend_after_engraver::start_translation_timestep ()
64 if (fall_ && now_mom ().main_part_ >= stop_moment_.main_part_)
71 Bend_after_engraver::acknowledge_note_head (Grob_info info)
76 if (note_head_ && fall_)
81 note_head_ = info.grob ();
82 stop_moment_ = now_mom () + get_event_length (info.event_cause ());
85 Bend_after_engraver::Bend_after_engraver ()
92 IMPLEMENT_TRANSLATOR_LISTENER (Bend_after_engraver, bend_after);
94 Bend_after_engraver::listen_bend_after (Stream_event *ev)
96 ASSIGN_EVENT_ONCE (fall_event_, ev);
100 Bend_after_engraver::process_music ()
102 if (fall_event_ && !fall_)
104 fall_ = make_spanner ("BendAfter", fall_event_->self_scm ());
105 fall_->set_property ("delta-position",
106 scm_from_double (robust_scm2double (fall_event_->get_property ("delta-step"), 0)));
110 ADD_ACKNOWLEDGER (Bend_after_engraver, note_head);
112 ADD_TRANSLATOR (Bend_after_engraver,
113 /* doc */ "Create fall spanners.",
114 /* create */ "BendAfter",