2 Sequential_music_iterator.cc -- implement Sequential_music_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 #include "grace-iterator.hh"
9 #include "translator-group.hh"
11 #include "sequential-music-iterator.hh"
12 #include "music-list.hh"
13 #include "request-chord-iterator.hh"
17 Sequential_music_iterator::do_print() const
23 Sequential_music_iterator::Sequential_music_iterator ()
31 Sequential_music_iterator::construct_children()
33 cursor_ = dynamic_cast<Music_sequence const*> (music_l_)->music_p_list_p_->head_;
44 set_sequential_music_translator();
51 Sequential_music_iterator::leave_element()
55 Moment elt_time = cursor_->car_->length_mom ();
56 here_mom_ += elt_time;
57 cursor_ =cursor_->next_;
61 Sequential_music_iterator::start_next_element()
64 iter_p_ = get_iterator_p (cursor_->car_);
68 Sequential_music_iterator::set_sequential_music_translator()
70 Translator_group * child_report = child_report = iter_p_->report_to_l ();
71 if (dynamic_cast<Grace_iterator*> (iter_p_))
72 child_report = child_report->daddy_trans_l_;
74 if (report_to_l()->depth_i () < child_report->depth_i ())
75 set_translator (child_report);
78 Sequential_music_iterator::~Sequential_music_iterator()
83 music_l_->warning (_ ("Must stop before this music ends"));
93 Sequential_music_iterator::do_process_and_next (Moment until)
100 Moment local_until = until - here_mom_;
101 while (iter_p_->ok())
103 Moment here = iter_p_->next_moment();
104 if (here != local_until)
107 iter_p_->process_and_next (local_until);
112 set_sequential_music_translator();
116 start_next_element();
124 Music_iterator::do_process_and_next (until);
128 Sequential_music_iterator::next_moment() const
130 return iter_p_->next_moment() + here_mom_;
135 Sequential_music_iterator::ok() const
141 Sequential_music_iterator::try_music_in_children (Music const *m) const
143 return iter_p_ ? iter_p_->try_music (m) : 0;