]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-symbol.cc
release: 1.5.47
[lilypond.git] / lily / staff-symbol.cc
index 00aafa5adab08b329d96e87450a663d7d2399f43..de2ecf4e423e0ac8e2c3f4c32846b3d283d8b8ac 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "lookup.hh"
 #include "spanner.hh"
 
 
-MAKE_SCHEME_CALLBACK(Staff_symbol,brew_molecule,1);
+
+MAKE_SCHEME_CALLBACK (Staff_symbol,brew_molecule,1);
 
 SCM
 Staff_symbol::brew_molecule (SCM smob)
 {
-  Score_element *me = unsmob_element (smob);
+  Grob *me = unsmob_grob (smob);
   Spanner* sp = dynamic_cast<Spanner*> (me);
-  Score_element * common
+  Grob * common
     = sp->get_bound (LEFT)->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
   
   Real width =
@@ -40,26 +41,26 @@ Staff_symbol::brew_molecule (SCM smob)
   for (int i=0; i < l; i++)
     {
       Molecule a =
-       me->lookup_l ()->filledbox (Box (Interval (0,width),
+       Lookup::filledbox (Box (Interval (0,width),
                                         Interval (-t/2, t/2)));
 
       a.translate_axis (height - i * staff_space (me), Y_AXIS);
       m.add_molecule (a);
     }
 
-  return m.create_scheme();
+  return m.smobbed_copy ();
 }
 
 int
-Staff_symbol::steps_i(Score_element*me) 
+Staff_symbol::steps_i (Grob*me) 
 {
   return line_count (me) * 2;
 }
 
 int
-Staff_symbol::line_count (Score_element*me) 
+Staff_symbol::line_count (Grob*me) 
 {
-  SCM c = me->get_elt_property ("line-count");
+  SCM c = me->get_grob_property ("line-count");
   if (gh_number_p (c))
     return gh_scm2int (c);
   else
@@ -67,18 +68,26 @@ Staff_symbol::line_count (Score_element*me)
 }
 
 Real
-Staff_symbol::staff_space (Score_element*me )
+Staff_symbol::staff_space (Grob*me)
 {
-  Real ss = me->paper_l ()->get_var ("staffspace");
+  Real ss = 1.0;
   
-  SCM s = me->get_elt_property ("staff-space");
+  SCM s = me->get_grob_property ("staff-space");
   if (gh_number_p (s))
     ss *= gh_scm2double (s);
   return ss;
 }
 
 bool
-Staff_symbol::has_interface (Score_element*m)
+Staff_symbol::has_interface (Grob*m)
 {
   return m && m->has_interface (ly_symbol2scm ("staff-symbol-interface"));
 }
+
+
+
+ADD_INTERFACE (Staff_symbol,"staff-symbol-interface",
+  "This spanner draws the lines of a staff.  The middle line is
+position 0.",
+  "staff-space line-count invisible-staff");
+