]> git.donarmstrong.com Git - lilypond.git/commitdiff
(LY_DEFINE): add
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 5 Jul 2003 00:41:12 +0000 (00:41 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 5 Jul 2003 00:41:12 +0000 (00:41 +0000)
ly:grob-staff-position

ChangeLog
lily/staff-symbol-referencer.cc
scm/new-markup.scm

index 71ba91794e5bd866991ab7e7bc785286c6d27627..768ce82393bdc1fe1c432a624bd525ac1f346354 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-07-05  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * lily/staff-symbol-referencer.cc (LY_DEFINE): add
+       ly:grob-staff-position
+
 2003-07-04  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
        * scm/to-xml.scm: import srfi-1
index 080f9ab0a039e76afd2dfd95c852ba29948d8da7..0ed60e616ba16f9e7f2f26f3f5a7a3615541dad5 100644 (file)
@@ -75,6 +75,22 @@ Staff_symbol_referencer::get_position (Grob*me)
 }
 
 
+LY_DEFINE(ly_grob_staff_position,
+         "ly:grob-staff-position",
+         1, 0,0, (SCM sg),
+         "Return the Y-position of this grob relative to the staff.")
+{
+  Grob * g = unsmob_grob (sg);
+
+  SCM_ASSERT_TYPE (g, sg, SCM_ARG1, __FUNCTION__, "grob");
+  Real pos = Staff_symbol_referencer::get_position (g);
+
+  if (fabs (rint (pos) -pos) < 1e-6) // ugh.
+    return gh_int2scm (lrint (pos));
+  else
+    return gh_double2scm (pos);
+}
+
 
 /*
   should use offset callback!
@@ -92,7 +108,7 @@ Staff_symbol_referencer::callback (SCM element_smob, SCM)
     {
       Real space = Staff_symbol_referencer::staff_space (me);
       off = gh_scm2double (pos) * space/2.0;
-      me->set_grob_property ("staff-position", gh_double2scm (0.0));
+      me->set_grob_property ("staff-position", gh_int2scm (0));
     }
 
   return gh_double2scm (off);
index 38d0079d2aa6c2c407734bf45677267fec9ad0e6..1cd7453db95afd09e918e57eeade43ce3e123335 100644 (file)
@@ -671,7 +671,7 @@ against SIGNATURE, reporting MAKE-NAME as the user-invoked function.
 
 (define-public empty-markup (make-simple-markup ""))
 
-(define (interpret-markup  grob props markup)
+(define-public (interpret-markup  grob props markup)
   (if (string? markup)
       (simple-markup grob props markup)
       (let*