]> git.donarmstrong.com Git - lilypond.git/blob - lily/pure-from-neighbor-interface.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / pure-from-neighbor-interface.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2011--2014 Mike Solomon <mike@mikesolomon.org>
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 "axis-group-interface.hh"
21 #include "grob.hh"
22 #include "grob-array.hh"
23 #include "moment.hh"
24 #include "paper-column.hh"
25 #include "pointer-group-interface.hh"
26 #include "pure-from-neighbor-interface.hh"
27 #include "spanner.hh"
28 #include "system.hh"
29
30 MAKE_SCHEME_CALLBACK (Pure_from_neighbor_interface, calc_pure_relevant_grobs, 1);
31 SCM
32 Pure_from_neighbor_interface::calc_pure_relevant_grobs (SCM smob)
33 {
34   Grob *me = unsmob_grob (smob);
35   extract_grob_set ((me->original () && me->original ()->is_live ()
36                      ? me->original ()
37                      : me),
38                     "neighbors",
39                     elts);
40
41   vector<Grob *> new_elts;
42   new_elts.insert (new_elts.end (), elts.begin (), elts.end ());
43
44   SCM neighbors_scm = me->get_object ("neighbors");
45   if (Grob_array::unsmob (neighbors_scm))
46     {
47       vector<Grob *> &arr
48         = unsmob_grob_array (neighbors_scm)->array_reference ();
49       arr = new_elts;
50     }
51
52   return Axis_group_interface::internal_calc_pure_relevant_grobs (me, "neighbors");
53 }
54
55 ADD_INTERFACE (Pure_from_neighbor_interface,
56                "A collection of routines to allow for objects' pure"
57                "heights and heights to be calculated based on the"
58                "heights of the objects' neighbors.",
59
60                /* properties */
61                "neighbors "
62                "pure-relevant-grobs "
63                "pure-Y-common "
64               );