--- /dev/null
+/*
+ change-iterator.cc -- implement
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "change-iterator.hh"
+#include "translator-group.hh"
+#include "change-translator.hh"
+
+Change_iterator::Change_iterator (Change_translator *change_l)
+{
+ change_l_ = change_l;
+}
+
+/*
+ move to construct_children ?
+ */
+void
+Change_iterator::process_and_next (Moment m)
+{
+ Translator_group * current = report_to_l ();
+ Translator_group * last = 0;
+ while (current && current->type_str_ != change_l_->change_to_type_str_)
+ {
+ last = current;
+ current = current->daddy_trans_l_;
+ }
+ if (current)
+ {
+ Translator_group * dest =
+ report_to_l ()->find_create_translator_l (change_l_->change_to_type_str_,
+ change_l_->change_to_id_str_);
+ current->remove_translator_p (last);
+ dest->add (last);
+ }
+
+ Music_iterator::process_and_next (m);
+}
+
+IMPLEMENT_IS_TYPE_B1 (Change_iterator, Music_iterator);
--- /dev/null
+/*
+ change-iterator.hh -- declare
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CHANGE_ITERATOR_HH
+#define CHANGE_ITERATOR_HH
+
+#include "music-iterator.hh"
+
+
+class Change_iterator : public Music_iterator
+{
+ Change_translator *change_l_;
+
+public:
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Change_iterator (Change_translator* prop_l);
+protected:
+ virtual void process_and_next (Moment);
+};
+
+#endif
--- /dev/null
+/*
+ change-translator.hh -- declare Change_translator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CHANGE_TRANSLATOR_HH
+#define CHANGE_TRANSLATOR_HH
+
+#include "music.hh"
+
+class Change_translator : public Music
+{
+public:
+ String change_to_type_str_;
+ String change_to_id_str_;
+ DECLARE_MY_RUNTIME_TYPEINFO;
+protected:
+ VIRTUAL_COPY_CONS(Change_translator, Music);
+ void do_print () const;
+};
+
+
+#endif // CHANGE_TRANSLATOR_HH
#include "request-iterator.hh"
#include "translator-group.hh"
#include "translation-property.hh"
+#include "change-iterator.hh"
+#include "change-translator.hh"
IMPLEMENT_IS_TYPE_B(Music_iterator);
p = new Voice_iterator ((Voice*) m);
else if (m->is_type_b (Translation_property::static_name ()))
p = new Property_iterator((Translation_property *) m);
-
+ else if (m->is_type_b (Change_translator::static_name ()))
+ p = new Change_iterator((Change_translator*) m);
+
if (m -> translator_type_str_)
{
Translator_group* a =report_l->
p->set_translator (a);
}
-
if (! p->report_to_l())
p ->set_translator (report_l);