]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.7
authorfred <fred>
Sun, 24 Mar 2002 19:53:30 +0000 (19:53 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:53:30 +0000 (19:53 +0000)
16 files changed:
lily/beam.cc
lily/clef-item.cc
lily/include/molecule.hh
lily/include/span-bar.hh
lily/include/staff-side.hh
lily/include/symbol.hh
lily/key-item.cc
lily/local-key-item.cc
lily/lyric-grav.cc
lily/molecule.cc
lily/notehead.cc
lily/script.cc
lily/stem.cc
lily/tex-slur.cc
lily/text-item.cc
lily/vertical-align-elem.cc

index 9079d277ba292c8f90b7189377b3ceb07af1be11..4dd852f1882d16e31b81b187227fc6c86093af7c 100644 (file)
@@ -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;
 }
 
index 15cc5687b21786cd60e0c38665d81a9ff78f246f..67742488ca421babf2b6f08450578f870ee13fd1 100644 (file)
@@ -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;
 }
 
index 2eccfd3ee8b6cbf381f82736939eed4ae654307b..d1057bebf0d6a317219fbeddb8452148ebfa658b 100644 (file)
@@ -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;
index d181ebbc9531f9ca0f87fd279206301d6a60cc85..724caa3b9f52d52572069b28189b5bdc543f3821 100644 (file)
@@ -17,6 +17,7 @@ class Span_bar : public Bar
     Link_array<Bar> 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;
index 4186c01be10cd371d4fd574e5443ec5feda3336e..73f174f1052e5ecf430362d5b6c47b76258f0515 100644 (file)
@@ -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<Score_elem> support_l_arr_;
index e1e24b25e068b45dfbe405471e0649be60187ef9..3e2eafc7d3ab592a262a669f4d1d47fc386e4af9 100644 (file)
@@ -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);
index aa8401e005e520b8b744464bf772888afa6edace..299695561f2da23f456e81774466d430ace55e9a 100644 (file)
@@ -1,10 +1,20 @@
+/*
+  key-item.cc -- implement Key_item
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+
+  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);   
     }
index 50f870c1cfe9b1f2b353d5ffe7907c3df742135f..6f84c2d40dfd28bd38621443dde879d424d1c961 100644 (file)
@@ -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;
 }
index 85e8e630fd14e4401d0d535374ca9fb7966c0d95..0ab6b7920447fa9c96922c5db4b8cd36718de680 100644 (file)
@@ -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_));
index ee4fe5e48527549fa91dd0e7db647b34087fd03a..f9cc7bb12a9da38d87b4e51a55c4616fda3d913d 100644 (file)
@@ -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);
 }
 
index 48b6b7ba6d16641a59b7fb6cf282f8afc95ebe41..1e37bb328b9a9ca5ff0799d5521803b7a4847754 100644 (file)
@@ -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;
 }
 
index 4fed33001398e65ea5299accfa66310f082e8261..eb88b8756f4a8bb13e1ee8c489eba34bc8d41591 100644 (file)
@@ -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;
 }
 
index cf811ddf56025118613ec50b517be066b8026f43..d0f9f8105c72cd8a949f74406b105273cbdfb28f 100644 (file)
@@ -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;
 }
 
index c1ba56bd89623823fd400fc0da71ba355dfc1af7..b7c0660a43843b5c98bbd2e78894d879d2f96df4 100644 (file)
@@ -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();
index 3ae99c40ad1b352ad71fe51d995d682dcb15be96..ad5745f6a5fe9f3fb260d52480592afec66f3314 100644 (file)
@@ -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;
 }
index 4ba8b7c5a4d69f566273907571113be9c4e20a20..7ebf647c34094df89c7a08f354e6b335880ff01f 100644 (file)
@@ -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();
     }
 }