]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/axis-group-interface.cc
Issue 2491: Macro for(UP_and_DOWN) and 3 similar.
[lilypond.git] / lily / axis-group-interface.cc
index f3a099b5df5dfb238fccf7a09768155c0fa8dedf..1b937985eeee2aab63444c47401f2a49e9a59af7 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
@@ -31,6 +31,7 @@
 #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"
@@ -81,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++)
@@ -326,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 ())
@@ -456,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?");
@@ -469,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);
         }
     }