From a202b9c7d93e63030acb36b414afc417487cc08c Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:47:31 +0000 Subject: [PATCH] lilypond-0.0.74pre --- lily/beam.cc | 2 +- lily/crescendo.cc | 38 +++++++++++++++++++++++++------------- lily/include/crescendo.hh | 2 ++ lily/include/script.hh | 6 +----- lily/include/staff-side.hh | 14 +++++++++++--- lily/include/text-item.hh | 6 ++---- lily/script.cc | 12 +++--------- lily/staff-side.cc | 22 ++++++++++++++-------- lily/text-item.cc | 15 +++------------ 9 files changed, 62 insertions(+), 55 deletions(-) diff --git a/lily/beam.cc b/lily/beam.cc index d4f741d788..872cfae025 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -378,7 +378,7 @@ Beam::do_print()const { #ifndef NPRINT mtor << "slope " <lookup_l()->hairpin( lookup_wid, grow_dir_i_ < 0) ); + return Symbol( paper()->lookup_l()->hairpin( w_dim, grow_dir_i_ < 0) ); +} + +Molecule* +Crescendo::brew_molecule_p() const +{ + Molecule* m_p =0; + Real x_off_dim=0.0; + if ( left_dyn_b_) + x_off_dim += absdyn_dim; + + m_p = new Molecule; + Symbol s(get_symbol()); m_p->add(Atom(s)); - int pos = get_position_i(s.dim.y); - m_p->translate(Offset(x_off_dim + 0.05 * w_dim, - pos * paper()->internote_f())); + m_p->translate(Offset(x_off_dim, pos_i_ * paper()->internote_f())); return m_p; } diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh index 998c1669ee..0ebf499cdf 100644 --- a/lily/include/crescendo.hh +++ b/lily/include/crescendo.hh @@ -28,9 +28,11 @@ public: protected: SCORE_ELEM_CLONE(Crescendo); virtual Molecule*brew_molecule_p()const; + virtual Interval symbol_height()const; NAME_MEMBERS(); private: + Symbol get_symbol()const; }; diff --git a/lily/include/script.hh b/lily/include/script.hh index f6d41a2c2f..ef7dae9f32 100644 --- a/lily/include/script.hh +++ b/lily/include/script.hh @@ -15,8 +15,6 @@ */ class Script : public Item, public Staff_side { - int pos_i_; - Stem *stem_l_; /* *************** */ @@ -24,14 +22,12 @@ protected: Molecule *brew_molecule_p()const; virtual void do_substitute_dependency(Score_elem*,Score_elem*); virtual void do_print() const; - virtual void do_post_processing(); + virtual Interval symbol_height()const; virtual void do_pre_processing(); virtual Interval do_width() const; private: void set_default_dir(); - void set_default_index(); - Symbol symbol()const; public: General_script_def *specs_l_; diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index 1d4245abbb..d62da65dad 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -11,13 +11,18 @@ #define STAFF_SIDE_HH #include "score-elem.hh" +#include "interval.hh" -/// A symbol which sits along the staff +/** A symbol which sits along a staff + + Should override translate_y() ? + */ 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; void read_staff_sym(); public: @@ -26,10 +31,13 @@ public: Vertical dir of symbol relative to staff. -1 = below staff? */ int dir_i_; + Interval sym_int_; /// follow the support inside the staff? bool inside_staff_b_; + int pos_i_; + void set_staffsym(Staff_symbol * ); Staff_side(); @@ -37,8 +45,8 @@ public: NAME_MEMBERS(); protected: + virtual Interval symbol_height() const; virtual void do_substitute_dependency(Score_elem *, Score_elem*); - int get_position_i()const; - int get_position_i(Interval)const; + virtual void do_post_processing(); }; #endif // STAFF_SIDE_HH diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh index 16bffcd0d8..d4cbcff364 100644 --- a/lily/include/text-item.hh +++ b/lily/include/text-item.hh @@ -19,8 +19,6 @@ class Text_item : public Item ,public Staff_side{ public: - int pos_i_; - /// do I have width? bool fat_b_; @@ -33,9 +31,9 @@ public: protected: General_script_def * tdef_p_; - virtual void set_default_index(); + virtual Interval symbol_height()const; + virtual Molecule* brew_molecule_p() const; - virtual void do_post_processing(); virtual void do_pre_processing(); }; diff --git a/lily/script.cc b/lily/script.cc index bf01359399..c74afdb1fb 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -43,7 +43,6 @@ Script::Script() specs_l_ = 0; inside_staff_b_ = false; stem_l_ = 0; - pos_i_ = 0; dir_i_ = 0; } @@ -64,11 +63,6 @@ Script::set_default_dir() assert(dir_i_); } -void -Script::set_default_index() -{ - pos_i_ = get_position_i(specs_l_->get_atom(paper(), dir_i_).extent().y); -} Interval Script::do_width() const @@ -84,10 +78,10 @@ Script::do_pre_processing() inside_staff_b_ = specs_l_->inside_b(); } -void -Script::do_post_processing() +Interval +Script::symbol_height()const { - set_default_index(); + return specs_l_->get_atom(paper(), dir_i_).extent().y; } Molecule* diff --git a/lily/staff-side.cc b/lily/staff-side.cc index e7d8ccebf6..9cb61495f9 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -22,6 +22,8 @@ Staff_side::set_staffsym(Staff_symbol* s_l) Staff_side::Staff_side() { + pos_i_ =0; + sym_int_ = Interval(0,0); staff_size_i_ = 0; staff_sym_l_=0; dir_i_ =0; @@ -86,16 +88,20 @@ Staff_side::get_position_i()const return int(rint(Real(y)/inter_f)); // should ret a float? } -int -Staff_side::get_position_i(Interval sym_dim) const -{ - int i= get_position_i(); - if (dir_i_) - return i+ int(rint(- sym_dim[-dir_i_] / paper()->internote_f())); - else - return i; +Interval +Staff_side::symbol_height() const +{ + return Interval(0,0); } +void +Staff_side::do_post_processing() +{ + sym_int_ = symbol_height(); + pos_i_ = get_position_i( ); + if (dir_i_) + pos_i_ += int(rint(- sym_int_[-dir_i_] / paper()->internote_f())); +} void Staff_side::do_substitute_dependency(Score_elem*o, Score_elem*n) diff --git a/lily/text-item.cc b/lily/text-item.cc index 42ae3994c4..a8cddcfade 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -19,7 +19,6 @@ Text_item::Text_item(General_script_def*tdef_l, int d) dir_i_ = d; fat_b_ = false; tdef_p_ = tdef_l->clone(); - pos_i_ =0; } Text_item::~Text_item() @@ -27,13 +26,6 @@ Text_item::~Text_item() delete tdef_p_; } -void -Text_item::set_default_index() -{ - pos_i_ = get_position_i( - tdef_p_->get_atom(paper(), dir_i_).extent().y ); -} - void Text_item::do_pre_processing() { @@ -41,12 +33,11 @@ Text_item::do_pre_processing() dir_i_ = -1; } -void -Text_item::do_post_processing() +Interval +Text_item::symbol_height()const { - set_default_index(); + return tdef_p_->get_atom(paper(), dir_i_).sym_.dim.y; } - Molecule* Text_item::brew_molecule_p() const -- 2.39.5