source file of the GNU LilyPond music typesetter
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "staff-symbol.hh"
#include "lookup.hh"
#include "item.hh"
-Staff_symbol::Staff_symbol ()
-{
- no_lines_i_ = 5;
- staff_line_leading_f_ = 5.0 PT;
-}
-
-void
-Staff_symbol::do_print() const
-{
-#ifndef NPRINT
- Spanner::do_print();
- DEBUG_OUT << "lines: " << no_lines_i_;
-#endif
-}
-
-Molecule*
-Staff_symbol::do_brew_molecule_p() const
+Molecule
+Staff_symbol::do_brew_molecule() const
{
Score_element * common
- = spanned_drul_[LEFT]->common_refpoint (spanned_drul_[RIGHT], X_AXIS);
-
-#if 0
- Interval r = spanned_drul_[RIGHT]->extent (X_AXIS);
- Interval l = spanned_drul_[LEFT]->extent (X_AXIS);
+ = get_bound (LEFT)->common_refpoint (get_bound (RIGHT), X_AXIS);
- Real left_shift =l.empty_b () ? 0.0: l[LEFT];
- Real right_shift =r.empty_b () ? 0.0: r[RIGHT];
-#endif
Real width =
// right_shift - left_shift
- + spanned_drul_[RIGHT]->relative_coordinate (common , X_AXIS)
- - spanned_drul_[LEFT]->relative_coordinate (common, X_AXIS)
+ + get_bound (RIGHT)->relative_coordinate (common , X_AXIS)
+ - get_bound (LEFT)->relative_coordinate (common, X_AXIS)
;
Real t = paper_l ()->get_var ("stafflinethickness");
- Molecule rule = lookup_l ()->filledbox (Box (Interval (0,width),
- Interval (-t/2, t/2)));
-
- Real height = (no_lines_i_-1) * staff_line_leading_f_ /2;
- Molecule * m = new Molecule;
- for (int i=0; i < no_lines_i_; i++)
+ int l = line_count ();
+
+ Real height = (l-1) * staff_space () /2;
+ Molecule m;
+ for (int i=0; i < l; i++)
{
- Molecule a (rule);
- a.translate_axis (height - i * staff_line_leading_f_, Y_AXIS);
- m->add_molecule (a);
+ Molecule a =
+ lookup_l ()->filledbox (Box (Interval (0,width),
+ Interval (-t/2, t/2)));
+
+ a.translate_axis (height - i * staff_space (), Y_AXIS);
+ m.add_molecule (a);
}
- // m->translate_axis (left_shift, X_AXIS);
return m;
}
-
int
Staff_symbol::steps_i() const
{
- return no_lines_i_*2;
+ return line_count () * 2;
+}
+
+int
+Staff_symbol::line_count () const
+{
+ return gh_scm2int (get_elt_property ("line-count"));
}
+
Real
-Staff_symbol::staff_line_leading_f ()
+Staff_symbol::staff_space ()const
+{
+ return gh_scm2double (get_elt_property ("staff-space")) *
+ paper_l ()->get_var ("staffspace");
+}
+
+Staff_symbol::Staff_symbol( SCM s)
+ : Spanner (s)
{
- return staff_line_leading_f_;
}