From: fred Date: Sun, 24 Mar 2002 19:44:24 +0000 (+0000) Subject: lilypond-0.0.65 X-Git-Tag: release/1.5.59~4666 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=369a31443a264e5dfe6b9057cb263e43bbaafe20;p=lilypond.git lilypond-0.0.65 --- diff --git a/lily/collision.cc b/lily/collision.cc index 7e1f0988d7..8f43ee4233 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -1,14 +1,14 @@ /* collision.cc -- implement Collision - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys */ #include "debug.hh" #include "collision.hh" #include "note-column.hh" -#include "notehead.hh" +#include "note-head.hh" #include "paper-def.hh" Collision::Collision() @@ -21,7 +21,9 @@ Collision::add(Note_column* ncol_l) clash_l_arr_.push(ncol_l); add_dependency(ncol_l); } - +/** + should derive of Array. + */ static int idx(int dir, bool h_shift_b) { @@ -105,26 +107,28 @@ Collision::do_pre_processing() // y_extent: smallest y-pos noteball interval containing all balls // 4 (0..3) groups: stem up/down; shift on/off; - 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); + Interval_t middle( y_extent[idx(-1,0)].max(), + y_extent[idx(1,0)].min() ); + Interval_t open_middle( y_extent[idx(-1,0)].max()+1, y_extent[idx(1,0)].min()-1); do{ if (!open_middle.contains_b(y_extent[idx(d,true)])) x_off[idx(d, true)] = d *1.0 ; } while ((d *= -1) != 1); - if (!middle.empty_b() && - middle.length() <= 2 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)]) { + if (!middle.empty_b() + && middle.length() < 2 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)]) { // reproduction of bugfix at 3am ? - Notehead * nu_l= col_l_a[idx(1,0)]->head_l_arr_[0]; - Notehead * nd_l = col_l_a[idx(-1,0)]->head_l_arr_.top(); - if (! (nu_l->balltype_i_ == nd_l->balltype_i_ && nu_l->dots_i_ == nd_l->dots_i_)) { + Note_head * nu_l= col_l_a[idx(1,0)]->head_l_arr_[0]; + Note_head * nd_l = col_l_a[idx(-1,0)]->head_l_arr_.top(); + if (! (nu_l->balltype_i_ == nd_l->balltype_i_ && nu_l->dots_i_ == nd_l->dots_i_ && middle.length() == 0 )) { x_off[idx(1,0)] -= 0.5; - x_off[1] -= 0.5; - x_off[2] += 0.5; + x_off[idx(1,1)] -= 0.5; + x_off[idx(-1,1)] += 0.5; x_off[idx(-1,0)] += 0.5; } + } - Real inter_f = paper()->internote(); + Real inter_f = paper()->internote_f(); Real wid_f = paper()->note_width(); for (int j=0; j < 4; j++) { if (col_l_a[j]) @@ -135,3 +139,10 @@ Collision::do_pre_processing() } IMPLEMENT_STATIC_NAME(Collision); + +void +Collision::do_substitute_dependency(Score_elem*o_l,Score_elem*n_l) +{ + clash_l_arr_.substitute((Note_column*)o_l->item(), + (Note_column*)(n_l?n_l->item():0)); +} diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index b5af018528..32b1a18e11 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -1,7 +1,7 @@ /* note-column.hh -- declare Note_column - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys */ @@ -15,14 +15,16 @@ /** a struct for treating a group of noteheads (noteheads, stem (chord) and scripts ) as a single entity. */ class Note_column : public Script_column { - void do_pre_processing(); +protected: + virtual void do_pre_processing(); + virtual void do_substitute_dependency(Score_elem*,Score_elem*); public: /// link to the stem. For setting default direction Stem * stem_l_; bool h_shift_b_; - Array head_l_arr_; + Link_array head_l_arr_; Interval_t head_positions_interval()const; /** The relative position of the "voice" containing this @@ -33,7 +35,7 @@ public: NAME_MEMBERS(Note_column); Note_column(); - void add(Notehead *); + void add(Note_head *); void add(Stem *); void sort(); void add(Script* s) { Script_column::add(s);}