lilypond-1.4.4
[lilypond.git] / lily / chord-tremolo-iterator.cc
blob9c2aaf4a77278b708ea27d14cd20650ab932fae8
1 /*
2 chord-tremolo-iterator.cc -- implement Chord_tremolo_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
12 this is culled from various other iterators, but sharing code by subclassing proved to be too difficult.
15 #include "input.hh"
16 #include "chord-tremolo-iterator.hh"
17 #include "repeated-music.hh"
19 void
20 Chord_tremolo_iterator::construct_children ()
22 Repeated_music * rep = dynamic_cast<Repeated_music*> (music_l_);
23 factor_ = Moment (1, rep->repeat_count ());
24 child_iter_p_ = get_iterator_p (rep->body ());
27 Chord_tremolo_iterator::Chord_tremolo_iterator ()
29 factor_ = 1;
30 child_iter_p_ = 0;
33 Chord_tremolo_iterator::Chord_tremolo_iterator (Chord_tremolo_iterator const &src)
34 : Music_iterator (src)
36 child_iter_p_ = src.child_iter_p_? src.child_iter_p_->clone () : 0;
39 void
40 Chord_tremolo_iterator::process (Moment m)
42 if (!m)
44 Music_iterator *yeah = try_music (music_l_);
45 if (yeah)
46 set_translator (yeah->report_to_l ());
47 else
48 music_l_->origin ()->warning (_ ("no one to print a tremolos"));
51 child_iter_p_->process (factor_ * m);
55 Moment
56 Chord_tremolo_iterator::pending_moment () const
58 return child_iter_p_->pending_moment () / factor_;
61 bool
62 Chord_tremolo_iterator::ok () const
64 return child_iter_p_ && child_iter_p_->ok ();
67 Chord_tremolo_iterator::~Chord_tremolo_iterator ()
69 delete child_iter_p_;
72 Music_iterator*
73 Chord_tremolo_iterator::try_music_in_children (Music *m) const
75 return child_iter_p_->try_music (m);
80 IMPLEMENT_CTOR_CALLBACK (Chord_tremolo_iterator);