summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0732055)
Routing information manages how to pass information to acknowledgers
but should not reach the acknowledgers themselves. Moving this
information into arguments for the various kinds of announce_grob
procedures is cleaner and allows to bounce Grob_info through Scheme
without the danger of information loss.
Beam::add_stem (beam, (*stems_)[i]);
Grob_info i = make_grob_info (beam, (*stems_)[0]->self_scm ());
Beam::add_stem (beam, (*stems_)[i]);
Grob_info i = make_grob_info (beam, (*stems_)[0]->self_scm ());
- i.rerouting_daddy_context_ = beam_start_context_.get_context ();
- announce_grob (i);
+ announce_grob (i, beam_start_context_.get_context ());
if (finished_beam_)
{
Grob_info i = make_grob_info (finished_beam_, SCM_EOL);
if (finished_beam_)
{
Grob_info i = make_grob_info (finished_beam_, SCM_EOL);
- i.rerouting_daddy_context_ = beam_start_context_.get_context ();
+ announce_end_grob (i, beam_start_context_.get_context ());
finished_grouping_ = grouping_;
finished_beaming_options_ = beaming_options_;
}
finished_grouping_ = grouping_;
finished_beaming_options_ = beaming_options_;
}
-Engraver_group::announce_grob (Grob_info info)
+Engraver_group::announce_grob (Grob_info info, Direction dir,
+ Context *reroute_context)
- announce_infos_.push_back (info);
+ announce_infos_.push_back (Announce_grob_info (info, dir));
- Context *dad_con = context_->get_parent_context ();
- if (info.rerouting_daddy_context_)
- {
- dad_con = info.rerouting_daddy_context_;
- info.rerouting_daddy_context_ = 0;
- }
+ Context *dad_con = reroute_context ? reroute_context
+ : context_->get_parent_context ();
Engraver_group *dad_eng
= dad_con
Engraver_group *dad_eng
= dad_con
- dad_eng->announce_grob (info);
+ dad_eng->announce_grob (info, dir);
for (vsize j = 0; j < announce_infos_.size (); j++)
{
for (vsize j = 0; j < announce_infos_.size (); j++)
{
- Grob_info info = announce_infos_[j];
+ Announce_grob_info info = announce_infos_[j];
SCM meta = info.grob ()->get_property ("meta");
SCM nm = scm_assoc (name_sym, meta);
SCM meta = info.grob ()->get_property ("meta");
SCM nm = scm_assoc (name_sym, meta);
-Engraver::announce_grob (Grob_info inf)
+Engraver::announce_grob (Grob_info inf, Context *reroute_context)
- get_daddy_engraver ()->announce_grob (inf);
+ get_daddy_engraver ()->announce_grob (inf, START, reroute_context);
-Engraver::announce_end_grob (Grob_info inf)
+Engraver::announce_end_grob (Grob_info inf, Context *reroute_context)
- inf.start_end_ = STOP;
- get_daddy_engraver ()->announce_grob (inf);
+ get_daddy_engraver ()->announce_grob (inf, STOP, reroute_context);
{
origin_trans_ = t;
grob_ = g;
{
origin_trans_ = t;
grob_ = g;
- start_end_ = START;
- rerouting_daddy_context_ = 0;
/*
assert here, because this is easier to debug.
/*
assert here, because this is easier to debug.
Grob_info::Grob_info ()
{
grob_ = 0;
Grob_info::Grob_info ()
{
grob_ = 0;
- rerouting_daddy_context_ = 0;
#include "engraver.hh"
#include "translator-group.hh"
#include "engraver.hh"
#include "translator-group.hh"
+class Announce_grob_info : public Grob_info
+{
+ Direction start_end_;
+public:
+ Announce_grob_info (Grob_info gi, Direction start_end)
+ : Grob_info (gi), start_end_ (start_end)
+ { }
+ Direction start_end () const { return start_end_; }
+};
+
class Engraver_group : public Translator_group
{
protected:
class Engraver_group : public Translator_group
{
protected:
- vector<Grob_info> announce_infos_;
+ vector<Announce_grob_info> announce_infos_;
Drul_array<SCM> acknowledge_hash_table_drul_;
void override (SCM);
void revert (SCM);
Drul_array<SCM> acknowledge_hash_table_drul_;
void override (SCM);
void revert (SCM);
void do_announces ();
virtual void connect_to_context (Context *c);
virtual void disconnect_from_context ();
void do_announces ();
virtual void connect_to_context (Context *c);
virtual void disconnect_from_context ();
- virtual void announce_grob (Grob_info);
+ virtual void announce_grob (Grob_info, Direction start_end,
+ Context *reroute_context = 0);
bool pending_grobs () const;
private:
virtual void acknowledge_grobs ();
bool pending_grobs () const;
private:
virtual void acknowledge_grobs ();
Default: ignore the info
*/
virtual void acknowledge_grob (Grob_info) {}
Default: ignore the info
*/
virtual void acknowledge_grob (Grob_info) {}
- virtual void announce_grob (Grob_info);
- virtual void announce_end_grob (Grob_info);
+ virtual void announce_grob (Grob_info, Context *reroute_context = 0);
+ virtual void announce_end_grob (Grob_info, Context *reroute_context = 0);
Engraver_group *get_daddy_engraver () const;
public:
Engraver_group *get_daddy_engraver () const;
public:
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef STAFFELEMINFO_HH
-#define STAFFELEMINFO_HH
+#ifndef GROB_INFO_HH
+#define GROB_INFO_HH
#include "lily-guile.hh"
#include "lily-proto.hh"
#include "lily-guile.hh"
#include "lily-proto.hh"
{
Translator *origin_trans_;
Grob *grob_;
{
Translator *origin_trans_;
Grob *grob_;
- Direction start_end () const { return start_end_; }
Grob *grob () const { return grob_; }
Translator *origin_translator () const { return origin_trans_; }
Grob *grob () const { return grob_; }
Translator *origin_translator () const { return origin_trans_; }
Item *item () const;
Spanner *spanner () const;
static bool less (Grob_info i, Grob_info j);
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
virtual void disconnect_from_context ();
virtual void initialize ();
virtual void finalize ();
virtual void disconnect_from_context ();
virtual void initialize ();
virtual void finalize ();
- virtual void announce_grob (Grob_info);
+ virtual void announce_grob (Grob_info, Direction dir, Context *reroute_context = 0);
void stop_translation_timestep ();
/*
void stop_translation_timestep ();
/*
-Score_engraver::announce_grob (Grob_info info)
+Score_engraver::announce_grob (Grob_info info, Direction start_end, Context *reroute_context)
- Engraver_group::announce_grob (info);
- if (info.start_end () == START)
+ Engraver_group::announce_grob (info, start_end, reroute_context);
+ if (start_end == START)
{
pscore_->root_system ()->typeset_grob (info.grob ());
elems_.push_back (info.grob ());
{
pscore_->root_system ()->typeset_grob (info.grob ());
elems_.push_back (info.grob ());
Item *it = new Item (Grob_property_info (affected_contexts[j], ly_symbol2scm ("SpanBarStub")).updated ());
it->set_parent (spanbars_[i], X_AXIS);
Grob_info gi = make_grob_info (it, spanbars_[i]->self_scm ());
Item *it = new Item (Grob_property_info (affected_contexts[j], ly_symbol2scm ("SpanBarStub")).updated ());
it->set_parent (spanbars_[i], X_AXIS);
Grob_info gi = make_grob_info (it, spanbars_[i]->self_scm ());
- gi.rerouting_daddy_context_ = affected_contexts[j];
- announce_grob (gi);
+ announce_grob (gi, affected_contexts[j]);
if (!keep_extent[j])
it->suicide ();
}
if (!keep_extent[j])
it->suicide ();
}