/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 2004--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 2004--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
private:
bool start_new_syllable () const;
Context *find_voice ();
- DECLARE_LISTENER (set_busy);
- DECLARE_LISTENER (check_new_context);
+ void set_busy (SCM);
+ void check_new_context (SCM);
bool music_found_;
bool lyrics_found_;
associatedVoice switching, this routine may be triggered for
the wrong music_context_
*/
-IMPLEMENT_LISTENER (Lyric_combine_music_iterator, set_busy)
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_)
if (music_context_)
{
music_context_->events_below ()->
- remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("rhythmic-event"));
+ remove_listener (GET_LISTENER (Lyric_combine_music_iterator, set_busy), ly_symbol2scm ("rhythmic-event"));
}
music_context_ = to;
if (to)
{
- to->events_below ()->add_listener (GET_LISTENER (set_busy),
+ to->events_below ()->add_listener (GET_LISTENER (Lyric_combine_music_iterator, set_busy),
ly_symbol2scm ("rhythmic-event"));
}
}
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 (),
delayed when voices are created implicitly.
*/
Global_context *g = get_outlet ()->get_global_context ();
- g->events_below ()->add_listener (GET_LISTENER (check_new_context), ly_symbol2scm ("CreateContext"));
+ g->events_below ()->add_listener (GET_LISTENER (Lyric_combine_music_iterator, check_new_context), ly_symbol2scm ("CreateContext"));
/*
We do not create a Lyrics context, because the user might
*/
}
-IMPLEMENT_LISTENER (Lyric_combine_music_iterator, check_new_context)
void
Lyric_combine_music_iterator::check_new_context (SCM /*sev*/)
{
&& (!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;