]> git.donarmstrong.com Git - lilypond.git/blob - lily/staff-collecting-engraver.cc
Web-ja: update introduction
[lilypond.git] / lily / staff-collecting-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2001--2015  Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "staff-symbol.hh"
21 #include "engraver.hh"
22 #include "grob.hh"
23 #include "context.hh"
24
25 class Staff_collecting_engraver : public Engraver
26 {
27 public:
28   TRANSLATOR_DECLARATIONS (Staff_collecting_engraver);
29   void acknowledge_staff_symbol (Grob_info);
30   void acknowledge_end_staff_symbol (Grob_info);
31 };
32
33 Staff_collecting_engraver::Staff_collecting_engraver (Context *c)
34   : Engraver (c)
35 {
36 }
37
38 void
39 Staff_collecting_engraver::acknowledge_staff_symbol (Grob_info gi)
40 {
41   SCM staffs = get_property ("stavesFound");
42   staffs = scm_cons (gi.grob ()->self_scm (), staffs);
43
44   context ()->set_property ("stavesFound", staffs);
45 }
46
47 void
48 Staff_collecting_engraver::acknowledge_end_staff_symbol (Grob_info gi)
49 {
50   SCM staffs = get_property ("stavesFound");
51   staffs = scm_delq (gi.grob ()->self_scm (), staffs);
52
53   context ()->set_property ("stavesFound", staffs);
54 }
55
56 #include "translator.icc"
57
58
59 void
60 Staff_collecting_engraver::boot ()
61 {
62   ADD_ACKNOWLEDGER (Staff_collecting_engraver, staff_symbol);
63   ADD_END_ACKNOWLEDGER (Staff_collecting_engraver, staff_symbol);
64 }
65
66 ADD_TRANSLATOR (Staff_collecting_engraver,
67                 /* doc */
68                 "Maintain the @code{stavesFound} variable.",
69
70                 /* create */
71                 "",
72
73                 /* read */
74                 "stavesFound ",
75
76                 /* write */
77                 "stavesFound "
78                );