From: fred Date: Tue, 18 Feb 1997 08:32:21 +0000 (+0000) Subject: lilypond-0.0.32 X-Git-Tag: release/1.5.59~6327 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f8589d635293661aba633d91c79129af9faa0630;p=lilypond.git lilypond-0.0.32 --- diff --git a/src/complexcolumn.cc b/src/complexcolumn.cc new file mode 100644 index 0000000000..22e695016a --- /dev/null +++ b/src/complexcolumn.cc @@ -0,0 +1,102 @@ +/* + complexcolumn.cc -- implement Complex_column + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ +#include "voice.hh" +#include "debug.hh" +#include "complexcolumn.hh" +#include "pscore.hh" +#include "request.hh" +#include "pscore.hh" +#include "sccol.hh" +#include "complexstaff.hh" +#include "misc.hh" + +void +Complex_column::typeset_musical_item(Item *i) +{ + assert(i); + Score_column * sccol_l = musical_column_l_; + staff_l_->pscore_l_->typeset_item(i, sccol_l->pcol_l_, + staff_l_->pstaff_l_); +} + +Complex_column::Complex_column(Complex_staff *staff_l) +{ + staff_l_ = staff_l; +} + +void +Complex_column::setup_one_request(Request * j) +{ + if (j->nonmus()) // ugh + first_l_arr_.push(j); + else if (j->musical()) + second_l_arr_.push(j); +} + +/** + align items in #item_l_arr#, return the width. + */ +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(); + item_l_arr[i]->translate(Offset( wid.right - item_width.left ,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 +Complex_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=staff_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); +}