]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-sym.cc
release: 1.1.41
[lilypond.git] / lily / staff-sym.cc
index 4e1a81d955dc6d36690dc68623bb952e98f648b1..2065ef5d42a9e08b71d1761af5b8b2324221b449 100644 (file)
@@ -3,56 +3,64 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-#include "staff-sym.hh"
+#include "staff-symbol.hh"
 #include "lookup.hh"
+#include "dimensions.hh"
 #include "paper-def.hh"
 #include "molecule.hh"
 #include "debug.hh"
+#include "item.hh"
 
 
-
-Staff_symbol::Staff_symbol (int l)
+Staff_symbol::Staff_symbol ()
 {
-    no_lines_i_ = l;
+  no_lines_i_ = 5;
+  staff_line_leading_f_ = 5.0 PT;
 }
 
-
-IMPLEMENT_IS_TYPE_B1(Staff_symbol,Spanner);
-
 void
-Staff_symbol::do_print()const
+Staff_symbol::do_print() const
 {
 #ifndef NPRINT
-    Spanner::do_print();
-    DOUT << "lines: " << no_lines_i_;
+  Spanner::do_print();
+  DOUT << "lines: " << no_lines_i_;
 #endif
 }
 
-Molecule*
-Staff_symbol::brew_molecule_p() const
+Interval
+Staff_symbol::do_height() const
 {
-    Atom a  = paper()->lookup_l ()->linestaff (no_lines_i_, width ().length ());
-    return new Molecule (a);
+  Interval i =Interval (0, staff_line_leading_f_ * (no_lines_i_-1));
+  i += - i.center ();
+  return i;
 }
 
-void
-Staff_symbol::set_extent (PCol*p1, PCol*p2)
+Molecule*
+Staff_symbol::do_brew_molecule_p() const
 {
-    assert (p1&&p2);
-    left_col_l_ = p1;
-    right_col_l_ = p2;
-}
+  Real w = extent (X_AXIS).length ();
+  Paper_def * p = paper_l ();
+  Real t = p->get_var ("rulethickness");
+  Molecule rule  = lookup_l ()->filledbox (Box (Interval (0,w),
+                                               Interval (-t/2, t/2)));
 
-Real
-Staff_symbol::inter_note_f()const
-{
-    return paper()->internote_f ();
+  Real height = (no_lines_i_-1) * staff_line_leading_f_ /2;
+  Molecule * m = new Molecule;
+  for (int i=0; i < no_lines_i_; i++)
+    {
+      Molecule a (rule);
+      a.translate_axis (height - i * staff_line_leading_f_, Y_AXIS);
+      m->add_molecule (a);
+    }
+
+  return m;
 }
 
+
 int
 Staff_symbol::steps_i() const
 {
-    return no_lines_i_*2;
+  return no_lines_i_*2;
 }