2 grob-info.cc -- implement Grob_info
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "grob-info.hh"
15 #include "stream-event.hh"
16 #include "translator-group.hh"
18 Grob_info::Grob_info (Translator *t, Grob *g)
25 Grob_info::Grob_info ()
32 /* ES TODO: Junk this when no more engravers use try_music */
34 Grob_info::music_cause () const
36 SCM cause = grob_->get_property ("cause");
38 Music *ret = unsmob_music (cause);
43 Stream_event *ev = unsmob_stream_event (cause);
46 return unsmob_music (ev->get_property ("music-cause"));
51 Grob_info::event_cause () const
53 SCM cause = grob_->get_property ("cause");
54 return unsmob_stream_event (cause);
58 Grob_info::origin_contexts (Translator *end) const
60 Context *t = origin_trans_->context ();
65 t = t->get_parent_context ();
67 while (t && t != end->context ());
73 Grob_info::context () const
75 return origin_trans_->context ();
79 Grob_info::spanner () const
81 return dynamic_cast<Spanner *> (grob_);
85 Grob_info::item () const
87 return dynamic_cast<Item *> (grob_);
91 Grob_info::ultimate_event_cause () const
93 SCM cause = grob_->self_scm ();
94 while (unsmob_grob (cause))
96 cause = unsmob_grob (cause)->get_property ("cause");
98 return unsmob_stream_event (cause);
102 ES TODO: Junk this when no more engraver uses try_music
105 Grob_info::ultimate_music_cause () const
107 SCM cause = grob_->self_scm ();
108 while (unsmob_grob (cause))
110 cause = unsmob_grob (cause)->get_property ("cause");
113 Music *ret = unsmob_music (cause);
118 Stream_event *ev = unsmob_stream_event (cause);
119 return unsmob_music (ev->get_property ("music-cause"));