]> git.donarmstrong.com Git - lilypond.git/blob - lily/event-chord-iterator.cc
release commit
[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--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "event-chord-iterator.hh"
10
11 #include "context.hh"
12 #include "warn.hh"
13 #include "music.hh"
14 #include "input.hh"
15 #include "pitch.hh"
16 #include "duration.hh"
17
18 Event_chord_iterator::Event_chord_iterator ()
19 {
20 }
21
22 Context *
23 Event_chord_iterator::get_bottom_context ()
24 {
25   assert (get_outlet ());
26   if (get_outlet ()->is_bottom_context ())
27     return get_outlet ();
28
29   set_context (get_outlet ()->get_default_interpreter ());
30   return get_outlet ();
31 }
32
33 void
34 Event_chord_iterator::construct_children ()
35 {
36   Simple_music_iterator::construct_children ();
37   get_bottom_context ();
38 }
39
40 void
41 Event_chord_iterator::process (Moment m)
42 {
43   if (last_processed_mom_ < Moment (0))
44     {
45       for (SCM s = get_music ()->get_property ("elements");
46            scm_is_pair (s); s = scm_cdr (s))
47         {
48           Music *mus = unsmob_music (scm_car (s));
49
50           bool gotcha = try_music (mus);
51           if (!gotcha)
52             mus->origin ()->warning (_f ("junking event: `%s'", mus->name ()));
53         }
54     }
55   Simple_music_iterator::process (m);
56 }
57
58 IMPLEMENT_CTOR_CALLBACK (Event_chord_iterator);