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