From: fred Date: Sun, 24 Mar 2002 19:44:22 +0000 (+0000) Subject: lilypond-0.0.65 X-Git-Tag: release/1.5.59~4668 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f66cbcac151eca3adb40407c1931bf6614320a7c;p=lilypond.git lilypond-0.0.65 --- diff --git a/flower/include/parray.hh b/flower/include/parray.hh index e003d46223..1e7404ee55 100644 --- a/flower/include/parray.hh +++ b/flower/include/parray.hh @@ -16,19 +16,47 @@ an array of pointers. TODO - should init to 0. + should init to 0. Derive from Array? */ template -class Link_array : public Array +class Link_array : public Array { + static default_compare(T *const& p1, T *const&p2) { + /* can't do p1 -p2, since T might be an incomplete type */ + if (p1 < p2) + return -1 ; + if (p2 < p1) + return 1; + return 0; + } public: - int find_i (T t) const{ + void substitute(T *old, T*new_l) + { + int i; + while ((i = find_i(old)) >=0) + if (new_l) + elem(i) =new_l; + else + del(i); + } + void default_sort() { + sort(default_compare); + } + void uniq() { + Link_array l_arr; + for (int i=0; i < size(); i++) + if (!i || elem(i-1) != elem(i)) + l_arr.push(elem(i)); + *this = l_arr; + } + + int find_i (T const * t) const { for (int i=0; i < size(); i++) if (elem(i) == t) return i; return -1; } - T find_l(T t)const + T *find_l(T const *t)const { int i = find_i(t); if (i >= 0) diff --git a/lily/note-column.cc b/lily/note-column.cc index f0c518a5b7..9af2cd3fd4 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -1,7 +1,7 @@ /* note-column.cc -- implement Note_column - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys */ @@ -9,7 +9,7 @@ #include "note-column.hh" #include "debug.hh" #include "script.hh" -#include "notehead.hh" +#include "note-head.hh" #include "stem.hh" IMPLEMENT_STATIC_NAME(Note_column); @@ -22,7 +22,7 @@ Note_column::add(Stem*stem_l) } void -Note_column::add(Notehead* n_l) +Note_column::add(Note_head* n_l) { assert(!n_l->rest_b_); head_l_arr_.push(n_l); @@ -39,7 +39,7 @@ Note_column::Note_column() void Note_column::sort() { - head_l_arr_.sort( Notehead::compare); + head_l_arr_.sort( Note_head::compare); } Interval_t @@ -62,3 +62,18 @@ Note_column::do_pre_processing() dir_i_ = (head_positions_interval().center() >= 5) ? -1 : 1; } } + + + +void +Note_column::do_substitute_dependency(Score_elem*o,Score_elem*n) +{ + Script_column::do_substitute_dependency(o,n); + if (o->name() == Note_head::static_name()) { + head_l_arr_.substitute( (Note_head*)o->item(), + (n)? (Note_head*)n->item() : 0); + } + if (stem_l_ == o) { + stem_l_ = n ? (Stem*)n->item():0; + } +} diff --git a/lily/rest-column.cc b/lily/rest-column.cc index f9543a2e01..8d0963482a 100644 --- a/lily/rest-column.cc +++ b/lily/rest-column.cc @@ -1,17 +1,17 @@ /* rest-column.cc -- implement Rest_column - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys */ #include "rest-column.hh" -#include "notehead.hh" +#include "note-head.hh" #include "rest-column.hh" void -Rest_column::add(Notehead *n_l) +Rest_column::add(Note_head *n_l) { add_support(n_l); head_l_arr_.push(n_l); @@ -31,3 +31,13 @@ Rest_column::Rest_column() dir_i_ = 0; } + +void +Rest_column::do_substitute_dependency(Score_elem*o,Score_elem*n) +{ + Script_column::do_substitute_dependency(o,n); + if (o->name() == Note_head::static_name()) { + head_l_arr_.substitute( (Note_head*)o->item(), + (n)? (Note_head*)n->item() : 0); + } +}