X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fauto-change-iterator.cc;h=ade8303e0d75a5cdc639799fa58bcee6d617b541;hb=08b2a48bdd102e2e53b4eafaf8bdc4726e4f1119;hp=bc589b25bb1dc8e0f80386209a5b7c88f9ed2d5d;hpb=64313890b232c731d432e5b096f30bffc3f3756d;p=lilypond.git diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index bc589b25bb..ade8303e0d 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -22,11 +22,11 @@ protected: virtual void do_quit (); virtual void construct_children (); virtual void process (Moment); - std::vector pending_pitch (Moment) const; + vector pending_pitch (Moment) const; private: SCM split_list_; Direction where_dir_; - void change_to (Music_iterator *, SCM, std::string); + void change_to (Music_iterator *, SCM, string); Moment start_moment_; Context_handle up_; @@ -35,7 +35,7 @@ private: void Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym, - std::string to_id) + string to_id) { Context *current = it->get_outlet (); Context *last = 0; @@ -58,27 +58,30 @@ Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym, if (current && current->id_string () == to_id) { - std::string msg; + string msg; msg += _f ("can't change, already in translator: %s", to_id); } if (current) - if (last) - { - Context *dest - = it->get_outlet ()->find_create_context (to_type_sym, to_id, SCM_EOL); - current->remove_context (last); - dest->add_context (last); - } - else - { - /* - We could change the current translator's id, but that would make - errors hard to catch - - */ - } - else; + { + if (last) + { + Context *dest + = it->get_outlet ()->find_create_context (to_type_sym, to_id, SCM_EOL); + + send_stream_event (last, "ChangeParent", get_music ()->origin (), + ly_symbol2scm ("context"), dest->self_scm ()); + } + else + { + /* + We could change the current translator's id, but that would make + errors hard to catch + + */ + ; + } + } } void @@ -88,6 +91,8 @@ Auto_change_iterator::process (Moment m) Moment now = get_outlet ()->now_mom (); Moment *splitm = 0; + if (start_moment_.main_part_.is_infinity () && start_moment_ < 0) + start_moment_ = now; for (; scm_is_pair (split_list_); split_list_ = scm_cdr (split_list_)) { @@ -101,7 +106,7 @@ Auto_change_iterator::process (Moment m) if (d && d != where_dir_) { where_dir_ = d; - std::string to_id = (d >= 0) ? "up" : "down"; + string to_id = (d >= 0) ? "up" : "down"; change_to (child_iter_, ly_symbol2scm ("Staff"), to_id);