]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/line-spanner.cc
Doc: mention page-count in "fitting music onto fewer pages"
[lilypond.git] / lily / line-spanner.cc
index 8cdc16b94ffcf75aab36686c86bf203e4e242b61..028fe20e155d5db5ad46ec5624fa6baab3a2f406 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2000--2011 Jan Nieuwenhuizen <janneke@gnu.org>
+  Copyright (C) 2000--2012 Jan Nieuwenhuizen <janneke@gnu.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
@@ -38,6 +38,7 @@ class Line_spanner
 {
 public:
   DECLARE_SCHEME_CALLBACK (print, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_left_bound_info, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_left_bound_info_and_text, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_right_bound_info, (SCM));
@@ -200,6 +201,22 @@ Line_spanner::calc_bound_info (SCM smob, Direction dir)
   return details;
 }
 
+MAKE_SCHEME_CALLBACK (Line_spanner, calc_cross_staff, 1);
+SCM
+Line_spanner::calc_cross_staff (SCM smob)
+{
+  Spanner *me = unsmob_spanner (smob);
+  if (!me)
+    return SCM_BOOL_F;
+
+  if (to_boolean (me->get_bound (LEFT)->get_property ("non-musical"))
+      || to_boolean (me->get_bound (RIGHT)->get_property ("non-musical")))
+    return SCM_BOOL_F;
+
+  return scm_from_bool (Staff_symbol_referencer::get_staff_symbol (me->get_bound (LEFT))
+                        != Staff_symbol_referencer::get_staff_symbol (me->get_bound (RIGHT)));
+}
+
 MAKE_SCHEME_CALLBACK (Line_spanner, calc_right_bound_info, 1);
 SCM
 Line_spanner::calc_right_bound_info (SCM smob)