X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fambitus-engraver.cc;h=cd5402b2a0ac50768f80209484a92dc9d435c3c6;hb=c4cfedc7e988cc56d6390881288ae8c1a7e333c3;hp=82f05c3974a7e279cb498366275f186e693c540f;hpb=a7f82e4dc22fc6219a9fe0f6874f8c91e3f31f24;p=lilypond.git diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc index 82f05c3974..cd5402b2a0 100644 --- a/lily/ambitus-engraver.cc +++ b/lily/ambitus-engraver.cc @@ -3,18 +3,22 @@ source file of the GNU LilyPond music typesetter - (c) 2002--2005 Juergen Reuter + (c) 2002--2007 Juergen Reuter Han-Wen Nienhuys set_parent (heads_[d], Y_AXIS); heads_[d]->set_object ("accidental-grob", - accidentals_[d]->self_scm ()); + accidentals_[d]->self_scm ()); Axis_group_interface::add_element (group_, heads_[d]); Axis_group_interface::add_element (group_, accidentals_[d]); Side_position_interface::add_support (accidentals_[d], heads_[d]); @@ -85,15 +89,10 @@ void Ambitus_engraver::process_music () { /* - * Ensure that ambitus is created in the very first timestep (on - * which lily does not call start_translation_timestep ()). - * Otherwise, if a voice begins with a rest, the ambitus grob will - * be placed after the rest. + * Ensure that ambitus is created in the very first timestep */ if (!ambitus_) - { - create_ambitus (); - } + create_ambitus (); } void @@ -115,20 +114,13 @@ Ambitus_engraver::stop_translation_timestep () } void -Ambitus_engraver::acknowledge_grob (Grob_info info) +Ambitus_engraver::acknowledge_note_head (Grob_info info) { - Item *item = dynamic_cast (info.grob ()); - if (item) + Stream_event *nr = info.event_cause (); + if (nr && nr->in_event_class ("note-event")) { - if (Note_head::has_interface (info.grob ())) - { - Music *nr = info.music_cause (); - if (nr && nr->is_mus_type ("note-event")) - { - Pitch pitch = *unsmob_pitch (nr->get_property ("pitch")); - pitch_interval_.add_point (pitch); - } - } + Pitch pitch = *unsmob_pitch (nr->get_property ("pitch")); + pitch_interval_.add_point (pitch); } } @@ -153,9 +145,9 @@ Ambitus_engraver::finalize () handle = scm_assoc (scm_from_int (p.get_notename ()), start_key_sig_); - int sig_alter = (handle != SCM_BOOL_F) - ? scm_to_int (scm_cdr (handle)) : 0; - + Rational sig_alter = (handle != SCM_BOOL_F) + ? robust_scm2rational (scm_cdr (handle), Rational (0)) : Rational (0); + if (sig_alter == p.get_alteration ()) { accidentals_[d]->suicide (); @@ -163,15 +155,14 @@ Ambitus_engraver::finalize () } else { - SCM l = scm_list_1 (scm_from_int (p.get_alteration ())); - accidentals_[d]->set_property ("accidentals", l); - + accidentals_[d]->set_property ("alteration", ly_rational2scm (p.get_alteration ())); } } while (flip (&d) != DOWN); - ambitus_->set_object ("note-heads", scm_list_2 (heads_[DOWN]->self_scm (), - heads_[UP]->self_scm ())); + + Pointer_group_interface::add_grob (ambitus_, ly_symbol2scm ("note-heads"), heads_[DOWN]); + Pointer_group_interface::add_grob (ambitus_, ly_symbol2scm ("note-heads"), heads_[UP]); } else { @@ -187,12 +178,13 @@ Ambitus_engraver::finalize () } } -#include "translator.icc" - +ADD_ACKNOWLEDGER (Ambitus_engraver, note_head); ADD_TRANSLATOR (Ambitus_engraver, - /* descr */ "", - /* creats*/ "Ambitus AmbitusLine AmbitusNoteHead AmbitusAccidental", - /* accepts */ "", - /* acks */ "note-head-interface", - /* reads */ "", + /* doc */ "", + /* create */ + "Ambitus " + "AmbitusLine " + "AmbitusNoteHead " + "AmbitusAccidental", + /* read */ "", /* write */ "");