X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpart-combine-engraver.cc;h=9646d7a355a6a46bdf6c6bcb12b36614d9f904b8;hb=97a0169312a260933246ab224e4f8b0969871dd5;hp=f12cfbad95de5324622307e5c0f4cff712076e6f;hpb=55ac733b69643a6bc6a83b706c65cb56efd388ef;p=lilypond.git diff --git a/lily/part-combine-engraver.cc b/lily/part-combine-engraver.cc index f12cfbad95..9646d7a355 100644 --- a/lily/part-combine-engraver.cc +++ b/lily/part-combine-engraver.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2000--2011 Jan Nieuwenhuizen + Copyright (C) 2000--2015 Jan Nieuwenhuizen Han-Wen Nienhuys @@ -34,11 +34,11 @@ class Part_combine_engraver : public Engraver TRANSLATOR_DECLARATIONS (Part_combine_engraver); protected: - DECLARE_ACKNOWLEDGER (note_head); - DECLARE_ACKNOWLEDGER (stem); + void acknowledge_note_head (Grob_info); + void acknowledge_stem (Grob_info); - DECLARE_TRANSLATOR_LISTENER (part_combine); - DECLARE_TRANSLATOR_LISTENER (note); + void listen_part_combine (Stream_event *); + void listen_note (Stream_event *); void process_music (); void stop_translation_timestep (); void create_item (Stream_event *ev); @@ -51,7 +51,6 @@ private: Stream_event *waiting_event_; }; -IMPLEMENT_TRANSLATOR_LISTENER (Part_combine_engraver, part_combine); void Part_combine_engraver::listen_part_combine (Stream_event *ev) { @@ -61,14 +60,14 @@ Part_combine_engraver::listen_part_combine (Stream_event *ev) waiting_event_ = new_event_; } -IMPLEMENT_TRANSLATOR_LISTENER (Part_combine_engraver, note); void Part_combine_engraver::listen_note (Stream_event *) { note_found_ = true; } -Part_combine_engraver::Part_combine_engraver () +Part_combine_engraver::Part_combine_engraver (Context *c) + : Engraver (c) { text_ = 0; new_event_ = 0; @@ -79,13 +78,13 @@ Part_combine_engraver::Part_combine_engraver () void Part_combine_engraver::create_item (Stream_event *ev) { - SCM what = ev->get_property ("class"); + SCM what = scm_car (ev->get_property ("class")); SCM text = SCM_EOL; - if (what == ly_symbol2scm ("solo-one-event")) + if (scm_is_eq (what, ly_symbol2scm ("solo-one-event"))) text = get_property ("soloText"); - else if (what == ly_symbol2scm ("solo-two-event")) + else if (scm_is_eq (what, ly_symbol2scm ("solo-two-event"))) text = get_property ("soloIIText"); - else if (what == ly_symbol2scm ("unisono-event")) + else if (scm_is_eq (what, ly_symbol2scm ("unisono-event"))) text = get_property ("aDueText"); if (Text_interface::is_markup (text)) @@ -117,8 +116,8 @@ Part_combine_engraver::acknowledge_note_head (Grob_info i) Grob *t = text_; Side_position_interface::add_support (t, i.grob ()); if (Side_position_interface::get_axis (t) == X_AXIS - && !t->get_parent (Y_AXIS)) - t->set_parent (i.grob (), Y_AXIS); + && !t->get_parent (Y_AXIS)) + t->set_parent (i.grob (), Y_AXIS); } } @@ -137,23 +136,30 @@ Part_combine_engraver::stop_translation_timestep () note_found_ = false; } -ADD_ACKNOWLEDGER (Part_combine_engraver, note_head); -ADD_ACKNOWLEDGER (Part_combine_engraver, stem); +void +Part_combine_engraver::boot () +{ + ADD_LISTENER (Part_combine_engraver, part_combine); + ADD_LISTENER (Part_combine_engraver, note); + ADD_ACKNOWLEDGER (Part_combine_engraver, note_head); + ADD_ACKNOWLEDGER (Part_combine_engraver, stem); +} + ADD_TRANSLATOR (Part_combine_engraver, - /* doc */ - "Part combine engraver for orchestral scores: Print markings" - " @q{a2}, @q{Solo}, @q{Solo II}, and @q{unisono}.", - - /* create */ - "CombineTextScript ", - - /* read */ - "printPartCombineTexts " - "partCombineTextsOnNote " - "soloText " - "soloIIText " - "aDueText ", - - /* write */ - "" - ); + /* doc */ + "Part combine engraver for orchestral scores: Print markings" + " @q{a2}, @q{Solo}, @q{Solo II}, and @q{unisono}.", + + /* create */ + "CombineTextScript ", + + /* read */ + "printPartCombineTexts " + "partCombineTextsOnNote " + "soloText " + "soloIIText " + "aDueText ", + + /* write */ + "" + );