2 change-iterator.cc -- implement Change_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "change-iterator.hh"
10 #include "translator-group.hh"
11 #include "change-translator.hh"
16 Change_iterator::error (String reason)
18 String to_type = change_l ()->change_to_type_str_;
19 String to_id = change_l ()->change_to_id_str_;
21 String warn1 = _f ("can't change `%s\' to `%s\'", to_type, to_id)
23 String warn2= "Change_iterator::do_process_and_next (): "
24 + report_to_l ()->type_str_ + " = `"
25 + report_to_l ()->id_str_ + "\': ";
27 change_l ()->warning (warn1);
31 Change_iterator::change_l ()
33 return (Change_translator*) music_l_;
37 move to construct_children ?
40 Change_iterator::do_process_and_next (Moment m)
42 Translator_group * current = report_to_l ();
43 Translator_group * last = 0;
45 String to_type = change_l ()->change_to_type_str_;
46 String to_id = change_l ()->change_to_id_str_;
48 /* find the type of translator that we're changing.
50 If \translator Staff = bass, then look for Staff = *
52 while (current && current->type_str_ != to_type)
55 current = current->daddy_trans_l_;
62 Translator_group * dest =
63 report_to_l ()->find_create_translator_l (to_type, to_id);
64 current->remove_translator_p (last);
65 dest->add_translator (last);
70 We could change the current translator's id, but that would make
73 last->translator_id_str_ = change_l ()->change_to_id_str_;
75 error ("I'm one myself");
78 error ("None of these in my family.");
79 Music_iterator::do_process_and_next (m);
82 IMPLEMENT_IS_TYPE_B1 (Change_iterator, Music_iterator);