Moment extend_mom_;
Moment beam_start_moment_;
Moment beam_start_location_;
+ Context *beam_start_context_;
// We act as if beam were created, and start a grouping anyway.
Beaming_pattern *grouping_;
for (vsize i = 0; i < stems_->size (); i++)
Beam::add_stem (beam, (*stems_)[i]);
- announce_grob (beam, (*stems_)[0]->self_scm ());
+ Grob_info i = make_grob_info (beam, (*stems_)[0]->self_scm ());
+ i.rerouting_daddy_context_ = beam_start_context_;
+ announce_grob (i);
return beam;
}
beaming_options_.from_context (context ());
beam_settings_ = updated_grob_properties (context (), ly_symbol2scm ("Beam"));
+ beam_start_context_ = context ()->get_parent_context ();
beam_start_moment_ = now_mom ();
beam_start_location_
= robust_scm2moment (get_property ("measurePosition"), Moment (0));
if (finished_beam_)
{
- announce_end_grob (finished_beam_, SCM_EOL);
+ Grob_info i = make_grob_info (finished_beam_, SCM_EOL);
+ i.rerouting_daddy_context_ = beam_start_context_;
+
+ announce_end_grob (i);
finished_grouping_ = grouping_;
finished_beaming_options_ = beaming_options_;
}
{
announce_infos_.push_back (info);
+ Context *dad_con = context_->get_parent_context ();
+ if (info.rerouting_daddy_context_)
+ {
+ dad_con = info.rerouting_daddy_context_;
+ info.rerouting_daddy_context_ = 0;
+ }
+
Engraver_group *dad_eng
- = context_->get_parent_context ()
- ? dynamic_cast<Engraver_group *> (context_->get_parent_context ()->implementation ())
+ = dad_con
+ ? dynamic_cast<Engraver_group *> (dad_con->implementation ())
: 0;
if (dad_eng)
void
Engraver::announce_end_grob (Grob_info inf)
{
+ inf.start_end_ = STOP;
get_daddy_engraver ()->announce_grob (inf);
}
-/*
- CAUSE is the object (typically a Stream_event object) that
- was the reason for making E.
-*/
-void
-Engraver::announce_grob (Grob *e, SCM cause)
+Grob_info
+Engraver::make_grob_info(Grob *e, SCM cause)
{
/* TODO: Remove Music code when it's no longer needed */
if (Music *m = unsmob_music (cause))
{
cause = m->to_event ()->unprotect ();
}
- if (unsmob_stream_event (cause) || unsmob_grob (cause))
+ if (e->get_property ("cause") == SCM_EOL
+ && (unsmob_stream_event (cause) || unsmob_grob (cause)))
e->set_property ("cause", cause);
- Grob_info i (this, e);
+ return Grob_info (this, e);
+}
- Engraver_group *g = get_daddy_engraver ();
- if (g)
- g->announce_grob (i);
+/*
+ CAUSE is the object (typically a Stream_event object) that
+ was the reason for making E.
+*/
+void
+Engraver::announce_grob (Grob *e, SCM cause)
+{
+ announce_grob (make_grob_info (e, cause));
}
void
Engraver::announce_end_grob (Grob *e, SCM cause)
{
- /* TODO: Remove Music code when it's no longer needed */
- if (Music *m = unsmob_music (cause))
- {
- cause = m->to_event ()->unprotect ();
- }
- if (e->get_property ("cause") == SCM_EOL
- && (unsmob_stream_event (cause) || unsmob_grob (cause)))
- e->set_property ("cause", cause);
-
- Grob_info i (this, e);
-
- i.start_end_ = STOP;
- Engraver_group *g = get_daddy_engraver ();
- if (g)
- g->announce_grob (i);
+ announce_end_grob (make_grob_info (e, cause));
}
origin_trans_ = t;
grob_ = g;
start_end_ = START;
+ rerouting_daddy_context_ = 0;
/*
assert here, because this is easier to debug.
grob_ = 0;
start_end_ = START;
origin_trans_ = 0;
+ rerouting_daddy_context_ = 0;
}
Stream_event *
void announce_grob (Grob *, SCM cause);
void announce_end_grob (Grob *, SCM cause);
+ Grob_info make_grob_info (Grob *, SCM cause);
+
Item *internal_make_item (SCM sym, SCM cause, char const *name,
char const *f, int l, char const *fun);
Spanner *internal_make_spanner (SCM sym, SCM cause, char const *name,
Translator *origin_trans_;
Grob *grob_;
Direction start_end_;
+
friend class Engraver;
public:
Item *item () const;
Spanner *spanner () const;
static bool less (Grob_info i, Grob_info j);
+
+ /*
+ For contexts that change staves, it may be desirable to emit a
+ grob into a staff other than the current one. If this is non-null,
+ this grob should be announced in this context instead of the
+ daddy_context_.
+ */
+ Context *rerouting_daddy_context_;
};
#endif // STAFFELEMINFO_HH