]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/system.cc
Revert "Fix 1062."
[lilypond.git] / lily / system.cc
index 5aa3bfe61fe108b9ef4b4eac46cbe90c1ed427ea..f938b8322e744377ef68488ee137fd64e521b09f 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1996--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1996--2010 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
@@ -570,6 +570,43 @@ System::get_extremal_staff (Direction dir, Interval const &iv)
   return 0;
 }
 
+Interval
+System::part_of_line_pure_height (vsize start, vsize end, bool begin)
+{
+  Grob *alignment = get_vertical_alignment ();
+  if (!alignment)
+    {
+      programming_error("system does not have a vertical alignment");
+      return Interval();
+    }
+  extract_grob_set (alignment, "elements", staves);
+  vector<Real> offsets = Align_interface::get_minimum_translations (alignment, staves, Y_AXIS, true, start, end);
+
+  Interval ret;
+  for (vsize i = 0; i < staves.size(); ++i)
+    {
+      Interval iv = begin?
+        Axis_group_interface::begin_of_line_pure_height (staves[i], start) :
+        Axis_group_interface::rest_of_line_pure_height (staves[i], start, end);
+      if (i<offsets.size())
+        iv.translate (offsets[i]);
+      ret.unite (iv);
+    }
+  return ret;
+}
+
+Interval
+System::begin_of_line_pure_height (vsize start, vsize end)
+{
+  return part_of_line_pure_height (start, end, true);
+}
+
+Interval
+System::rest_of_line_pure_height (vsize start, vsize end)
+{
+  return part_of_line_pure_height (start, end, false);
+}
+
 ADD_INTERFACE (System,
               "This is the top-level object: Each object in a score"
               " ultimately has a @code{System} object as its X and"