summaryrefslogtreecommitdiff
path: root/lily/spanner.cc
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>2006-12-21 14:58:08 +0100
committerHan-Wen Nienhuys <hanwen@xs4all.nl>2006-12-21 14:58:08 +0100
commit4bfec5e2a321897c98167d1bb03def77252ad44d (patch)
treea783f7f9c78db16c8d48016a224fbdac8781b317 /lily/spanner.cc
parented60f7cdbde0681088d88b9abea5025f27538309 (diff)
spanner::bounds-width
Diffstat (limited to 'lily/spanner.cc')
-rw-r--r--lily/spanner.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/lily/spanner.cc b/lily/spanner.cc
index c0ac823b02..f4909f53b2 100644
--- a/lily/spanner.cc
+++ b/lily/spanner.cc
@@ -384,11 +384,30 @@ unsmob_spanner (SCM s)
return dynamic_cast<Spanner *> (unsmob_grob (s));
}
+MAKE_SCHEME_CALLBACK(Spanner, bounds_width, 1);
+SCM
+Spanner::bounds_width (SCM grob)
+{
+ Spanner *me = unsmob_spanner (grob);
+
+
+ Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
+
+ Interval w (me->get_bound (LEFT)->relative_coordinate (common, X_AXIS),
+ me->get_bound (RIGHT)->relative_coordinate (common, X_AXIS));
+
+ w -= me->relative_coordinate (common, X_AXIS);
+
+ return ly_interval2scm (w);
+}
+
ADD_INTERFACE (Spanner,
"Some objects are horizontally spanned between objects. For\n"
"example, slur, beam, tie, etc. These grobs form a subtype called\n"
"@code{Spanner}. All spanners have two span-points (these must be\n"
"@code{Item} objects), one on the left and one on the right. The left bound is\n"
"also the X-reference point of the spanner.\n",
- "minimum-length");
+
+ "minimum-length "
+ );