From: fred Date: Sun, 24 Mar 2002 19:53:30 +0000 (+0000) Subject: lilypond-0.1.7 X-Git-Tag: release/1.5.59~4135 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2ef23913b92d49c939be189b25845176276fba49;p=lilypond.git lilypond-0.1.7 --- diff --git a/lily/beam.cc b/lily/beam.cc index 9079d277ba..4dd852f188 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -312,7 +312,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const a.translate(Offset (-w, -w * sl)); for (int j = 0; j < lhalfs; j++) { Atom b(a); - b.translate_y( -dir_i_ * dy * (lwholebeams+j)); + b.translate( -dir_i_ * dy * (lwholebeams+j), Y_AXIS); leftbeams.add( b ); } } @@ -327,7 +327,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const int j = 0; for (; j < rwholebeams; j++) { Atom b(a); - b.translate_y( -dir_i_ * dy * j); + b.translate( -dir_i_ * dy * j, Y_AXIS); rightbeams.add( b ); } @@ -337,7 +337,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const for (; j < rwholebeams + rhalfs; j++) { Atom b(a); - b.translate_y( -dir_i_ * dy * j); + b.translate( -dir_i_ * dy * j, Y_AXIS); rightbeams.add(b ); } @@ -366,7 +366,7 @@ Beam::brew_molecule_p() const sb.translate(Offset(x, (x * slope + left_pos)* inter_f)); mol_p->add(sb); } - mol_p->translate_x(x0 - left_col_l_->hpos_f_); + mol_p->translate(x0 - left_col_l_->hpos_f_, X_AXIS); return mol_p; } diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 15cc5687b2..67742488ca 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -27,6 +27,7 @@ Clef_item::do_pre_processing() Clef_item::Clef_item() { + breakable_b_ =true; default_b_ = false; change_b_ = true; read("violin"); @@ -59,7 +60,7 @@ Clef_item::brew_molecule_p()const t += "_change"; Symbol s = paper()->lookup_l()->clef(t); Molecule*output = new Molecule(Atom(s)); - output->translate_y( paper()->internote_f() * y_off); + output->translate( paper()->internote_f() * y_off, Y_AXIS); return output; } diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index 2eccfd3ee8..d1057bebf0 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -22,8 +22,7 @@ struct Molecule { void add_bottom(const Molecule &m); void add(Molecule const &m); void translate(Offset); - void translate_y(Real); - void translate_x(Real); + void translate(Real,Axis); void add(Atom const & a) ; /// how big is #this#? Box extent() const; diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index d181ebbc95..724caa3b9f 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -17,6 +17,7 @@ class Span_bar : public Bar Link_array spanning_l_arr_; public: + Span_bar(); DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Span_bar); void add(Bar* ); @@ -25,7 +26,6 @@ public: protected: virtual Interval do_width()const; virtual void do_pre_processing(); - virtual void translate_y(Real y); virtual void do_substitute_dependency(Score_elem*,Score_elem*); virtual Molecule * brew_molecule_p()const; diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index 4186c01be1..73f174f105 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -13,9 +13,8 @@ #include "score-elem.hh" #include "interval.hh" -/** A symbol which sits along a staff +/** A symbol which sits along a staff. - Should override translate_y() ? */ class Staff_side : virtual Score_elem { Link_array support_l_arr_; diff --git a/lily/include/symbol.hh b/lily/include/symbol.hh index e1e24b25e0..3e2eafc7d3 100644 --- a/lily/include/symbol.hh +++ b/lily/include/symbol.hh @@ -33,13 +33,9 @@ struct Atom { void translate(Offset o) { off_ += o; } - void translate_x(Real r){ - off_.x += r; + void translate(Real r,Axis a){ + off_[a] += r; } - void translate_y(Real r) { - off_.y += r; - } - /// how big is #this#? Box extent() const; Atom(Symbol s); diff --git a/lily/key-item.cc b/lily/key-item.cc index aa8401e005..299695561f 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -1,10 +1,20 @@ +/* + key-item.cc -- implement Key_item + + source file of the GNU LilyPond music typesetter + + (c) 1996,1997 Han-Wen Nienhuys + + keyplacement by Mats Bengtsson +*/ + #include "key-item.hh" #include "key.hh" #include "debug.hh" #include "molecule.hh" #include "paper-def.hh" #include "lookup.hh" -//#include "clef-grav.hh" + #include "key-grav.hh" const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */ @@ -12,6 +22,7 @@ const int SHARP_TOP_PITCH=4; /* ais and bis typeset in lower octave */ Key_item::Key_item(int c) { + breakable_b_ =true; default_b_ = false; set_c_position(c); } @@ -58,7 +69,7 @@ Key_item::brew_molecule_p()const for (int i =0; i < pitch.size(); i++) { Symbol s= paper()->lookup_l()->accidental(acc[i]); Atom a(s); - a.translate_y((c_position + pitch[i]) * inter); + a.translate((c_position + pitch[i]) * inter, Y_AXIS); Molecule m(a); output->add_right(m); } diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 50f870c1cf..6f84c2d40d 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -66,7 +66,7 @@ Local_key_item::brew_molecule_p()const if (accs[i].octave_i_ != lastoct) { if (octmol){ Real dy =lastoct*7*paper()->internote_f(); - octmol->translate_y( dy); + octmol->translate( dy, Y_AXIS); output->add(*octmol); delete octmol; } @@ -76,20 +76,20 @@ Local_key_item::brew_molecule_p()const Symbol s =paper()->lookup_l()->accidental(accs[i].accidental_i_); Atom a(s); Real dy = (accs[i].name_i_ + c0_position) * paper()->internote_f(); - a.translate_y(dy); + a.translate(dy, Y_AXIS); octmol->add_right(a); } if (octmol){ Real dy =lastoct*7*paper()->internote_f(); - octmol->translate_y( dy); + octmol->translate( dy, Y_AXIS); output->add(*octmol); delete octmol; } Interval head_width=itemlist_width(support_items_); - output->translate_x(-output->extent().x.right + head_width.left ); + output->translate(-output->extent().x().right + head_width.left , X_AXIS); return output; } diff --git a/lily/lyric-grav.cc b/lily/lyric-grav.cc index 85e8e630fd..0ab6b79204 100644 --- a/lily/lyric-grav.cc +++ b/lily/lyric-grav.cc @@ -36,7 +36,7 @@ Lyric_engraver::do_process_requests() if ( lreq_l_ ) { lyric_item_p_ = new Text_item(lreq_l_->tdef_p_ ); - lyric_item_p_->translate_x( paper()->note_width()/2 ); + lyric_item_p_->translate( paper()->note_width()/2 , X_AXIS); lyric_item_p_->dir_i_ = -1; lyric_item_p_->fat_b_ = true; announce_element( Score_elem_info( lyric_item_p_, lreq_l_)); diff --git a/lily/molecule.cc b/lily/molecule.cc index ee4fe5e485..f9cc7bb12a 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -14,9 +14,6 @@ #include "debug.hh" #include "tex.hh" - -/* *************** */ - String Molecule::TeX_string() const { @@ -43,15 +40,10 @@ Molecule::translate(Offset o) } void -Molecule::translate_x(Real x) -{ - translate(Offset(x,0)); -} - -void -Molecule::translate_y(Real y) +Molecule::translate(Real x,Axis a) { - translate(Offset(0,y)); + for (iter_top(ats,c); c.ok(); c++) + c->translate(x,a); } void @@ -69,7 +61,9 @@ Molecule::add_right(Molecule const &m) add(m); return; } - Real xof=extent().x.right - m.extent().x.left; + Real xof=extent().x().right - m.extent().x().left; + + Molecule toadd(m); toadd.translate(Offset(xof, 0.0)); add(toadd); @@ -82,7 +76,8 @@ Molecule::add_left(Molecule const &m) add(m); return; } - Real xof=extent().x.left - m.extent().x.right; + Real xof=extent().x().left - m.extent().x().right; + Molecule toadd(m); toadd.translate(Offset(xof, 0.0)); add(toadd); @@ -96,9 +91,10 @@ Molecule::add_top(Molecule const &m) add(m); return; } - Real yof=extent().y.right - m.extent().y.left; + Real yof=extent().y().right - m.extent().y().left; + Molecule toadd(m); - toadd.translate_y(yof); + toadd.translate(yof, Y_AXIS); add(toadd); } @@ -109,9 +105,9 @@ Molecule::add_bottom(Molecule const &m) add(m); return; } - Real yof=extent().y.left- m.extent().y.right; + Real yof=extent().y().left- m.extent().y().right; Molecule toadd(m); - toadd.translate_y(yof); + toadd.translate(yof, Y_AXIS); add(toadd); } diff --git a/lily/notehead.cc b/lily/notehead.cc index 48b6b7ba6d..1e37bb328b 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -114,12 +114,12 @@ Note_head::brew_molecule_p() const s = p->lookup_l()->rest(balltype_i_, streepjes_b); } out = new Molecule(Atom(s)); - out->translate_x( x_dir_i_ * s.dim.x.length() ); + out->translate( x_dir_i_ * s.dim.x().length() , X_AXIS); if (dots_i_) { Symbol d = p->lookup_l()->dots(dots_i_ ); Molecule dm; dm.add(Atom(d)); - dm.translate_y( inter_f * dot_delta_y_i_ ); + dm.translate( inter_f * dot_delta_y_i_ , Y_AXIS); out->add_right(dm); } @@ -136,11 +136,11 @@ Note_head::brew_molecule_p() const Molecule sm; sm.add(Atom(str)); if (position_i_ % 2) - sm.translate_y(-inter_f* dir); + sm.translate(-inter_f* dir, Y_AXIS); out->add(sm); } - out->translate_y(inter_f*position_i_); + out->translate(inter_f*position_i_, Y_AXIS); return out; } diff --git a/lily/script.cc b/lily/script.cc index 4fed330013..eb88b8756f 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -67,12 +67,16 @@ Script::set_default_dir() Interval Script::do_width() const { - return specs_l_->get_atom(paper(), dir_i_).extent().x; + return specs_l_->get_atom(paper(), dir_i_).extent().x(); } void Script::do_pre_processing() { + if (breakable_b_ && break_status_i() != 1) { + transparent_b_ = empty_b_ = true; + } + if (!dir_i_) set_default_dir(); inside_staff_b_ = specs_l_->inside_b(); @@ -81,7 +85,7 @@ Script::do_pre_processing() Interval Script::symbol_height()const { - return specs_l_->get_atom(paper(), dir_i_).extent().y; + return specs_l_->get_atom(paper(), dir_i_).extent().y(); } Molecule* @@ -90,7 +94,7 @@ Script::brew_molecule_p() const Real dy = paper()->internote_f(); Molecule*out = new Molecule(specs_l_->get_atom(paper(), dir_i_)); - out->translate_y(dy * pos_i_); + out->translate(dy * pos_i_, Y_AXIS); return out; } diff --git a/lily/stem.cc b/lily/stem.cc index cf811ddf56..d0f9f8105c 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -237,7 +237,7 @@ Stem::do_width()const if (!print_flag_b_ || abs(flag_i_) <= 4) return Interval(0,0); // TODO! Paper_def*p= paper(); - Interval r(p->lookup_l()->flag(flag_i_).dim.x); + Interval r(p->lookup_l()->flag(flag_i_).dim.x()); r+= stem_xoffset_f_; return r; } @@ -270,7 +270,7 @@ Stem::brew_molecule_p()const assert(false); } - out->translate_x(stem_xoffset_f_); + out->translate(stem_xoffset_f_, X_AXIS); return out; } diff --git a/lily/tex-slur.cc b/lily/tex-slur.cc index c1ba56bd89..b7c0660a43 100644 --- a/lily/tex-slur.cc +++ b/lily/tex-slur.cc @@ -52,8 +52,8 @@ Lookup::half_slur_middlepart(Real &dx, int dir) const Symbol s; - s.dim.y = Interval(min(0,0), max(0,0)); // todo - s.dim.x = Interval(0,dx); + s.dim.y() = Interval(min(0,0), max(0,0)); // todo + s.dim.x() = Interval(0,dx); String f = String("\\hslurchar"); f += direction_char(0); @@ -67,7 +67,7 @@ Lookup::half_slur_middlepart(Real &dx, int dir) const f+=String( "{" ) + String( idx ) + "}"; s.tex = f; Atom a(s); - a.translate_x(dx/2); + a.translate(dx/2, X_AXIS); s.tex = a.TeX_string(); return s; @@ -95,8 +95,8 @@ Lookup::half_slur(int dy, Real &dx, int dir, int xpart) const } Symbol s; - s.dim.x = Interval(0,dx); - s.dim.y = Interval(min(0,dy), max(0,dy)); + s.dim.x() = Interval(0,dx); + s.dim.y() = Interval(min(0,dy), max(0,dy)); String f = String("\\hslurchar"); @@ -156,8 +156,8 @@ Lookup::slur (int dy , Real &dx, int dir) const } Symbol s; - s.dim.x = Interval(0,dx); - s.dim.y = Interval(min(0,dy), max(0,dy)); + s.dim.x() = Interval(0,dx); + s.dim.y() = Interval(min(0,dy), max(0,dy)); String f = String("\\slurchar") + String( direction_char(y_sign) ); @@ -182,7 +182,7 @@ Lookup::slur (int dy , Real &dx, int dir) const s.tex = f; Atom a(s); - a.translate_x(dx/2); + a.translate(dx/2, X_AXIS); s.dim = a.extent(); s.tex = a.TeX_string(); return s; @@ -209,10 +209,10 @@ Lookup::big_slur(int dy , Real &dx, int dir) const Molecule mol; mol.add(l); Atom a(m); - a.translate_y(slur_extra * internote_f); + a.translate(slur_extra * internote_f, Y_AXIS); mol.add_right(m); mol.add_right(r); - mol.translate_y( l_dy * internote_f); + mol.translate( l_dy * internote_f, Y_AXIS); Symbol s; s.tex = mol.TeX_string(); s.dim = mol.extent(); diff --git a/lily/text-item.cc b/lily/text-item.cc index 3ae99c40ad..ad5745f6a5 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -36,7 +36,7 @@ Text_item::do_pre_processing() Interval Text_item::symbol_height()const { - return tdef_p_->get_atom(paper(), dir_i_).sym_.dim.y; + return tdef_p_->get_atom(paper(), dir_i_).sym_.dim.y(); } Molecule* @@ -51,8 +51,8 @@ Text_item::brew_molecule_p() const Molecule* mol_p = new Molecule(a); if(dir_i_<0 ) // should do something better anyway. - mol_p->translate_y( -mol_p->extent().y.left ); - mol_p->translate_y( pos_i_ * paper()->internote_f()); + mol_p->translate( -mol_p->extent().y().left , Y_AXIS); + mol_p->translate( pos_i_ * paper()->internote_f(), Y_AXIS); return mol_p; } diff --git a/lily/vertical-align-elem.cc b/lily/vertical-align-elem.cc index 4ba8b7c5a4..7ebf647c34 100644 --- a/lily/vertical-align-elem.cc +++ b/lily/vertical-align-elem.cc @@ -27,6 +27,13 @@ Vertical_align_element::do_substitute_dependency(Score_elem*o,Score_elem*n) else elem_l_arr_.del(i); } + +/** + Align elements top to bottom. + The first element has its top at y =0.0 afterwards + + TODO configurable, like Horizontal_align_item + */ void Vertical_align_element::do_post_processing() { @@ -41,7 +48,7 @@ Vertical_align_element::do_post_processing() Real where_f=0; for ( int i=0 ; i < elem_l_arr_.size(); i++) { - elem_l_arr_[i]->translate_y( - dims[i][1] - where_f); + elem_l_arr_[i]->translate( - dims[i][1] - where_f, Y_AXIS); where_f += dims[i].length(); } }