X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fspan-arpeggio-engraver.cc;h=2bd12b0b3190cc58163180429827ccca815ac851;hb=7a748b8d385139bf3c68d1370a119d277d92134b;hp=90b0767e67feaffaa15acd0852fc7c3a79868778;hpb=dcb8f596283022b8fdc4385c5f9f72d48c6b46fa;p=lilypond.git diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc index 90b0767e67..2bd12b0b31 100644 --- a/lily/span-arpeggio-engraver.cc +++ b/lily/span-arpeggio-engraver.cc @@ -3,38 +3,37 @@ source file of the GNU LilyPond music typesetter - (c) 2000 Jan Nieuwenhuizen + (c) 2000--2004 Jan Nieuwenhuizen + + Han-Wen Nienhuys */ #include "engraver.hh" #include "lily-guile.hh" #include "item.hh" #include "arpeggio.hh" -#include "span-arpeggio.hh" #include "group-interface.hh" #include "side-position-interface.hh" #include "staff-symbol-referencer.hh" /** - - Make arpeggios that span multiple staffs. Catch arpeggios, and span a + Make arpeggios that span multiple staves. Catch arpeggios, and span a Span_arpeggio over them if we find more than two arpeggios. */ class Span_arpeggio_engraver : public Engraver { public: - VIRTUAL_COPY_CONS (Translator); - Span_arpeggio_engraver (); - + TRANSLATOR_DECLARATIONS (Span_arpeggio_engraver); + protected: - virtual void acknowledge_element (Score_element_info); - virtual void process_acknowledged (); - virtual void do_pre_move_processing (); + virtual void acknowledge_grob (Grob_info); + virtual void process_acknowledged_grobs (); + virtual void stop_translation_timestep (); private: Item *span_arpeggio_; - Link_array arpeggios_; + Link_array arpeggios_; }; @@ -44,45 +43,70 @@ Span_arpeggio_engraver::Span_arpeggio_engraver () } void -Span_arpeggio_engraver::acknowledge_element (Score_element_info info) +Span_arpeggio_engraver::acknowledge_grob (Grob_info info) { - if (info.origin_trans_l_arr (this).size () - && Arpeggio::has_interface (info.elem_l_)) + if (Arpeggio::has_interface (info.grob_) + && info.origin_contexts (this).size ()) // huh? what's this test for? { - arpeggios_.push (info.elem_l_); + arpeggios_.push (info.grob_); } } void -Span_arpeggio_engraver::process_acknowledged () +Span_arpeggio_engraver::process_acknowledged_grobs () { + /* + connectArpeggios is slightly brusque; we should really read a grob + property of the caught non-span arpeggios. That way, we can have + + both non-connected and connected arps in one pianostaff. + + */ if (!span_arpeggio_ && arpeggios_.size () > 1 && to_boolean (get_property ("connectArpeggios"))) { - span_arpeggio_ = new Item (get_property ("SpanArpeggio")); - span_arpeggio_->set_parent (arpeggios_[0], Y_AXIS); - Side_position::set_axis (span_arpeggio_, X_AXIS); - Pointer_group_interface pgi (span_arpeggio_, "arpeggios"); - for (int i = 0; i < arpeggios_.size () ; i++) - { - pgi.add_element (arpeggios_[i]); - span_arpeggio_->add_dependency (arpeggios_[i]); - } - - announce_element (span_arpeggio_, 0); + span_arpeggio_ = make_item ("Arpeggio"); + announce_grob (span_arpeggio_, SCM_EOL); } } void -Span_arpeggio_engraver::do_pre_move_processing () +Span_arpeggio_engraver::stop_translation_timestep () { if (span_arpeggio_) { - typeset_element (span_arpeggio_); + /* + we do this very late, to make sure we also catch `extra' + side-pos support like accidentals. + */ + for (int i=0; i < arpeggios_.size (); i ++) + { + for (SCM s = arpeggios_[i]->get_property ("stems"); + ly_c_pair_p (s); s = ly_cdr (s)) + Group_interface::add_thing (span_arpeggio_, ly_symbol2scm ("stems"), ly_car (s)); + for (SCM s = arpeggios_[i]->get_property ("side-support-elements"); + ly_c_pair_p (s); s = ly_cdr (s)) + Group_interface::add_thing (span_arpeggio_, ly_symbol2scm ("side-support-elements"), ly_car (s)); + + /* + we can't kill the children, since we don't want to the + previous note to bump into the span arpeggio; so we make + it transparent. */ + arpeggios_[i]->set_property ("print-function", SCM_EOL); + } + + typeset_grob (span_arpeggio_); span_arpeggio_ = 0; } arpeggios_.clear (); } -ADD_THIS_TRANSLATOR (Span_arpeggio_engraver); + +ENTER_DESCRIPTION (Span_arpeggio_engraver, +/* descr */ "", +/* creats*/ "Arpeggio", +/* accepts */ "", +/* acks */ "arpeggio-interface", +/* reads */ "connectArpeggios", +/* write */ "");