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