]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/auto-change-iterator.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / auto-change-iterator.cc
index 76286042f05c813cdef156148f3104ec8c77b418..f5c54f224ce37f508faa70e3a905c7d87a592b70 100644 (file)
@@ -3,13 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1999--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "context.hh"
-#include "event.hh"
-#include "music-wrapper-iterator.hh"
 #include "direction.hh"
+#include "international.hh"
+#include "music-wrapper-iterator.hh"
 
 class Auto_change_iterator : public Music_wrapper_iterator
 {
@@ -22,20 +22,20 @@ protected:
   virtual void do_quit ();
   virtual void construct_children ();
   virtual void process (Moment);
-  Array<Pitch> pending_pitch (Moment) const;
+  vector<Pitch> pending_pitch (Moment) const;
 private:
   SCM split_list_;
   Direction where_dir_;
-  void change_to (Music_iterator *, SCM, String);
+  void change_to (Music_iterator *, SCM, string);
   Moment start_moment_;
 
-  Interpretation_context_handle up_;
-  Interpretation_context_handle down_;
+  Context_handle up_;
+  Context_handle down_;
 };
 
 void
 Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym,
-                                String to_id)
+                                string to_id)
 {
   Context *current = it->get_outlet ();
   Context *last = 0;
@@ -58,27 +58,29 @@ Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym,
 
   if (current && current->id_string () == to_id)
     {
-      String msg;
-      msg += _ ("Can't switch translators, I'm there already");
+      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);
+         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
+
+         */
+         ;
+       }
+    }
 }
 
 void
@@ -101,7 +103,7 @@ Auto_change_iterator::process (Moment m)
       if (d && d != where_dir_)
        {
          where_dir_ = d;
-         String to_id = (d >= 0) ? "up" : "down";
+         string to_id = (d >= 0) ? "up" : "down";
          change_to (child_iter_,
                     ly_symbol2scm ("Staff"),
                     to_id);