]> git.donarmstrong.com Git - lilypond.git/blob - lily/chord-tremolo-iterator.cc
release: 1.3.73
[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 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10
11 /*
12   this is culled from various other iterators, but sharing code by subclassing proved to be too difficult.
13  */
14
15 #include "input.hh"
16 #include "chord-tremolo-iterator.hh"
17 #include "repeated-music.hh"
18
19 void
20 Chord_tremolo_iterator::construct_children ()
21 {
22   Repeated_music * rep = dynamic_cast<Repeated_music*> (music_l_);
23   factor_  = Moment (1, rep->repeats_i_);
24   child_iter_p_ = get_iterator_p (rep->body ());
25 }
26
27 Chord_tremolo_iterator::Chord_tremolo_iterator()
28 {
29   factor_ = 1;
30   child_iter_p_ = 0;
31 }
32
33 void
34 Chord_tremolo_iterator::do_process_and_next (Moment m)
35 {
36   if (!m)
37     {
38       Music_iterator *yeah = try_music (music_l_);
39       if (yeah)
40         set_translator (yeah->report_to_l ());
41       else
42         music_l_->origin ()->warning ( _("no one to print a tremolos"));
43     }
44
45   child_iter_p_->process_and_next  (factor_ * m);
46 }
47
48
49 Moment
50 Chord_tremolo_iterator::next_moment () const
51 {
52   return child_iter_p_->next_moment () / factor_;
53 }
54
55 bool
56 Chord_tremolo_iterator::ok () const
57 {
58   return child_iter_p_ && child_iter_p_->ok();
59 }
60
61 Chord_tremolo_iterator::~Chord_tremolo_iterator ()
62 {
63   delete child_iter_p_;
64 }
65
66 Music_iterator*
67 Chord_tremolo_iterator::try_music_in_children (Music  *m) const
68 {
69   return child_iter_p_->try_music (m);
70 }
71
72
73 void
74 Chord_tremolo_iterator::do_print () const
75 {
76   child_iter_p_->print  ();
77 }