]> git.donarmstrong.com Git - lilypond.git/blob - lily/staff-collecting-engraver.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / staff-collecting-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2001--2014  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   DECLARE_ACKNOWLEDGER (staff_symbol);
30   DECLARE_END_ACKNOWLEDGER (staff_symbol);
31 };
32
33 Staff_collecting_engraver::Staff_collecting_engraver ()
34 {
35 }
36
37 void
38 Staff_collecting_engraver::acknowledge_staff_symbol (Grob_info gi)
39 {
40   SCM staffs = get_property ("stavesFound");
41   staffs = scm_cons (gi.grob ()->self_scm (), staffs);
42
43   context ()->set_property ("stavesFound", staffs);
44 }
45
46 void
47 Staff_collecting_engraver::acknowledge_end_staff_symbol (Grob_info gi)
48 {
49   SCM staffs = get_property ("stavesFound");
50   staffs = scm_delq (gi.grob ()->self_scm (), staffs);
51
52   context ()->set_property ("stavesFound", staffs);
53 }
54
55 #include "translator.icc"
56
57 ADD_ACKNOWLEDGER (Staff_collecting_engraver, staff_symbol);
58 ADD_END_ACKNOWLEDGER (Staff_collecting_engraver, staff_symbol);
59
60 ADD_TRANSLATOR (Staff_collecting_engraver,
61                 /* doc */
62                 "Maintain the @code{stavesFound} variable.",
63
64                 /* create */
65                 "",
66
67                 /* read */
68                 "stavesFound ",
69
70                 /* write */
71                 "stavesFound "
72                );