]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.56
authorfred <fred>
Sun, 24 Mar 2002 19:41:49 +0000 (19:41 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:41:49 +0000 (19:41 +0000)
Documentation/faq.pod
lily/beam.cc
lily/input-register.cc
lily/notehead.cc
lily/pulk-voice.cc
lily/register.cc
lily/script-column.cc [new file with mode: 0644]
lily/staff-regs.cc
lily/staff-side.cc
lily/symbol.cc

index 70162a6095692b6057f5223572f9f8cd38e1ada9..3b33cf79b52b21b2cca8d3512dca54b927a30de4 100644 (file)
@@ -100,25 +100,28 @@ saves us a I<lot> of trouble. GNU LilyPond and FlowerLib use:
 =over 4
 
 =item *
+
 builtin bool
 
 =item *
+
 64 bit integral type long long
 
 =item *
+
 typeof
 
 =item *
+
 operator <?, operator >?
 
 =item *
+
 the new for-scope
 
 =item   *
-class Rational (libg++)
 
-=item *
-named return values
+class Rational (libg++)
 
 =back
 
index 389226fa7158a8e09e97923ad3e4f9918c16b1d5..ccf37114db9edc2044c9aa9caab178e35ad3a10b 100644 (file)
@@ -29,12 +29,11 @@ struct Stem_info {
 
 Stem_info::Stem_info(Stem const *s)
 {
-    x = s->hindex();
+    x = s->hpos_f();
     int dir = s->dir_i_;
-    idealy  = max(dir*s->top, dir*s->bot);
-    miny = max(dir*s->minnote, dir*s-> maxnote);
+    idealy  = dir * s->stem_end_f();
+    miny = dir * s->stem_start_f();
     assert(miny <= idealy);
-
 }
 
 /* *************** */
@@ -60,7 +59,7 @@ Beam::add(Stem*s)
 {
     stems.bottom().add(s);
     s->add_dependency(this);
-    s->print_flag = false;
+    s->print_flag_b_ = false;
 }
 
 void
@@ -87,6 +86,9 @@ Beam::solve_slope()
     Array<Stem_info> sinfo;
     for (iter_top(stems,i); i.ok(); i++) {
        i->set_default_extents();
+       if (i->invisible_b())
+           continue;
+       
        Stem_info info(i);
        sinfo.push(info);
     }
@@ -120,9 +122,9 @@ void
 Beam::set_stemlens()
 {
     iter_top(stems,s);
-    Real x0 = s->hindex();    
+    Real x0 = s->hpos_f();    
     for (; s.ok() ; s++) {
-       Real x =  s->hindex()-x0;
+       Real x =  s->hpos_f()-x0;
        s->set_stemend(left_pos + slope * x);   
     }
 }
@@ -149,7 +151,7 @@ Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur)
        iter_top(stems,s);
        Array<int> flags;
        for (; s.ok(); s++) {
-           int f = intlog2(abs(s->flag))-2;
+           int f = intlog2(abs(s->flag_i_))-2;
            assert(f>0);
            flags.push(f);
        }
@@ -162,8 +164,8 @@ Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur)
 
     iter_top(stems,s);
     for (int i=0; i < b.size() && s.ok(); i+=2, s++) {
-       s->beams_left = b[i];
-       s->beams_right = b[i+1];
+       s->beams_left_i_ = b[i];
+       s->beams_right_i_ = b[i+1];
     }
 }
 
