2 staff-side.cc -- implement Staff_side
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "staff-side.hh"
10 #include "staff-sym.hh"
14 Staff_side::set_staffsym(Staff_symbol* s_l)
19 Staff_side::Staff_side(Staff_elem * elem_l)
24 inside_staff_b_ =false;
29 Staff_side::support_height() const return r;
31 for (int i=0; i < support_l_arr_.size(); i++)
32 r.unite(support_l_arr_[i]->height());
36 Staff_side::add_support(Staff_elem*i)
38 support_l_arr_.push(i);
39 elem_l_->add_dependency(i);
43 Staff_side::get_position_i()const
48 warning("Staff_side::get_position_i(): returning -20");
52 Real inter_f = staff_sym_l_->inter_note_f();
53 int staff_size_i = staff_sym_l_->steps_i();
55 if (!inside_staff_b_) {
56 y = (dir_i_ > 0) ? staff_size_i + 2: -2;
58 Interval v= support_height();
61 y = y >? (v.max() + 2*inter_f);
62 } else if (dir_i_ < 0) {
63 y = y <? (v.min() - 2*inter_f);
66 Interval v= support_height();
67 y = v[dir_i_] + 2*dir_i_*inter_f; // ugh
69 return int(rint(Real(y)/inter_f)); // should ret a float?
73 Staff_side::get_position_i(Interval sym_dim) const
78 warning("Staff_side::get_position_i(): returning -20");
82 Real inter_f = staff_sym_l_->inter_note_f();
84 int i= get_position_i();
85 return i+ int(rint(- sym_dim[dir_i_] / inter_f));