From: fred Date: Sun, 24 Mar 2002 19:33:33 +0000 (+0000) Subject: lilypond-0.0.35 X-Git-Tag: release/1.5.59~5286 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e4697e4fdb54dfaba9c14b5ff433255877cf4249;p=lilypond.git lilypond-0.0.35 --- diff --git a/NEWS b/NEWS index 9e99b19fe0..bd29eda5ce 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +pl 35 + - Register_group +Bugfix + - alignment of breakable items. + ******* pl 34 - better midi syntax. diff --git a/init/table_sixteen.ini b/init/table_sixteen.ini index 689f935b0f..1b7b379f67 100644 --- a/init/table_sixteen.ini +++ b/init/table_sixteen.ini @@ -39,11 +39,11 @@ symboltables { "clefs" = table { "violin" "\violinclef" 0pt 12.8pt -10pt 18pt - "bass" "\bassclef" 0pt 11.2pt 0pt 16pt + "bass" "\bassclef" 0pt 12.8pt 0pt 16pt "alto" "\altoclef" 0pt 12.8pt 0pt 16pt "tenor" "\altoclef" 0pt 12.8pt 0pt 16pt "violin_change" "\cviolinclef" 0pt 11.2pt -12pt 12pt - "bass_change" "\cbassclef" 0pt 12.8pt 0pt 16pt + "bass_change" "\cbassclef" 0pt 11.2pt 0pt 16pt "alto_change" "\caltoclef" 0pt 11.2pt 0pt 16pt "tenor_change" "\caltoclef" 0pt 11.2pt 0pt 16pt } diff --git a/src/inputmusic.cc b/src/inputmusic.cc index 8f3ca2cb93..b7ad70b0ab 100644 --- a/src/inputmusic.cc +++ b/src/inputmusic.cc @@ -8,12 +8,12 @@ Input_music::check_plet(Voice_element* velt_l) { for (iter_top(velt_l->reqs,i); i.ok(); i++) if ( i->plet() ) { - Moment start_moment = 0.0; + Moment start_moment = 0; if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) { error( "begin of plet not found", i->defined_ch_c_l_ ); break; } - Moment moment = 0.0; + Moment moment = 0; set_plet_backwards( moment, start_moment, i->plet()->dur_i_, i->plet()->type_i_ ); i.del(); break; @@ -209,7 +209,7 @@ Music_general_chord::translate_time(Moment t) Moment Music_general_chord::length()const { - Moment l =0.0; + Moment l =0; for (iter_top(elts,i); i.ok(); i++) l = l >? i->length(); diff --git a/src/score.cc b/src/score.cc index 83bffd72f7..4d8ac63296 100644 --- a/src/score.cc +++ b/src/score.cc @@ -7,7 +7,7 @@ */ #include "tstream.hh" #include "score.hh" -#include "sccol.hh" +#include "scorecolumn.hh" #include "pscore.hh" #include "staff.hh" #include "debug.hh" @@ -159,15 +159,12 @@ Score::find_col(Moment w, bool mus) } void -Score::do_cols() - +Score::do_cols() { - iter_top(cols_,i); for (; i.ok(); i++) { pscore_p_->add(i->pcol_l_); } - } Moment diff --git a/src/staff.cc b/src/staff.cc index a996964661..d5c08487ab 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -2,8 +2,8 @@ #include "score.hh" #include "voice.hh" #include "staffwalker.hh" -#include "stcol.hh" -#include "sccol.hh" +#include "staffcolumn.hh" +#include "scorecolumn.hh" #include "debug.hh" #include "musicalrequest.hh" @@ -57,17 +57,17 @@ Staff::get_col(Moment w, PCursor *last) } - PCursor sccols(score_l_->find_col(w, false)); - Staff_column* stcol_p = new Staff_column; - stcol_p->staff_l_ = this; - Score_column* comcol_l = sccols++; - stcol_p->set_cols(comcol_l, sccols); + PCursor scorecolumns(score_l_->find_col(w, false)); + Staff_column* staffcolumn_p = new Staff_column; + staffcolumn_p->staff_l_ = this; + Score_column* comcol_l = scorecolumns++; + staffcolumn_p->set_cols(comcol_l, scorecolumns); if (!i.ok()) { - cols_.bottom().add( stcol_p); + cols_.bottom().add( staffcolumn_p); i = cols_.bottom(); } else { - i.insert(stcol_p); + i.insert(staffcolumn_p); i--; } if (last) @@ -117,7 +117,7 @@ Staff::OK() const Moment Staff::last() const { - Moment l = 0.0; + Moment l = 0; for (iter_top(voice_list_,i); i.ok(); i++) { l = l >? i->last(); } diff --git a/src/staffcolumn.cc b/src/staffcolumn.cc new file mode 100644 index 0000000000..229ab69933 --- /dev/null +++ b/src/staffcolumn.cc @@ -0,0 +1,163 @@ +/* + staffcolumn.cc -- implement Staff_column + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ +#include "staff.hh" +#include "voice.hh" +#include "timedescription.hh" +#include "scorecolumn.hh" +#include "staffcolumn.hh" +#include "commandrequest.hh" +#include "musicalrequest.hh" +#include "interval.hh" +#include "pscore.hh" +#include "item.hh" +#include "pcol.hh" + +void +Staff_column::OK() const +{ +#ifndef NDEBUG + assert (command_column_l_->when() == musical_column_l_->when()); +#endif +} + +Moment +Staff_column::when() const +{ + return (command_column_l_)? + command_column_l_->when(): + musical_column_l_->when(); +} + +void +Staff_column::add(Voice_element*ve) +{ + for (iter_top(ve->reqs,j); j.ok(); j++) { + if (j->command()) { + Command_req * c_l = j->command(); + if (c_l->timing()) { + timing_req_l_arr_.push(j->command()->timing()); + } + if (!c_l->barcheck() && !c_l->partial() && + !c_l->measuregrouping()) + setup_one_request(j); // no need to bother children + } else { + if (j->rhythmic()) { + musical_column_l_->add_duration(j->rhythmic()->duration()); + } + if (!j->musical()->skip()) + setup_one_request(j); + } + } +} + +Staff_column::Staff_column() +{ + musical_column_l_ = 0; + command_column_l_ = 0; + staff_l_ = 0; +} + + + + +Staff_column::~Staff_column() +{ +} + +void +Staff_column::set_cols(Score_column*c1, Score_column*c2) +{ + command_column_l_ = c1; + musical_column_l_ = c2; +} + +void +Staff_column::setup_one_request(Request * j) +{ + if (j->command()) // ugh + commandreq_l_arr_.push(j); + else if (j->musical()) + musicalreq_l_arr_.push(j); +} + +void +Staff_column::typeset_musical_item(Item*i) +{ + assert(i); + Score_column * scorecolumn_l = musical_column_l_; + musical_column_l_->pcol_l_->pscore_l_->typeset_item(i, scorecolumn_l->pcol_l_, + staff_l_->pstaff_l_); +} + +/** + align items in #item_l_arr#, + + @return the width of the items after aligning. + */ +Interval +align_items(Array item_l_arr) +{ + Interval wid(0,0); + for (int i =0; i < item_l_arr.size(); i++) { + Interval item_width= item_l_arr[i]->width(); + Real dx =wid.right - item_width.left; + item_width += dx; + item_l_arr[i]->translate(Offset(dx ,0)); + wid.unite(item_width); + } + return wid; +} + +void +translate_items(Real x, Array item_l_arr) +{ + for (int i =0; i < item_l_arr.size(); i++) + item_l_arr[i]->translate(Offset(x, 0)); +} +/* + UGR + This still sux + */ +void +Staff_column::typeset_breakable_items(Array &pre_p_arr, + Array &nobreak_p_arr, + Array &post_p_arr) +{ + PCol * c= command_column_l_->pcol_l_; + PScore *ps_l=command_column_l_->pcol_l_->pscore_l_; + + if (!c->breakable_b()) { + for (int i =0; i < pre_p_arr.size(); i++) + delete pre_p_arr[i]; + pre_p_arr.set_size(0); + for (int i =0; i < post_p_arr.size(); i++) + delete post_p_arr[i]; + post_p_arr.set_size(0); + } + + + for (int i =0; i < pre_p_arr.size(); i++) { + ps_l->typeset_item(pre_p_arr[i], c, staff_l_->pstaff_l_,0); + } + for (int i =0; i < nobreak_p_arr.size(); i++) { + ps_l->typeset_item(nobreak_p_arr[i], c, staff_l_->pstaff_l_,1); + } + for (int i =0; i < post_p_arr.size(); i++) { + ps_l->typeset_item(post_p_arr[i], c, staff_l_->pstaff_l_,2); + } + + Interval pre_wid= align_items(pre_p_arr); + translate_items( -pre_wid.right, pre_p_arr); + align_items(nobreak_p_arr); + Interval post_wid =align_items(post_p_arr); + translate_items (-post_wid.left , post_p_arr); + + pre_p_arr.set_size(0); + post_p_arr.set_size(0); + nobreak_p_arr.set_size(0); +} diff --git a/src/voice.cc b/src/voice.cc index 718e7cb6d1..ad07cf2040 100644 --- a/src/voice.cc +++ b/src/voice.cc @@ -48,7 +48,7 @@ Voice::Voice(Voice const&src) Voice::Voice() { - start = 0.0; + start = 0; } void