]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-symbol-referencer.cc
Add cautionary-style to interface.
[lilypond.git] / lily / staff-symbol-referencer.cc
index 13cf324351f2e5018b50c8c8af524e6340677dc5..2d05d1f11a7f975c641c64bce0c525ca6e928284 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
  */
 
 #include <math.h>
@@ -53,11 +53,9 @@ Staff_symbol_referencer::staff_space (Grob*me)
   if (st)
     return Staff_symbol::staff_space (st);
 
-  
   return 1.0;
 }
 
-
 Real
 Staff_symbol_referencer::position_f (Grob*me) 
 {
@@ -99,10 +97,9 @@ 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_double2scm (0.0));
-
   return gh_double2scm (off);
 }
 
@@ -161,12 +158,12 @@ compare_position (Grob *const  &a, Grob * const &b)
 }
 
 
-void
-Staff_symbol_referencer::set_interface (Grob * e)
-{
-  if (!gh_number_p (e->get_grob_property ("staff-position")))
-      e->set_grob_property ("staff-position", gh_double2scm (0.0));
 
-  e->add_offset_callback (Staff_symbol_referencer::callback_proc, Y_AXIS);
-}
 
+#define has_interface ugly_hack
+ADD_INTERFACE (Staff_symbol_referencer,"staff-symbol-referencer-interface",
+  "Object whose Y position is meaning with reference to a staff
+symbol. Objects that have this interface should include
+Staff_symbol_referencer::callback in their Y-offset-callback.
+",
+  "staff-position");