/*
staffsym.cc -- implement Staff_symbol
- source file of the LilyPond music typesetter
+ source file of the GNU LilyPond music typesetter
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "staff-sym.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;
+ interline_f_ = 0 PT;
}
-IMPLEMENT_STATIC_NAME(Staff_symbol);
+
+
void
-Staff_symbol::do_print()const
+Staff_symbol::do_print() const
{
- mtor << "lines: " << no_lines_i_;
+#ifndef NPRINT
+ Spanner::do_print();
+ DOUT << "lines: " << no_lines_i_;
+#endif
+}
+
+Interval
+Staff_symbol::do_height() const
+{
+ int n = no_lines_i_ -1;
+// return 2* inter_note_f () * Interval (-n, n);
+ return inter_note_f () * Interval (-n, n);
}
Molecule*
-Staff_symbol::brew_molecule_p() const
+Staff_symbol::do_brew_molecule_p() const
{
- Atom a = paper()->lookup_l()->linestaff(no_lines_i_, width().length());
- return new Molecule(a);
+ Real w = extent (X_AXIS).length ();
+ Paper_def * p = paper();
+ Molecule rule = lookup_l ()->rule_symbol (p->get_var ("rulethickness"),
+ w);
+ Real height = (no_lines_i_-1) * inter_note_f();
+ Molecule * m = new Molecule;
+ for (int i=0; i < no_lines_i_; i++)
+ {
+ Molecule a (rule);
+ a.translate_axis (height - i * inter_note_f()*2, Y_AXIS);
+ m->add_molecule (a);
+ }
+
+ return m;
}
-Spanner*
-Staff_symbol::do_break_at(PCol*p1, PCol*p2)const
+Real
+Staff_symbol::inter_note_f() const
{
- Staff_symbol *span_p=new Staff_symbol(*this);
- return span_p;
+ if (interline_f_)
+ return interline_f_/2;
+
+ return paper()->internote_f ();
}
-void
-Staff_symbol::set_extent(PCol*p1, PCol*p2)
+int
+Staff_symbol::steps_i() const
{
- assert(p1&&p2);
- left_col_l_ = p1;
- right_col_l_ = p2;
+ return no_lines_i_*2;
}