2 staff-side.cc -- implement Staff_side
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #include "paper-def.hh"
12 #include "staff-side.hh"
13 #include "staff-sym.hh"
17 Staff_side::set_staffsym (Staff_symbol* s_l)
23 Staff_side::Staff_side()
26 sym_int_ = Interval (0,0);
30 inside_staff_b_ = false;
34 Staff_side::read_staff_sym()
38 staff_size_i_ = staff_sym_l_->steps_i();
43 Staff_side::support_height() const
47 for (int i=0; i < support_l_arr_.size(); i++)
48 r.unite (support_l_arr_[i]->height());
57 Staff_side::add_support (Score_elem*i)
59 support_l_arr_.push (i);
64 Staff_side::get_position_i() const
68 warning (_("Staff_side::get_position_i(): "
69 "somebody forgot to set my vertical direction, returning -20"));
75 Real inter_f = paper()-> internote_f ();
78 y = (staff_sym_l_) ? dir_ * (staff_sym_l_->steps_i()/2 + 2) : -2;
81 Interval v= support_height();
85 y = y >? (v.max() + 2*inter_f);
89 y = y <? (v.min() - 2*inter_f);
94 Interval v= support_height();
95 y = v[dir_] + 2*dir_*inter_f; // ugh
97 return int (rint (Real (y)/inter_f)); // should ret a float?
101 Staff_side::symbol_height() const
103 return Interval (0,0);
107 Staff_side::do_post_processing()
109 sym_int_ = symbol_height();
110 pos_i_ = get_position_i();
112 pos_i_ += int (rint (- sym_int_[-dir_] / paper()->internote_f ()));
116 Staff_side::do_substitute_dependency (Score_elem*o, Score_elem*n)
118 support_l_arr_.unordered_substitute (o,n);
119 if (staff_sym_l_ == o)
120 staff_sym_l_ = n ? (Staff_symbol*) n->spanner():0;
124 IMPLEMENT_IS_TYPE_B1(Staff_side, Score_elem);