]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/request-iterator.cc
release: 1.1.1
[lilypond.git] / lily / request-iterator.cc
index 19be49a8d374b7b98d04cd83b1a883b2035d7fbd..5ed0f311556015b890cc3724c78e0184263a5a08 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "translator-group.hh"
@@ -17,14 +17,18 @@ IMPLEMENT_IS_TYPE_B1(Request_chord_iterator,Music_iterator);
 void
 Request_chord_iterator::construct_children()
 {
+  elt_duration_ =elt_l ()->duration ();
   get_req_translator_l();
 }
 
-Request_chord_iterator::Request_chord_iterator (Request_chord*el_l)
+Request_chord*
+Request_chord_iterator::elt_l () const
+{
+  return (Request_chord*) music_l_;
+}
+
+Request_chord_iterator::Request_chord_iterator ()
 {
-  elt_l_ = el_l;
-  MInterval elt_dur =el_l->time_int();
-  elt_duration_ = elt_dur.length ();
   last_b_ = false;
 }
 
@@ -53,19 +57,22 @@ Request_chord_iterator::do_print() const
   DOUT << "duration: " << elt_duration_;
 #endif
 }
+
 void
-Request_chord_iterator::process_and_next (Moment mom)
+Request_chord_iterator::do_process_and_next (Moment mom)
 {
   if (first_b_)
     {
-      for (PCursor<Music*> i (elt_l_->music_p_list_); i.ok(); i++)
+      for (PCursor<Music*> i (elt_l ()->music_p_list_p_->top ()); i.ok(); i++)
        {
-         assert (i->is_type_b (Request::static_name()));
-         Request * req_l = (Request*)i.ptr();
-         bool gotcha = report_to_l()->try_request (req_l);
-         if (!gotcha)
-           req_l->warning (_("Junking request: ") + String (req_l->name()));
-
+         if (Request * req_l = dynamic_cast<Request*> (i.ptr()))
+           {
+             bool gotcha = report_to_l()->try_request (req_l);
+             if (!gotcha)
+               req_l->warning (_f ("junking request: `%s\'", req_l->name()));
+           }
+         else
+           i.ptr ()->warning (_f ("Huh? Not a Request: `%s\'", i.ptr()->name ()));
        }
       first_b_ = false;
     }