2 change-iterator.cc -- implement Change_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "change-iterator.hh"
10 #include "translator-group.hh"
11 #include "change-translator.hh"
14 Change_iterator::Change_iterator (Change_translator *change_l)
20 Change_iterator::error (String reason)
22 String to_type = change_l_->change_to_type_str_;
23 String to_id = change_l_->change_to_id_str_;
26 _ ("Can't change ") + to_type
27 + _(" to ") + "`" + to_id + "\': " + reason;
28 String warn2= "Change_iterator::process_and_next (): " + report_to_l ()->type_str_ + " = `"
29 + report_to_l ()->id_str_ + "\': ";
31 change_l_->warning (warn1);
35 move to construct_children ?
38 Change_iterator::process_and_next (Moment m)
40 Translator_group * current = report_to_l ();
41 Translator_group * last = 0;
43 String to_type = change_l_->change_to_type_str_;
44 String to_id = change_l_->change_to_id_str_;
46 /* find the type of translator that we're changing.
48 If \translator Staff = bass, then look for Staff = *
50 while (current && current->type_str_ != to_type)
53 current = current->daddy_trans_l_;
60 Translator_group * dest =
61 report_to_l ()->find_create_translator_l (to_type, to_id);
62 current->remove_translator_p (last);
69 We could change the current translator's id, but that would make
72 last->translator_id_str_ = change_l_->change_to_id_str_;
74 error ("I'm one myself");
77 error ("None of these in my family.");
78 Music_iterator::process_and_next (m);
81 IMPLEMENT_IS_TYPE_B1 (Change_iterator, Music_iterator);