@@ -193,8 +195,8 @@ Interval
 Beam::do_width() const
 {
     Beam * me = (Beam*) this;  // ugh
-    return Interval( (*me->stems.top()) ->hindex(),
-                    (*me->stems.bottom()) ->hindex() );
+    return Interval( (*me->stems.top()) ->hpos_f(),
+                    (*me->stems.bottom()) ->hpos_f() );
 }
 
 /*
@@ -203,8 +205,8 @@ Beam::do_width() const
 Molecule
 Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
 {
-    assert( !next || next->hindex() > here->hindex()  );
-    assert( !prev || prev->hindex() < here->hindex()  );
+    assert( !next || next->hpos_f() > here->hpos_f()  );
+    assert( !prev || prev->hpos_f() < here->hpos_f()  );
     Real dy=paper()->internote()*2;
     Real stemdx = paper()->rule_thickness();
     Real sl = slope*paper()->internote();
@@ -215,9 +217,9 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
 
     /* half beams extending to the left. */
     if (prev) {
-       int lhalfs= lhalfs = here->beams_left - prev->beams_right ;
-       int lwholebeams= here->beams_left <? prev->beams_right ;
-       Real w = (here->hindex() - prev->hindex())/4;
+       int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ;
+       int lwholebeams= here->beams_left_i_ <? prev->beams_right_i_ ;
+       Real w = (here->hpos_f() - prev->hpos_f())/4;
        Symbol dummy;
        Atom a(dummy);
        if (lhalfs)             // generates warnings if not
@@ -231,10 +233,10 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
     }
        
     if (next){
-       int rhalfs = here->beams_right - next->beams_left;
-       int rwholebeams = here->beams_right <? next->beams_left
+       int rhalfs = here->beams_right_i_ - next->beams_left_i_;
+       int rwholebeams = here->beams_right_i_ <? next->beams_left_i_
 
-       Real w = next->hindex() - here->hindex();
+       Real w = next->hpos_f() - here->hpos_f();
        Atom a = paper()->lookup_l()->beam(sl, w + stemdx);
        
        int j = 0;
@@ -261,11 +263,12 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
 
 
 Molecule*
-Beam::brew_molecule_p() const return out;
+Beam::brew_molecule_p() const 
 {
+    Molecule *out=0;
     Real inter=paper()->internote();
     out = new Molecule;
-    Real x0 = stems.top()->hindex();
+    Real x0 = stems.top()->hpos_f();
     
     for (iter_top(stems,i); i.ok(); i++) {
        PCursor<Stem*> p(i-1);
@@ -274,11 +277,12 @@ Beam::brew_molecule_p() const return out;
        Stem * next = n.ok() ? n.ptr() : 0;
 
        Molecule sb = stem_beams(i, next, prev);
-       Real  x = i->hindex()-x0;
+       Real  x = i->hpos_f()-x0;
        sb.translate(Offset(x, (x * slope  + left_pos)* inter));
        out->add(sb);
     }
     out->translate(Offset(x0 - left_col_l_->hpos,0));
+    return out;
 }
 
 IMPLEMENT_STATIC_NAME(Beam);
index e038b18dd27604e9120985820c55f738d91e470e..711b89bd6d57c8800d14d92259eb374c084fac28 100644 (file)
@@ -42,11 +42,13 @@ Input_register::get_ireg_l(String nm)const
     return 0;
 }
 Array<Request_register*>
-Input_register::get_nongroup_p_arr() const return a;
+Input_register::get_nongroup_p_arr() const 
 {
+    Array <Request_register*>a;
     Array<String> sa(get_nongroups_str_arr());
     for (int i=0; i < sa.size(); i++)
        a.push(get_nongroup_register_p(sa[i]));
+    return a;
 }
 
 void
index df2becf109836459c85de012b77f3afd5cfbf3e7..6e6ca348d9371b087881699302e01337a744788f 100644 (file)
 
 Notehead::Notehead(int ss)
 {
-    x_dir = 0;
-    staff_size=ss;
-    position = 0;
-    balltype = 0;
-    dots = 0;
-    extremal = 0;
+    x_dir_i_ = 0;
+    staff_size_i_=ss;
+    position_i_ = 0;
+    balltype_i_ = 0;
+    dots_i_ = 0;
+    extremal_i_ = 0;
     rest_b_ = false;
 }
 
 void
 Notehead::set_rhythmic(Rhythmic_req*r_req_l)
 {
-    balltype = r_req_l->duration_.type_i_;
-    dots = r_req_l->duration_.dots_i_;
+    balltype_i_ = r_req_l->duration_.type_i_;
+    dots_i_ = r_req_l->duration_.dots_i_;
 }
     
 IMPLEMENT_STATIC_NAME(Notehead);
@@ -35,8 +35,8 @@ Notehead::do_print()const
 #ifndef NPRINT
     if (rest_b_)
        mtor << "REST! ";
