]> git.donarmstrong.com Git - lilypond.git/blob - lily/event-chord-iterator.cc
* lily/include/music-iterator.hh (class Music_iterator): remove
[lilypond.git] / lily / event-chord-iterator.cc
1 /*
2   event-chord-iterator.cc -- implement Event_chord_iterator
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "translator-group.hh"
10 #include "warn.hh"
11 #include "event-chord-iterator.hh"
12 #include "music-list.hh"
13 #include "event.hh"
14
15 Event_chord_iterator::Event_chord_iterator ()
16 {
17 }
18
19 Event_chord_iterator::Event_chord_iterator (Event_chord_iterator const &src)
20   : Simple_music_iterator (src)
21 {
22 }
23
24 Translator_group*
25 Event_chord_iterator::get_req_translator ()
26 {
27   assert (get_outlet ());
28   if (get_outlet ()->is_bottom_context ())
29     return get_outlet ();
30
31   set_translator (get_outlet ()->get_default_interpreter ());
32   return get_outlet ();
33 }
34
35 void
36 Event_chord_iterator::construct_children ()
37 {
38   Simple_music_iterator::construct_children ();
39   get_req_translator ();
40 }
41
42 Event_chord*
43 Event_chord_iterator::get_elt () const
44 {
45   return (Event_chord*) get_music ();
46 }
47
48
49 void
50 Event_chord_iterator::process (Moment )
51 {
52   if (last_processed_mom_ < Moment (0))
53     {
54       for (SCM s = dynamic_cast<Music_sequence *> (get_music ())->music_list ();
55            gh_pair_p (s);  s = ly_cdr (s))
56         {
57           Music *mus = unsmob_music (ly_car (s));
58
59           bool gotcha = try_music (mus);
60           if (!gotcha)
61             mus->origin ()->warning (_f ("Junking event: `%s'", mus->name()));
62         }
63     }
64 }
65
66 IMPLEMENT_CTOR_CALLBACK (Event_chord_iterator);