]> git.donarmstrong.com Git - lilypond.git/blob - lily/staff-collecting-engraver.cc
* flower
[lilypond.git] / lily / staff-collecting-engraver.cc
1 /*
2   staff-collecting-engraver.cc -- implement Staff_collecting_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2001--2005  Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "staff-symbol.hh"
10 #include "engraver.hh"
11 #include "grob.hh"
12 #include "context.hh"
13
14 class Staff_collecting_engraver : public Engraver
15 {
16 public:
17   TRANSLATOR_DECLARATIONS (Staff_collecting_engraver);
18   virtual void acknowledge_grob (Grob_info);
19 };
20
21 Staff_collecting_engraver::Staff_collecting_engraver ()
22 {
23
24 }
25
26 void
27 Staff_collecting_engraver::acknowledge_grob (Grob_info gi)
28 {
29   if (Staff_symbol::has_interface (gi.grob_))
30     {
31       SCM staffs = get_property ("stavesFound");
32       staffs = scm_cons (gi.grob_->self_scm (), staffs);
33
34       context ()->set_property ("stavesFound", staffs);
35     }
36 }
37
38 ADD_TRANSLATOR (Staff_collecting_engraver,
39                 /* descr */ "Maintain the stavesFound variable",
40
41                 /* creats*/ "",
42                 /* accepts */ "",
43                 /* acks  */ "staff-symbol-interface",
44                 /* reads */ "stavesFound",
45                 /* write */ "stavesFound");