-    mtor << "balltype "<< balltype << ", position = "<< position
-        << "dots " << dots;
+    mtor << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_
+        << "dots_i_ " << dots_i_;
 #endif
 }
 
@@ -44,47 +44,49 @@ Notehead::do_print()const
 int
 Notehead::compare(Notehead *const  &a, Notehead * const &b)
 {
-    return a->position - b->position;
+    return a->position_i_ - b->position_i_;
 }
 
 Molecule*
-Notehead::brew_molecule_p() const return out;
+Notehead::brew_molecule_p() const 
 {
+    Molecule*out = 0;
     Paper_def *p = paper();
 
     Real dy = p->internote();
     Symbol s;
     if (!rest_b_)
-       s = p->lookup_l()->ball(balltype);
+       s = p->lookup_l()->ball(balltype_i_);
     else 
-       s = p->lookup_l()->rest(balltype);
+       s = p->lookup_l()->rest(balltype_i_);
     
     out = new Molecule(Atom(s));
-    if (dots) {
-       Symbol d = p->lookup_l()->dots(dots);
+    if (dots_i_) {
+       Symbol d = p->lookup_l()->dots(dots_i_);
        Molecule dm;
        dm.add(Atom(d));
-       if (!(position %2))
+       if (!(position_i_ %2))
            dm.translate(Offset(0,dy));
        out->add_right(dm);
     }
-    out->translate(Offset(x_dir * p->note_width(),0));
-    bool streepjes = (position<-1)||(position > staff_size+1);
+    out->translate(Offset(x_dir_i_ * p->note_width(),0));
+    bool streepjes = (position_i_<-1)||(position_i_ > staff_size_i_+1);
     
-    if (rest_b_ && balltype > 2)
+    if (rest_b_ && balltype_i_ > 2)
        streepjes = false;
     
     if (streepjes) {
-       int dir = sign(position);
-       int s =(position<-1) ? -((-position)/2): (position-staff_size)/2;
+       int dir = sign(position_i_);
+       int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2;
        Symbol str = p->lookup_l()->streepjes(s);
        Molecule sm;
        sm.add(Atom(str));
-       if (position % 2)
+       if (position_i_ % 2)
            sm.translate(Offset(0,-dy* dir));
        out->add(sm);       
     }
     
-    out->translate(Offset(0,dy*position));
+    out->translate(Offset(0,dy*position_i_));
+    return out;
 }
 
index 31e931a9f384c22641b867366fa302d3b3f2437d..58cdd538964131f50a8c96750649b24cd07067dc 100644 (file)
@@ -19,8 +19,9 @@ Pulk_voice::Pulk_voice(Voice*voice_l, int idx)
 }
 
 Array<Request*>
-Pulk_voice::get_req_l_arr() return req_l_arr;
+Pulk_voice::get_req_l_arr() 
 {
+    Array<Request*> req_l_arr;
     Moment w = when();
     do {
        Moment sub = subtle_moment_priorities_[subtle_idx_];
@@ -36,6 +37,7 @@ Pulk_voice::get_req_l_arr() return req_l_arr;
        }
        next();
     } while ( ok() && when () == w);
+    return req_l_arr;
 }
 
 void
index ed84c42c9b91a99daa8f162d29c8f456bd821a5c..57a030d956a550d5b2bc150641f7a8a9bcc9e933 100644 (file)
@@ -66,9 +66,9 @@ Request_register::contains_b(Request_register *reg_l)const
 }
 
 Staff_info
-Request_register::get_staff_info() return inf;
+Request_register::get_staff_info() 
 {
-    inf = daddy_reg_l_->get_staff_info();
+    return daddy_reg_l_->get_staff_info();
 }
 
 void
