From: fred Date: Sun, 24 Mar 2002 20:01:42 +0000 (+0000) Subject: lilypond-0.1.30 X-Git-Tag: release/1.5.59~3650 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=241d58fda7c3e18f8bdcf5ea4e5df85132f7b4c6;p=lilypond.git lilypond-0.1.30 --- diff --git a/lily/crescendo.cc b/lily/crescendo.cc index acb8a5bdf3..ffe6648c53 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -18,7 +18,6 @@ Crescendo::Crescendo() grow_dir_ =0; dir_ = DOWN ; dyn_b_drul_[LEFT] = dyn_b_drul_[RIGHT] =false; - inside_staff_b_ = false; } Interval @@ -62,7 +61,7 @@ Crescendo::brew_molecule_p() const m_p = new Molecule; Atom s (get_symbol()); m_p->add (Atom (s)); - m_p->translate (Offset (x_off_dim, pos_i_ * paper()->internote_f ())); + m_p->translate (Offset (x_off_dim, y_)); return m_p; } diff --git a/lily/dynamic-grav.cc b/lily/dynamic-grav.cc index 7a62123f83..d4b9544e3a 100644 --- a/lily/dynamic-grav.cc +++ b/lily/dynamic-grav.cc @@ -105,7 +105,8 @@ Dynamic_engraver::do_pre_move_processing() Staff_symbol* s_l = get_staff_info().staff_sym_l_; if (dynamic_p_) { - dynamic_p_->set_staffsym (s_l); + + dynamic_p_->add_support (s_l); typeset_element (dynamic_p_); dynamic_p_ = 0; } @@ -115,7 +116,7 @@ Dynamic_engraver::do_pre_move_processing() to_end_cresc_p_->dyn_b_drul_[RIGHT]=true; to_end_cresc_p_->set_bounds(RIGHT,get_staff_info().musical_l ()); - to_end_cresc_p_->set_staffsym (s_l); + to_end_cresc_p_->add_support (s_l); typeset_element (to_end_cresc_p_); to_end_cresc_p_ = 0; } diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index c682c9efbd..131b265186 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -18,35 +18,36 @@ */ class Staff_side : virtual Score_elem { - Link_array support_l_arr_; - int staff_size_i_; - Interval support_height() const; - Staff_symbol* staff_sym_l_; - int get_position_i() const; + Link_array support_l_arr_; + int staff_size_i_; + Interval support_height() const; + Staff_symbol* staff_sym_l_; + Real get_position_f() const; - void read_staff_sym(); + void read_staff_sym(); public: - /** - Vertical dir of symbol relative to staff. -1 = below staff? - */ - Direction dir_; - Interval sym_int_; + /** + Vertical dir of symbol relative to staff. -1 = below staff? + */ + Direction dir_; + Interval sym_int_; - /// follow the support inside the staff? - bool inside_staff_b_; + /// follow the support inside the staff? + bool inside_staff_b_; - int pos_i_; + Real y_; - void set_staffsym (Staff_symbol * ); + + void set_staffsym (Staff_symbol * ); - Staff_side(); - void add_support (Score_elem*); - DECLARE_MY_RUNTIME_TYPEINFO; + Staff_side(); + void add_support (Score_elem*); + DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual Interval symbol_height() const; - virtual void do_substitute_dependency (Score_elem *, Score_elem*); - virtual void do_post_processing(); + virtual Interval symbol_height() const; + virtual void do_substitute_dependency (Score_elem *, Score_elem*); + virtual void do_post_processing(); }; #endif // STAFF_SIDE_HH diff --git a/lily/script.cc b/lily/script.cc index ceaeacd4c3..0979cfe824 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -86,7 +86,6 @@ Script::do_pre_processing() if (!dir_) set_default_dir(); - inside_staff_b_ = specs_l_->inside_b(); } Interval @@ -98,11 +97,10 @@ Script::symbol_height() const Molecule* Script::brew_molecule_p() const { - Real dy = paper()->internote_f (); Real dx = paper()->note_width()/2; Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_)); - out->translate_axis (dy * pos_i_, Y_AXIS); + out->translate_axis (y_, Y_AXIS); out->translate_axis (dx, X_AXIS); // FIXME! ugh return out; } diff --git a/lily/staff-side.cc b/lily/staff-side.cc index 7f9abeeb83..4099f2eece 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; + 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); - for (int i=0; i < support_l_arr_.size(); i++) - r.unite (support_l_arr_[i]->height()); - if (r.empty_b()) + 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,8 +53,8 @@ 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_) { @@ -73,28 +66,11 @@ Staff_side::get_position_i() const Real y=0; Real inter_f = paper()-> internote_f (); - if (!inside_staff_b_) - { - y = (staff_sym_l_) ? dir_ * (staff_sym_l_->steps_i()/2 + 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; } diff --git a/lily/staff-sym.cc b/lily/staff-sym.cc index ebacee46f7..4cd214b79b 100644 --- a/lily/staff-sym.cc +++ b/lily/staff-sym.cc @@ -10,12 +10,13 @@ #include "paper-def.hh" #include "molecule.hh" #include "debug.hh" - +#include "dimen.hh" Staff_symbol::Staff_symbol (int l) { no_lines_i_ = l; + interline_f_ = 0 PT; } @@ -30,19 +31,25 @@ Staff_symbol::do_print() const #endif } +Interval +Staff_symbol::do_height() const +{ + int n = no_lines_i_ -1; + return 2* inter_note_f () * Interval (-n, n); +} + Molecule* Staff_symbol::brew_molecule_p() const { Paper_def * p = paper(); Atom rule = p->lookup_l ()->rule_symbol (p->get_var ("rule_thickness"), width ().length ()); - Real inter = p->interline_f (); - Real height = (no_lines_i_-1) * inter/2; + Real height = (no_lines_i_-1) * inter_note_f(); Molecule * m = new Molecule; for (int i=0; i < no_lines_i_; i++) { Atom a (rule); - a.translate_axis (height - i * inter, Y_AXIS); + a.translate_axis (height - i * inter_note_f()*2, Y_AXIS); m->add (a); } @@ -52,6 +59,9 @@ Staff_symbol::brew_molecule_p() const Real Staff_symbol::inter_note_f() const { + if (interline_f_) + return interline_f_/2; + return paper()->internote_f (); } diff --git a/lily/text-item.cc b/lily/text-item.cc index 8d62ea7289..16a45977f1 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -52,7 +52,7 @@ Text_item::brew_molecule_p() const if (dir_<0) // should do something better anyway. mol_p->translate_axis (-mol_p->extent().y ().left , Y_AXIS); - mol_p->translate_axis (pos_i_ * paper()->internote_f (), Y_AXIS); + mol_p->translate_axis (y_, Y_AXIS); return mol_p; }