#include "music-iterator.hh"
#include "music.hh"
+using std::string;
+
/*
This iterator is hairy. It tracks both lyric and melody contexts,
and has a complicated communication route, reading/writing
void
Lyric_combine_music_iterator::set_busy (SCM se)
{
- Stream_event *e = Stream_event::unsmob (se);
+ Stream_event *e = unsmob<Stream_event> (se);
if ((e->in_event_class ("note-event") || e->in_event_class ("cluster-note-event"))
&& music_context_)
- busy_moment_ = max (music_context_->now_mom (),
+ busy_moment_ = std::max (music_context_->now_mom (),
busy_moment_);
}
bool
Lyric_combine_music_iterator::ok () const
{
- return lyric_iter_ && lyric_iter_->ok ();
+ return lyric_iter_ && lyric_iter_->ok ()
+ && !(music_context_ && music_context_->is_removable ());
}
void
void
Lyric_combine_music_iterator::construct_children ()
{
- Music *m = Music::unsmob (get_music ()->get_property ("element"));
- lyric_iter_ = Music_iterator::unsmob (get_iterator (m));
+ Music *m = unsmob<Music> (get_music ()->get_property ("element"));
+ lyric_iter_ = unsmob<Music_iterator> (get_iterator (m));
if (!lyric_iter_)
return;
lyrics_context_ = find_context_below (lyric_iter_->get_outlet (),
&& (!music_context_ || ly_scm2string (voice_name) != music_context_->id_string ())
&& scm_is_symbol (voice_type))
{
- Context *t = get_outlet ();
- while (t && t->get_parent_context ())
- t = t->get_parent_context ();
-
- string name = ly_scm2string (voice_name);
- return find_context_below (t, voice_type, name);
+ return find_context_below (find_top_context (get_outlet ()),
+ voice_type, ly_scm2string (voice_name));
}
return 0;