]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.14
authorfred <fred>
Sun, 24 Mar 2002 19:57:11 +0000 (19:57 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:57:11 +0000 (19:57 +0000)
lily/change-iterator.cc [new file with mode: 0644]
lily/include/change-iterator.hh [new file with mode: 0644]
lily/include/change-translator.hh [new file with mode: 0644]
lily/music-iterator.cc

diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc
new file mode 100644 (file)
index 0000000..c6ebf29
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+  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);
diff --git a/lily/include/change-iterator.hh b/lily/include/change-iterator.hh
new file mode 100644 (file)
index 0000000..bde2628
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+  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
diff --git a/lily/include/change-translator.hh b/lily/include/change-translator.hh
new file mode 100644 (file)
index 0000000..ade016e
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+  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
index d05b752df097ee42fe7a80e8ed3bc8ff2488336b..9c1f2c733e1ad815c58c228432fcc40665eac182 100644 (file)
@@ -14,6 +14,8 @@
 #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);
 
@@ -130,7 +132,9 @@ Music_iterator::static_get_iterator_p (Music *m,
     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->
@@ -138,7 +142,6 @@ Music_iterator::static_get_iterator_p (Music *m,
       p->set_translator (a);
     }
 
-
   if (! p->report_to_l())
     p ->set_translator (report_l);