-/*
- auto-change-iterator.cc -- implement Auto_change_iterator
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#include "music.hh"
-#include "auto-change-iterator.hh"
-#include "translator-group.hh"
-#include "musical-request.hh"
-
-
-
-void
-Auto_change_iterator::change_to (Music_iterator *it, String to_type,
- String to_id)
-{
- Translator_group * current = it->report_to ();
- Translator_group * last = 0;
-
- /*
- Cut & Paste from Change_iterator (ugh).
-
- TODO: abstract this function
- */
-
- /* find the type of translator that we're changing.
-
- If \translator Staff = bass, then look for Staff = *
- */
- while (current && current->type_string_ != to_type)
- {
- last = current;
- current = current->daddy_trans_;
- }
-
- if (current && current->id_string_ == to_id)
- {
- String msg;
- msg += _ ("Can't switch translators, I'm there already");
- }
-
- if (current)
- if (last)
- {
- Translator_group * dest =
- it->report_to ()->find_create_translator (to_type, to_id);
- current->remove_translator (last);
- dest->add_used_group_translator (last);
- }
- else
- {
- /*
- We could change the current translator's id, but that would make
- errors hard to catch
-
- last->translator_id_string_ = get_change ()->change_to_id_string_;
- */
- // error (_ ("I'm one myself"));
- }
- else
- ; // error (_ ("none of these in my family"));
-
-}
-