X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstaff-side.cc;h=980990cf65fa9d2f3b831f7ba1361be732cb8816;hb=946c135a338e2daadfed8da3026f0ed9d29bf9ad;hp=a58d2f2828ad3bcf84f69873af8368fddc9458ca;hpb=2862b1027f316a2f0444fa92e441ee28acf7a463;p=lilypond.git diff --git a/lily/staff-side.cc b/lily/staff-side.cc index a58d2f2828..980990cf65 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -13,44 +13,37 @@ #include "staff-sym.hh" #include "debug.hh" -void -Staff_side::set_staffsym (Staff_symbol* s_l) -{ - staff_sym_l_ = s_l; - add_dependency (s_l); -} Staff_side::Staff_side() { - pos_i_ =0; + y_=0; sym_int_ = Interval (0,0); - staff_size_i_ = 0; - staff_sym_l_ = 0; dir_ = CENTER; inside_staff_b_ = false; } -void -Staff_side::read_staff_sym() -{ - if (! staff_sym_l_) - return ; - staff_size_i_ = staff_sym_l_->steps_i(); -} - Interval Staff_side::support_height() const { - Interval r; - - for (int i=0; i < support_l_arr_.size(); i++) - r.unite (support_l_arr_[i]->height()); - if (r.empty_b()) + Interval y_int; + for (int i=0; i < support_l_arr_.size(); i++) + { + Axis_group_element *common = + common_group (support_l_arr_[i], Y_AXIS); + + Real y = support_l_arr_[i]->relative_coordinate (common, Y_AXIS) + -relative_coordinate (common,Y_AXIS); + + y_int.unite (y + support_l_arr_[i]->height()); + } + + + if (y_int.empty_b()) { - r = Interval (0,0); + y_int = Interval (0,0); } - return r; + return y_int; } void @@ -60,40 +53,24 @@ Staff_side::add_support (Score_elem*i) add_dependency (i); } -int -Staff_side::get_position_i() const +Real +Staff_side::get_position_f() const { - if (!dir_) + if (!dir_) { - warning ("Staff_side::get_position_i(): " - "somebody forgot to set my vertical direction, returning -20"); + warning (_("Staff_side::get_position_i(): " + "somebody forgot to set my vertical direction, returning -20")); return -20; } - + Real y=0; Real inter_f = paper()-> internote_f (); - if (!inside_staff_b_) - { - y = (dir_ > 0 && staff_sym_l_) ? staff_sym_l_->steps_i() + 2: -2; - y *=inter_f; - Interval v= support_height(); - - if (dir_ > 0) - { - y = y >? (v.max() + 2*inter_f); - } - else if (dir_ < 0) - { - y = y internote_f ())); + y_ += - sym_int_[-dir_]; } void Staff_side::do_substitute_dependency (Score_elem*o, Score_elem*n) -{ +{ support_l_arr_.unordered_substitute (o,n); - if (staff_sym_l_ == o) - staff_sym_l_ = n ? (Staff_symbol*) n->spanner():0; }