diff --git a/lily/script-column.cc b/lily/script-column.cc
new file mode 100644 (file)
index 0000000..bc309b1
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+  script-column.cc -- implement Script_column
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "script-column.hh"
+#include "debug.hh"
+#include "script.hh"
+#include "notehead.hh"
+#include "stem.hh"
+
+IMPLEMENT_STATIC_NAME(Script_column);
+
+
+void
+Script_column::add(Script*s_l)
+{
+    script_l_arr_.push(s_l);
+    add_dependency(s_l);
+}
+
+void
+Script_column::translate(Offset o)
+{
+    for (int i=0; i < script_l_arr_.size(); i++) 
+       script_l_arr_[i]->translate(o);
+}
+
+
+void
+Script_column::do_print()const
+{
+    mtor << "scripts: " << script_l_arr_.size() << '\n'; 
+}
+
+Interval
+Script_column::do_height()const return r
+{
+    for (int i=0; i < script_l_arr_.size(); i++) 
+       r.unite(script_l_arr_[i]->height());
+}
+
+Interval
+Script_column::do_width()const 
+{
+    Interval r;
+    for (int i=0; i < script_l_arr_.size(); i++) 
+       r.unite(script_l_arr_[i]->width());
+    return r;
+}
+
+void
+Script_column::do_pre_processing()
+{
+    if (!script_l_arr_.size()) 
+       return;
+    /* up+outside, up+inside, down+outside, down+inside */
+    Array<Script*> placed_l_arr_a[4];
+    for (int i=0; i < script_l_arr_.size(); i++) {
+       Script*s_l = script_l_arr_[i];
+       int j = (s_l->dir_i_ >0) ? 0 : 2;
+       if (!s_l->inside_staff_b_) 
+           j ++;
+       
+       placed_l_arr_a[j].push(s_l);
+    }
+    
+    for (int j =0; j <4; j++) {
+       placed_l_arr_a[j].sort( Script::compare);
+    }
+
+
+    for (int j =0; j < 4; j++) {
+       if (placed_l_arr_a[j].size())
+           for (int i=0; i  < support_l_arr_.size(); i++)
+               placed_l_arr_a[j][0]->add_support( support_l_arr_[i]);
+    }
+    Item * support_l=0;
+    int j = 0;
+    for (; j < 2; j++ ) {
+       for (int i=1; i < placed_l_arr_a[j].size(); i++) {
+           if (support_l)
+               placed_l_arr_a[j][i]->add_support(support_l);
+           support_l = placed_l_arr_a[j][i];
+       }
+    }
+    support_l = 0;
+    for (; j < 4; j++ ) {
+       for (int i=1; i < placed_l_arr_a[j].size(); i++) {
+           if (support_l)
+               placed_l_arr_a[j][i]->add_support(support_l);
+           support_l = placed_l_arr_a[j][i];
+       }
+    }
+}
+
+
+void
+Script_column::add_support(Item*i_l)
+{
+    support_l_arr_.push(i_l);
+    add_dependency(i_l);
+}
index 983c6a6d2e8a2ce1357bede9081f54e29d0115fa..9f5cc9cd81daf4788f40327c47c31d1e8e65f3f2 100644 (file)
 #include "input-register.hh"
 
 Staff_info
-Staff_registers::get_staff_info() return inf;
+Staff_registers::get_staff_info() 
 {
+    Staff_info inf;
     inf = Request_register::get_staff_info();
     inf.staff_sym_l_=staff_sym_l_;
     inf.c0_position_i_l_ = &c0_position_i_;
+    return inf;
 }
 
 Staff_registers::Staff_registers(Input_register const*ireg_C)
index b9974b5b5ac44802a7eef8c3ce24882086791fca..34aab2833296981aaa1f2f382ebe794949a64825 100644 (file)
@@ -38,14 +38,16 @@ Staff_side::read_staff_sym()
 
 
 Interval
-Staff_side::support_height() const return r;
+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()) {
        r = Interval(0,0);
     }
+    return r;
 }
 
 void
index becdf1e29f63862f2f73a7a6daf7c79b16ccf921..29674b58d4909909756f4fa2a724babfe50827ff 100644 (file)
@@ -15,7 +15,7 @@ Symbol::Symbol(String s, Box b)
 
 
 String
-Symbol::str()const return s;
+Symbol::str()const 
 {
-    s = "symbol(\'"+tex+"\', (" + dim.x.str() + ", " + dim.y.str() + "))";
+    return  "symbol(\'"+tex+"\', (" + dim.x.str() + ", " + dim.y.str() + "))";
 }