]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/pure-from-neighbor-interface.cc
lilypond-manuals.css: edit color scheme and some spacing
[lilypond.git] / lily / pure-from-neighbor-interface.cc
index d0c85aab9e7b0483566e3ae601c170349ea7c8c0..745c23dbec0d982ab59e1d5d3aec275d0ae86bcd 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2011 Mike Solomon <mike@apollinemike.com>
+  Copyright (C) 2011--2015 Mike Solomon <mike@mikesolomon.org>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include "axis-group-interface.hh"
 #include "grob.hh"
 #include "grob-array.hh"
+#include "moment.hh"
+#include "paper-column.hh"
 #include "pointer-group-interface.hh"
 #include "pure-from-neighbor-interface.hh"
 #include "spanner.hh"
 #include "system.hh"
 
-MAKE_SCHEME_CALLBACK (Pure_from_neighbor_interface, filter_elements, 1);
+MAKE_SCHEME_CALLBACK (Pure_from_neighbor_interface, calc_pure_relevant_grobs, 1);
 SCM
-Pure_from_neighbor_interface::filter_elements (SCM smob)
+Pure_from_neighbor_interface::calc_pure_relevant_grobs (SCM smob)
 {
-  Grob *me = unsmob_grob (smob);
-  extract_grob_set (me, "elements", elts);
+  Grob *me = unsmob<Grob> (smob);
+  extract_grob_set ((me->original () && me->original ()->is_live ()
+                     ? me->original ()
+                     : me),
+                    "neighbors",
+                    elts);
+
   vector<Grob *> new_elts;
-  Interval_t<int> srl = me->get_system ()->spanned_rank_interval ();
-  for (vsize i = 0; i < elts.size (); i++)
-    if (srl.contains (elts[i]->spanned_rank_interval ()[LEFT]))
-      new_elts.push_back (elts[i]);
-
-  SCM elements_scm = me->get_object ("elements");
-  if (Grob_array::unsmob (elements_scm))
-    {
-      vector<Grob *> &arr
-        = unsmob_grob_array (elements_scm)->array_reference ();
-      arr = new_elts;
-    }
-
-  return SCM_BOOL_T;
+  new_elts.insert (new_elts.end (), elts.begin (), elts.end ());
+
+  if (Grob_array *a = unsmob<Grob_array> (me->get_object ("neighbors")))
+    a->set_array (new_elts);
+
+  return Axis_group_interface::internal_calc_pure_relevant_grobs (me, "neighbors");
 }
 
 ADD_INTERFACE (Pure_from_neighbor_interface,
-               "A collection of routines to allow for objects' pure"
-               "heights and heights to be calculated based on the"
+               "A collection of routines to allow for objects' pure "
+               "heights and heights to be calculated based on the "
                "heights of the objects' neighbors.",
 
                /* properties */
-               "elements-filtered "
+               "neighbors "
                "pure-relevant-grobs "
                "pure-Y-common "
               );