]> git.donarmstrong.com Git - lilypond.git/blob - lily/staff-collecting-engraver.cc
c6e134ffcb506e412390822afcecc45be6e32500
[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
10 #include "staff-symbol.hh"
11 #include "engraver.hh"
12 #include "grob.hh"
13 #include "context.hh"
14
15 class Staff_collecting_engraver : public Engraver
16 {
17 public:
18   TRANSLATOR_DECLARATIONS (Staff_collecting_engraver);
19   virtual void acknowledge_grob (Grob_info);
20 };
21
22 Staff_collecting_engraver::Staff_collecting_engraver ()
23 {
24   
25 }
26
27 void
28 Staff_collecting_engraver::acknowledge_grob (Grob_info gi)
29 {
30   if (Staff_symbol::has_interface (gi.grob_))
31     {
32       SCM staffs = get_property ("stavesFound");
33       staffs = scm_cons (gi.grob_->self_scm (), staffs);
34
35       context ()->set_property ("stavesFound", staffs);
36     }
37 }
38
39
40 ADD_TRANSLATOR (Staff_collecting_engraver,
41 /* descr */       "Maintain the stavesFound variable",
42
43 /* creats*/       "",
44 /* accepts */     "",
45 /* acks  */      "staff-symbol-interface",
46 /* reads */       "stavesFound",
47 /* write */       "stavesFound");