]> git.donarmstrong.com Git - lilypond.git/commitdiff
new function Staff_symbol_referencer::extent_in_staff()
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 12 Jan 2007 17:02:14 +0000 (18:02 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 12 Jan 2007 17:02:14 +0000 (18:02 +0100)
lily/include/staff-symbol-referencer.hh
lily/staff-symbol-referencer.cc

index 5b9656de2264800fce4a315e72a7bd8cd5e224d4..4a43a94e037e46d221bd60d68eb9fba8703f1b05 100644 (file)
@@ -39,6 +39,7 @@ public:
   static Real get_position (Grob *);
   static Real staff_radius (Grob *);
   static int get_rounded_position (Grob *);
+  static Interval extent_in_staff (Grob *); 
 };
 
 int compare_position (Grob *const &, Grob *const &);\
index a74a1c07c948ecee9d18e8e095500dfb6afe8ed6..53637c86e5f1bd8fadc39ece6ee3dec4fdbc0f87 100644 (file)
@@ -92,6 +92,25 @@ Staff_symbol_referencer::get_position (Grob *me)
   return robust_scm2double (me->get_property ("staff-position"), p);
 }
 
+
+Interval
+Staff_symbol_referencer::extent_in_staff (Grob *me)
+{
+  Grob *st = get_staff_symbol (me);
+  Grob *c = st ? me->common_refpoint (st, Y_AXIS) : 0;
+
+  Interval retval;
+  if (st && c)
+    {
+      retval  = me->extent (c, Y_AXIS)
+       - st->relative_coordinate (c, Y_AXIS);
+    }
+
+  return retval;
+}
+
+
+
 int
 Staff_symbol_referencer::get_rounded_position (Grob *me)
 {
@@ -172,3 +191,4 @@ ADD_INTERFACE (Staff_symbol_referencer,
               /* properties */
               "staff-position");
 
+