]> git.donarmstrong.com Git - lilypond.git/blob - lily/vertically-spaced-context-engraver.cc
Merge branch 'master' into lilypond/translation
[lilypond.git] / lily / vertically-spaced-context-engraver.cc
1 /*
2   vertically-spaced-contexts-engraver.cc -- implement Vertically_spaced_contexts_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "engraver.hh"
10 #include "grob.hh"
11 #include "axis-group-interface.hh"
12 #include "context.hh"
13 #include "pointer-group-interface.hh"
14
15 class Vertically_spaced_contexts_engraver : public Engraver
16 {
17   TRANSLATOR_DECLARATIONS (Vertically_spaced_contexts_engraver);
18 protected:
19   virtual void initialize ();
20   DECLARE_ACKNOWLEDGER (vertically_spaceable);
21
22 private:
23   Grob *system_;
24 };
25
26 Vertically_spaced_contexts_engraver::Vertically_spaced_contexts_engraver ()
27 {
28   system_ = 0;
29 }
30
31 void
32 Vertically_spaced_contexts_engraver::initialize ()
33 {
34   system_ = unsmob_grob (get_property ("rootSystem"));
35 }
36
37 void
38 Vertically_spaced_contexts_engraver::acknowledge_vertically_spaceable (Grob_info gi)
39 {
40   if (Axis_group_interface::has_interface (gi.grob ()))
41     {
42       SCM spaceable = get_property ("verticallySpacedContexts");
43       Context *orig = gi.origin_contexts (this)[0];
44
45       if (scm_memq (ly_symbol2scm (orig->context_name ().c_str ()),
46                     spaceable) != SCM_BOOL_F)
47         {
48           Pointer_group_interface::add_unordered_grob (system_,
49                                                        ly_symbol2scm ("spaceable-staves"),
50                                                        gi.grob ());
51         }
52     }
53 }
54
55 #include "translator.icc"
56
57 ADD_ACKNOWLEDGER (Vertically_spaced_contexts_engraver, vertically_spaceable);
58 ADD_TRANSLATOR (Vertically_spaced_contexts_engraver,
59                 /* doc */
60                 "",
61
62                 /* create */
63                 "",
64
65                 /* read */
66                 "verticallySpacedContexts ",
67
68                 /* write */
69                 "verticallySpacedContexts "
70                 );