2 staff-symbol-referencer.cc -- implement Staff_symbol_referencer
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "staff-symbol-referencer.hh"
12 #include "staff-symbol.hh"
13 #include "paper-def.hh"
14 #include "dimension-cache.hh"
16 Staff_symbol_referencer::Staff_symbol_referencer ()
23 Staff_symbol_referencer::do_substitute_element_pointer (Score_element *o, Score_element*n)
25 if (staff_sym_l_ == o)
27 staff_sym_l_ = dynamic_cast<Staff_symbol*> (n);
32 Staff_symbol_referencer::lines_i () const
34 return (staff_sym_l_) ? staff_sym_l_->no_lines_i_ : 5;
38 Staff_symbol_referencer::set_staff_symbol (Staff_symbol*s)
45 Staff_symbol_referencer::staff_symbol_l () const
51 Staff_symbol_referencer::staff_line_leading_f () const
54 return staff_sym_l_->staff_line_leading_f_;
55 else if (pscore_l_ && paper_l ())
56 paper_l ()->get_var ("interline");
62 Staff_symbol_referencer::position_f () const
67 Graphical_element * c = common_refpoint (staff_sym_l_, Y_AXIS);
68 Real y = relative_coordinate (c, Y_AXIS) - staff_sym_l_->relative_coordinate (c, Y_AXIS);
70 p += 2.0 * y / staff_line_leading_f ();
78 Staff_symbol_referencer::do_pre_processing ()
80 translate_axis (position_i_ * staff_line_leading_f () /2.0, Y_AXIS);
86 Staff_symbol_referencer::set_position (int p)
88 Real halfspace = staff_line_leading_f ()* 0.5;
90 translate_axis (- halfspace * position_f (), Y_AXIS);
92 translate_axis (halfspace * p, Y_AXIS);