]> git.donarmstrong.com Git - lilypond.git/blob - lily/chord-tremolo-iterator.cc
* configure.in: Test for and accept lmodern if EC fonts not found.
[lilypond.git] / lily / chord-tremolo-iterator.cc
1 /*   
2   chord-tremolo-iterator.cc --  implement Chord_tremolo_iterator
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10
11 /*
12   this is culled from various other iterators, but sharing code by
13   subclassing proved to be too difficult.
14  */
15
16 #include "chord-tremolo-iterator.hh"
17
18 #include "input.hh"
19 #include "repeated-music.hh"
20
21 void
22 Chord_tremolo_iterator::construct_children ()
23 {
24   Repeated_music * rep = dynamic_cast<Repeated_music*> (get_music ());
25   factor_  = Moment (Rational (1, 1));
26   child_iter_ = unsmob_iterator (get_iterator (rep->body ()));
27 }
28
29 Chord_tremolo_iterator::Chord_tremolo_iterator ()
30 {
31   factor_ = 1;
32   child_iter_ = 0;
33 }
34
35 void
36 Chord_tremolo_iterator::do_quit ()
37 {
38   if (child_iter_)
39     child_iter_->quit ();
40 }
41
42 void
43 Chord_tremolo_iterator::derived_mark () const
44 {
45   if (child_iter_)
46     scm_gc_mark (child_iter_->self_scm ());
47 }
48
49 void
50 Chord_tremolo_iterator::derived_substitute (Context *f, Context *t) 
51 {
52   if (child_iter_)
53     child_iter_->substitute_outlet (f,t);
54 }
55
56 void
57 Chord_tremolo_iterator::process (Moment m)
58 {
59   if (!m.to_bool () )
60     {
61       Music_iterator *yeah = try_music (get_music ());
62       if (yeah)
63         set_context (yeah->get_outlet ());
64       else
65         get_music ()->origin ()->warning (_ ("no one to print a tremolos"));
66     }
67
68   child_iter_->process (factor_ * m);
69 }
70
71 Moment
72 Chord_tremolo_iterator::pending_moment () const
73 {
74   return child_iter_->pending_moment () / factor_;
75 }
76
77 bool
78 Chord_tremolo_iterator::ok () const
79 {
80   return child_iter_ && child_iter_->ok ();
81 }
82
83 Music_iterator*
84 Chord_tremolo_iterator::try_music_in_children (Music  *m) const
85 {
86   return child_iter_->try_music (m);
87 }
88
89 IMPLEMENT_CTOR_CALLBACK (Chord_tremolo_iterator);
90