From b766909a06fdb9771586b103c636a4c4f40bfc78 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:41:46 +0000 Subject: [PATCH] lilypond-0.0.56 --- lily/collision.cc | 31 ++--------- lily/note-column.cc | 123 +++----------------------------------------- 2 files changed, 10 insertions(+), 144 deletions(-) diff --git a/lily/collision.cc b/lily/collision.cc index 2fbb0d8018..53c64fed95 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -76,7 +76,6 @@ Collision::do_pre_processing() Note_column * col_l_a[4]; Real x_off [4]; int y_off[4]; - bool rest_b_a[4]; for (int j =0 ; j < 4; j++) { if (clash_group_arr_a[j].size()) @@ -88,7 +87,7 @@ Collision::do_pre_processing() y_extent[j] = col_l_a[j]->head_positions_interval(); } - rest_b_a[j] = (col_l_a[j]) ? col_l_a[j]->rest_b_ : false; + x_off [j] = 0.0; y_off[j] = 0; } @@ -97,28 +96,8 @@ Collision::do_pre_processing() x_off[idx(d, true)] = d*0.5; } while ((d *= -1) != 1); - do { - int i1 = idx(d, false); - int i2 = idx(d,true); - if (!intersection(y_extent[i1] , - y_extent[i2]).empty_b()) { - if (rest_b_a[i1]) { - y_off[i1] = -y_extent[i1][-d] + y_extent[1][d] + d*4; // ugh - y_extent[i1] += y_off[i1]; - } - } - } while ((d *= -1) != 1); + - do { - int i1 = idx(d, false); - int i2 = idx(-d,false); - - if (d*(y_extent[i1][-d] - y_extent[i2][d] )< 0&& rest_b_a[i1]) { - y_off[i1] = -y_extent[i1][-d] + y_extent[i2][d] +d* 4; // ugh - y_extent[i1] += y_off[i1]; - } - } while ((d *= -1) != 1); - Interval_t middle( y_extent[0].min(), y_extent[3].max()); Interval_t open_middle( y_extent[3].max()+1, y_extent[0].min()-1); do{ @@ -127,12 +106,10 @@ Collision::do_pre_processing() } while ((d *= -1) != 1); if (!middle.empty_b() && - middle.length() <= 1 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)] - && !rest_b_a[idx(1,0)] && !rest_b_a[idx(-1,0)]) { - + middle.length() <= 1 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)]) { Notehead * nu_l= col_l_a[idx(1,0)]->head_l_arr_[idx(1,0)]; Notehead * nd_l = col_l_a[idx(-1,0)]->head_l_arr_[idx(1,0)]; - if (! (nu_l->balltype == nd_l->balltype && nu_l->dots == nd_l->dots)) { + if (! (nu_l->balltype_i_ == nd_l->balltype_i_ && nu_l->dots_i_ == nd_l->dots_i_)) { x_off[idx(1,0)] -= 0.5; x_off[1] -= 0.5; x_off[2] += 0.5; diff --git a/lily/note-column.cc b/lily/note-column.cc index 9dbc4f93dd..d3daf57a2c 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -18,134 +18,23 @@ IMPLEMENT_STATIC_NAME(Note_column); void Note_column::add(Stem*stem_l) { - assert(!stem_l_); - stem_l_ = stem_l; - add_dependency(stem_l); + add_support(stem_l); } void Note_column::add(Notehead* n_l) { - if (head_l_arr_.size()){ - if (n_l->rest_b_ != rest_b_) return; // ugly fix. Should think about integrating rests into colunms. - } else - rest_b_ = n_l->rest_b_; - + assert(!n_l->rest_b_); head_l_arr_.push(n_l); - add_dependency(n_l); -} - -void -Note_column::add(Script*s_l) -{ - script_l_arr_.push(s_l); - add_dependency(s_l); -} - -void -Note_column::translate(Offset o) -{ - for (int i=0; i < head_l_arr_.size(); i++) - head_l_arr_[i]->translate(o); - for (int i=0; i < script_l_arr_.size(); i++) - script_l_arr_[i]->translate(o); - if (stem_l_) - stem_l_->translate(o); -} - - -void -Note_column::do_print()const -{ - mtor << "heads: " << head_l_arr_.size() << '\n'; - mtor << "scripts: " << script_l_arr_.size() << '\n'; -} - -Interval -Note_column::do_height()const return r -{ - if (stem_l_) - r.unite(stem_l_->height()); - for (int i=0; i < head_l_arr_.size(); i++) - r.unite(head_l_arr_[i]->height()); - for (int i=0; i < script_l_arr_.size(); i++) - r.unite(script_l_arr_[i]->height()); -} - -Interval -Note_column::do_width()const return r; -{ - if (stem_l_) - r.unite(stem_l_->width()); - for (int i=0; i < head_l_arr_.size(); i++) - r.unite(head_l_arr_[i]->width()); - for (int i=0; i < script_l_arr_.size(); i++) - r.unite(script_l_arr_[i]->width()); -} - -void -Note_column::do_pre_processing() -{ - if (stem_l_ && !dir_i_) - dir_i_ = stem_l_->dir_i_; - - if (!script_l_arr_.size()) - return; - - 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); - } - - Notehead *top_head_l=0; - Notehead *bot_head_l=0; - for (int i=0; i< head_l_arr_.size(); i++) { - if (head_l_arr_[i]->extremal == -1) - bot_head_l = head_l_arr_[i]; - else if (head_l_arr_[i]->extremal == 1) - top_head_l = head_l_arr_[i]; - } - /* argh. This sux. */ - if (!top_head_l) - top_head_l = bot_head_l; - if (!bot_head_l) - bot_head_l = top_head_l; - //assert(bot_head_l && top_head_l); - Item *support_l=top_head_l; - int j; - for (j = 0; j < 2; j++ ) { - for (int i=0; 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=bot_head_l; - for (; j < 4; j++ ) { - for (int i=0; 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]; - } - } + add_support(n_l); } Note_column::Note_column() { h_shift_b_ =false; - stem_l_ =0; - rest_b_ = false; dir_i_ =0; } + void Note_column::sort() { @@ -156,7 +45,7 @@ Interval_t Note_column::head_positions_interval()const { ( (Note_column*)this)->sort(); - return Interval_t ( head_l_arr_[0]->position, - head_l_arr_.top()->position); + return Interval_t ( head_l_arr_[0]->position_i_, + head_l_arr_.top()->position_i_); } -- 2.39.5