]> git.donarmstrong.com Git - lilypond.git/blob - lily/context-specced-music-iterator.cc
*** empty log message ***
[lilypond.git] / lily / context-specced-music-iterator.cc
1 /*
2   context-specced-music-iterator.cc -- implement
3   Context_specced_music_iterator
4
5   source file of the GNU LilyPond music typesetter
6
7   (c) 2002--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 */
9
10 #include "music-wrapper-iterator.hh"
11 #include "context.hh"
12
13 class Context_specced_music_iterator : public Music_wrapper_iterator
14 {
15 public:
16   DECLARE_SCHEME_CALLBACK (constructor, ());
17   virtual void construct_children ();
18 };
19
20 void
21 Context_specced_music_iterator::construct_children ()
22 {
23   SCM ct = get_music ()->get_property ("context-type");
24
25   std::string c_id;
26   SCM ci = get_music ()->get_property ("context-id");
27   if (scm_is_string (ci))
28     c_id = ly_scm2string (ci);
29   SCM ops = get_music ()->get_property ("property-operations");
30
31   Context *a = 0;
32
33   if (c_id == "$uniqueContextId")
34     a = get_outlet ()->create_unique_context (ct, ops);
35   else
36     a = get_outlet ()->find_create_context (ct, c_id, ops);
37
38   if (a
39       && to_boolean (get_music ()->get_property ("descend-only"))
40       && !is_child_context (get_outlet (), a))
41     a = 0;
42
43   if (a)
44     set_context (a);
45
46   Music_wrapper_iterator::construct_children ();
47 }
48
49 IMPLEMENT_CTOR_CALLBACK (Context_specced_music_iterator);