]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/axis-group-interface.cc
Doc-de: Update of learning manual
[lilypond.git] / lily / axis-group-interface.cc
index ac778b05364b44ef269dddb48261d2adc2e97737..febff36afb6462d4b39137d46e1c7c221414ab73 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2000--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 2000--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 #include "separation-item.hh"
 #include "skyline-pair.hh"
 #include "staff-grouper-interface.hh"
+#include "stem.hh"
 #include "stencil.hh"
 #include "system.hh"
 #include "warn.hh"
+#include "unpure-pure-container.hh"
 
 static bool
 pure_staff_priority_less (Grob *const &g1, Grob *const &g2);
@@ -80,7 +82,7 @@ Axis_group_interface::relative_group_extent (vector<Grob *> const &elts,
 
 Interval
 Axis_group_interface::relative_maybe_bound_group_extent (vector<Grob *> const &elts,
-                                                        Grob *common, Axis a, bool bound)
+                                                         Grob *common, Axis a, bool bound)
 {
   Interval r;
   for (vsize i = 0; i < elts.size (); i++)
@@ -325,7 +327,8 @@ Axis_group_interface::relative_pure_height (Grob *me, int start, int end)
       Interval_t<int> rank_span = g->spanned_rank_interval ();
       if (rank_span[LEFT] <= end && rank_span[RIGHT] >= start
           && g->pure_is_visible (start, end)
-          && !to_boolean (g->get_property ("cross-staff")))
+          && !(to_boolean (g->get_property ("cross-staff"))
+               && Stem::has_interface (g)))
         {
           Interval dims = g->pure_height (common, start, end);
           if (!dims.is_empty ())
@@ -455,8 +458,13 @@ SCM
 Axis_group_interface::calc_pure_relevant_grobs (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
+  return internal_calc_pure_relevant_grobs (me, "elements");
+}
 
-  extract_grob_set (me, "elements", elts);
+SCM
+Axis_group_interface::internal_calc_pure_relevant_grobs (Grob *me, string grob_set_name)
+{
+  extract_grob_set (me, grob_set_name.c_str (), elts);
 
   vector<Grob *> relevant_grobs;
   SCM pure_relevant_p = ly_lily_module_constant ("pure-relevant?");
@@ -468,14 +476,12 @@ Axis_group_interface::calc_pure_relevant_grobs (SCM smob)
 
       if (Item *it = dynamic_cast<Item *> (elts[i]))
         {
-          Direction d = LEFT;
-          do
+          for (LEFT_and_RIGHT (d))
             {
               Item *piece = it->find_prebroken_piece (d);
               if (piece && to_boolean (scm_apply_1 (pure_relevant_p, piece->self_scm (), SCM_EOL)))
                 relevant_grobs.push_back (piece);
             }
-          while (flip (&d) != LEFT);
         }
     }
 
@@ -822,18 +828,6 @@ Axis_group_interface::calc_maybe_pure_staff_staff_spacing (Grob *me, bool pure,
   return me->get_maybe_pure_property ("default-staff-staff-spacing", pure, start, end);
 }
 
-Real
-Axis_group_interface::minimum_distance (Grob *g1, Grob *g2, Axis a)
-{
-  SCM sym = ly_symbol2scm ((a == Y_AXIS) ? "vertical-skylines" : "horizontal-skylines");
-
-  Skyline_pair *s1 = Skyline_pair::unsmob (g1->get_property (sym));
-  Skyline_pair *s2 = Skyline_pair::unsmob (g2->get_property (sym));
-  if (s1 && s2)
-    return (*s1)[DOWN].distance ((*s2)[UP]);
-  return 0;
-}
-
 ADD_INTERFACE (Axis_group_interface,
                "An object that groups other layout objects.",