From d5d48190e4edb2cf387b7ea75851ed4329442f5b Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:41:49 +0000 Subject: [PATCH] lilypond-0.0.56 --- Documentation/faq.pod | 9 ++-- lily/beam.cc | 50 ++++++++++--------- lily/input-register.cc | 4 +- lily/notehead.cc | 50 +++++++++---------- lily/pulk-voice.cc | 4 +- lily/register.cc | 4 +- lily/script-column.cc | 106 +++++++++++++++++++++++++++++++++++++++++ lily/staff-regs.cc | 4 +- lily/staff-side.cc | 4 +- lily/symbol.cc | 4 +- 10 files changed, 181 insertions(+), 58 deletions(-) create mode 100644 lily/script-column.cc diff --git a/Documentation/faq.pod b/Documentation/faq.pod index 70162a6095..3b33cf79b5 100644 --- a/Documentation/faq.pod +++ b/Documentation/faq.pod @@ -100,25 +100,28 @@ saves us a I of trouble. GNU LilyPond and FlowerLib use: =over 4 =item * + builtin bool =item * + 64 bit integral type long long =item * + typeof =item * + operator ? =item * + the new for-scope =item * -class Rational (libg++) -=item * -named return values +class Rational (libg++) =back diff --git a/lily/beam.cc b/lily/beam.cc index 389226fa71..ccf37114db 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -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 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 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 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_ 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 beams_left; + int rhalfs = here->beams_right_i_ - next->beams_left_i_; + int rwholebeams = here->beams_right_i_ 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 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); diff --git a/lily/input-register.cc b/lily/input-register.cc index e038b18dd2..711b89bd6d 100644 --- a/lily/input-register.cc +++ b/lily/input-register.cc @@ -42,11 +42,13 @@ Input_register::get_ireg_l(String nm)const return 0; } Array -Input_register::get_nongroup_p_arr() const return a; +Input_register::get_nongroup_p_arr() const { + Array a; Array sa(get_nongroups_str_arr()); for (int i=0; i < sa.size(); i++) a.push(get_nongroup_register_p(sa[i])); + return a; } void diff --git a/lily/notehead.cc b/lily/notehead.cc index df2becf109..6e6ca348d9 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -11,20 +11,20 @@ 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; } diff --git a/lily/pulk-voice.cc b/lily/pulk-voice.cc index 31e931a9f3..58cdd53896 100644 --- a/lily/pulk-voice.cc +++ b/lily/pulk-voice.cc @@ -19,8 +19,9 @@ Pulk_voice::Pulk_voice(Voice*voice_l, int idx) } Array -Pulk_voice::get_req_l_arr() return req_l_arr; +Pulk_voice::get_req_l_arr() { + Array 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 diff --git a/lily/register.cc b/lily/register.cc index ed84c42c9b..57a030d956 100644 --- a/lily/register.cc +++ b/lily/register.cc @@ -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 index 0000000000..bc309b1e04 --- /dev/null +++ b/lily/script-column.cc @@ -0,0 +1,106 @@ +/* + script-column.cc -- implement Script_column + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#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 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); +} diff --git a/lily/staff-regs.cc b/lily/staff-regs.cc index 983c6a6d2e..9f5cc9cd81 100644 --- a/lily/staff-regs.cc +++ b/lily/staff-regs.cc @@ -15,11 +15,13 @@ #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) diff --git a/lily/staff-side.cc b/lily/staff-side.cc index b9974b5b5a..34aab28332 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -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 diff --git a/lily/symbol.cc b/lily/symbol.cc index becdf1e29f..29674b58d4 100644 --- a/lily/symbol.cc +++ b/lily/symbol.cc @@ -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() + "))"; } -- 2.39.5