/*
collision.cc -- implement Collision
- source file of the LilyPond music typesetter
+ source file of the GNU LilyPond music typesetter
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
#include "debug.hh"
#include "collision.hh"
#include "note-column.hh"
-#include "notehead.hh"
+#include "note-head.hh"
#include "paper-def.hh"
Collision::Collision()
clash_l_arr_.push(ncol_l);
add_dependency(ncol_l);
}
-
+/**
+ should derive of Array.
+ */
static
int idx(int dir, bool h_shift_b)
{
// y_extent: smallest y-pos noteball interval containing all balls
// 4 (0..3) groups: stem up/down; shift on/off;
- Interval_t<int> middle( y_extent[0].min(), y_extent[3].max());
- Interval_t<int> open_middle( y_extent[3].max()+1, y_extent[0].min()-1);
+ Interval_t<int> middle( y_extent[idx(-1,0)].max(),
+ y_extent[idx(1,0)].min() );
+ Interval_t<int> 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])
}
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));
+}
/*
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 <hanwen@stack.nl>
*/
/** 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<Notehead*> head_l_arr_;
+ Link_array<Note_head> head_l_arr_;
Interval_t<int> head_positions_interval()const;
/** The relative position of the "voice" containing this
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);}