X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpiano-pedal-engraver.cc;h=2a2d2aa8ec5b417081fb09f8f1a31ba8e7de9f19;hb=97a0169312a260933246ab224e4f8b0969871dd5;hp=546351a0b9a2f8cb1620e5fc7615a18306786f2d;hpb=55ff9f5a64a00b6c369be47eb8ca3949250f120b;p=lilypond.git diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 546351a0b9..2a2d2aa8ec 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -123,9 +123,9 @@ public: protected: virtual void initialize (); virtual void finalize (); - DECLARE_TRANSLATOR_LISTENER (sustain); - DECLARE_TRANSLATOR_LISTENER (una_corda); - DECLARE_TRANSLATOR_LISTENER (sostenuto); + void listen_sustain (Stream_event *); + void listen_una_corda (Stream_event *); + void listen_sostenuto (Stream_event *); void stop_translation_timestep (); void process_music (); @@ -181,7 +181,8 @@ init_pedal_types () ADD_SCM_INIT_FUNC (Piano_pedal_engraver_init_pedal_types_, init_pedal_types); -Piano_pedal_engraver::Piano_pedal_engraver () +Piano_pedal_engraver::Piano_pedal_engraver (Context *c) + : Engraver (c) { } @@ -205,7 +206,6 @@ Piano_pedal_engraver::initialize () info_list_[NUM_PEDAL_TYPES].type_ = 0; } -IMPLEMENT_TRANSLATOR_LISTENER (Piano_pedal_engraver, sostenuto); void Piano_pedal_engraver::listen_sostenuto (Stream_event *ev) { @@ -213,7 +213,6 @@ Piano_pedal_engraver::listen_sostenuto (Stream_event *ev) ASSIGN_EVENT_ONCE (info_list_[SOSTENUTO].event_drul_[d], ev); } -IMPLEMENT_TRANSLATOR_LISTENER (Piano_pedal_engraver, sustain); void Piano_pedal_engraver::listen_sustain (Stream_event *ev) { @@ -221,7 +220,6 @@ Piano_pedal_engraver::listen_sustain (Stream_event *ev) ASSIGN_EVENT_ONCE (info_list_[SUSTAIN].event_drul_[d], ev); } -IMPLEMENT_TRANSLATOR_LISTENER (Piano_pedal_engraver, una_corda); void Piano_pedal_engraver::listen_una_corda (Stream_event *ev) { @@ -251,11 +249,11 @@ Piano_pedal_engraver::process_music () SCM style = get_property (p->type_->style_sym_); - bool mixed = style == ly_symbol2scm ("mixed"); + bool mixed = scm_is_eq (style, ly_symbol2scm ("mixed")); bool bracket = (mixed - || style == ly_symbol2scm ("bracket")); - bool text = (style == ly_symbol2scm ("text") - || mixed); + || scm_is_eq (style, ly_symbol2scm ("bracket"))); + bool text = (mixed + || scm_is_eq (style, ly_symbol2scm ("text"))); if (text && !p->item_) create_text_grobs (p, mixed); @@ -346,7 +344,7 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, bool mixed) { assert (!p->finished_bracket_); - Grob *cmc = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *cmc = unsmob (get_property ("currentMusicalColumn")); p->bracket_->set_bound (RIGHT, cmc); /* @@ -424,7 +422,7 @@ Piano_pedal_engraver::finalize () if (p->bracket_) { SCM cc = get_property ("currentCommandColumn"); - Item *c = Item::unsmob (cc); + Item *c = unsmob (cc); p->bracket_->set_bound (RIGHT, c); p->finished_bracket_ = p->bracket_; @@ -444,7 +442,7 @@ Piano_pedal_engraver::stop_translation_timestep () typeset_all (p); if (p->bracket_ && !p->bracket_->get_bound (LEFT)) { - Grob *cmc = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *cmc = unsmob (get_property ("currentMusicalColumn")); p->bracket_->set_bound (LEFT, cmc); } } @@ -473,12 +471,20 @@ Piano_pedal_engraver::typeset_all (Pedal_info *p) { Grob *r = p->finished_bracket_->get_bound (RIGHT); if (!r) - p->finished_bracket_->set_bound (RIGHT, Grob::unsmob (get_property ("currentMusicalColumn"))); + p->finished_bracket_->set_bound (RIGHT, unsmob (get_property ("currentMusicalColumn"))); p->finished_bracket_ = 0; } } +void +Piano_pedal_engraver::boot () +{ + ADD_LISTENER (Piano_pedal_engraver, sostenuto); + ADD_LISTENER (Piano_pedal_engraver, sustain); + ADD_LISTENER (Piano_pedal_engraver, una_corda); +} + ADD_TRANSLATOR (Piano_pedal_engraver, /* doc */ "Engrave piano pedal symbols and brackets.",