Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / lily / grob-info.cc
blob68ca9f38802add8d629bbe5c56177a047a2f591f
1 /*
2 grob-info.cc -- implement Grob_info
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "context.hh"
10 #include "grob-info.hh"
11 #include "item.hh"
12 #include "music.hh"
13 #include "spanner.hh"
14 #include "stream-event.hh"
15 #include "translator-group.hh"
17 Grob_info::Grob_info (Translator *t, Grob *g)
19 origin_trans_ = t;
20 grob_ = g;
21 start_end_ = START;
24 assert here, because this is easier to debug.
26 assert (g);
29 Grob_info::Grob_info ()
31 grob_ = 0;
32 start_end_ = START;
33 origin_trans_ = 0;
36 Stream_event *
37 Grob_info::event_cause () const
39 SCM cause = grob_->get_property ("cause");
40 return unsmob_stream_event (cause);
43 vector<Context*>
44 Grob_info::origin_contexts (Translator *end) const
46 Context *t = origin_trans_->context ();
47 vector<Context*> r;
50 r.push_back (t);
51 t = t->get_parent_context ();
53 while (t && t != end->context ());
55 return r;
58 Context *
59 Grob_info::context () const
61 return origin_trans_->context ();
64 Spanner *
65 Grob_info::spanner () const
67 return dynamic_cast<Spanner *> (grob_);
70 Item *
71 Grob_info::item () const
73 return dynamic_cast<Item *> (grob_);
76 Stream_event *
77 Grob_info::ultimate_event_cause () const
79 SCM cause = grob_->self_scm ();
80 while (unsmob_grob (cause))
82 cause = unsmob_grob (cause)->get_property ("cause");
84 return unsmob_stream_event (cause);